2023-10-05 12:00:09 +00:00
|
|
|
when (NimMajor, NimMinor) < (1, 4):
|
|
|
|
{.push raises: [Defect].}
|
|
|
|
else:
|
|
|
|
{.push raises: [].}
|
|
|
|
|
|
|
|
import
|
|
|
|
chronicles,
|
|
|
|
json_serialization,
|
|
|
|
json_serialization/std/options,
|
|
|
|
presto/[route, client],
|
|
|
|
stew/byteutils
|
|
|
|
|
|
|
|
import
|
|
|
|
../serdes,
|
|
|
|
../responses,
|
2023-11-14 15:59:53 +00:00
|
|
|
../rest_serdes,
|
2023-10-05 12:00:09 +00:00
|
|
|
./types
|
|
|
|
|
|
|
|
export types
|
|
|
|
|
|
|
|
|
|
|
|
logScope:
|
|
|
|
topics = "waku node rest admin api"
|
|
|
|
|
|
|
|
proc encodeBytes*(value: seq[string],
|
|
|
|
contentType: string): RestResult[seq[byte]] =
|
2023-11-14 15:59:53 +00:00
|
|
|
return encodeBytesOf(value, contentType)
|
2023-10-05 12:00:09 +00:00
|
|
|
|
|
|
|
proc getPeers*():
|
|
|
|
RestResponse[seq[WakuPeer]]
|
|
|
|
{.rest, endpoint: "/admin/v1/peers", meth: HttpMethod.MethodGet.}
|
|
|
|
|
|
|
|
proc postPeers*(body: seq[string]):
|
|
|
|
RestResponse[string]
|
|
|
|
{.rest, endpoint: "/admin/v1/peers", meth: HttpMethod.MethodPost.}
|