From 19a60d2466ef9bc6fca8b172c96af98acbc40b96 Mon Sep 17 00:00:00 2001 From: violog Date: Fri, 14 Jun 2024 15:15:42 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=2057f72?= =?UTF-8?q?18d943f7e4633d24981b259101b626d6d14=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openapi.json | 265 +++++++++++++++++++++++++++++++++------------------ openapi.yaml | 209 +++++++++++++++++++++++++++------------- 2 files changed, 312 insertions(+), 162 deletions(-) diff --git a/openapi.json b/openapi.json index 0e321aa..4d9a5f9 100644 --- a/openapi.json +++ b/openapi.json @@ -164,8 +164,7 @@ "description": "Specifies whether to return the referral codes", "required": false, "schema": { - "type": "booleand", - "example": true + "type": "boolean" } } ], @@ -198,78 +197,6 @@ "$ref": "#/components/responses/internalError" } } - }, - "patch": { - "tags": [ - "Points balance" - ], - "summary": "Activate points balance", - "description": "Activate inactive balance. Balance is inactive when referred_by field is null.\nnullifier in query must match with id in request body\n", - "operationId": "activatePointsBalance", - "parameters": [ - { - "$ref": "#/components/parameters/pathNullifier" - } - ], - "requestBody": { - "content": { - "application/vnd.api+json": { - "schema": { - "type": "object", - "required": [ - "data" - ], - "properties": { - "data": { - "$ref": "#/components/schemas/CreateBalance" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/vnd.api+json": { - "schema": { - "type": "object", - "required": [ - "data" - ], - "properties": { - "data": { - "$ref": "#/components/schemas/Balance" - } - } - } - } - } - }, - "400": { - "$ref": "#/components/responses/invalidParameter" - }, - "401": { - "$ref": "#/components/responses/invalidAuth" - }, - "404": { - "$ref": "#/components/responses/notFound" - }, - "409": { - "description": "Balance already activated", - "content": { - "application/vnd.api+json": { - "schema": { - "$ref": "#/components/schemas/Errors" - } - } - } - }, - "500": { - "$ref": "#/components/responses/internalError" - } - } } }, "/integrations/rarime-points-svc/v1/public/balances/{nullifier}/verifypassport": { @@ -510,6 +437,75 @@ } } }, + "/integrations/rarime-points-svc/v1/public/event_types": { + "get": { + "tags": [ + "Events" + ], + "summary": "List event types", + "description": "Returns public configuration of all event types.\nBasically, it is event static metadata (model `EventStaticMeta`)\nfor each event type in the system.\n", + "operationId": "getEventTypes", + "parameters": [ + { + "in": "query", + "name": "filter[name]", + "description": "Filter by type name. Possible values should be hard-coded in the client.", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string", + "example": "passport_scan" + } + } + }, + { + "in": "query", + "name": "filter[flag]", + "description": "Filter by configuration flags. Values are disjunctive (OR).", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "active", + "not_started", + "expired", + "disabled" + ] + } + } + } + ], + "responses": { + "200": { + "description": "Success", + "content": { + "application/vnd.api+json": { + "schema": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EventType" + } + } + } + } + } + } + }, + "500": { + "$ref": "#/components/responses/internalError" + } + } + } + }, "/integrations/rarime-points-svc/v1/public/events": { "get": { "tags": [ @@ -548,10 +544,19 @@ "type": "array", "items": { "type": "string", - "example": "create_org" + "example": "passport_scan" } } }, + { + "in": "query", + "name": "filter[has_expiration]", + "description": "Filter events by type which has or hasn't expiration.", + "required": false, + "schema": { + "type": "boolean" + } + }, { "in": "query", "name": "count", @@ -798,7 +803,6 @@ "type": "object", "required": [ "amount", - "is_disabled", "created_at", "updated_at", "level" @@ -831,26 +835,11 @@ "description": "Rank of the user in the full leaderboard. Returned only for the single user.", "example": 294 }, - "active_referral_codes": { - "type": "array", - "description": "Referral codes which can be used to build a referral link and send it\nto friends. Returned only for the single user.\n", - "example": [ - "zgsScguZ", - "jerUsmac" - ], - "items": { - "type": "string" - } - }, - "consumed_referral_codes": { + "referral_codes": { "type": "array", - "description": "Referral codes used by invited users. Returned only for the single user.", - "example": [ - "73k3bdYaFWM", - "9csIL7dW65m" - ], + "description": "Referral codes. Returned only for the single user.", "items": { - "type": "string" + "$ref": "#/components/schemas/ReferralCode" } }, "level": { @@ -858,6 +847,10 @@ "format": "int", "description": "The level indicates user permissions and features", "example": 2 + }, + "is_verified": { + "type": "boolean", + "description": "Whether the user has scanned passport. Returned only for the single user.\n" } } } @@ -1084,6 +1077,7 @@ "status", "created_at", "updated_at", + "has_expiration", "meta" ], "properties": { @@ -1106,6 +1100,10 @@ "description": "Unix timestamp of the event status change", "example": 1706531218 }, + "has_expiration": { + "type": "boolean", + "description": "Whether this event may become expired." + }, "meta": { "$ref": "#/components/schemas/EventMeta" }, @@ -1188,7 +1186,7 @@ "description", "short_description", "frequency", - "no_auto_open" + "flag" ], "properties": { "name": { @@ -1245,6 +1243,57 @@ "type": "string", "description": "Event logo", "example": "https://logo.com/some_logo.svg" + }, + "flag": { + "type": "string", + "description": "Event configuration flag:\n - active: Events can be opened, fulfilled, claimed\n - not_started: Event are not available yet, see `starts_at`\n - expired: Event is not available, as it has already expired, see `expires_at`\n - disabled: Event is disabled in the system\n\nIf event is disabled, it doesn't matter if it's expired or not started:\nit has `disabled` flag.\n", + "enum": [ + "active", + "not_started", + "expired", + "disabled" + ] + } + } + }, + "EventType": { + "allOf": [ + { + "$ref": "#/components/schemas/EventTypeKey" + }, + { + "type": "object", + "description": "Event type configuration and metadata", + "required": [ + "attributes" + ], + "properties": { + "attributes": { + "type": "object", + "format": "EventStaticMeta", + "$ref": "#/components/schemas/EventStaticMeta" + } + } + } + ] + }, + "EventTypeKey": { + "type": "object", + "required": [ + "id", + "type" + ], + "properties": { + "id": { + "type": "string", + "description": "Event type unique code name", + "example": "passport_scan" + }, + "type": { + "type": "string", + "enum": [ + "event_type" + ] } } }, @@ -1346,6 +1395,32 @@ } } }, + "ReferralCode": { + "type": "object", + "required": [ + "id", + "status" + ], + "properties": { + "id": { + "type": "string", + "description": "Referral code itself, unique identifier", + "example": "bDSCcQB8Hhk" + }, + "status": { + "type": "string", + "description": "Status of the code, belonging to this user (referrer):\n 1. active: the code is not used yet by another user (referee)\n 2. banned: the referrer's country (known after scanning passport)\n is not allowed to participate in the referral program\n 3. limited: the limit of reserved tokens in the referrer's country is reached\n 4. awaiting: the code is used by referee who has scanned passport, but the referrer hasn't yet\n 5. rewarded: the code is used, both referee and referrer have scanned passports\n 6. consumed: the code is used by referee who has not scanned passport yet\n\nThe list is sorted by priority. E.g. if the referee has scanned passport,\nbut referrer's country has limit reached, the status would be `limited`.\n", + "enum": [ + "active", + "banned", + "limited", + "awaiting", + "rewarded", + "consumed" + ] + } + } + }, "VerifyPassport": { "allOf": [ { diff --git a/openapi.yaml b/openapi.yaml index 5969436..8be4a1a 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -113,46 +113,7 @@ paths: description: Specifies whether to return the referral codes required: false schema: - type: booleand - example: true - responses: - '200': - description: Success - content: - application/vnd.api+json: - schema: - type: object - required: - - data - properties: - data: - $ref: '#/components/schemas/Balance' - '400': - $ref: '#/components/responses/invalidParameter' - '401': - $ref: '#/components/responses/invalidAuth' - '500': - $ref: '#/components/responses/internalError' - patch: - tags: - - Points balance - summary: Activate points balance - description: | - Activate inactive balance. Balance is inactive when referred_by field is null. - nullifier in query must match with id in request body - operationId: activatePointsBalance - parameters: - - $ref: '#/components/parameters/pathNullifier' - requestBody: - content: - application/vnd.api+json: - schema: - type: object - required: - - data - properties: - data: - $ref: '#/components/schemas/CreateBalance' + type: boolean responses: '200': description: Success @@ -169,14 +130,6 @@ paths: $ref: '#/components/responses/invalidParameter' '401': $ref: '#/components/responses/invalidAuth' - '404': - $ref: '#/components/responses/notFound' - '409': - description: Balance already activated - content: - application/vnd.api+json: - schema: - $ref: '#/components/schemas/Errors' '500': $ref: '#/components/responses/internalError' '/integrations/rarime-points-svc/v1/public/balances/{nullifier}/verifypassport': @@ -328,6 +281,55 @@ paths: $ref: '#/components/schemas/CountriesConfig' '500': $ref: '#/components/responses/internalError' + /integrations/rarime-points-svc/v1/public/event_types: + get: + tags: + - Events + summary: List event types + description: | + Returns public configuration of all event types. + Basically, it is event static metadata (model `EventStaticMeta`) + for each event type in the system. + operationId: getEventTypes + parameters: + - in: query + name: 'filter[name]' + description: Filter by type name. Possible values should be hard-coded in the client. + required: false + schema: + type: array + items: + type: string + example: passport_scan + - in: query + name: 'filter[flag]' + description: Filter by configuration flags. Values are disjunctive (OR). + required: false + schema: + type: array + items: + type: string + enum: + - active + - not_started + - expired + - disabled + responses: + '200': + description: Success + content: + application/vnd.api+json: + schema: + type: object + required: + - data + properties: + data: + type: array + items: + $ref: '#/components/schemas/EventType' + '500': + $ref: '#/components/responses/internalError' /integrations/rarime-points-svc/v1/public/events: get: tags: @@ -361,7 +363,13 @@ paths: type: array items: type: string - example: create_org + example: passport_scan + - in: query + name: 'filter[has_expiration]' + description: Filter events by type which has or hasn't expiration. + required: false + schema: + type: boolean - in: query name: count description: 'Count total number of events for a single user, applying filters.' @@ -519,7 +527,6 @@ components: type: object required: - amount - - is_disabled - created_at - updated_at - level @@ -549,29 +556,20 @@ components: format: int description: Rank of the user in the full leaderboard. Returned only for the single user. example: 294 - active_referral_codes: - type: array - description: | - Referral codes which can be used to build a referral link and send it - to friends. Returned only for the single user. - example: - - zgsScguZ - - jerUsmac - items: - type: string - consumed_referral_codes: + referral_codes: type: array - description: Referral codes used by invited users. Returned only for the single user. - example: - - 73k3bdYaFWM - - 9csIL7dW65m + description: Referral codes. Returned only for the single user. items: - type: string + $ref: '#/components/schemas/ReferralCode' level: type: integer format: int description: The level indicates user permissions and features example: 2 + is_verified: + type: boolean + description: | + Whether the user has scanned passport. Returned only for the single user. BalanceKey: type: object required: @@ -724,6 +722,7 @@ components: - status - created_at - updated_at + - has_expiration - meta properties: status: @@ -741,6 +740,9 @@ components: type: integer description: Unix timestamp of the event status change example: 1706531218 + has_expiration: + type: boolean + description: Whether this event may become expired. meta: $ref: '#/components/schemas/EventMeta' points_amount: @@ -801,7 +803,7 @@ components: - description - short_description - frequency - - no_auto_open + - flag properties: name: type: string @@ -849,6 +851,48 @@ components: type: string description: Event logo example: 'https://logo.com/some_logo.svg' + flag: + type: string + description: | + Event configuration flag: + - active: Events can be opened, fulfilled, claimed + - not_started: Event are not available yet, see `starts_at` + - expired: Event is not available, as it has already expired, see `expires_at` + - disabled: Event is disabled in the system + + If event is disabled, it doesn't matter if it's expired or not started: + it has `disabled` flag. + enum: + - active + - not_started + - expired + - disabled + EventType: + allOf: + - $ref: '#/components/schemas/EventTypeKey' + - type: object + description: Event type configuration and metadata + required: + - attributes + properties: + attributes: + type: object + format: EventStaticMeta + $ref: '#/components/schemas/EventStaticMeta' + EventTypeKey: + type: object + required: + - id + - type + properties: + id: + type: string + description: Event type unique code name + example: passport_scan + type: + type: string + enum: + - event_type PassportEventState: allOf: - $ref: '#/components/schemas/PassportEventStateKey' @@ -911,6 +955,37 @@ components: type: string enum: - point_price + ReferralCode: + type: object + required: + - id + - status + properties: + id: + type: string + description: 'Referral code itself, unique identifier' + example: bDSCcQB8Hhk + status: + type: string + description: | + Status of the code, belonging to this user (referrer): + 1. active: the code is not used yet by another user (referee) + 2. banned: the referrer's country (known after scanning passport) + is not allowed to participate in the referral program + 3. limited: the limit of reserved tokens in the referrer's country is reached + 4. awaiting: the code is used by referee who has scanned passport, but the referrer hasn't yet + 5. rewarded: the code is used, both referee and referrer have scanned passports + 6. consumed: the code is used by referee who has not scanned passport yet + + The list is sorted by priority. E.g. if the referee has scanned passport, + but referrer's country has limit reached, the status would be `limited`. + enum: + - active + - banned + - limited + - awaiting + - rewarded + - consumed VerifyPassport: allOf: - $ref: '#/components/schemas/VerifyPassportKey'