From 5cec284450e5398436952abc12d1d347328abd6e Mon Sep 17 00:00:00 2001 From: kene Date: Tue, 17 Dec 2024 09:55:06 +0100 Subject: [PATCH] fix docs --- docs/docs.go | 58 ++++++++++++++++++++++++++++++++++++++++------- docs/swagger.json | 57 ++++++++++++++++++++++++++++++++++++++++------ docs/swagger.yaml | 34 ++++++++++++++++++++++++--- 3 files changed, 131 insertions(+), 18 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 7425190..62b7a55 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -3088,7 +3088,45 @@ const docTemplate = `{ "required": true, "schema": { "$ref": "#/definitions/schemas.CreateICPWallet" - + } + } + ], + "responses": { + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/utils.ErrorResponse" + } + } + } + } + }, + "/wallet/icp/{username}/balance": { + "get": { + "description": "This endpoint returns user ICP wallet balance", + "tags": [ + "Wallet" + ], + "summary": "Get user ICP wallet balance", + "parameters": [ + { + "type": "string", + "description": "Username of user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/utils.ErrorResponse" + } + } + } + } + }, "/wallet/plans": { "get": { "description": "Retrieves a list of available subscription plans.", @@ -3187,19 +3225,16 @@ const docTemplate = `{ "required": true, "schema": { "$ref": "#/definitions/schemas.CreateSubscriptionSchema" - } } ], "responses": { - "200": { "description": "OK", "schema": { "$ref": "#/definitions/schemas.PaymentResponseSchema" } }, - "400": { "description": "Bad Request", "schema": { @@ -3258,11 +3293,11 @@ const docTemplate = `{ "type": "string", "enum": [ "READER", - "WRITER" + "AUTHOR" ], "x-enum-varnames": [ "ACCTYPE_READER", - "ACCTYPE_WRITER" + "ACCTYPE_AUTHOR" ] }, "choices.AgeType": { @@ -3529,6 +3564,9 @@ const docTemplate = `{ "author": { "$ref": "#/definitions/schemas.UserDataSchema" }, + "avg_rating": { + "type": "number" + }, "blurb": { "type": "string" }, @@ -3609,6 +3647,9 @@ const docTemplate = `{ "author": { "$ref": "#/definitions/schemas.UserDataSchema" }, + "avg_rating": { + "type": "number" + }, "blurb": { "type": "string" }, @@ -3987,7 +4028,6 @@ const docTemplate = `{ } } }, - "schemas.CreateICPWallet": { "type": "object", "required": [ @@ -3998,7 +4038,9 @@ const docTemplate = `{ "type": "string", "maxLength": 1000, "example": "john-doe" - + } + } + }, "schemas.CreateSubscriptionSchema": { "type": "object", "required": [ diff --git a/docs/swagger.json b/docs/swagger.json index 7bd72db..410a88f 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -3066,7 +3066,6 @@ } } }, - "/wallet/icp": { "post": { "description": "`This endpoint creates a new ICP wallet`", @@ -3082,7 +3081,45 @@ "required": true, "schema": { "$ref": "#/definitions/schemas.CreateICPWallet" - + } + } + ], + "responses": { + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/utils.ErrorResponse" + } + } + } + } + }, + "/wallet/icp/{username}/balance": { + "get": { + "description": "This endpoint returns user ICP wallet balance", + "tags": [ + "Wallet" + ], + "summary": "Get user ICP wallet balance", + "parameters": [ + { + "type": "string", + "description": "Username of user", + "name": "username", + "in": "path", + "required": true + } + ], + "responses": { + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/utils.ErrorResponse" + } + } + } + } + }, "/wallet/plans": { "get": { "description": "Retrieves a list of available subscription plans.", @@ -3181,7 +3218,6 @@ "required": true, "schema": { "$ref": "#/definitions/schemas.CreateSubscriptionSchema" - } } ], @@ -3250,11 +3286,11 @@ "type": "string", "enum": [ "READER", - "WRITER" + "AUTHOR" ], "x-enum-varnames": [ "ACCTYPE_READER", - "ACCTYPE_WRITER" + "ACCTYPE_AUTHOR" ] }, "choices.AgeType": { @@ -3521,6 +3557,9 @@ "author": { "$ref": "#/definitions/schemas.UserDataSchema" }, + "avg_rating": { + "type": "number" + }, "blurb": { "type": "string" }, @@ -3601,6 +3640,9 @@ "author": { "$ref": "#/definitions/schemas.UserDataSchema" }, + "avg_rating": { + "type": "number" + }, "blurb": { "type": "string" }, @@ -3979,7 +4021,6 @@ } } }, - "schemas.CreateICPWallet": { "type": "object", "required": [ @@ -3990,7 +4031,9 @@ "type": "string", "maxLength": 1000, "example": "john-doe" - + } + } + }, "schemas.CreateSubscriptionSchema": { "type": "object", "required": [ diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 3604cbb..3361310 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -5,11 +5,11 @@ definitions: choices.AccType: enum: - READER - - WRITER + - AUTHOR type: string x-enum-varnames: - ACCTYPE_READER - - ACCTYPE_WRITER + - ACCTYPE_AUTHOR choices.AgeType: enum: - 4 @@ -210,6 +210,8 @@ definitions: $ref: '#/definitions/choices.AgeType' author: $ref: '#/definitions/schemas.UserDataSchema' + avg_rating: + type: number blurb: type: string chapter_price: @@ -264,6 +266,8 @@ definitions: $ref: '#/definitions/choices.AgeType' author: $ref: '#/definitions/schemas.UserDataSchema' + avg_rating: + type: number blurb: type: string chapter_price: @@ -530,6 +534,7 @@ definitions: type: string required: - username + type: object schemas.CreateSubscriptionSchema: properties: payment_method_token: @@ -3368,6 +3373,30 @@ paths: schema: $ref: '#/definitions/schemas.CreateICPWallet' responses: + "400": + description: Bad Request + schema: + $ref: '#/definitions/utils.ErrorResponse' + summary: Create a new ICP wallet + tags: + - Wallet + /wallet/icp/{username}/balance: + get: + description: This endpoint returns user ICP wallet balance + parameters: + - description: Username of user + in: path + name: username + required: true + type: string + responses: + "400": + description: Bad Request + schema: + $ref: '#/definitions/utils.ErrorResponse' + summary: Get user ICP wallet balance + tags: + - Wallet /wallet/plans: get: consumes: @@ -3437,7 +3466,6 @@ paths: description: Bad Request schema: $ref: '#/definitions/utils.ErrorResponse' - summary: Create a new ICP wallet security: - BearerAuth: [] summary: Subscribe