2023-09-22 11:46:55 +00:00
|
|
|
when (NimMajor, NimMinor) < (1, 4):
|
|
|
|
{.push raises: [Defect].}
|
|
|
|
else:
|
|
|
|
{.push raises: [].}
|
|
|
|
|
|
|
|
import
|
|
|
|
json,
|
|
|
|
std/sets,
|
|
|
|
stew/byteutils,
|
|
|
|
strformat,
|
|
|
|
chronicles,
|
|
|
|
json_serialization,
|
|
|
|
json_serialization/std/options,
|
|
|
|
presto/[route, client, common]
|
2024-03-15 23:08:47 +00:00
|
|
|
import ../../../waku_core, ../serdes, ../responses, ../rest_serdes, ./types
|
2023-09-22 11:46:55 +00:00
|
|
|
|
|
|
|
export types
|
|
|
|
|
|
|
|
logScope:
|
|
|
|
topics = "waku node rest client v2"
|
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
proc encodeBytes*(value: PushRequest, contentType: string): RestResult[seq[byte]] =
|
2023-11-14 15:59:53 +00:00
|
|
|
return encodeBytesOf(value, contentType)
|
2023-09-22 11:46:55 +00:00
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
proc sendPushRequest*(
|
|
|
|
body: PushRequest
|
|
|
|
): RestResponse[string] {.
|
|
|
|
rest, endpoint: "/lightpush/v1/message", meth: HttpMethod.MethodPost
|
|
|
|
.}
|