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

910 lines
23 KiB
YAML
Raw 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.

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