mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-10 18:03:11 +00:00
* Rename waku_api to rest_api and underlying rest to endpoint for clearity * Rename node/api to node/kernel_api to suggest that it is an internal accessor to node interface + make everything compile after renaming * make waku api a top level import * fix use of relative path imports and use default to root rather in case of waku and tools modules
76 lines
2.1 KiB
Nim
76 lines
2.1 KiB
Nim
{.push raises: [].}
|
|
|
|
import chronicles, json_serialization, presto/[route, client], stew/byteutils
|
|
|
|
import ../serdes, ../rest_serdes, ./types
|
|
|
|
export types
|
|
|
|
logScope:
|
|
topics = "waku node rest admin api"
|
|
|
|
proc encodeBytes*(value: seq[string], contentType: string): RestResult[seq[byte]] =
|
|
return encodeBytesOf(value, contentType)
|
|
|
|
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
|
|
.}
|
|
|
|
proc getPeerById*(
|
|
peerId: string
|
|
): RestResponse[WakuPeer] {.
|
|
rest, endpoint: "/admin/v1/peer/{peerId}", meth: HttpMethod.MethodGet
|
|
.}
|
|
|
|
proc getServicePeers*(): RestResponse[seq[WakuPeer]] {.
|
|
rest, endpoint: "/admin/v1/peers/service", meth: HttpMethod.MethodGet
|
|
.}
|
|
|
|
proc getConnectedPeers*(): RestResponse[seq[WakuPeer]] {.
|
|
rest, endpoint: "/admin/v1/peers/connected", meth: HttpMethod.MethodGet
|
|
.}
|
|
|
|
proc getConnectedPeersByShard*(
|
|
shardId: uint16
|
|
): RestResponse[seq[WakuPeer]] {.
|
|
rest, endpoint: "/admin/v1/peers/connected/on/{shardId}", meth: HttpMethod.MethodGet
|
|
.}
|
|
|
|
proc getRelayPeers*(): RestResponse[PeersOfShards] {.
|
|
rest, endpoint: "/admin/v1/peers/relay", meth: HttpMethod.MethodGet
|
|
.}
|
|
|
|
proc getRelayPeersByShard*(
|
|
shardId: uint16
|
|
): RestResponse[PeersOfShard] {.
|
|
rest, endpoint: "/admin/v1/peers/relay/on/{shardId}", meth: HttpMethod.MethodGet
|
|
.}
|
|
|
|
proc getMeshPeers*(): RestResponse[PeersOfShards] {.
|
|
rest, endpoint: "/admin/v1/peers/mesh", meth: HttpMethod.MethodGet
|
|
.}
|
|
|
|
proc getMeshPeersByShard*(
|
|
shardId: uint16
|
|
): RestResponse[PeersOfShard] {.
|
|
rest, endpoint: "/admin/v1/peers/mesh/on/{shardId}", meth: HttpMethod.MethodGet
|
|
.}
|
|
|
|
proc getPeersStats*(): RestResponse[PeerStats] {.
|
|
rest, endpoint: "/admin/v1/peers/stats", meth: HttpMethod.MethodGet
|
|
.}
|
|
|
|
proc getFilterSubscriptions*(): RestResponse[seq[FilterSubscription]] {.
|
|
rest, endpoint: "/admin/v1/filter/subscriptions", meth: HttpMethod.MethodGet
|
|
.}
|
|
|
|
proc getFilterSubscriptionsFilterNotMounted*(): RestResponse[string] {.
|
|
rest, endpoint: "/admin/v1/filter/subscriptions", meth: HttpMethod.MethodGet
|
|
.}
|