{ "swagger": "2.0", "info": { "description": "Сервер маршрутизации", "title": "API Gateway", "contact": {}, "version": "1.0" }, "paths": { "/auth/login": { "post": { "description": "Авторизация пользователя", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Authentication" ], "summary": "Авторизация", "parameters": [ { "description": "Данные для авторизации пользователя", "name": "user", "in": "body", "required": true, "schema": { "$ref": "#/definitions/server.LoginRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/server.LoginResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/server.HTTPError" } } } } }, "/links": { "get": { "description": "Массив с ссылками в базе данных", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Links" ], "summary": "Список всех ссылок", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.Links" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/server.HTTPError" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Создание новой сущности ссылки", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Links" ], "summary": "Создание ссылки", "parameters": [ { "description": "Сущность ссылки", "name": "link", "in": "body", "schema": { "$ref": "#/definitions/models.Links" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.Links" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/server.HTTPError" } } } } }, "/links/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Поиск ссылки по ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Links" ], "summary": "Поиск ссылки", "parameters": [ { "type": "integer", "description": "Link ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.Links" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/server.HTTPError" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Обновление сущности ссылки", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Links" ], "summary": "Обновление ссылки", "parameters": [ { "type": "integer", "description": "ID ссылки", "name": "id", "in": "path", "required": true }, { "description": "Модель для обновления", "name": "link", "in": "body", "required": true, "schema": { "$ref": "#/definitions/models.Links" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.Links" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/server.HTTPError" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Удаление ссылки по ID", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Links" ], "summary": "Удаление ссылки", "parameters": [ { "type": "integer", "description": "ID ссылки", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "ok", "schema": { "type": "string" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/server.HTTPError" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/server.HTTPError" } } } } } }, "definitions": { "models.Links": { "type": "object", "properties": { "id": { "type": "integer" }, "link": { "type": "string" }, "position": { "type": "integer" }, "title": { "type": "string" } } }, "server.HTTPError": { "type": "object", "properties": { "code": { "type": "integer" }, "message": { "type": "string" } } }, "server.LoginRequest": { "type": "object", "properties": { "login": { "type": "string" }, "password": { "type": "string" } } }, "server.LoginResponse": { "type": "object", "properties": { "token": { "type": "string" } } } }, "securityDefinitions": { "BearerAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }