2024-06-28 10:34:57 +00:00
|
|
|
{.push raises: [].}
|
2023-10-05 12:00:09 +00:00
|
|
|
|
|
|
|
import
|
|
|
|
chronicles,
|
|
|
|
json_serialization,
|
|
|
|
json_serialization/std/options,
|
|
|
|
presto/[route, client],
|
|
|
|
stew/byteutils
|
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
import ../serdes, ../responses, ../rest_serdes, ./types
|
2023-10-05 12:00:09 +00:00
|
|
|
|
|
|
|
export types
|
|
|
|
|
|
|
|
logScope:
|
|
|
|
topics = "waku node rest admin api"
|
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
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
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
proc getPeers*(): RestResponse[seq[WakuPeer]] {.
|
|
|
|
rest, endpoint: "/admin/v1/peers", meth: HttpMethod.MethodGet
|
|
|
|
.}
|
2023-10-05 12:00:09 +00:00
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
proc postPeers*(
|
|
|
|
body: seq[string]
|
|
|
|
): RestResponse[string] {.
|
|
|
|
rest, endpoint: "/admin/v1/peers", meth: HttpMethod.MethodPost
|
|
|
|
.}
|
2024-01-09 10:42:29 +00:00
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
proc getFilterSubscriptions*(): RestResponse[seq[FilterSubscription]] {.
|
|
|
|
rest, endpoint: "/admin/v1/filter/subscriptions", meth: HttpMethod.MethodGet
|
|
|
|
.}
|
2024-01-09 10:42:29 +00:00
|
|
|
|
2024-03-15 23:08:47 +00:00
|
|
|
proc getFilterSubscriptionsFilterNotMounted*(): RestResponse[string] {.
|
|
|
|
rest, endpoint: "/admin/v1/filter/subscriptions", meth: HttpMethod.MethodGet
|
|
|
|
.}
|