From 12e5456d82862a1129e5cb1bc8164a1efa167fd7 Mon Sep 17 00:00:00 2001 From: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com> Date: Thu, 6 Mar 2025 07:56:46 +0100 Subject: [PATCH] Define lightpush v3 api, rename ligthpush to legacy. Fix discrepancy of store api. --- ...tpushapi.yaml => lightpushapi_legacy.yaml} | 4 +- api-spec/lightpushapi_v3.yaml | 72 +++++++++++++++++++ api-spec/openapi.yaml | 4 +- api-spec/schemas/apitypes.yaml | 24 +++++-- 4 files changed, 94 insertions(+), 10 deletions(-) rename api-spec/{lightpushapi.yaml => lightpushapi_legacy.yaml} (77%) create mode 100644 api-spec/lightpushapi_v3.yaml diff --git a/api-spec/lightpushapi.yaml b/api-spec/lightpushapi_legacy.yaml similarity index 77% rename from api-spec/lightpushapi.yaml rename to api-spec/lightpushapi_legacy.yaml index 6fc3524..e36b2c0 100644 --- a/api-spec/lightpushapi.yaml +++ b/api-spec/lightpushapi_legacy.yaml @@ -1,6 +1,6 @@ post: - summary: Request a message relay from a LightPush service provider - description: Push a message to be relayed on a PubSub topic. + summary: Request a message relay from a `Legacy` LightPush service provider + description: Push a message to be relayed on a PubSub topic. Notice this version of the /lightpush endpoint will be depricated. operationId: postMessagesToPubsubTopic tags: - lightpush diff --git a/api-spec/lightpushapi_v3.yaml b/api-spec/lightpushapi_v3.yaml new file mode 100644 index 0000000..47056cc --- /dev/null +++ b/api-spec/lightpushapi_v3.yaml @@ -0,0 +1,72 @@ +post: + summary: Request a message relay from a LightPush service provider + description: Push a message to be relayed on a PubSub topic. + operationId: postMessagesToPubsubTopic + tags: + - lightpush + requestBody: + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushRequest' + responses: + '200': + description: OK + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushResponse' + '400': + description: Bad request. + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushResponse' + '413': + description: Payload too large. + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushResponse' + '420': + description: Invalid message. + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushResponse' + '421': + description: Unsupported pubsub topic. + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushResponse' + '500': + description: Internal server error + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushResponse' + '429': + description: Too many requests + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushResponse' + '503': + description: Service not available + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushResponse' + '504': + description: Out of RLN proof + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushResponse' + '505': + description: No peers to relay + content: + application/json: + schema: + $ref: './schemas/apitypes.yaml#/PushResponse' diff --git a/api-spec/openapi.yaml b/api-spec/openapi.yaml index 7649f65..8650344 100644 --- a/api-spec/openapi.yaml +++ b/api-spec/openapi.yaml @@ -40,7 +40,9 @@ paths: /health: $ref: "./healthapi.yaml" /lightpush/v1/message: - $ref: "./lightpushapi.yaml" + $ref: "./lightpushapi_legacy.yaml" + /lightpush/v3/message: + $ref: "./lightpushapi_v3.yaml" /relay/v1/messages/{pubsubTopic}: $ref: "./relayapi_messages.yaml" /relay/v1/subscriptions: diff --git a/api-spec/schemas/apitypes.yaml b/api-spec/schemas/apitypes.yaml index fe9ba73..78c2854 100644 --- a/api-spec/schemas/apitypes.yaml +++ b/api-spec/schemas/apitypes.yaml @@ -145,23 +145,23 @@ WakuMessageKeyValue: StoreQueryResponse: type: object properties: - request_id: + requestId: type: string - status_code: + statusCode: type: integer format: uint32 - status_desc: + statusDesc: type: string messages: type: array items: $ref: '#/components/schemas/WakuMessageKeyValue' - pagination_cursor: + paginationCursor: type: string required: - - request_id - - status_code - - status_desc + - requestId + - statusCode + - statusDesc - messages PushRequest: @@ -174,6 +174,16 @@ PushRequest: required: - message +PushResponse: + type: object + properties: + statusDesc: + type: string + 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: