From 7f8277d89c8d60a91fded6d4095de9e789c61838 Mon Sep 17 00:00:00 2001 From: Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> Date: Mon, 24 Apr 2023 18:05:38 +0300 Subject: doc: map summary and leaderboard endpoints (#38) --- docs/docs.go | 181 ++++++++++++++++++++++++++++++++++++++++++++++++++---- docs/swagger.json | 181 ++++++++++++++++++++++++++++++++++++++++++++++++++---- docs/swagger.yaml | 112 ++++++++++++++++++++++++++++++--- 3 files changed, 442 insertions(+), 32 deletions(-) (limited to 'docs') diff --git a/docs/docs.go b/docs/docs.go index b708f2b..022814a 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -21,6 +21,46 @@ const docTemplate = `{ "basePath": "{{.BasePath}}", "paths": { "/demo": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "rankings" + ], + "summary": "Get rankings of every player.", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/models.RankingsResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/models.Response" + } + } + } + } + }, + "/demos": { "get": { "consumes": [ "application/json" @@ -97,7 +137,7 @@ const docTemplate = `{ } } }, - "/maps/{id}": { + "/maps/{id}/leaderboards": { "get": { "consumes": [ "application/json" @@ -108,7 +148,7 @@ const docTemplate = `{ "tags": [ "maps" ], - "summary": "Get map page with specified id.", + "summary": "Get map leaderboards with specified id.", "parameters": [ { "type": "integer", @@ -130,7 +170,19 @@ const docTemplate = `{ "type": "object", "properties": { "data": { - "$ref": "#/definitions/models.Map" + "allOf": [ + { + "$ref": "#/definitions/models.Map" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/models.MapRecords" + } + } + } + ] } } } @@ -239,6 +291,67 @@ const docTemplate = `{ } } }, + "/maps/{id}/summary": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "maps" + ], + "summary": "Get map summary with specified id.", + "parameters": [ + { + "type": "integer", + "description": "Map ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/definitions/models.Map" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/models.MapSummary" + } + } + } + ] + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/models.Response" + } + } + } + } + }, "/profile": { "get": { "consumes": [ @@ -407,7 +520,7 @@ const docTemplate = `{ } } }, - "/user/{id}": { + "/users/{id}": { "get": { "consumes": [ "application/json" @@ -475,24 +588,70 @@ const docTemplate = `{ "models.Map": { "type": "object", "properties": { + "chapter_name": { + "type": "string" + }, + "data": {}, + "game_name": { + "type": "string" + }, "id": { "type": "integer" }, - "is_coop": { - "type": "boolean" - }, - "name": { + "map_name": { "type": "string" + } + } + }, + "models.MapCategoryScores": { + "type": "object", + "properties": { + "any": { + "type": "integer" + }, + "cm": { + "type": "integer" }, - "records": {}, - "wr_score": { + "inbounds_sla": { "type": "integer" }, - "wr_time": { + "no_sla": { "type": "integer" } } }, + "models.MapRecords": { + "type": "object", + "properties": { + "records": {} + } + }, + "models.MapSummary": { + "type": "object", + "properties": { + "category_scores": { + "$ref": "#/definitions/models.MapCategoryScores" + }, + "description": { + "type": "string" + }, + "first_completion": { + "type": "string" + }, + "rating": { + "type": "number" + }, + "routers": { + "type": "array", + "items": { + "type": "string" + } + }, + "showcase": { + "type": "string" + } + } + }, "models.ProfileResponse": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index abdd6a8..4f3e868 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -14,6 +14,46 @@ "basePath": "/v1", "paths": { "/demo": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "rankings" + ], + "summary": "Get rankings of every player.", + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/models.RankingsResponse" + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/models.Response" + } + } + } + } + }, + "/demos": { "get": { "consumes": [ "application/json" @@ -90,7 +130,7 @@ } } }, - "/maps/{id}": { + "/maps/{id}/leaderboards": { "get": { "consumes": [ "application/json" @@ -101,7 +141,7 @@ "tags": [ "maps" ], - "summary": "Get map page with specified id.", + "summary": "Get map leaderboards with specified id.", "parameters": [ { "type": "integer", @@ -123,7 +163,19 @@ "type": "object", "properties": { "data": { - "$ref": "#/definitions/models.Map" + "allOf": [ + { + "$ref": "#/definitions/models.Map" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/models.MapRecords" + } + } + } + ] } } } @@ -232,6 +284,67 @@ } } }, + "/maps/{id}/summary": { + "get": { + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "maps" + ], + "summary": "Get map summary with specified id.", + "parameters": [ + { + "type": "integer", + "description": "Map ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/models.Response" + }, + { + "type": "object", + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/definitions/models.Map" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/models.MapSummary" + } + } + } + ] + } + } + } + ] + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/models.Response" + } + } + } + } + }, "/profile": { "get": { "consumes": [ @@ -400,7 +513,7 @@ } } }, - "/user/{id}": { + "/users/{id}": { "get": { "consumes": [ "application/json" @@ -468,24 +581,70 @@ "models.Map": { "type": "object", "properties": { + "chapter_name": { + "type": "string" + }, + "data": {}, + "game_name": { + "type": "string" + }, "id": { "type": "integer" }, - "is_coop": { - "type": "boolean" - }, - "name": { + "map_name": { "type": "string" + } + } + }, + "models.MapCategoryScores": { + "type": "object", + "properties": { + "any": { + "type": "integer" + }, + "cm": { + "type": "integer" }, - "records": {}, - "wr_score": { + "inbounds_sla": { "type": "integer" }, - "wr_time": { + "no_sla": { "type": "integer" } } }, + "models.MapRecords": { + "type": "object", + "properties": { + "records": {} + } + }, + "models.MapSummary": { + "type": "object", + "properties": { + "category_scores": { + "$ref": "#/definitions/models.MapCategoryScores" + }, + "description": { + "type": "string" + }, + "first_completion": { + "type": "string" + }, + "rating": { + "type": "number" + }, + "routers": { + "type": "array", + "items": { + "type": "string" + } + }, + "showcase": { + "type": "string" + } + } + }, "models.ProfileResponse": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 16e5eab..873dbee 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -7,17 +7,47 @@ definitions: type: object models.Map: properties: + chapter_name: + type: string + data: {} + game_name: + type: string id: type: integer - is_coop: - type: boolean - name: + map_name: type: string - records: {} - wr_score: + type: object + models.MapCategoryScores: + properties: + any: + type: integer + cm: type: integer - wr_time: + inbounds_sla: type: integer + no_sla: + type: integer + type: object + models.MapRecords: + properties: + records: {} + type: object + models.MapSummary: + properties: + category_scores: + $ref: '#/definitions/models.MapCategoryScores' + description: + type: string + first_completion: + type: string + rating: + type: number + routers: + items: + type: string + type: array + showcase: + type: string type: object models.ProfileResponse: properties: @@ -101,6 +131,29 @@ info: version: "1.0" paths: /demo: + get: + consumes: + - application/json + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/models.Response' + - properties: + data: + $ref: '#/definitions/models.RankingsResponse' + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/models.Response' + summary: Get rankings of every player. + tags: + - rankings + /demos: get: consumes: - application/json @@ -147,7 +200,7 @@ paths: summary: Get (redirect) login page for Steam auth. tags: - login - /maps/{id}: + /maps/{id}/leaderboards: get: consumes: - application/json @@ -167,13 +220,18 @@ paths: - $ref: '#/definitions/models.Response' - properties: data: - $ref: '#/definitions/models.Map' + allOf: + - $ref: '#/definitions/models.Map' + - properties: + data: + $ref: '#/definitions/models.MapRecords' + type: object type: object "400": description: Bad Request schema: $ref: '#/definitions/models.Response' - summary: Get map page with specified id. + summary: Get map leaderboards with specified id. tags: - maps /maps/{id}/record: @@ -236,6 +294,40 @@ paths: summary: Post record with demo of a specific map. tags: - maps + /maps/{id}/summary: + get: + consumes: + - application/json + parameters: + - description: Map ID + in: path + name: id + required: true + type: integer + produces: + - application/json + responses: + "200": + description: OK + schema: + allOf: + - $ref: '#/definitions/models.Response' + - properties: + data: + allOf: + - $ref: '#/definitions/models.Map' + - properties: + data: + $ref: '#/definitions/models.MapSummary' + type: object + type: object + "400": + description: Bad Request + schema: + $ref: '#/definitions/models.Response' + summary: Get map summary with specified id. + tags: + - maps /profile: get: consumes: @@ -338,7 +430,7 @@ paths: summary: Update country code of session user. tags: - users - /user/{id}: + /users/{id}: get: consumes: - application/json -- cgit v1.2.3