163 lines
10 KiB
TypeScript
163 lines
10 KiB
TypeScript
export interface ApiEndpoint {
|
||
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
||
path: string;
|
||
summary: string;
|
||
description?: string;
|
||
auth?: boolean;
|
||
}
|
||
|
||
export interface ApiTagGroup {
|
||
tag: string;
|
||
endpoints: ApiEndpoint[];
|
||
}
|
||
|
||
export const apiReference: ApiTagGroup[] = [
|
||
{
|
||
tag: 'Аутентификация',
|
||
endpoints: [
|
||
{ method: 'POST', path: '/auth/register', summary: 'Регистрация пользователя', description: 'Первый пользователь получает isSuperAdmin.' },
|
||
{ method: 'POST', path: '/auth/login', summary: 'Вход по почте, телефону или логину' },
|
||
{ method: 'POST', path: '/auth/identify', summary: 'Проверить способ входа (identifier-first)', description: 'Возвращает isTotpEnabled, otpChannels, methods.' },
|
||
{ method: 'POST', path: '/auth/totp/begin', summary: 'Начать вход по TOTP', description: 'Challenge для Google Authenticator вместо SMS/email OTP.' },
|
||
{ method: 'POST', path: '/auth/totp/verify', summary: 'Подтвердить TOTP при входе', description: 'Завершает вход после кода из приложения-аутентификатора.' },
|
||
{ method: 'POST', path: '/auth/otp/send', summary: 'Отправить OTP для passwordless-входа', description: 'Альтернатива TOTP; channel: email | phone | backupEmail | backupPhone.' },
|
||
{ method: 'POST', path: '/auth/otp/verify', summary: 'Проверить OTP', description: 'Завершает вход по SMS/email без повторного TOTP.' },
|
||
{ method: 'POST', path: '/auth/login/password', summary: 'Войти по паролю' },
|
||
{ method: 'POST', path: '/auth/ldap/login', summary: 'Войти через LDAP/LDAPS' },
|
||
{ method: 'POST', path: '/auth/pin/verify', summary: 'Подтвердить PIN-код' },
|
||
{ method: 'POST', path: '/auth/refresh', summary: 'Обновить access token' },
|
||
{ method: 'GET', path: '/auth/session', summary: 'Состояние текущей сессии', auth: true },
|
||
{ method: 'GET', path: '/auth/me', summary: 'Текущий пользователь', auth: true }
|
||
]
|
||
},
|
||
{
|
||
tag: 'OAuth 2.0',
|
||
endpoints: [
|
||
{ method: 'GET', path: '/oauth/authorize', summary: 'Создать authorization code' },
|
||
{ method: 'POST', path: '/oauth/token', summary: 'Выдать OAuth токены (code / refresh_token)' },
|
||
{ method: 'GET', path: '/oauth/userinfo', summary: 'Профиль по OAuth access token', auth: true }
|
||
]
|
||
},
|
||
{
|
||
tag: 'Профиль и биометрия',
|
||
endpoints: [
|
||
{ method: 'GET', path: '/profile/users/{userId}', summary: 'Получить профиль', auth: true },
|
||
{ method: 'PATCH', path: '/profile/users/{userId}', summary: 'Обновить профиль', auth: true },
|
||
{ method: 'PATCH', path: '/profile/users/{userId}/avatar', summary: 'Обновить аватар', auth: true },
|
||
{ method: 'PATCH', path: '/profile/users/{userId}/contacts', summary: 'Обновить контакты', auth: true },
|
||
{ method: 'POST', path: '/profile/users/{userId}/password', summary: 'Установить пароль', auth: true },
|
||
{
|
||
method: 'POST',
|
||
path: '/profile/users/{userId}/self-delete',
|
||
summary: 'Запланировать удаление профиля',
|
||
description: 'Не удаляет аккаунт сразу. Запускает период ожидания ACCOUNT_DELETE_GRACE_DAYS (по умолчанию 30 дней).',
|
||
auth: true
|
||
},
|
||
{
|
||
method: 'POST',
|
||
path: '/profile/users/{userId}/self-delete/cancel',
|
||
summary: 'Отменить запланированное удаление профиля',
|
||
auth: true
|
||
},
|
||
{
|
||
method: 'GET',
|
||
path: '/profile/users/{userId}/self-delete/status',
|
||
summary: 'Статус запланированного удаления профиля',
|
||
description: 'Возвращает pending, deletionRequestedAt, effectiveAt и graceDays.',
|
||
auth: true
|
||
}
|
||
]
|
||
},
|
||
{
|
||
tag: 'Безопасность',
|
||
endpoints: [
|
||
{ method: 'GET', path: '/security/users/{userId}/devices', summary: 'Активные устройства', auth: true },
|
||
{ method: 'GET', path: '/security/users/{userId}/sessions', summary: 'Активные сессии', auth: true },
|
||
{ method: 'GET', path: '/security/users/{userId}/totp/status', summary: 'Статус TOTP', auth: true },
|
||
{ method: 'POST', path: '/security/users/{userId}/totp/setup', summary: 'Настроить TOTP (QR + секрет)', auth: true },
|
||
{ method: 'POST', path: '/security/users/{userId}/totp/enable', summary: 'Включить TOTP', auth: true },
|
||
{ method: 'POST', path: '/security/users/{userId}/totp/disable', summary: 'Отключить TOTP', auth: true },
|
||
{ method: 'POST', path: '/security/users/{userId}/pin/setup', summary: 'Настроить PIN', auth: true },
|
||
{ method: 'POST', path: '/security/users/{userId}/revoke-all-sessions', summary: 'Выйти везде', auth: true }
|
||
]
|
||
},
|
||
{
|
||
tag: 'Администрирование',
|
||
endpoints: [
|
||
{ method: 'GET', path: '/admin/users', summary: 'Список пользователей', auth: true },
|
||
{ method: 'PATCH', path: '/admin/users/{userId}', summary: 'Обновить пользователя', auth: true },
|
||
{ method: 'POST', path: '/admin/users/{userId}/reset-password', summary: 'Сбросить пароль', auth: true },
|
||
{ method: 'PATCH', path: '/admin/users/{userId}/super-admin', summary: 'Права супер-администратора', auth: true }
|
||
]
|
||
},
|
||
{
|
||
tag: 'RBAC и OAuth',
|
||
endpoints: [
|
||
{ method: 'GET', path: '/admin/rbac/roles', summary: 'Список ролей', auth: true },
|
||
{ method: 'POST', path: '/admin/rbac/oauth-clients', summary: 'Создать OAuth-приложение', auth: true },
|
||
{ method: 'GET', path: '/admin/rbac/oauth-scopes', summary: 'OAuth scopes', auth: true }
|
||
]
|
||
},
|
||
{
|
||
tag: 'Глобальные настройки',
|
||
endpoints: [
|
||
{ method: 'GET', path: '/admin/settings', summary: 'Список системных настроек', auth: true },
|
||
{ method: 'PUT', path: '/admin/settings', summary: 'Создать или обновить настройку', auth: true },
|
||
{ method: 'GET', path: '/settings/public', summary: 'Публичные настройки (без авторизации)' }
|
||
]
|
||
},
|
||
{
|
||
tag: 'Семья',
|
||
endpoints: [
|
||
{ method: 'POST', path: '/family/groups', summary: 'Создать семейную группу', auth: true },
|
||
{ method: 'GET', path: '/family/users/{userId}/groups', summary: 'Список семей пользователя', auth: true },
|
||
{ method: 'GET', path: '/family/groups/{groupId}', summary: 'Получить семейную группу', auth: true },
|
||
{ method: 'PATCH', path: '/family/groups/{groupId}', summary: 'Обновить семейную группу (название)', auth: true },
|
||
{
|
||
method: 'DELETE',
|
||
path: '/family/groups/{groupId}',
|
||
summary: 'Удалить семейную группу',
|
||
description: 'Только создатель семьи. Удаляет всех участников, приглашения, чаты, сообщения и медиа семьи.',
|
||
auth: true
|
||
},
|
||
{ method: 'POST', path: '/family/groups/{groupId}/members', summary: 'Добавить участника', auth: true },
|
||
{
|
||
method: 'DELETE',
|
||
path: '/family/members/{memberId}',
|
||
summary: 'Исключить участника или выйти из семьи',
|
||
description: 'Создатель может удалить участника; участник может удалить себя («Выйти»). Владельца семьи удалить нельзя.',
|
||
auth: true
|
||
},
|
||
{ method: 'POST', path: '/family/groups/{groupId}/invites', summary: 'Пригласить участника', auth: true },
|
||
{ method: 'GET', path: '/family/groups/{groupId}/invite-search', summary: 'Поиск пользователей для приглашения', auth: true },
|
||
{ method: 'GET', path: '/family/invites', summary: 'Входящие приглашения', auth: true },
|
||
{ method: 'POST', path: '/family/invites/{inviteId}/respond', summary: 'Принять или отклонить приглашение', auth: true },
|
||
{ method: 'GET', path: '/family/groups/{groupId}/presence', summary: 'Онлайн-статус участников семьи', auth: true }
|
||
]
|
||
},
|
||
{
|
||
tag: 'Чат',
|
||
endpoints: [
|
||
{ method: 'GET', path: '/chat/groups/{groupId}/rooms', summary: 'Список чатов семьи', auth: true },
|
||
{ method: 'POST', path: '/chat/rooms/{roomId}/messages', summary: 'Отправить сообщение', auth: true },
|
||
{ method: 'GET', path: '/chat/rooms/{roomId}/messages', summary: 'Сообщения чата', auth: true }
|
||
]
|
||
},
|
||
{
|
||
tag: 'Медиа',
|
||
endpoints: [
|
||
{ method: 'POST', path: '/media/avatars/upload-url', summary: 'URL для загрузки аватара', auth: true },
|
||
{ method: 'GET', path: '/media/stream/{token}', summary: 'Потоковая выдача медиа' },
|
||
{ method: 'POST', path: '/media/chat/{roomId}/media/upload-url', summary: 'URL для медиа чата', auth: true }
|
||
]
|
||
},
|
||
{
|
||
tag: 'Уведомления',
|
||
endpoints: [
|
||
{ method: 'GET', path: '/notifications', summary: 'Список уведомлений', auth: true },
|
||
{ method: 'PATCH', path: '/notifications/{notificationId}/read', summary: 'Удалить просмотренное', auth: true },
|
||
{ method: 'DELETE', path: '/notifications', summary: 'Удалить все уведомления', auth: true }
|
||
]
|
||
}
|
||
];
|