Skip to content

Commit

Permalink
Changing endpoint to /admin/v1/filter/subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmer committed Jan 3, 2024
1 parent e7a5332 commit 65f9dfc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions tests/wakunode_rest/test_rest_admin.nim
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ suite "Waku v2 Rest API - Admin":
assert subscribeResponse2.isOk(), $subscribeResponse2.error
assert subscribeResponse3.isOk(), $subscribeResponse3.error

let getRes = await client.getFilterData()
let getRes = await client.getFilterSubscriptions()

check:
getRes.status == 200
Expand Down Expand Up @@ -165,7 +165,7 @@ suite "Waku v2 Rest API - Admin":
assert subscribeResponse2.isOk(), $subscribeResponse2.error
assert subscribeResponse3.isOk(), $subscribeResponse3.error

let getRes = await client.getFilterData()
let getRes = await client.getFilterSubscriptions()

check:
getRes.status == 200
Expand All @@ -177,15 +177,15 @@ suite "Waku v2 Rest API - Admin":
asyncTest "Get filter data - no filter subscribers":
await node1.mountFilter()

let getRes = await client.getFilterData()
let getRes = await client.getFilterSubscriptions()

check:
getRes.status == 200
$getRes.contentType == $MIMETYPE_JSON
getRes.data.len() == 0

asyncTest "Get filter data - filter not mounted":
let getRes = await client.getFilterData()
let getRes = await client.getFilterSubscriptions()

check:
getRes.status == 200
Expand Down
4 changes: 2 additions & 2 deletions waku/waku_api/rest/admin/client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ proc postPeers*(body: seq[string]):
RestResponse[string]
{.rest, endpoint: "/admin/v1/peers", meth: HttpMethod.MethodPost.}

proc getFilterData*():
proc getFilterSubscriptions*():
RestResponse[seq[FilterSubscription]]
{.rest, endpoint: "/admin/v1/filter", meth: HttpMethod.MethodGet.}
{.rest, endpoint: "/admin/v1/filter/subscriptions", meth: HttpMethod.MethodGet.}
8 changes: 4 additions & 4 deletions waku/waku_api/rest/admin/handlers.nim
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ logScope:
topics = "waku node rest admin api"

const ROUTE_ADMIN_V1_PEERS* = "/admin/v1/peers"
const ROUTE_ADMIN_V1_FILTER* = "/admin/v1/filter"
const ROUTE_ADMIN_V1_FILTER_SUBS* = "/admin/v1/filter/subscriptions"

type PeerProtocolTuple = tuple[multiaddr: string, protocol: string, connected: bool]

Expand Down Expand Up @@ -111,8 +111,8 @@ proc installAdminV1PostPeersHandler(router: var RestRouter, node: WakuNode) =

return RestApiResponse.ok()

proc installAdminV1GetFilterHandler(router: var RestRouter, node: WakuNode) =
router.api(MethodGet, ROUTE_ADMIN_V1_FILTER) do () -> RestApiResponse:
proc installAdminV1GetFilterSubsHandler(router: var RestRouter, node: WakuNode) =
router.api(MethodGet, ROUTE_ADMIN_V1_FILTER_SUBS) do () -> RestApiResponse:

var subscriptions: seq[FilterSubscription] = @[]

Expand All @@ -137,4 +137,4 @@ proc installAdminV1GetFilterHandler(router: var RestRouter, node: WakuNode) =
proc installAdminApiHandlers*(router: var RestRouter, node: WakuNode) =
installAdminV1GetPeersHandler(router, node)
installAdminV1PostPeersHandler(router, node)
installAdminV1GetFilterHandler(router, node)
installAdminV1GetFilterSubsHandler(router, node)
4 changes: 2 additions & 2 deletions waku/waku_api/rest/admin/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ paths:
description: Cannot connect to one or more peers.
'5XX':
description: Unexpected error.
/admin/v1/filter:
/admin/v1/filter/subscriptions:
get:
summary: Get filter protocol info
summary: Get filter protocol subscribers
description: Retrieve information about the serving filter subscriptions
operationId: getFilterInfo
tags:
Expand Down

0 comments on commit 65f9dfc

Please sign in to comment.