{ "schemes": [ "http" ], "swagger": "2.0", "info": { "title": "API Avito Shop", "contact": {}, "version": "1.0.0" }, "host": "localhost:8080", "paths": { "/api/auth": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "Аутентификация и получение JWT-токена", "parameters": [ { "description": "Данные пользователя для авторизации", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.PostAuthRequest" } } ], "responses": { "200": { "description": "Успешная аутентификация", "schema": { "$ref": "#/definitions/types.PostAuthResponse" } }, "400": { "description": "Неверный запрос", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } }, "401": { "description": "Неавторизован", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } }, "500": { "description": "Внутренняя ошибка сервера", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } } } } }, "/api/buy/{item}": { "get": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "Купить предмет за монеты", "parameters": [ { "type": "string", "description": "Название товара", "name": "item", "in": "path", "required": true } ], "responses": { "200": { "description": "Успешный ответ" }, "400": { "description": "Неверный запрос", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } }, "401": { "description": "Неавторизован", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } }, "500": { "description": "Внутренняя ошибка сервера", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } } } } }, "/api/info": { "get": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "Получить информацию о монетах, инвентаре и истории транзакций", "responses": { "200": { "description": "Успешный ответ", "schema": { "$ref": "#/definitions/types.GetInfoResponse" } }, "400": { "description": "Неверный запрос", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } }, "401": { "description": "Неавторизован", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } }, "500": { "description": "Внутренняя ошибка сервера", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } } } } }, "/api/sendCoin": { "post": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "summary": "Отправить монеты другому пользователю", "parameters": [ { "description": "Данные для отправки монет", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/types.PostSendCoinRequest" } } ], "responses": { "200": { "description": "Успешный ответ" }, "400": { "description": "Неверный запрос", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } }, "401": { "description": "Неавторизован", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } }, "500": { "description": "Внутренняя ошибка сервера", "schema": { "$ref": "#/definitions/responses.ErrorResponse" } } } } } }, "definitions": { "domain.Inventory": { "type": "object", "properties": { "quantity": { "type": "integer" }, "type": { "type": "string" } } }, "responses.ErrorResponse": { "type": "object", "properties": { "errors": { "type": "string" } } }, "types.CoinHistory": { "type": "object", "properties": { "received": { "type": "array", "items": { "$ref": "#/definitions/types.CoinHistoryIncoming" } }, "sent": { "type": "array", "items": { "$ref": "#/definitions/types.CoinHistoryUpcoming" } } } }, "types.CoinHistoryIncoming": { "type": "object", "properties": { "amount": { "type": "integer" }, "fromUser": { "type": "string" } } }, "types.CoinHistoryUpcoming": { "type": "object", "properties": { "ToUser": { "type": "string" }, "amount": { "type": "integer" } } }, "types.GetInfoResponse": { "type": "object", "properties": { "coinHistory": { "$ref": "#/definitions/types.CoinHistory" }, "coins": { "type": "integer" }, "inventory": { "type": "array", "items": { "$ref": "#/definitions/domain.Inventory" } } } }, "types.PostAuthRequest": { "type": "object", "properties": { "password": { "type": "string" }, "username": { "type": "string" } } }, "types.PostAuthResponse": { "type": "object", "properties": { "token": { "type": "string" } } }, "types.PostSendCoinRequest": { "type": "object", "properties": { "amount": { "type": "integer" }, "toUser": { "type": "string" } } } }, "securityDefinitions": { "BearerAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }