From 25ee98d91ec658e2070a02e279e937e623a20625 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Mon, 27 Dec 2021 13:22:34 +0100 Subject: [PATCH] refactor: installation related rpc calls added --- status/statusgo_backend_new/installations.nim | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 status/statusgo_backend_new/installations.nim diff --git a/status/statusgo_backend_new/installations.nim b/status/statusgo_backend_new/installations.nim new file mode 100644 index 0000000..85e52e4 --- /dev/null +++ b/status/statusgo_backend_new/installations.nim @@ -0,0 +1,32 @@ +import json +import core, utils +import response_type + +export response_type + +proc setInstallationMetadata*(installationId: string, deviceName: string, deviceType: string): + RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [installationId, { + "name": deviceName, + "deviceType": deviceType + }] + result = callPrivateRPC("setInstallationMetadata".prefix, payload) + +proc getOurInstallations*(): RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [] + result = callPrivateRPC("getOurInstallations".prefix, payload) + +proc syncDevices*(preferredName: string, photoPath: string): RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [preferredName, photoPath] + result = callPrivateRPC("syncDevices".prefix, payload) + +proc sendPairInstallation*(): RpcResponse[JsonNode] {.raises: [Exception].} = + result = callPrivateRPC("sendPairInstallation".prefix) + +proc enableInstallation*(installationId: string): RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [installationId] + result = callPrivateRPC("enableInstallation".prefix, payload) + +proc disableInstallation*(installationId: string): RpcResponse[JsonNode] {.raises: [Exception].} = + let payload = %* [installationId] + result = callPrivateRPC("disableInstallation".prefix, payload)