wishli-api/docs/swagger.json
2025-03-23 20:05:51 +03:00

1410 lines
46 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"swagger": "2.0",
"info": {
"description": "API-сервер для приложения списка желаний",
"title": "Wish List API",
"contact": {},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0"
},
"host": "localhost:8080",
"basePath": "/api",
"paths": {
"/auth/login": {
"post": {
"description": "Аутентифицирует пользователя и выдает JWT токены",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Вход пользователя",
"parameters": [
{
"description": "Учетные данные пользователя",
"name": "credentials",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
}
}
}
},
"/auth/refresh": {
"post": {
"description": "Обновляет JWT токены с помощью refresh токена",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Обновление токенов",
"parameters": [
{
"description": "Refresh токен",
"name": "refreshToken",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.TokenRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
}
}
}
},
"/auth/register": {
"post": {
"description": "Регистрирует нового пользователя и выдает JWT токены",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Регистрация пользователя",
"parameters": [
{
"description": "Данные нового пользователя",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.RegisterRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
}
}
}
},
"/auth/telegram": {
"post": {
"description": "Аутентифицирует пользователя через Telegram и выдает JWT токены",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Вход пользователя через Telegram",
"parameters": [
{
"description": "Данные аутентификации Telegram",
"name": "credentials",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.TelegramAuthRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/presenter.AuthResponse"
}
}
}
}
},
"/users": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Возвращает список всех пользователей в системе",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Получить всех пользователей",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.UsersResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Обновляет информацию о существующем пользователе",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Обновить пользователя",
"parameters": [
{
"description": "Информация о пользователе для обновления",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.User"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
}
}
},
"post": {
"description": "Создает нового пользователя в системе",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Добавить нового пользователя",
"parameters": [
{
"description": "Информация о пользователе",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.User"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Удаляет пользователя из системы по ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Удалить пользователя",
"parameters": [
{
"description": "ID пользователя для удаления",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.DeleteUserRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
}
}
}
},
"/users/email/{email}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Возвращает информацию о пользователе по его Email",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Получить пользователя по Email",
"parameters": [
{
"type": "string",
"description": "Email пользователя",
"name": "email",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
}
}
}
},
"/users/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Возвращает информацию о пользователе по его ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Получить пользователя по ID",
"parameters": [
{
"type": "string",
"description": "ID пользователя",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/presenter.UserResponse"
}
}
}
}
},
"/wishlist": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create a new wishlist for the authenticated user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"wishlist"
],
"summary": "Create a new wishlist",
"parameters": [
{
"type": "string",
"description": "Bearer token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "Wishlist data",
"name": "wishlist",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.WishList"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
}
}
}
},
"/wishlist/item": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "Create a new item for a wishlist",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"wishlist-items"
],
"summary": "Create a wishlist item",
"parameters": [
{
"type": "string",
"description": "Bearer token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "Wishlist item data",
"name": "item",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.WishListItem"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
}
}
}
},
"/wishlist/item/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get a wishlist item by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"wishlist-items"
],
"summary": "Get a wishlist item",
"parameters": [
{
"type": "string",
"description": "Item ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update an existing wishlist item",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"wishlist-items"
],
"summary": "Update a wishlist item",
"parameters": [
{
"type": "string",
"description": "Bearer token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Item ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Updated item data",
"name": "item",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.WishListItem"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete a wishlist item",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"wishlist-items"
],
"summary": "Delete a wishlist item",
"parameters": [
{
"type": "string",
"description": "Bearer token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Item ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/presenter.WishListItemResponse"
}
}
}
}
},
"/wishlist/user/{userId}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get all wishlists for a specific user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"wishlist"
],
"summary": "Get user wishlists",
"parameters": [
{
"type": "string",
"description": "User ID",
"name": "userId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.WishListsResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
}
}
}
},
"/wishlist/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get a wishlist by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"wishlist"
],
"summary": "Get a wishlist",
"parameters": [
{
"type": "string",
"description": "Wishlist ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
}
}
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"description": "Update an existing wishlist",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"wishlist"
],
"summary": "Update a wishlist",
"parameters": [
{
"type": "string",
"description": "Bearer token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Wishlist ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Updated wishlist data",
"name": "wishlist",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/entities.WishList"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "Delete a wishlist and all its items",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"wishlist"
],
"summary": "Delete a wishlist",
"parameters": [
{
"type": "string",
"description": "Bearer token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Wishlist ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/presenter.WishListResponse"
}
}
}
}
},
"/wishlist/{wishlistId}/items": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Get all items in a wishlist",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"wishlist-items"
],
"summary": "Get wishlist items",
"parameters": [
{
"type": "string",
"description": "Wishlist ID",
"name": "wishlistId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/presenter.WishListItemsResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/presenter.WishListItemsResponse"
}
}
}
}
}
},
"definitions": {
"entities.DeleteUserRequest": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
}
},
"entities.LoginRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"entities.RegisterRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"entities.TelegramAuthRequest": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"auth_date": {
"type": "integer"
},
"first_name": {
"type": "string"
},
"hash": {
"type": "string"
},
"last_name": {
"type": "string"
},
"photo_url": {
"type": "string"
},
"refresh_token": {
"type": "string"
},
"telegram_id": {
"type": "integer"
},
"username": {
"type": "string"
}
}
},
"entities.TokenPair": {
"type": "object",
"properties": {
"access_token": {
"type": "string"
},
"refresh_token": {
"type": "string"
}
}
},
"entities.TokenRequest": {
"type": "object",
"properties": {
"refresh_token": {
"type": "string"
}
}
},
"entities.User": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"email": {
"type": "string"
},
"first_name": {
"type": "string"
},
"id": {
"type": "string"
},
"last_login_date": {
"type": "string"
},
"last_name": {
"type": "string"
},
"password": {
"type": "string"
},
"photo_url": {
"type": "string"
},
"telegram_id": {
"type": "integer"
},
"telegram_username": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"entities.WishList": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"is_public": {
"type": "boolean"
},
"photo_url": {
"type": "string"
},
"title": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"entities.WishListItem": {
"type": "object",
"properties": {
"cost": {
"type": "number"
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"photo_url": {
"type": "string"
},
"title": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"url": {
"type": "string"
},
"wish_list_id": {
"type": "string"
}
}
},
"presenter.AuthResponse": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/entities.TokenPair"
},
"error": {
"type": "string"
},
"status": {
"type": "boolean"
},
"user": {
"$ref": "#/definitions/presenter.User"
}
}
},
"presenter.User": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"email": {
"type": "string"
},
"id": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"presenter.UserResponse": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/presenter.User"
},
"error": {
"type": "string"
},
"status": {
"type": "boolean"
}
}
},
"presenter.UsersResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/presenter.User"
}
},
"error": {
"type": "string"
},
"status": {
"type": "boolean"
}
}
},
"presenter.WishList": {
"type": "object",
"properties": {
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"is_public": {
"type": "boolean"
},
"photo_url": {
"type": "string"
},
"title": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"user_id": {
"type": "string"
}
}
},
"presenter.WishListItem": {
"type": "object",
"properties": {
"cost": {
"type": "number"
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"photo_url": {
"type": "string"
},
"title": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"url": {
"type": "string"
},
"wish_list_id": {
"type": "string"
}
}
},
"presenter.WishListItemResponse": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/presenter.WishListItem"
},
"error": {
"type": "string"
},
"status": {
"type": "boolean"
}
}
},
"presenter.WishListItemsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/presenter.WishListItem"
}
},
"error": {
"type": "string"
},
"status": {
"type": "boolean"
}
}
},
"presenter.WishListResponse": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/presenter.WishList"
},
"error": {
"type": "string"
},
"status": {
"type": "boolean"
}
}
},
"presenter.WishListsResponse": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/presenter.WishList"
}
},
"error": {
"type": "string"
},
"status": {
"type": "boolean"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}