definitions: AuthRequest: properties: password: description: Пароль для аутентификации. maxLength: 25 minLength: 8 type: string username: description: Имя пользователя для аутентификации. maxLength: 25 minLength: 5 type: string required: - password - username type: object AuthResponse: properties: token: description: JWT-токен для доступа к защищенным ресурсам. type: string type: object CoinHistory: properties: received: items: $ref: '#/definitions/ReceivedTransaction' type: array sent: items: $ref: '#/definitions/SentTransaction' type: array type: object ErrorResponse: properties: errors: description: Сообщение об ошибке, описывающее проблему. type: string type: object InfoResponse: properties: coinHistory: $ref: '#/definitions/CoinHistory' coins: description: Количество доступных монет. type: integer inventory: items: $ref: '#/definitions/UserInventoryItem' type: array type: object ReceivedTransaction: properties: amount: description: Количество полученных монет. type: integer fromUser: description: Имя пользователя, который отправил монеты. type: string type: object SendCoinRequest: properties: amount: description: Количество монет, которые необходимо отправить. minimum: 1 type: integer toUser: description: Имя пользователя, которому нужно отправить монеты. type: string required: - amount - toUser type: object SentTransaction: properties: amount: description: Количество отправленных монет. type: integer toUser: description: Имя пользователя, которому отправлены монеты. type: string type: object UserInventoryItem: properties: quantity: description: Количество предметов. type: integer type: description: Тип предмета. type: string type: object host: localhost:8080 info: contact: {} title: API Avito shop version: "1.0" paths: /api/auth: post: consumes: - application/json parameters: - description: Данные для аутентификации. in: body name: AuthRequest required: true schema: $ref: '#/definitions/AuthRequest' produces: - application/json responses: "200": description: Успешная аутентификация. schema: $ref: '#/definitions/AuthResponse' "400": description: Неверный запрос. schema: $ref: '#/definitions/ErrorResponse' "401": description: Неавторизован. schema: $ref: '#/definitions/ErrorResponse' "500": description: Внутренняя ошибка сервера. schema: $ref: '#/definitions/ErrorResponse' "504": description: Превышено время ожидания. schema: $ref: '#/definitions/ErrorResponse' summary: Аутентификация и получение JWT-токена. При первой аутентификации пользователь создается автоматически. /api/buy/{item}: get: parameters: - description: Название товара in: path name: item required: true type: string produces: - application/json responses: "200": description: Успешный ответ. "400": description: Неверный запрос. schema: $ref: '#/definitions/ErrorResponse' "401": description: Неавторизован. schema: $ref: '#/definitions/ErrorResponse' "500": description: Внутренняя ошибка сервера. schema: $ref: '#/definitions/ErrorResponse' security: - JWTAuth: [] summary: Купить предмет за монеты. /api/info: get: produces: - application/json responses: "200": description: Успешный ответ. schema: $ref: '#/definitions/InfoResponse' "401": description: Неавторизован. schema: $ref: '#/definitions/ErrorResponse' "500": description: Внутренняя ошибка сервера. schema: $ref: '#/definitions/ErrorResponse' security: - JWTAuth: [] summary: Получить информацию о монетах, инвентаре и истории транзакций. /api/sendCoin: post: consumes: - application/json parameters: - description: Данные для отправки монет. in: body name: SendCoinRequest required: true schema: $ref: '#/definitions/SendCoinRequest' produces: - application/json responses: "200": description: Успешный ответ. "400": description: Неверный запрос. schema: $ref: '#/definitions/ErrorResponse' "401": description: Неавторизован. schema: $ref: '#/definitions/ErrorResponse' "500": description: Внутренняя ошибка сервера. schema: $ref: '#/definitions/ErrorResponse' security: - JWTAuth: [] summary: Отправить монеты другому пользователю. securityDefinitions: JWTAuth: in: header name: Authorization type: apiKey swagger: "2.0"