refactor: mailservers related rpc calls added
This commit is contained in:
parent
25ee98d91e
commit
749fdd33c4
|
@ -1,12 +1,9 @@
|
||||||
import json, chronicles
|
import json
|
||||||
import core, utils
|
import core
|
||||||
import response_type
|
import response_type
|
||||||
|
|
||||||
export response_type
|
export response_type
|
||||||
|
|
||||||
logScope:
|
|
||||||
topics = "status-lib-mailserver"
|
|
||||||
|
|
||||||
proc saveMailserver*(id: string, name: string, enode: string, fleet: string):
|
proc saveMailserver*(id: string, name: string, enode: string, fleet: string):
|
||||||
RpcResponse[JsonNode] {.raises: [Exception].} =
|
RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
let payload = %* [{
|
let payload = %* [{
|
||||||
|
@ -15,32 +12,7 @@ proc saveMailserver*(id: string, name: string, enode: string, fleet: string):
|
||||||
"address": enode,
|
"address": enode,
|
||||||
"fleet": fleet
|
"fleet": fleet
|
||||||
}]
|
}]
|
||||||
result = core.callPrivateRPC("mailservers_addMailserver", payload)
|
result = callPrivateRPC("mailservers_addMailserver", payload)
|
||||||
|
|
||||||
proc getMailservers*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
proc getMailservers*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
result = core.callPrivateRPC("mailservers_getMailservers")
|
result = callPrivateRPC("mailservers_getMailservers")
|
||||||
|
|
||||||
proc requestAllHistoricMessages*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
||||||
let payload = %* []
|
|
||||||
result = core.callPrivateRPC("requestAllHistoricMessages".prefix, payload)
|
|
||||||
info "requestAllHistoricMessages", topics="mailserver-interaction", rpc_method="mailservers_requestAllHistoricMessages"
|
|
||||||
|
|
||||||
proc syncChatFromSyncedFrom*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
||||||
let payload = %*[chatId]
|
|
||||||
result = core.callPrivateRPC("syncChatFromSyncedFrom".prefix, payload)
|
|
||||||
info "syncChatFromSyncedFrom", topics="mailserver-interaction", rpc_method="wakuext_syncChatFromSyncedFrom", chatId, result
|
|
||||||
|
|
||||||
proc fillGaps*(chatId: string, messageIds: seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
||||||
let payload = %*[chatId, messageIds]
|
|
||||||
result = core.callPrivateRPC("fillGaps".prefix, payload)
|
|
||||||
info "fillGaps", topics="mailserver-interaction", rpc_method="wakuext_fillGaps", chatId, messageIds, result
|
|
||||||
|
|
||||||
proc delete*(peer: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
||||||
let payload = %* [peer]
|
|
||||||
result = core.callPrivateRPC("mailservers_deleteMailserver", payload)
|
|
||||||
info "delete", topics="mailserver-interaction", rpc_method="mailservers_deleteMailserver", peer, result
|
|
||||||
|
|
||||||
proc disconnectActiveMailserver*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
||||||
let payload = %* []
|
|
||||||
result = core.callPrivateRPC("disconnectActiveMailserver".prefix, payload)
|
|
||||||
info "delete", topics="mailserver-interaction", rpc_method="wakuext_disconnectActiveMailserver", result
|
|
Loading…
Reference in New Issue