{ "swagger": "2.0", "info": { "title": "Advent Calendar API docs", "contact": {}, "version": "1.0" }, "host": "localhost:9000", "basePath": "/", "paths": { "/api/days": { "get": { "tags": [ "Days" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header" }, { "type": "string", "description": "Subscriber email", "name": "Subscriber", "in": "query" }, { "type": "string", "description": "Например Europe/Samara", "name": "timeZone", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/repository.Day" } } } } }, "post": { "tags": [ "Days" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header", "required": true }, { "minLength": 5, "type": "string", "name": "description", "in": "formData", "required": true }, { "minLength": 5, "type": "string", "name": "title", "in": "formData", "required": true }, { "type": "array", "items": { "type": "file" }, "collectionFormat": "csv", "description": " ", "name": "attachments", "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } }, "/api/days/admin": { "get": { "tags": [ "Days" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/repository.Day" } } } } } }, "/api/days/{id}": { "put": { "tags": [ "Days" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header", "required": true }, { "type": "integer", "description": " ", "name": "id", "in": "path", "required": true }, { "type": "array", "items": { "type": "integer" }, "collectionFormat": "csv", "name": "attachmentIds", "in": "formData" }, { "minLength": 5, "type": "string", "name": "description", "in": "formData" }, { "type": "boolean", "name": "isLongRead", "in": "formData" }, { "minLength": 5, "type": "string", "name": "title", "in": "formData" }, { "type": "array", "items": { "type": "file" }, "collectionFormat": "csv", "description": " ", "name": "attachments", "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } }, "/api/days/{id}/views": { "post": { "tags": [ "Days" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header" }, { "type": "integer", "description": " ", "name": "id", "in": "path", "required": true }, { "type": "string", "description": " ", "name": "email", "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } }, "/api/projects": { "get": { "tags": [ "Projects" ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/repository.Project" } } } } }, "post": { "tags": [ "Projects" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header", "required": true }, { "minLength": 5, "type": "string", "name": "description", "in": "formData", "required": true }, { "type": "string", "name": "link", "in": "formData", "required": true }, { "minLength": 5, "type": "string", "name": "title", "in": "formData", "required": true }, { "type": "file", "description": " ", "name": "preview", "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } }, "/api/projects/{id}": { "put": { "tags": [ "Projects" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header", "required": true }, { "type": "integer", "description": " ", "name": "id", "in": "path", "required": true }, { "minLength": 5, "type": "string", "name": "description", "in": "formData", "required": true }, { "type": "string", "name": "link", "in": "formData", "required": true }, { "minLength": 5, "type": "string", "name": "title", "in": "formData", "required": true }, { "type": "file", "description": " ", "name": "preview", "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } }, "delete": { "tags": [ "Projects" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header", "required": true }, { "type": "integer", "description": " ", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } }, "/api/settings": { "get": { "tags": [ "Settings" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/repository.Setting" } } } }, "put": { "tags": [ "Settings" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header", "required": true }, { "maximum": 12, "minimum": 1, "type": "integer", "name": "month", "in": "formData", "required": true }, { "type": "boolean", "name": "showAllDays", "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } }, "/api/users/check": { "get": { "tags": [ "Users" ], "parameters": [ { "type": "string", "description": "Authorization", "name": "Authorization", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/repository.User" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } }, "/api/users/confirm": { "patch": { "tags": [ "Users" ], "parameters": [ { "type": "string", "name": "code", "in": "formData", "required": true }, { "minLength": 5, "type": "string", "name": "email", "in": "formData", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handler.Tokens" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } }, "/api/users/login": { "post": { "tags": [ "Users" ], "parameters": [ { "minLength": 5, "type": "string", "name": "email", "in": "formData", "required": true }, { "type": "string", "name": "password", "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handler.Tokens" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } }, "/api/users/refresh": { "patch": { "tags": [ "Users" ], "parameters": [ { "type": "string", "description": "RefreshToken", "name": "RefreshToken", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/handler.Tokens" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } }, "/api/users/subscribe": { "post": { "tags": [ "Users" ], "parameters": [ { "minLength": 5, "type": "string", "name": "email", "in": "formData", "required": true }, { "type": "boolean", "name": "isConfirm", "in": "formData", "required": true }, { "minLength": 5, "type": "string", "name": "nickname", "in": "formData", "required": true }, { "minLength": 5, "type": "string", "name": "tgUsername", "in": "formData", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } }, "delete": { "tags": [ "Users" ], "parameters": [ { "minLength": 5, "type": "string", "name": "email", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/validators.GlobalHandlerResp" } } } } } }, "definitions": { "handler.Tokens": { "type": "object", "properties": { "accessToken": { "type": "string" }, "exp": { "type": "integer" }, "refreshToken": { "type": "string" } } }, "repository.Attachment": { "type": "object", "properties": { "id": { "type": "integer" }, "label": { "type": "string" }, "type": { "type": "string" }, "url": { "type": "string" } } }, "repository.Day": { "type": "object", "properties": { "attachments": { "type": "array", "items": { "$ref": "#/definitions/repository.Attachment" } }, "description": { "type": "string" }, "id": { "type": "integer" }, "isLongRead": { "type": "boolean" }, "isViewed": { "type": "boolean" }, "title": { "type": "string" } } }, "repository.Project": { "type": "object", "properties": { "description": { "type": "string" }, "id": { "type": "integer" }, "link": { "type": "string" }, "preview": { "type": "string" }, "title": { "type": "string" } } }, "repository.Setting": { "type": "object", "properties": { "id": { "type": "integer" }, "month": { "type": "integer" }, "showAllDays": { "type": "boolean" }, "year": { "type": "integer" } } }, "repository.User": { "type": "object", "properties": { "code": { "type": "string" }, "email": { "type": "string" }, "id": { "type": "integer" }, "refreshToken": { "type": "string" }, "role": { "type": "string" } } }, "validators.GlobalHandlerResp": { "type": "object", "properties": { "message": { "type": "string" }, "success": { "type": "boolean" } } } } }