2021-11-05 13:55:48 +00:00
|
|
|
import json, strmisc
|
|
|
|
import core, utils
|
|
|
|
import response_type
|
|
|
|
|
|
|
|
export response_type
|
|
|
|
|
|
|
|
proc getContacts*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
|
|
let payload = %* []
|
|
|
|
result = callPrivateRPC("contacts".prefix, payload)
|
|
|
|
|
|
|
|
proc getContactById*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
|
|
|
let payload = %* [id]
|
|
|
|
result = callPrivateRPC("getContactByID".prefix, payload)
|
|
|
|
|
2021-11-23 13:15:06 +00:00
|
|
|
proc blockContact*(id: string) =
|
|
|
|
discard callPrivateRPC("blockContact".prefix, %* [id])
|
|
|
|
|
|
|
|
proc unblockContact*(id: string) =
|
|
|
|
discard callPrivateRPC("unblockContact".prefix, %* [id])
|
|
|
|
|
|
|
|
proc removeContact*(id: string) =
|
|
|
|
discard callPrivateRPC("removeContact".prefix, %* [id])
|
|
|
|
|
|
|
|
proc rejectContactRequest*(id: string) =
|
|
|
|
let payload = %*[{
|
|
|
|
"id": id
|
|
|
|
}]
|
|
|
|
discard callPrivateRPC("rejectContactRequest".prefix, payload)
|
|
|
|
|
|
|
|
proc setContactLocalNickname*(id: string, name: string) =
|
|
|
|
let payload = %* [{
|
|
|
|
"id": id,
|
|
|
|
"nickname": name
|
|
|
|
}]
|
|
|
|
discard callPrivateRPC("setContactLocalNickname".prefix, payload)
|
|
|
|
|
2021-12-01 18:04:53 +00:00
|
|
|
proc addContact*(id: string, ensName: string) {.raises: [Exception].} =
|
2021-11-05 13:55:48 +00:00
|
|
|
let payload = %* [{
|
2021-11-23 13:15:06 +00:00
|
|
|
"id": id,
|
|
|
|
"ensName": ensName
|
|
|
|
}]
|
2021-11-05 13:55:48 +00:00
|
|
|
|
2021-11-23 13:15:06 +00:00
|
|
|
discard callPrivateRPC("addContact".prefix, payload)
|
2021-11-05 13:55:48 +00:00
|
|
|
|
|
|
|
proc sendContactUpdate*(publicKey, ensName, thumbnail: string)
|
|
|
|
{.raises: [Exception].} =
|
|
|
|
let payload = %* [publicKey, ensName, thumbnail]
|
|
|
|
discard callPrivateRPC("sendContactUpdate".prefix, payload)
|
2021-11-23 13:15:06 +00:00
|
|
|
|