From c0d302c232ec97f11a672e1be48d6d0bb99352e1 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Wed, 26 Jan 2022 20:23:00 +0100 Subject: [PATCH] feat: Move Tenor Gif APi to status_go --- status/statusgo_backend_new/gif.nim | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 status/statusgo_backend_new/gif.nim diff --git a/status/statusgo_backend_new/gif.nim b/status/statusgo_backend_new/gif.nim new file mode 100644 index 0000000..a5a508e --- /dev/null +++ b/status/statusgo_backend_new/gif.nim @@ -0,0 +1,33 @@ +import json, strutils, chronicles, core +import response_type + +import status_go + +export response_type + +logScope: + topics = "rpc-gif" + +proc setTenorAPIKey*(key: string): RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [key] + result = core.callPrivateRPC("gif_setTenorAPIKey", payload) + +proc fetchGifs*(path: string): RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [path] + result = core.callPrivateRPC("gif_fetchGifs", payload) + +proc updateRecentGifs*(recentGifs: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [recentGifs] + return core.callPrivateRPC("gif_updateRecentGifs", payload) + +proc updateFavoriteGifs*(favoriteGifs: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [favoriteGifs] + return core.callPrivateRPC("gif_updateFavoriteGifs", payload) + +proc getRecentGifs*(): RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [] + return core.callPrivateRPC("gif_getRecentGifs", payload) + +proc getFavoriteGifs*(): RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [] + return core.callPrivateRPC("gif_getFavoriteGifs", payload)