codeword/docs/openapi.yaml

515 lines
16 KiB
YAML
Raw Normal View History

2024-01-05 11:37:06 +00:00
openapi: 3.0.0
info:
title: Codeword Recovery Service API
version: 1.0.0
2024-03-03 19:31:40 +00:00
description: API для обработки восстановления паролей для сервиса Codeword.
2024-01-05 11:37:06 +00:00
2024-03-03 19:31:40 +00:00
tags:
- name: recover
description: Операции связанные с восстановлением пароля
- name: promocode
description: Операции связанные с промокодами
- name: stats
description: Операции связанные со статистикой
2024-01-05 11:37:06 +00:00
paths:
/liveness:
get:
2024-03-03 19:31:40 +00:00
operationId: Liveness
2024-01-05 11:37:06 +00:00
summary: Роут проверки активности
2024-03-03 19:31:40 +00:00
tags:
- recover
2024-01-05 11:37:06 +00:00
responses:
'200':
description: Успех сервис запущен
/readiness:
get:
2024-03-03 19:31:40 +00:00
operationId: Readiness
summary: Роут проверки баз данных
tags:
- recover
2024-01-05 11:37:06 +00:00
responses:
'200':
description: Успех — сервис готов и соединение с БД живо
'503':
description: Служба недоступна — не удалось выполнить проверку связи с БД
/recover:
post:
2024-03-03 19:31:40 +00:00
operationId: Recovery
summary: Восстановления пароля
tags:
- recover
2024-01-05 11:37:06 +00:00
requestBody:
required: true
content:
2024-01-15 13:32:46 +00:00
application/json:
2024-01-05 11:37:06 +00:00
schema:
2024-03-03 20:22:19 +00:00
$ref: '#/components/schemas/RecoveryReq'
2024-01-05 11:37:06 +00:00
responses:
'200':
2024-03-03 19:31:40 +00:00
description: Запрос на восстановление принят
2024-01-05 11:37:06 +00:00
'404':
description: Пользователь не найден по электронной почте
'500':
2024-03-03 19:31:40 +00:00
description: Внутренняя ошибка сервера
2024-01-05 11:37:06 +00:00
/recover/{sign}:
get:
2024-03-03 19:31:40 +00:00
operationId: RecoveryLink
summary: Обработать ссылку восстановления и обменять ее на токены
tags:
- recover
2024-01-05 11:37:06 +00:00
parameters:
- in: path
name: sign
required: true
schema:
type: string
description: Подпись восстановления как часть URL-адреса восстановления
responses:
'200':
2024-03-03 19:31:40 +00:00
description: Восстановление успешно, информация для обмена токенов возвращена в cookie
2024-01-05 11:37:06 +00:00
'406':
description: NotAcceptable - срок действия ссылки для восстановления истек или она недействительна
'500':
2024-03-03 19:31:40 +00:00
description: Внутренняя ошибка сервера
2024-01-11 18:46:47 +00:00
/promocode/create:
post:
2024-03-03 19:31:40 +00:00
operationId: CreatePromoCode
2024-01-11 18:46:47 +00:00
summary: Создать новый промокод
2024-03-03 19:31:40 +00:00
tags:
- promocode
2024-01-11 18:46:47 +00:00
requestBody:
required: true
content:
application/json:
schema:
2024-03-03 19:31:40 +00:00
$ref: '#/components/schemas/PromoCodeReq'
2024-01-11 18:46:47 +00:00
responses:
2024-03-03 19:31:40 +00:00
'200':
2024-01-11 18:46:47 +00:00
description: Новый промокод успешно создан
content:
application/json:
schema:
2024-03-03 19:31:40 +00:00
$ref: '#/components/schemas/PromoCode'
2024-01-11 18:46:47 +00:00
'400':
2024-03-03 19:31:40 +00:00
description: Неверный формат запроса или дублирующийся codeword
2024-01-11 18:46:47 +00:00
'500':
description: Внутренняя ошибка сервера
2024-01-11 19:47:54 +00:00
/promocode/edit:
put:
2024-03-03 19:31:40 +00:00
operationId: EditPromoCode
2024-01-11 19:47:54 +00:00
summary: Обновить существующий промокод
2024-03-03 19:31:40 +00:00
tags:
- promocode
2024-01-11 19:47:54 +00:00
requestBody:
required: true
content:
application/json:
schema:
2024-03-03 20:22:19 +00:00
$ref: '#/components/schemas/EditPromoCodeReq'
2024-01-11 19:47:54 +00:00
responses:
'200':
description: Промокод успешно обновлен
content:
application/json:
schema:
2024-03-03 19:31:40 +00:00
$ref: '#/components/schemas/PromoCode'
2024-01-11 19:47:54 +00:00
'400':
description: Неверный формат запроса
'404':
description: Промокод не найден
'500':
description: Внутренняя ошибка сервера
2024-01-12 11:28:22 +00:00
/promocode/getList:
post:
2024-03-03 19:31:40 +00:00
operationId: GetList
summary: Получить список промокодов с пагинацией
tags:
- promocode
2024-01-12 11:28:22 +00:00
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/GetPromoCodesListReq'
responses:
'200':
description: Список промокодов и общее количество успешно получены
content:
application/json:
schema:
$ref: '#/components/schemas/GetPromoCodesListResp'
'400':
description: Неверный запрос из-за невалидных данных
'500':
description: Внутренняя ошибка сервера
2024-01-12 13:57:51 +00:00
/promocode/activate:
post:
2024-03-03 19:31:40 +00:00
operationId: Activate
2024-01-12 13:57:51 +00:00
summary: Активировать промокод
2024-03-03 19:31:40 +00:00
tags:
- promocode
2024-01-12 13:57:51 +00:00
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ActivateReq'
responses:
'200':
description: Промокод успешно активирован
content:
application/json:
schema:
$ref: '#/components/schemas/ActivateResp'
'400':
2024-03-03 19:31:40 +00:00
description: Невалидный запрос или отсутствует обязательное поле codeword или fastLink
2024-01-12 13:57:51 +00:00
'404':
description: Промокод не найден
'500':
description: Внутренняя ошибка сервера
2024-01-12 14:50:53 +00:00
/promocode/{promocodeID}:
delete:
2024-03-03 19:31:40 +00:00
operationId: Delete
2024-01-12 14:50:53 +00:00
summary: Мягко удалить промокод по его id
2024-03-03 19:31:40 +00:00
tags:
- promocode
2024-01-12 14:50:53 +00:00
parameters:
- in: path
name: promocodeID
required: true
schema:
type: string
description: Id промокода для удаления
responses:
'204':
description: Промокод успешно помечен как удаленный
'400':
description: Неверный запрос, отсутствует идентификатор промокода
'404':
description: Промокод не найден
'500':
description: Внутренняя ошибка сервера
2024-01-15 13:32:46 +00:00
/promocode/fastlink:
post:
2024-03-03 19:31:40 +00:00
operationId: CreateFastLink
2024-01-15 13:32:46 +00:00
summary: Создать быструю ссылку для промокода
2024-03-03 19:31:40 +00:00
tags:
- promocode
2024-01-15 13:32:46 +00:00
requestBody:
required: true
content:
application/json:
schema:
2024-03-03 20:22:19 +00:00
$ref: '#/components/schemas/CreateFastLinkReq'
2024-01-15 13:32:46 +00:00
responses:
2024-03-03 19:31:40 +00:00
'200':
2024-01-15 13:32:46 +00:00
description: Быстрая ссылка для промокода успешно создана
content:
application/json:
schema:
2024-03-03 20:22:19 +00:00
$ref: '#/components/schemas/CreateFastLinkResp'
2024-01-15 13:32:46 +00:00
'400':
description: Неверный запрос, отсутствует идентификатор промокода
'404':
description: Промокод не найден
'500':
description: Внутренняя ошибка сервера
2024-03-03 19:31:40 +00:00
2024-01-27 12:51:32 +00:00
/promocode/stats:
2024-03-27 12:29:49 +00:00
post:
2024-03-03 19:31:40 +00:00
operationId: GetStats
2024-01-27 12:51:32 +00:00
summary: Получить статистику промокода
2024-03-03 19:31:40 +00:00
tags:
- stats
2024-03-27 12:29:49 +00:00
description: Идентификатор промокода и временной интерфал от до unix
2024-03-03 18:24:28 +00:00
requestBody:
required: true
content:
application/json:
schema:
2024-03-03 20:22:19 +00:00
$ref: '#/components/schemas/PromoCodeStatsReq'
2024-01-27 12:51:32 +00:00
responses:
'200':
description: Статистика промокода успешно получена
content:
application/json:
schema:
2024-03-03 20:22:19 +00:00
$ref: '#/components/schemas/PromoCodeStatsResp'
2024-03-03 18:24:28 +00:00
'400':
description: Неверный запрос
2024-01-27 12:51:32 +00:00
'500':
description: Внутренняя ошибка сервера
2024-03-03 19:31:40 +00:00
2024-01-11 19:47:54 +00:00
2024-01-11 18:46:47 +00:00
components:
schemas:
2024-03-03 20:22:19 +00:00
RecoveryReq:
2024-03-03 19:31:40 +00:00
type: object
required:
- email
properties:
email:
type: string
format: email
description: Электронная почта, на которую нужно отправить инструкции по восстановлению
redirectionURL:
type: string
description: URL-адрес, на который перенаправляется пользователь
2024-03-03 20:22:19 +00:00
PromoCodeStatsReq:
2024-03-03 19:31:40 +00:00
type: object
properties:
2024-03-27 12:29:49 +00:00
id:
2024-03-03 19:31:40 +00:00
type: string
2024-03-27 12:29:49 +00:00
from:
type: integer
to:
type: integer
2024-03-21 09:42:32 +00:00
required:
2024-03-27 12:29:49 +00:00
- id
2024-03-21 09:42:32 +00:00
PromoCodeStatsResp:
2024-03-03 19:31:40 +00:00
type: object
properties:
id:
type: string
2024-03-27 12:29:49 +00:00
description: id промокода
2024-03-03 19:31:40 +00:00
usageCount:
type: integer
2024-03-27 12:29:49 +00:00
description: общее количество использований промокода
example: 18
2024-03-03 19:31:40 +00:00
usageMap:
type: object
2024-03-27 12:29:49 +00:00
description: мапа использования промокода ранжированая по способу
2024-03-03 19:31:40 +00:00
additionalProperties:
2024-03-27 12:29:49 +00:00
type: integer
example:
"-": 10
"fastlinkID1": 5
"fastlinkID2": 3
2024-03-03 19:31:40 +00:00
2024-03-03 20:22:19 +00:00
CreateFastLinkReq:
2024-03-03 19:31:40 +00:00
type: object
properties:
id:
type: string
2024-03-21 09:42:32 +00:00
description: ID промокода, для которого нужно создать быструю ссылку
2024-03-03 19:31:40 +00:00
required:
- id
2024-03-03 20:22:19 +00:00
CreateFastLinkResp:
2024-01-11 18:46:47 +00:00
type: object
2024-03-03 19:31:40 +00:00
properties:
fastlink:
type: string
description: Быстрая ссылка для активации промокода
ActivateReq:
type: object
required:
- codeword
2024-01-11 18:46:47 +00:00
properties:
codeword:
type: string
2024-03-03 19:31:40 +00:00
description: Кодовое слово для активации промокода
fastLink:
2024-01-11 18:46:47 +00:00
type: string
2024-03-03 19:31:40 +00:00
description: Быстрая ссылка для активации промокода
ActivateResp:
type: object
properties:
2024-01-11 18:46:47 +00:00
greetings:
type: string
2024-03-03 19:31:40 +00:00
description: Слово успешной активации промокода
GetPromoCodesListReq:
type: object
required:
- page
- limit
properties:
page:
2024-01-11 18:46:47 +00:00
type: integer
2024-03-03 19:31:40 +00:00
description: Номер страницы
limit:
2024-01-11 18:46:47 +00:00
type: integer
2024-03-03 19:31:40 +00:00
description: Максимальное количество элементов на странице
filter:
$ref: '#/components/schemas/Filter'
Filter:
type: object
properties:
text:
type: string
description: Текстовый фильтр для поиска промокодов
active:
type: boolean
description: Флаг для фильтрации активных промокодов
2024-01-11 18:46:47 +00:00
2024-03-03 19:31:40 +00:00
GetPromoCodesListResp:
type: object
properties:
count:
type: integer
description: Общее количество промокодов
items:
type: array
items:
$ref: '#/components/schemas/PromoCode'
PromoCode:
2024-01-11 18:46:47 +00:00
type: object
properties:
id:
type: string
2024-03-03 19:31:40 +00:00
description: Идентификатор промокода
2024-01-11 18:46:47 +00:00
codeword:
type: string
2024-03-03 19:31:40 +00:00
description: Кодовое слово для активации промокода
2024-01-11 18:46:47 +00:00
description:
type: string
description: Описание промокода
greetings:
type: string
2024-03-03 19:31:40 +00:00
description: Приветственное сообщение после активации промокода
2024-01-11 18:46:47 +00:00
dueTo:
type: integer
2024-03-03 19:31:40 +00:00
description: Дата истечения действия промокода в формате Unix time
2024-01-11 18:46:47 +00:00
activationCount:
type: integer
2024-03-03 19:31:40 +00:00
description: Количество активаций промокода
2024-01-11 18:46:47 +00:00
bonus:
type: object
2024-03-03 19:31:40 +00:00
description: Бонус, предоставляемый с промокодом
2024-03-03 20:22:19 +00:00
items:
$ref: '#/components/schemas/Bonus'
2024-01-11 18:46:47 +00:00
outdated:
type: boolean
2024-03-03 19:31:40 +00:00
description: Флаг
2024-01-11 18:46:47 +00:00
offLimit:
type: boolean
2024-03-03 19:31:40 +00:00
description: Флаг
2024-01-11 18:46:47 +00:00
delete:
type: boolean
2024-03-03 19:31:40 +00:00
description: Флаг
2024-01-11 18:46:47 +00:00
createdAt:
type: string
format: date-time
2024-03-03 19:31:40 +00:00
description: Дата и время создания промокода
fastLinks:
type: array
items:
type: string
description: Список быстрых ссылок для активации промокода
2024-01-11 19:47:54 +00:00
2024-03-03 20:22:19 +00:00
EditPromoCodeReq:
2024-01-11 19:47:54 +00:00
type: object
properties:
2024-03-03 19:31:40 +00:00
ID:
2024-01-11 19:47:54 +00:00
type: string
2024-03-03 19:31:40 +00:00
description: Идентификатор промокода, который требуется обновить
Description:
2024-01-11 19:47:54 +00:00
type: string
2024-03-03 19:31:40 +00:00
nullable: true
description: Описание промокода
Greetings:
2024-01-11 19:47:54 +00:00
type: string
2024-03-03 19:31:40 +00:00
nullable: true
description: Приветственное сообщение после активации промокода
DueTo:
2024-01-11 19:47:54 +00:00
type: integer
2024-03-03 19:31:40 +00:00
nullable: true
description: Дата окончания промокода в формате Unix time
ActivationCount:
2024-01-11 19:47:54 +00:00
type: integer
2024-03-03 19:31:40 +00:00
nullable: true
description: Количество активаций промокода
2024-04-08 17:42:04 +00:00
ActivationLimit:
type: integer
description: Лимит, есть или нет если 0 то нет
2024-03-03 19:31:40 +00:00
Delete:
2024-01-11 19:47:54 +00:00
type: boolean
2024-03-03 19:31:40 +00:00
nullable: true
2024-01-11 19:47:54 +00:00
description: Флаг удаления промокода
2024-03-03 19:31:40 +00:00
PromoCodeReq:
2024-01-12 13:57:51 +00:00
type: object
properties:
codeword:
type: string
2024-03-03 19:31:40 +00:00
description: Кодовое слово для активации промокода
description:
2024-01-15 13:32:46 +00:00
type: string
2024-03-03 19:31:40 +00:00
description: Описание промокода
2024-01-12 13:57:51 +00:00
greetings:
type: string
2024-03-03 19:31:40 +00:00
description: Приветственное сообщение после активации промокода
dueTo:
type: integer
description: Дата истечения действия промокода в формате Unix time
activationCount:
type: integer
description: Количество активаций промокода
2024-04-08 17:42:04 +00:00
activationLimit:
type: integer
description: Лимит, есть или нет если 0 то нет
2024-03-03 19:31:40 +00:00
bonus:
2024-01-27 12:51:32 +00:00
type: object
2024-03-03 19:31:40 +00:00
description: Бонус
2024-03-03 20:22:19 +00:00
items:
$ref: '#/components/schemas/Bonus'
2024-03-03 19:31:40 +00:00
fastLinks:
type: array
items:
type: string
description: Список быстрых ссылок для активации промокода
2024-03-03 20:22:19 +00:00
Bonus:
type: object
description: Бонус
properties:
privilege:
$ref: '#/components/schemas/Privilege'
discount:
$ref: '#/components/schemas/Discount'
Privilege:
type: object
description: Привилегия
properties:
privilegeID:
type: string
description: Идентификатор привилегии
amount:
type: integer
description: Количество привилегии
2024-04-09 19:03:20 +00:00
serviceKey:
type: string
description: Тип сервиса
2024-03-03 20:22:19 +00:00
Discount:
type: object
description: Скидка
properties:
layer:
type: integer
description: Уровень скидки
factor:
type: integer
description: Множитель скидки
target:
type: string
description: Цель скидки
threshold:
type: integer
description: Порог скидки