diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-04-13 01:28:48 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-04-13 01:28:48 +0300 |
| commit | 3e10a3542f70f23313fc6a43c41aaca518e3d344 (patch) | |
| tree | 2bf813d90aa62336335141c1902b5eb7ec915550 /docs | |
| parent | Merge pull request #32 from Nidboj132/main (diff) | |
| download | lphub-3e10a3542f70f23313fc6a43c41aaca518e3d344.tar.gz lphub-3e10a3542f70f23313fc6a43c41aaca518e3d344.tar.bz2 lphub-3e10a3542f70f23313fc6a43c41aaca518e3d344.zip | |
doc: swagger init for login and user routes (#34)
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/docs.go | 293 | ||||
| -rw-r--r-- | docs/swagger.json | 292 | ||||
| -rw-r--r-- | docs/swagger.yaml | 177 |
3 files changed, 755 insertions, 7 deletions
diff --git a/docs/docs.go b/docs/docs.go index b05b0ad..caa64bf 100644 --- a/docs/docs.go +++ b/docs/docs.go | |||
| @@ -19,14 +19,301 @@ const docTemplate = `{ | |||
| 19 | }, | 19 | }, |
| 20 | "host": "{{.Host}}", | 20 | "host": "{{.Host}}", |
| 21 | "basePath": "{{.BasePath}}", | 21 | "basePath": "{{.BasePath}}", |
| 22 | "paths": {} | 22 | "paths": { |
| 23 | "/login": { | ||
| 24 | "get": { | ||
| 25 | "consumes": [ | ||
| 26 | "application/json" | ||
| 27 | ], | ||
| 28 | "produces": [ | ||
| 29 | "application/json" | ||
| 30 | ], | ||
| 31 | "summary": "Get (redirect) login page for Steam auth.", | ||
| 32 | "responses": { | ||
| 33 | "200": { | ||
| 34 | "description": "OK", | ||
| 35 | "schema": { | ||
| 36 | "allOf": [ | ||
| 37 | { | ||
| 38 | "$ref": "#/definitions/models.Response" | ||
| 39 | }, | ||
| 40 | { | ||
| 41 | "type": "object", | ||
| 42 | "properties": { | ||
| 43 | "data": { | ||
| 44 | "$ref": "#/definitions/models.LoginResponse" | ||
| 45 | } | ||
| 46 | } | ||
| 47 | } | ||
| 48 | ] | ||
| 49 | } | ||
| 50 | }, | ||
| 51 | "400": { | ||
| 52 | "description": "Bad Request", | ||
| 53 | "schema": { | ||
| 54 | "$ref": "#/definitions/models.Response" | ||
| 55 | } | ||
| 56 | } | ||
| 57 | } | ||
| 58 | } | ||
| 59 | }, | ||
| 60 | "/profile": { | ||
| 61 | "get": { | ||
| 62 | "consumes": [ | ||
| 63 | "application/json" | ||
| 64 | ], | ||
| 65 | "produces": [ | ||
| 66 | "application/json" | ||
| 67 | ], | ||
| 68 | "summary": "Get profile page of session user.", | ||
| 69 | "responses": { | ||
| 70 | "200": { | ||
| 71 | "description": "OK", | ||
| 72 | "schema": { | ||
| 73 | "allOf": [ | ||
| 74 | { | ||
| 75 | "$ref": "#/definitions/models.Response" | ||
| 76 | }, | ||
| 77 | { | ||
| 78 | "type": "object", | ||
| 79 | "properties": { | ||
| 80 | "data": { | ||
| 81 | "$ref": "#/definitions/models.ProfileResponse" | ||
| 82 | } | ||
| 83 | } | ||
| 84 | } | ||
| 85 | ] | ||
| 86 | } | ||
| 87 | }, | ||
| 88 | "400": { | ||
| 89 | "description": "Bad Request", | ||
| 90 | "schema": { | ||
| 91 | "$ref": "#/definitions/models.Response" | ||
| 92 | } | ||
| 93 | }, | ||
| 94 | "401": { | ||
| 95 | "description": "Unauthorized", | ||
| 96 | "schema": { | ||
| 97 | "$ref": "#/definitions/models.Response" | ||
| 98 | } | ||
| 99 | } | ||
| 100 | } | ||
| 101 | }, | ||
| 102 | "put": { | ||
| 103 | "consumes": [ | ||
| 104 | "application/json" | ||
| 105 | ], | ||
| 106 | "produces": [ | ||
| 107 | "application/json" | ||
| 108 | ], | ||
| 109 | "summary": "Update country code of session user.", | ||
| 110 | "parameters": [ | ||
| 111 | { | ||
| 112 | "type": "string", | ||
| 113 | "description": "Country Code [XX]", | ||
| 114 | "name": "country_code", | ||
| 115 | "in": "query", | ||
| 116 | "required": true | ||
| 117 | } | ||
| 118 | ], | ||
| 119 | "responses": { | ||
| 120 | "200": { | ||
| 121 | "description": "OK", | ||
| 122 | "schema": { | ||
| 123 | "allOf": [ | ||
| 124 | { | ||
| 125 | "$ref": "#/definitions/models.Response" | ||
| 126 | }, | ||
| 127 | { | ||
| 128 | "type": "object", | ||
| 129 | "properties": { | ||
| 130 | "data": { | ||
| 131 | "$ref": "#/definitions/models.ProfileResponse" | ||
| 132 | } | ||
| 133 | } | ||
| 134 | } | ||
| 135 | ] | ||
| 136 | } | ||
| 137 | }, | ||
| 138 | "400": { | ||
| 139 | "description": "Bad Request", | ||
| 140 | "schema": { | ||
| 141 | "$ref": "#/definitions/models.Response" | ||
| 142 | } | ||
| 143 | }, | ||
| 144 | "401": { | ||
| 145 | "description": "Unauthorized", | ||
| 146 | "schema": { | ||
| 147 | "$ref": "#/definitions/models.Response" | ||
| 148 | } | ||
| 149 | } | ||
| 150 | } | ||
| 151 | }, | ||
| 152 | "post": { | ||
| 153 | "consumes": [ | ||
| 154 | "application/json" | ||
| 155 | ], | ||
| 156 | "produces": [ | ||
| 157 | "application/json" | ||
| 158 | ], | ||
| 159 | "summary": "Update profile page of session user.", | ||
| 160 | "responses": { | ||
| 161 | "200": { | ||
| 162 | "description": "OK", | ||
| 163 | "schema": { | ||
| 164 | "allOf": [ | ||
| 165 | { | ||
| 166 | "$ref": "#/definitions/models.Response" | ||
| 167 | }, | ||
| 168 | { | ||
| 169 | "type": "object", | ||
| 170 | "properties": { | ||
| 171 | "data": { | ||
| 172 | "$ref": "#/definitions/models.ProfileResponse" | ||
| 173 | } | ||
| 174 | } | ||
| 175 | } | ||
| 176 | ] | ||
| 177 | } | ||
| 178 | }, | ||
| 179 | "400": { | ||
| 180 | "description": "Bad Request", | ||
| 181 | "schema": { | ||
| 182 | "$ref": "#/definitions/models.Response" | ||
| 183 | } | ||
| 184 | }, | ||
| 185 | "401": { | ||
| 186 | "description": "Unauthorized", | ||
| 187 | "schema": { | ||
| 188 | "$ref": "#/definitions/models.Response" | ||
| 189 | } | ||
| 190 | } | ||
| 191 | } | ||
| 192 | } | ||
| 193 | }, | ||
| 194 | "/user/{id}": { | ||
| 195 | "get": { | ||
| 196 | "consumes": [ | ||
| 197 | "application/json" | ||
| 198 | ], | ||
| 199 | "produces": [ | ||
| 200 | "application/json" | ||
| 201 | ], | ||
| 202 | "summary": "Get profile page of another user.", | ||
| 203 | "parameters": [ | ||
| 204 | { | ||
| 205 | "type": "integer", | ||
| 206 | "description": "User ID", | ||
| 207 | "name": "id", | ||
| 208 | "in": "path", | ||
| 209 | "required": true | ||
| 210 | } | ||
| 211 | ], | ||
| 212 | "responses": { | ||
| 213 | "200": { | ||
| 214 | "description": "OK", | ||
| 215 | "schema": { | ||
| 216 | "allOf": [ | ||
| 217 | { | ||
| 218 | "$ref": "#/definitions/models.Response" | ||
| 219 | }, | ||
| 220 | { | ||
| 221 | "type": "object", | ||
| 222 | "properties": { | ||
| 223 | "data": { | ||
| 224 | "$ref": "#/definitions/models.ProfileResponse" | ||
| 225 | } | ||
| 226 | } | ||
| 227 | } | ||
| 228 | ] | ||
| 229 | } | ||
| 230 | }, | ||
| 231 | "400": { | ||
| 232 | "description": "Bad Request", | ||
| 233 | "schema": { | ||
| 234 | "$ref": "#/definitions/models.Response" | ||
| 235 | } | ||
| 236 | }, | ||
| 237 | "404": { | ||
| 238 | "description": "Not Found", | ||
| 239 | "schema": { | ||
| 240 | "$ref": "#/definitions/models.Response" | ||
| 241 | } | ||
| 242 | } | ||
| 243 | } | ||
| 244 | } | ||
| 245 | } | ||
| 246 | }, | ||
| 247 | "definitions": { | ||
| 248 | "models.LoginResponse": { | ||
| 249 | "type": "object", | ||
| 250 | "properties": { | ||
| 251 | "token": { | ||
| 252 | "type": "string" | ||
| 253 | } | ||
| 254 | } | ||
| 255 | }, | ||
| 256 | "models.ProfileResponse": { | ||
| 257 | "type": "object", | ||
| 258 | "properties": { | ||
| 259 | "avatar_link": { | ||
| 260 | "type": "string" | ||
| 261 | }, | ||
| 262 | "country_code": { | ||
| 263 | "type": "string" | ||
| 264 | }, | ||
| 265 | "profile": { | ||
| 266 | "type": "boolean" | ||
| 267 | }, | ||
| 268 | "scores_mp": { | ||
| 269 | "type": "array", | ||
| 270 | "items": { | ||
| 271 | "$ref": "#/definitions/models.ScoreResponse" | ||
| 272 | } | ||
| 273 | }, | ||
| 274 | "scores_sp": { | ||
| 275 | "type": "array", | ||
| 276 | "items": { | ||
| 277 | "$ref": "#/definitions/models.ScoreResponse" | ||
| 278 | } | ||
| 279 | }, | ||
| 280 | "steam_id": { | ||
| 281 | "type": "string" | ||
| 282 | }, | ||
| 283 | "username": { | ||
| 284 | "type": "string" | ||
| 285 | } | ||
| 286 | } | ||
| 287 | }, | ||
| 288 | "models.Response": { | ||
| 289 | "type": "object", | ||
| 290 | "properties": { | ||
| 291 | "data": {}, | ||
| 292 | "message": { | ||
| 293 | "type": "string" | ||
| 294 | }, | ||
| 295 | "success": { | ||
| 296 | "type": "boolean" | ||
| 297 | } | ||
| 298 | } | ||
| 299 | }, | ||
| 300 | "models.ScoreResponse": { | ||
| 301 | "type": "object", | ||
| 302 | "properties": { | ||
| 303 | "map_id": { | ||
| 304 | "type": "integer" | ||
| 305 | }, | ||
| 306 | "records": {} | ||
| 307 | } | ||
| 308 | } | ||
| 309 | } | ||
| 23 | }` | 310 | }` |
| 24 | 311 | ||
| 25 | // SwaggerInfo holds exported Swagger Info so clients can modify it | 312 | // SwaggerInfo holds exported Swagger Info so clients can modify it |
| 26 | var SwaggerInfo = &swag.Spec{ | 313 | var SwaggerInfo = &swag.Spec{ |
| 27 | Version: "1.0", | 314 | Version: "1.0", |
| 28 | Host: "localhost:4000", | 315 | Host: "localhost:4000/api", |
| 29 | BasePath: "", | 316 | BasePath: "/v1", |
| 30 | Schemes: []string{}, | 317 | Schemes: []string{}, |
| 31 | Title: "Least Portals Database API", | 318 | Title: "Least Portals Database API", |
| 32 | Description: "Backend API endpoints for Least Portals Database.", | 319 | Description: "Backend API endpoints for Least Portals Database.", |
diff --git a/docs/swagger.json b/docs/swagger.json index 9c64dd0..3d038cb 100644 --- a/docs/swagger.json +++ b/docs/swagger.json | |||
| @@ -10,6 +10,294 @@ | |||
| 10 | }, | 10 | }, |
| 11 | "version": "1.0" | 11 | "version": "1.0" |
| 12 | }, | 12 | }, |
| 13 | "host": "localhost:4000", | 13 | "host": "localhost:4000/api", |
| 14 | "paths": {} | 14 | "basePath": "/v1", |
| 15 | "paths": { | ||
| 16 | "/login": { | ||
| 17 | "get": { | ||
| 18 | "consumes": [ | ||
| 19 | "application/json" | ||
| 20 | ], | ||
| 21 | "produces": [ | ||
| 22 | "application/json" | ||
| 23 | ], | ||
| 24 | "summary": "Get (redirect) login page for Steam auth.", | ||
| 25 | "responses": { | ||
| 26 | "200": { | ||
| 27 | "description": "OK", | ||
| 28 | "schema": { | ||
| 29 | "allOf": [ | ||
| 30 | { | ||
| 31 | "$ref": "#/definitions/models.Response" | ||
| 32 | }, | ||
| 33 | { | ||
| 34 | "type": "object", | ||
| 35 | "properties": { | ||
| 36 | "data": { | ||
| 37 | "$ref": "#/definitions/models.LoginResponse" | ||
| 38 | } | ||
| 39 | } | ||
| 40 | } | ||
| 41 | ] | ||
| 42 | } | ||
| 43 | }, | ||
| 44 | "400": { | ||
| 45 | "description": "Bad Request", | ||
| 46 | "schema": { | ||
| 47 | "$ref": "#/definitions/models.Response" | ||
| 48 | } | ||
| 49 | } | ||
| 50 | } | ||
| 51 | } | ||
| 52 | }, | ||
| 53 | "/profile": { | ||
| 54 | "get": { | ||
| 55 | "consumes": [ | ||
| 56 | "application/json" | ||
| 57 | ], | ||
| 58 | "produces": [ | ||
| 59 | "application/json" | ||
| 60 | ], | ||
| 61 | "summary": "Get profile page of session user.", | ||
| 62 | "responses": { | ||
| 63 | "200": { | ||
| 64 | "description": "OK", | ||
| 65 | "schema": { | ||
| 66 | "allOf": [ | ||
| 67 | { | ||
| 68 | "$ref": "#/definitions/models.Response" | ||
| 69 | }, | ||
| 70 | { | ||
| 71 | "type": "object", | ||
| 72 | "properties": { | ||
| 73 | "data": { | ||
| 74 | "$ref": "#/definitions/models.ProfileResponse" | ||
| 75 | } | ||
| 76 | } | ||
| 77 | } | ||
| 78 | ] | ||
| 79 | } | ||
| 80 | }, | ||
| 81 | "400": { | ||
| 82 | "description": "Bad Request", | ||
| 83 | "schema": { | ||
| 84 | "$ref": "#/definitions/models.Response" | ||
| 85 | } | ||
| 86 | }, | ||
| 87 | "401": { | ||
| 88 | "description": "Unauthorized", | ||
| 89 | "schema": { | ||
| 90 | "$ref": "#/definitions/models.Response" | ||
| 91 | } | ||
| 92 | } | ||
| 93 | } | ||
| 94 | }, | ||
| 95 | "put": { | ||
| 96 | "consumes": [ | ||
| 97 | "application/json" | ||
| 98 | ], | ||
| 99 | "produces": [ | ||
| 100 | "application/json" | ||
| 101 | ], | ||
| 102 | "summary": "Update country code of session user.", | ||
| 103 | "parameters": [ | ||
| 104 | { | ||
| 105 | "type": "string", | ||
| 106 | "description": "Country Code [XX]", | ||
| 107 | "name": "country_code", | ||
| 108 | "in": "query", | ||
| 109 | "required": true | ||
| 110 | } | ||
| 111 | ], | ||
| 112 | "responses": { | ||
| 113 | "200": { | ||
| 114 | "description": "OK", | ||
| 115 | "schema": { | ||
| 116 | "allOf": [ | ||
| 117 | { | ||
| 118 | "$ref": "#/definitions/models.Response" | ||
| 119 | }, | ||
| 120 | { | ||
| 121 | "type": "object", | ||
| 122 | "properties": { | ||
| 123 | "data": { | ||
| 124 | "$ref": "#/definitions/models.ProfileResponse" | ||
| 125 | } | ||
| 126 | } | ||
| 127 | } | ||
| 128 | ] | ||
| 129 | } | ||
| 130 | }, | ||
| 131 | "400": { | ||
| 132 | "description": "Bad Request", | ||
| 133 | "schema": { | ||
| 134 | "$ref": "#/definitions/models.Response" | ||
| 135 | } | ||
| 136 | }, | ||
| 137 | "401": { | ||
| 138 | "description": "Unauthorized", | ||
| 139 | "schema": { | ||
| 140 | "$ref": "#/definitions/models.Response" | ||
| 141 | } | ||
| 142 | } | ||
| 143 | } | ||
| 144 | }, | ||
| 145 | "post": { | ||
| 146 | "consumes": [ | ||
| 147 | "application/json" | ||
| 148 | ], | ||
| 149 | "produces": [ | ||
| 150 | "application/json" | ||
| 151 | ], | ||
| 152 | "summary": "Update profile page of session user.", | ||
| 153 | "responses": { | ||
| 154 | "200": { | ||
| 155 | "description": "OK", | ||
| 156 | "schema": { | ||
| 157 | "allOf": [ | ||
| 158 | { | ||
| 159 | "$ref": "#/definitions/models.Response" | ||
| 160 | }, | ||
| 161 | { | ||
| 162 | "type": "object", | ||
| 163 | "properties": { | ||
| 164 | "data": { | ||
| 165 | "$ref": "#/definitions/models.ProfileResponse" | ||
| 166 | } | ||
| 167 | } | ||
| 168 | } | ||
| 169 | ] | ||
| 170 | } | ||
| 171 | }, | ||
| 172 | "400": { | ||
| 173 | "description": "Bad Request", | ||
| 174 | "schema": { | ||
| 175 | "$ref": "#/definitions/models.Response" | ||
| 176 | } | ||
| 177 | }, | ||
| 178 | "401": { | ||
| 179 | "description": "Unauthorized", | ||
| 180 | "schema": { | ||
| 181 | "$ref": "#/definitions/models.Response" | ||
| 182 | } | ||
| 183 | } | ||
| 184 | } | ||
| 185 | } | ||
| 186 | }, | ||
| 187 | "/user/{id}": { | ||
| 188 | "get": { | ||
| 189 | "consumes": [ | ||
| 190 | "application/json" | ||
| 191 | ], | ||
| 192 | "produces": [ | ||
| 193 | "application/json" | ||
| 194 | ], | ||
| 195 | "summary": "Get profile page of another user.", | ||
| 196 | "parameters": [ | ||
| 197 | { | ||
| 198 | "type": "integer", | ||
| 199 | "description": "User ID", | ||
| 200 | "name": "id", | ||
| 201 | "in": "path", | ||
| 202 | "required": true | ||
| 203 | } | ||
| 204 | ], | ||
| 205 | "responses": { | ||
| 206 | "200": { | ||
| 207 | "description": "OK", | ||
| 208 | "schema": { | ||
| 209 | "allOf": [ | ||
| 210 | { | ||
| 211 | "$ref": "#/definitions/models.Response" | ||
| 212 | }, | ||
| 213 | { | ||
| 214 | "type": "object", | ||
| 215 | "properties": { | ||
| 216 | "data": { | ||
| 217 | "$ref": "#/definitions/models.ProfileResponse" | ||
| 218 | } | ||
| 219 | } | ||
| 220 | } | ||
| 221 | ] | ||
| 222 | } | ||
| 223 | }, | ||
| 224 | "400": { | ||
| 225 | "description": "Bad Request", | ||
| 226 | "schema": { | ||
| 227 | "$ref": "#/definitions/models.Response" | ||
| 228 | } | ||
| 229 | }, | ||
| 230 | "404": { | ||
| 231 | "description": "Not Found", | ||
| 232 | "schema": { | ||
| 233 | "$ref": "#/definitions/models.Response" | ||
| 234 | } | ||
| 235 | } | ||
| 236 | } | ||
| 237 | } | ||
| 238 | } | ||
| 239 | }, | ||
| 240 | "definitions": { | ||
| 241 | "models.LoginResponse": { | ||
| 242 | "type": "object", | ||
| 243 | "properties": { | ||
| 244 | "token": { | ||
| 245 | "type": "string" | ||
| 246 | } | ||
| 247 | } | ||
| 248 | }, | ||
| 249 | "models.ProfileResponse": { | ||
| 250 | "type": "object", | ||
| 251 | "properties": { | ||
| 252 | "avatar_link": { | ||
| 253 | "type": "string" | ||
| 254 | }, | ||
| 255 | "country_code": { | ||
| 256 | "type": "string" | ||
| 257 | }, | ||
| 258 | "profile": { | ||
| 259 | "type": "boolean" | ||
| 260 | }, | ||
| 261 | "scores_mp": { | ||
| 262 | "type": "array", | ||
| 263 | "items": { | ||
| 264 | "$ref": "#/definitions/models.ScoreResponse" | ||
| 265 | } | ||
| 266 | }, | ||
| 267 | "scores_sp": { | ||
| 268 | "type": "array", | ||
| 269 | "items": { | ||
| 270 | "$ref": "#/definitions/models.ScoreResponse" | ||
| 271 | } | ||
| 272 | }, | ||
| 273 | "steam_id": { | ||
| 274 | "type": "string" | ||
| 275 | }, | ||
| 276 | "username": { | ||
| 277 | "type": "string" | ||
| 278 | } | ||
| 279 | } | ||
| 280 | }, | ||
| 281 | "models.Response": { | ||
| 282 | "type": "object", | ||
| 283 | "properties": { | ||
| 284 | "data": {}, | ||
| 285 | "message": { | ||
| 286 | "type": "string" | ||
| 287 | }, | ||
| 288 | "success": { | ||
| 289 | "type": "boolean" | ||
| 290 | } | ||
| 291 | } | ||
| 292 | }, | ||
| 293 | "models.ScoreResponse": { | ||
| 294 | "type": "object", | ||
| 295 | "properties": { | ||
| 296 | "map_id": { | ||
| 297 | "type": "integer" | ||
| 298 | }, | ||
| 299 | "records": {} | ||
| 300 | } | ||
| 301 | } | ||
| 302 | } | ||
| 15 | } \ No newline at end of file | 303 | } \ No newline at end of file |
diff --git a/docs/swagger.yaml b/docs/swagger.yaml index e4d9f39..81d4073 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml | |||
| @@ -1,4 +1,46 @@ | |||
| 1 | host: localhost:4000 | 1 | basePath: /v1 |
| 2 | definitions: | ||
| 3 | models.LoginResponse: | ||
| 4 | properties: | ||
| 5 | token: | ||
| 6 | type: string | ||
| 7 | type: object | ||
| 8 | models.ProfileResponse: | ||
| 9 | properties: | ||
| 10 | avatar_link: | ||
| 11 | type: string | ||
| 12 | country_code: | ||
| 13 | type: string | ||
| 14 | profile: | ||
| 15 | type: boolean | ||
| 16 | scores_mp: | ||
| 17 | items: | ||
| 18 | $ref: '#/definitions/models.ScoreResponse' | ||
| 19 | type: array | ||
| 20 | scores_sp: | ||
| 21 | items: | ||
| 22 | $ref: '#/definitions/models.ScoreResponse' | ||
| 23 | type: array | ||
| 24 | steam_id: | ||
| 25 | type: string | ||
| 26 | username: | ||
| 27 | type: string | ||
| 28 | type: object | ||
| 29 | models.Response: | ||
| 30 | properties: | ||
| 31 | data: {} | ||
| 32 | message: | ||
| 33 | type: string | ||
| 34 | success: | ||
| 35 | type: boolean | ||
| 36 | type: object | ||
| 37 | models.ScoreResponse: | ||
| 38 | properties: | ||
| 39 | map_id: | ||
| 40 | type: integer | ||
| 41 | records: {} | ||
| 42 | type: object | ||
| 43 | host: localhost:4000/api | ||
| 2 | info: | 44 | info: |
| 3 | contact: {} | 45 | contact: {} |
| 4 | description: Backend API endpoints for Least Portals Database. | 46 | description: Backend API endpoints for Least Portals Database. |
| @@ -7,5 +49,136 @@ info: | |||
| 7 | url: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html | 49 | url: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
| 8 | title: Least Portals Database API | 50 | title: Least Portals Database API |
| 9 | version: "1.0" | 51 | version: "1.0" |
| 10 | paths: {} | 52 | paths: |
| 53 | /login: | ||
| 54 | get: | ||
| 55 | consumes: | ||
| 56 | - application/json | ||
| 57 | produces: | ||
| 58 | - application/json | ||
| 59 | responses: | ||
| 60 | "200": | ||
| 61 | description: OK | ||
| 62 | schema: | ||
| 63 | allOf: | ||
| 64 | - $ref: '#/definitions/models.Response' | ||
| 65 | - properties: | ||
| 66 | data: | ||
| 67 | $ref: '#/definitions/models.LoginResponse' | ||
| 68 | type: object | ||
| 69 | "400": | ||
| 70 | description: Bad Request | ||
| 71 | schema: | ||
| 72 | $ref: '#/definitions/models.Response' | ||
| 73 | summary: Get (redirect) login page for Steam auth. | ||
| 74 | /profile: | ||
| 75 | get: | ||
| 76 | consumes: | ||
| 77 | - application/json | ||
| 78 | produces: | ||
| 79 | - application/json | ||
| 80 | responses: | ||
| 81 | "200": | ||
| 82 | description: OK | ||
| 83 | schema: | ||
| 84 | allOf: | ||
| 85 | - $ref: '#/definitions/models.Response' | ||
| 86 | - properties: | ||
| 87 | data: | ||
| 88 | $ref: '#/definitions/models.ProfileResponse' | ||
| 89 | type: object | ||
| 90 | "400": | ||
| 91 | description: Bad Request | ||
| 92 | schema: | ||
| 93 | $ref: '#/definitions/models.Response' | ||
| 94 | "401": | ||
| 95 | description: Unauthorized | ||
| 96 | schema: | ||
| 97 | $ref: '#/definitions/models.Response' | ||
| 98 | summary: Get profile page of session user. | ||
| 99 | post: | ||
| 100 | consumes: | ||
| 101 | - application/json | ||
| 102 | produces: | ||
| 103 | - application/json | ||
| 104 | responses: | ||
| 105 | "200": | ||
| 106 | description: OK | ||
| 107 | schema: | ||
| 108 | allOf: | ||
| 109 | - $ref: '#/definitions/models.Response' | ||
| 110 | - properties: | ||
| 111 | data: | ||
| 112 | $ref: '#/definitions/models.ProfileResponse' | ||
| 113 | type: object | ||
| 114 | "400": | ||
| 115 | description: Bad Request | ||
| 116 | schema: | ||
| 117 | $ref: '#/definitions/models.Response' | ||
| 118 | "401": | ||
| 119 | description: Unauthorized | ||
| 120 | schema: | ||
| 121 | $ref: '#/definitions/models.Response' | ||
| 122 | summary: Update profile page of session user. | ||
| 123 | put: | ||
| 124 | consumes: | ||
| 125 | - application/json | ||
| 126 | parameters: | ||
| 127 | - description: Country Code [XX] | ||
| 128 | in: query | ||
| 129 | name: country_code | ||
| 130 | required: true | ||
| 131 | type: string | ||
| 132 | produces: | ||
| 133 | - application/json | ||
| 134 | responses: | ||
| 135 | "200": | ||
| 136 | description: OK | ||
| 137 | schema: | ||
| 138 | allOf: | ||
| 139 | - $ref: '#/definitions/models.Response' | ||
| 140 | - properties: | ||
| 141 | data: | ||
| 142 | $ref: '#/definitions/models.ProfileResponse' | ||
| 143 | type: object | ||
| 144 | "400": | ||
| 145 | description: Bad Request | ||
| 146 | schema: | ||
| 147 | $ref: '#/definitions/models.Response' | ||
| 148 | "401": | ||
| 149 | description: Unauthorized | ||
| 150 | schema: | ||
| 151 | $ref: '#/definitions/models.Response' | ||
| 152 | summary: Update country code of session user. | ||
| 153 | /user/{id}: | ||
| 154 | get: | ||
| 155 | consumes: | ||
| 156 | - application/json | ||
| 157 | parameters: | ||
| 158 | - description: User ID | ||
| 159 | in: path | ||
| 160 | name: id | ||
| 161 | required: true | ||
| 162 | type: integer | ||
| 163 | produces: | ||
| 164 | - application/json | ||
| 165 | responses: | ||
| 166 | "200": | ||
| 167 | description: OK | ||
| 168 | schema: | ||
| 169 | allOf: | ||
| 170 | - $ref: '#/definitions/models.Response' | ||
| 171 | - properties: | ||
| 172 | data: | ||
| 173 | $ref: '#/definitions/models.ProfileResponse' | ||
| 174 | type: object | ||
| 175 | "400": | ||
| 176 | description: Bad Request | ||
| 177 | schema: | ||
| 178 | $ref: '#/definitions/models.Response' | ||
| 179 | "404": | ||
| 180 | description: Not Found | ||
| 181 | schema: | ||
| 182 | $ref: '#/definitions/models.Response' | ||
| 183 | summary: Get profile page of another user. | ||
| 11 | swagger: "2.0" | 184 | swagger: "2.0" |