diff --git a/api-spec/adminapi_peer.yaml b/api-spec/adminapi_peer.yaml new file mode 100644 index 0000000..50bc34f --- /dev/null +++ b/api-spec/adminapi_peer.yaml @@ -0,0 +1,30 @@ +get: + summary: Get peer info about a single peer + description: Retrieve information about a single peer. + operationId: getPeerInfo + tags: + - admin + parameters: + - in: path + name: peerId + required: true + schema: + type: string + description: ID of the peer to retrieve information for + responses: + '200': + description: Information about a Waku v2 node. + content: + application/json: + schema: + $ref: "./schemas/apitypes.yaml#/WakuPeer" + '400': + description: Invalid argument. + content: + text/plain: + type: string + '500': + description: Internal server error. + content: + text/plain: + type: string diff --git a/api-spec/adminapi.yaml b/api-spec/adminapi_peers.yaml similarity index 62% rename from api-spec/adminapi.yaml rename to api-spec/adminapi_peers.yaml index 596b540..54c7f3e 100644 --- a/api-spec/adminapi.yaml +++ b/api-spec/adminapi_peers.yaml @@ -1,20 +1,23 @@ get: - summary: Get connected peers info - description: Retrieve information about connected peers. + summary: Get peer info about all peers + description: Retrieve information about all peers. operationId: getPeerInfo tags: - admin responses: '200': - description: Information about a Waku v2 node. + description: List of peer info about all peers in peer storage of the node. content: application/json: schema: type: array items: $ref: "./schemas/apitypes.yaml#/WakuPeer" - '5XX': - description: Unexpected error. + '500': + description: Internal server error. + content: + text/plain: + type: string post: summary: Adds new peer(s) to connect with description: Adds new peer(s) to connect with. @@ -33,5 +36,11 @@ post: description: Ok '400': description: Cannot connect to one or more peers. + content: + text/plain: + type: string '5XX': description: Unexpected error. + content: + text/plain: + type: string diff --git a/api-spec/adminapi_peers_connected.yaml b/api-spec/adminapi_peers_connected.yaml new file mode 100644 index 0000000..6014f3a --- /dev/null +++ b/api-spec/adminapi_peers_connected.yaml @@ -0,0 +1,20 @@ +get: + tags: + - admin + summary: Get peers by service + description: Returns information about connected peers + operationId: getConnectedPeers + responses: + '200': + description: Successful service peers response + content: + application/json: + schema: + type: array + items: + $ref: "./schemas/apitypes.yaml#/WakuPeer" + '500': + description: Internal server error. + content: + text/plain: + type: string \ No newline at end of file diff --git a/api-spec/adminapi_peers_connected_on_shard.yaml b/api-spec/adminapi_peers_connected_on_shard.yaml new file mode 100644 index 0000000..0e064c0 --- /dev/null +++ b/api-spec/adminapi_peers_connected_on_shard.yaml @@ -0,0 +1,33 @@ +get: + tags: + - admin + summary: Get peers by service + description: Returns information about connected peers for a specific shard. + operationId: getConnectedPeersByShard + parameters: + - in: path + name: shardId + required: true + schema: + type: integer + format: uint16 + description: ID of the shard to retrieve information for + responses: + '200': + description: Successful service peers response + content: + application/json: + schema: + type: array + items: + $ref: "./schemas/apitypes.yaml#/WakuPeer" + '400': + description: Invalid argument. + content: + text/plain: + type: string + '500': + description: Internal server error. + content: + text/plain: + type: string \ No newline at end of file diff --git a/api-spec/adminapi_peers_mesh.yaml b/api-spec/adminapi_peers_mesh.yaml new file mode 100644 index 0000000..ad261fd --- /dev/null +++ b/api-spec/adminapi_peers_mesh.yaml @@ -0,0 +1,20 @@ +get: + tags: + - admin + summary: Get peers of mesh bx subscribed shards + description: Returns information about relay peers in node's direct mesh, grouped by shards. + operationId: getMeshPeers + responses: + '200': + description: List of mesh peers grouped by shard + content: + application/json: + schema: + type: array + items: + $ref: "./schemas/apitypes.yaml#/PeersOfShard" + '500': + description: Internal server error. + content: + text/plain: + type: string diff --git a/api-spec/adminapi_peers_mesh_on_shard.yaml b/api-spec/adminapi_peers_mesh_on_shard.yaml new file mode 100644 index 0000000..2623c90 --- /dev/null +++ b/api-spec/adminapi_peers_mesh_on_shard.yaml @@ -0,0 +1,31 @@ +get: + tags: + - admin + summary: Get mesh peers by shard + description: Returns information about relay peers in node's direct mesh for a specific shard. + operationId: getMeshPeersByShard + parameters: + - in: path + name: shardId + required: true + schema: + type: integer + format: uint16 + description: ID of the shard to retrieve information for + responses: + '200': + description: List of peers in the mesh of the shard in question + content: + application/json: + schema: + $ref: "./schemas/apitypes.yaml#/PeersOfShard" + '400': + description: Invalid argument. + content: + text/plain: + type: string + '500': + description: Internal server error. + content: + text/plain: + type: string diff --git a/api-spec/adminapi_peers_relay.yaml b/api-spec/adminapi_peers_relay.yaml new file mode 100644 index 0000000..16e4ba7 --- /dev/null +++ b/api-spec/adminapi_peers_relay.yaml @@ -0,0 +1,20 @@ +get: + tags: + - admin + summary: Get peers by service + description: Returns information about relay peers in node's gossip network, grouped by shards. + operationId: getRelayPeers + responses: + '200': + description: Successful service peers response + content: + application/json: + schema: + type: array + items: + $ref: "./schemas/apitypes.yaml#/PeersOfShard" + '500': + description: Internal server error. + content: + text/plain: + type: string \ No newline at end of file diff --git a/api-spec/adminapi_peers_relay_on_shard.yaml b/api-spec/adminapi_peers_relay_on_shard.yaml new file mode 100644 index 0000000..e64407e --- /dev/null +++ b/api-spec/adminapi_peers_relay_on_shard.yaml @@ -0,0 +1,31 @@ +get: + tags: + - admin + summary: Get peers by service + description: Returns information about relay peers in node's gossip network for a specific shard. + operationId: getRelayPeersByShard + parameters: + - in: path + name: shardId + required: true + schema: + type: integer + format: uint16 + description: ID of the shard to retrieve information for + responses: + '200': + description: Successful service peers response + content: + application/json: + schema: + $ref: "./schemas/apitypes.yaml#/PeersOfShard" + '400': + description: Invalid argument. + content: + text/plain: + type: string + '500': + description: Internal server error. + content: + text/plain: + type: string \ No newline at end of file diff --git a/api-spec/adminapi_peers_service.yaml b/api-spec/adminapi_peers_service.yaml new file mode 100644 index 0000000..ab56963 --- /dev/null +++ b/api-spec/adminapi_peers_service.yaml @@ -0,0 +1,20 @@ +get: + tags: + - admin + summary: Get peers by service + description: Returns information about peers offering specific services + operationId: getPeersByService + responses: + '200': + description: Successful service peers response + content: + application/json: + schema: + type: array + items: + $ref: "./schemas/apitypes.yaml#/WakuPeer" + '500': + description: Internal server error. + content: + text/plain: + type: string \ No newline at end of file diff --git a/api-spec/openapi.yaml b/api-spec/openapi.yaml index c359de9..756eed1 100644 --- a/api-spec/openapi.yaml +++ b/api-spec/openapi.yaml @@ -36,7 +36,23 @@ paths: /version: $ref: "./debugapi_version.yaml" /admin/v1/peers: - $ref: "./adminapi.yaml" + $ref: "./adminapi_peers.yaml" + /admin/v1/peer/{peerId}: + $ref: "./adminapi_peer.yaml" + /admin/v1/peers/service: + $ref: "./adminapi_peers_service.yaml" + /admin/v1/peers/connected: + $ref: "./adminapi_peers_connected.yaml" + /admin/v1/peers/connected/on/{shardId}: + $ref: "./adminapi_peers_connected_on_shard.yaml" + /admin/v1/peers/relay: + $ref: "./adminapi_peers_relay.yaml" + /admin/v1/peers/relay/on/{shardId}: + $ref: "./adminapi_peers_relay_on_shard.yaml" + /admin/v1/peers/mesh: + $ref: "./adminapi_peers_mesh.yaml" + /admin/v1/peers/mesh/on/{shardId}: + $ref: "./adminapi_peers_mesh_on_shard.yaml" /admin/v1/filter/subscriptions: $ref: "./adminapi_filter.yaml" /debug/v1/info: diff --git a/api-spec/schemas/apitypes.yaml b/api-spec/schemas/apitypes.yaml index 3fd1a41..3bbe04f 100644 --- a/api-spec/schemas/apitypes.yaml +++ b/api-spec/schemas/apitypes.yaml @@ -3,6 +3,9 @@ WakuPeer: required: - multiaddr - protocols + - shards + - agent + - connected - origin properties: multiaddr: @@ -10,17 +13,37 @@ WakuPeer: protocols: type: array items: - type: object - required: - - protocol - - connected - properties: - protocol: - type: string - connected: - type: boolean + type: string + shards: + type: array + items: + type: integer + format: int32 + connected: + type: string + enum: + - "NotConnected" + - "CannotConnect" + - "CanConnect" + - "Connected" + agent: + type: string origin: type: string + score: + type: number + format: double + +PeersOfShard: + type: object + properties: + shard: + type: integer + format: int32 + peers: + type: array + items: + $ref: "#/WakuPeer" WakuInfo: type: object @@ -42,7 +65,7 @@ ContentTopic: FilterGetMessagesResponse: type: array items: - $ref: '#/WakuMessage' + $ref: "#/WakuMessage" FilterSubscribeRequest: type: object @@ -52,13 +75,13 @@ FilterSubscribeRequest: contentFilters: type: array items: - $ref: '#/ContentTopic' + $ref: "#/ContentTopic" pubsubTopic: $ref: "#/PubsubTopic" required: - - requestId - - contentFilters - - pubsubTopic + - requestId + - contentFilters + - pubsubTopic FilterUnsubscribeRequest: type: object @@ -68,12 +91,12 @@ FilterUnsubscribeRequest: contentFilters: type: array items: - $ref: '#/ContentTopic' + $ref: "#/ContentTopic" pubsubTopic: $ref: "#/PubsubTopic" required: - - requestId - - contentFilters + - requestId + - contentFilters FilterUnsubscribeAllRequest: type: object @@ -81,7 +104,7 @@ FilterUnsubscribeAllRequest: requestId: type: string required: - - requestId + - requestId FilterSubscriptionResponse: type: object @@ -91,7 +114,7 @@ FilterSubscriptionResponse: statusDesc: type: string required: - - requestId + - requestId WakuMessage: type: object @@ -100,7 +123,7 @@ WakuMessage: type: string format: byte contentTopic: - $ref: '#/ContentTopic' + $ref: "#/ContentTopic" version: type: integer format: int32 @@ -115,9 +138,9 @@ WakuMessage: type: string format: byte required: - - payload - - contentTopic - - timestamp + - payload + - contentTopic + - timestamp WakuMessageKeyValue: type: object @@ -125,7 +148,7 @@ WakuMessageKeyValue: message_hash: type: string message: - $ref: '#/components/schemas/WakuMessage' + $ref: "#/components/schemas/WakuMessage" required: - message_hash - message @@ -143,7 +166,7 @@ StoreQueryResponse: messages: type: array items: - $ref: '#/components/schemas/WakuMessageKeyValue' + $ref: "#/components/schemas/WakuMessageKeyValue" paginationCursor: type: string required: @@ -156,22 +179,21 @@ PushRequest: type: object properties: pubsubTopic: - $ref: '#/PubsubTopic' + $ref: "#/PubsubTopic" message: - $ref: '#/WakuMessage' + $ref: "#/WakuMessage" required: - message PushResponse: type: object properties: - statusDesc: + statusDesc: type: string - relayPeerCount: + relayPeerCount: type: integer format: uint32 - ## TODO: Check if it can be tunneled into the one WakuMessage structure ## mainly because of Relay post message request can break in client code RelayWakuMessage: @@ -181,7 +203,7 @@ RelayWakuMessage: type: string format: byte contentTopic: - $ref: '#/ContentTopic' + $ref: "#/ContentTopic" version: type: number timestamp: @@ -197,10 +219,10 @@ RelayWakuMessage: RelayGetMessagesResponse: type: array items: - $ref: '#/RelayWakuMessage' + $ref: "#/RelayWakuMessage" RelayPostMessagesRequest: - $ref: '#/RelayWakuMessage' + $ref: "#/RelayWakuMessage" StoreResponse: type: object @@ -208,9 +230,9 @@ StoreResponse: messages: type: array items: - $ref: '#/WakuMessage' + $ref: "#/WakuMessage" cursor: - $ref: '#/HistoryCursor' + $ref: "#/HistoryCursor" error_message: type: string required: @@ -268,11 +290,11 @@ HealthReport: type: object properties: nodeHealth: - $ref: '#/HealthStatus' + $ref: "#/HealthStatus" description: Overall health status of the node protocolsHealth: type: array items: type: object additionalProperties: - $ref: '#/HealthStatus' + $ref: "#/HealthStatus"