refactor: installation related rpc calls added

This commit is contained in:
Sale Djenic 2021-12-27 13:22:34 +01:00 committed by saledjenic
parent 623d3b0def
commit 25ee98d91e
1 changed files with 32 additions and 0 deletions

View File

@ -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)