2022-01-31 09:34:13 +00:00
|
|
|
import json, strutils, chronicles, core
|
|
|
|
import response_type
|
2021-09-08 18:05:39 +00:00
|
|
|
|
2022-01-31 09:34:13 +00:00
|
|
|
import status_go
|
2021-09-08 18:05:39 +00:00
|
|
|
|
2022-01-31 09:34:13 +00:00
|
|
|
export response_type
|
2021-09-08 18:05:39 +00:00
|
|
|
|
2022-01-31 09:34:13 +00:00
|
|
|
logScope:
|
|
|
|
topics = "rpc-gif"
|
2021-09-08 18:05:39 +00:00
|
|
|
|
2022-01-31 09:34:13 +00:00
|
|
|
proc setTenorAPIKey*(key: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
|
|
let payload = %* [key]
|
|
|
|
result = core.callPrivateRPC("gif_setTenorAPIKey", payload)
|
2021-09-08 18:05:39 +00:00
|
|
|
|
2022-01-31 09:34:13 +00:00
|
|
|
proc fetchGifs*(path: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
|
|
let payload = %* [path]
|
|
|
|
result = core.callPrivateRPC("gif_fetchGifs", payload)
|
2021-09-08 18:05:39 +00:00
|
|
|
|
2022-01-31 09:34:13 +00:00
|
|
|
proc updateRecentGifs*(recentGifs: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
|
|
let payload = %* [recentGifs]
|
|
|
|
return core.callPrivateRPC("gif_updateRecentGifs", payload)
|
2021-09-08 18:05:39 +00:00
|
|
|
|
2022-01-31 09:34:13 +00:00
|
|
|
proc updateFavoriteGifs*(favoriteGifs: JsonNode): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
|
|
let payload = %* [favoriteGifs]
|
|
|
|
return core.callPrivateRPC("gif_updateFavoriteGifs", payload)
|
2021-09-08 18:05:39 +00:00
|
|
|
|
2022-01-31 09:34:13 +00:00
|
|
|
proc getRecentGifs*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
|
|
let payload = %* []
|
|
|
|
return core.callPrivateRPC("gif_getRecentGifs", payload)
|
2021-09-20 14:07:22 +00:00
|
|
|
|
2022-01-31 09:34:13 +00:00
|
|
|
proc getFavoriteGifs*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
|
|
let payload = %* []
|
|
|
|
return core.callPrivateRPC("gif_getFavoriteGifs", payload)
|