This commit is contained in:
@@ -100,9 +100,6 @@ paths:
|
||||
message_desc: "User not found"
|
||||
message_body: {}
|
||||
|
||||
# = INTERNAL ENDPOINTS предназначены для работы с данными =
|
||||
# = Для использования эндпоинтов предусмотрен только внутренний ключ X-Internal-Key (header) =
|
||||
|
||||
/api/internal/data-info:
|
||||
post:
|
||||
tags:
|
||||
@@ -137,10 +134,10 @@ paths:
|
||||
value:
|
||||
msg_id: 30019
|
||||
message_body:
|
||||
top: 10,
|
||||
top: 10
|
||||
type: "image"
|
||||
tariffStatistic:
|
||||
summary: Информация по таррифам
|
||||
summary: Информация по тарифам
|
||||
value:
|
||||
msg_id: 30020
|
||||
message_body:
|
||||
@@ -164,7 +161,7 @@ paths:
|
||||
value:
|
||||
msg_id: 30024
|
||||
tokenStatistic:
|
||||
summary: Подписки
|
||||
summary: Статистика токенов
|
||||
value:
|
||||
msg_id: 30025
|
||||
incomingStatistic:
|
||||
@@ -195,7 +192,6 @@ paths:
|
||||
page_size: 10
|
||||
sort_by: "createdAt"
|
||||
sort_direction: "desc"
|
||||
|
||||
responses:
|
||||
'200':
|
||||
description: Ответ с запрашиваемой информацией
|
||||
@@ -393,7 +389,6 @@ paths:
|
||||
'404':
|
||||
description: Файл не найден
|
||||
|
||||
# ========== DATA ENDPOINTS TODO ==========
|
||||
/api/v{version}/data:
|
||||
post:
|
||||
tags:
|
||||
@@ -408,7 +403,6 @@ paths:
|
||||
- **20007** - Поиск по изображению (ImageFoundRequestHandler)
|
||||
|
||||
**Пользователи:**
|
||||
- **20008** - Авторизация через сторонние сервисы (AuthRequestHandler)
|
||||
- **20009** - Верификация регистрации (VerifyRegisterUserHandler)
|
||||
- **30014** - Информация о пользователе (UserInfoHandler)
|
||||
- **30016** - Верификация пользователя (UserVerificationHandler)
|
||||
@@ -421,7 +415,6 @@ paths:
|
||||
|
||||
**Платежи:**
|
||||
- **30005** - Платежи (PaymentHandler)
|
||||
- **30008** - Расчет стоимости (CostHandler)
|
||||
|
||||
**Мониторинг и нарушения:**
|
||||
- **30007** - Мониторинг (MonitoringHandler)
|
||||
@@ -463,7 +456,7 @@ paths:
|
||||
$ref: '#/components/schemas/BaseRequest'
|
||||
examples:
|
||||
fileUploadInit:
|
||||
summary: Инициализация загрузки файла
|
||||
summary: "[20004] Инициализация загрузки файла"
|
||||
value:
|
||||
msg_id: 20004
|
||||
message_body:
|
||||
@@ -471,35 +464,280 @@ paths:
|
||||
file_name: "document.pdf"
|
||||
file_type: "document"
|
||||
extension: "pdf"
|
||||
convert_to: "protected"
|
||||
convertTo: "protected"
|
||||
file_size: 1048576
|
||||
fileTypes:
|
||||
summary: Получение типов файлов
|
||||
summary: "[20004] Получение типов файлов"
|
||||
value:
|
||||
msg_id: 20004
|
||||
message_body:
|
||||
action: "file_types"
|
||||
fileExtensions:
|
||||
summary: Получение расширений для типа
|
||||
summary: "[20004] Получение расширений для типа"
|
||||
value:
|
||||
msg_id: 20004
|
||||
message_body:
|
||||
action: "file_extension"
|
||||
file_type: "image"
|
||||
companyInfo:
|
||||
summary: Информация о компании
|
||||
fileUploadChunks:
|
||||
summary: "[20004] Статус чанков загрузки"
|
||||
value:
|
||||
msg_id: 20004
|
||||
message_body:
|
||||
action: "chunks"
|
||||
upload_id: "550e8400-e29b-41d4-a716-446655440000"
|
||||
fileUploadCancel:
|
||||
summary: "[20004] Отмена загрузки"
|
||||
value:
|
||||
msg_id: 20004
|
||||
message_body:
|
||||
action: "cancel"
|
||||
upload_id: "550e8400-e29b-41d4-a716-446655440000"
|
||||
fileUploadProgress:
|
||||
summary: "[20004] Прогресс загрузки"
|
||||
value:
|
||||
msg_id: 20004
|
||||
message_body:
|
||||
action: "progress"
|
||||
upload_id: "550e8400-e29b-41d4-a716-446655440000"
|
||||
|
||||
fileInfo:
|
||||
summary: "[20005] Информация о файле"
|
||||
value:
|
||||
msg_id: 20005
|
||||
message_body:
|
||||
action: "file_info"
|
||||
file_id: "550e8400-e29b-41d4-a716-446655440000"
|
||||
userFilesInfo:
|
||||
summary: "[20005] Статистика по файлам пользователя"
|
||||
value:
|
||||
msg_id: 20005
|
||||
message_body:
|
||||
action: "user_files_info"
|
||||
userFiles:
|
||||
summary: "[20005] Список файлов пользователя"
|
||||
value:
|
||||
msg_id: 20005
|
||||
message_body:
|
||||
action: "user_files"
|
||||
page: 1
|
||||
page_size: 20
|
||||
searchFiles:
|
||||
summary: "[20005] Поиск файлов с фильтрацией"
|
||||
value:
|
||||
msg_id: 20005
|
||||
message_body:
|
||||
action: "search_files"
|
||||
query: "документ"
|
||||
type: "application/pdf"
|
||||
statuses: ["ACTIVE", "BLOCKED"]
|
||||
date_filter: "month"
|
||||
sort_by: "createdAt"
|
||||
sort_order: "desc"
|
||||
page: 1
|
||||
page_size: 20
|
||||
storageUsage:
|
||||
summary: "[20005] Использование дискового пространства"
|
||||
value:
|
||||
msg_id: 20005
|
||||
message_body:
|
||||
action: "storage_usage"
|
||||
deleteFile:
|
||||
summary: "[20005] Удаление файла"
|
||||
value:
|
||||
msg_id: 20005
|
||||
message_body:
|
||||
action: "delete_file"
|
||||
file_id: "550e8400-e29b-41d4-a716-446655440000"
|
||||
changePermission:
|
||||
summary: "[20005] Изменение прав доступа"
|
||||
value:
|
||||
msg_id: 20005
|
||||
message_body:
|
||||
action: "change_permission"
|
||||
file_id: "550e8400-e29b-41d4-a716-446655440000"
|
||||
permissions:
|
||||
VIEW: true
|
||||
DOWNLOAD: false
|
||||
|
||||
imageSearch:
|
||||
summary: "[20007] Поиск изображения"
|
||||
value:
|
||||
msg_id: 20007
|
||||
message_body:
|
||||
file_id: "550e8400-e29b-41d4-a716-446655440000"
|
||||
|
||||
verifyUser:
|
||||
summary: "[20009] Верификация пользователя"
|
||||
value:
|
||||
msg_id: 20009
|
||||
message_body:
|
||||
user_id: 123
|
||||
verify_token: "abc123def456"
|
||||
|
||||
companyCreate:
|
||||
summary: "[30000] Создание компании"
|
||||
value:
|
||||
msg_id: 30000
|
||||
message_body:
|
||||
action: "get_info"
|
||||
action: "create"
|
||||
company_name: "ООО Моя Компания"
|
||||
company_data:
|
||||
phone: "+79991234567"
|
||||
email: "info@company.ru"
|
||||
companyGetById:
|
||||
summary: "[30000] Получение компании по ID"
|
||||
value:
|
||||
msg_id: 30000
|
||||
message_body:
|
||||
action: "getCompany"
|
||||
company_id: "company-uuid-123"
|
||||
|
||||
tariffAdd:
|
||||
summary: "[30001] Добавление тарифа"
|
||||
value:
|
||||
msg_id: 30001
|
||||
message_body:
|
||||
action: "add"
|
||||
type: "MONTHLY"
|
||||
tariff_name: "Премиум"
|
||||
tariff_price: 999.99
|
||||
|
||||
tariffInfoCreate:
|
||||
summary: "[30002] Создание информации о тарифе"
|
||||
value:
|
||||
msg_id: 30002
|
||||
message_body:
|
||||
action: "create"
|
||||
tariff_id: 1
|
||||
|
||||
referralUserStats:
|
||||
summary: "[30003] Статистика пользователя"
|
||||
value:
|
||||
msg_id: 30003
|
||||
message_body:
|
||||
action: "userStats"
|
||||
|
||||
paymentUserPayments:
|
||||
summary: "[30005] Список платежей"
|
||||
value:
|
||||
msg_id: 30005
|
||||
message_body:
|
||||
action: "user_payments"
|
||||
email: "user@example.com"
|
||||
|
||||
monitoringSet:
|
||||
summary: "[30007] Установка мониторинга"
|
||||
value:
|
||||
msg_id: 30007
|
||||
message_body:
|
||||
file_id: "550e8400-e29b-41d4-a716-446655440000"
|
||||
monitoring_type: "MONITORING_DAILY"
|
||||
|
||||
violationList:
|
||||
summary: "[30009] Список нарушений"
|
||||
value:
|
||||
msg_id: 30009
|
||||
message_body:
|
||||
action: "list"
|
||||
page: 0
|
||||
size: 10
|
||||
|
||||
violationStats:
|
||||
summary: "[30010] Статистика нарушений"
|
||||
value:
|
||||
msg_id: 30010
|
||||
message_body: {}
|
||||
|
||||
globalSearch:
|
||||
summary: Глобальный поиск
|
||||
summary: "[30011] Глобальный поиск"
|
||||
value:
|
||||
msg_id: 30011
|
||||
message_body:
|
||||
query: "изображение кота"
|
||||
filters:
|
||||
file_type: "image"
|
||||
|
||||
notionAdd:
|
||||
summary: "[30012] Добавление заметки"
|
||||
value:
|
||||
msg_id: 30012
|
||||
message_body:
|
||||
action: "add_notion"
|
||||
violation_id: 1
|
||||
message: "Текст заметки"
|
||||
|
||||
complaintCreate:
|
||||
summary: "[30013] Создание жалобы"
|
||||
value:
|
||||
msg_id: 30013
|
||||
message_body:
|
||||
action: "create"
|
||||
violation_id: 1
|
||||
text: "Текст жалобы"
|
||||
|
||||
userInfoGetAllPaginated:
|
||||
summary: "[30014] Получить всех пользователей с пагинацией"
|
||||
value:
|
||||
msg_id: 30014
|
||||
message_body:
|
||||
action: "getAllWithPagination"
|
||||
page: 0
|
||||
size: 10
|
||||
|
||||
notificationList:
|
||||
summary: "[30015] Список уведомлений"
|
||||
value:
|
||||
msg_id: 30015
|
||||
message_body:
|
||||
action: "list"
|
||||
page: 0
|
||||
size: 10
|
||||
|
||||
userVerificationVerify:
|
||||
summary: "[30016] Верифицировать пользователя"
|
||||
value:
|
||||
msg_id: 30016
|
||||
message_body:
|
||||
action: "verified"
|
||||
user_id: 123
|
||||
verified: true
|
||||
|
||||
lawCaseCreate:
|
||||
summary: "[30017] Создать юридическое дело"
|
||||
value:
|
||||
msg_id: 30017
|
||||
message_body:
|
||||
action: "create"
|
||||
name: "Дело о нарушении"
|
||||
description: "Описание дела"
|
||||
priority: "HIGH"
|
||||
violation_id: 1
|
||||
|
||||
tokenOpGetList:
|
||||
summary: "[30018] Список операций с токенами"
|
||||
value:
|
||||
msg_id: 30018
|
||||
message_body:
|
||||
action: "get_list"
|
||||
page: 0
|
||||
size: 20
|
||||
|
||||
monitoringStatistic:
|
||||
summary: "[30027] Статистика мониторинга"
|
||||
value:
|
||||
msg_id: 30027
|
||||
message_body: {}
|
||||
|
||||
dockViewHistory:
|
||||
summary: "[30028] История просмотров документов"
|
||||
value:
|
||||
msg_id: 30028
|
||||
message_body:
|
||||
action: "history_view"
|
||||
page: 0
|
||||
size: 10
|
||||
|
||||
responses:
|
||||
'200':
|
||||
description: Успешный ответ
|
||||
@@ -509,7 +747,7 @@ paths:
|
||||
$ref: '#/components/schemas/BaseResponse'
|
||||
examples:
|
||||
fileUploadInitSuccess:
|
||||
summary: Успешная инициализация загрузки
|
||||
summary: "[20004] Успешная инициализация загрузки"
|
||||
value:
|
||||
msg_id: 20004
|
||||
message_code: 0
|
||||
@@ -521,26 +759,179 @@ paths:
|
||||
chunk_size: 209715
|
||||
status: "INITIALIZED"
|
||||
fileTypesSuccess:
|
||||
summary: Типы файлов
|
||||
summary: "[20004] Типы файлов"
|
||||
value:
|
||||
msg_id: 20004
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
file_types:
|
||||
- "IMAGE"
|
||||
- "DOCUMENT"
|
||||
- "AUDIO"
|
||||
file_types: ["IMAGE", "DOCUMENT", "AUDIO"]
|
||||
count: 3
|
||||
|
||||
fileInfoSuccess:
|
||||
summary: "[20005] Информация о файле"
|
||||
value:
|
||||
msg_id: 20005
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
id: "550e8400-e29b-41d4-a716-446655440000"
|
||||
file_name: "document.pdf"
|
||||
status: "ACTIVE"
|
||||
|
||||
imageSearchSuccess:
|
||||
summary: "[20007] Результаты поиска изображений"
|
||||
value:
|
||||
msg_id: 20007
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
images:
|
||||
- url: "https://example.com/similar-image.jpg"
|
||||
title: "Похожее изображение"
|
||||
page: 1
|
||||
total_results: 25
|
||||
|
||||
verifySuccess:
|
||||
summary: "[20009] Успешная верификация"
|
||||
value:
|
||||
msg_id: 20009
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
token: "eyJhbGciOiJIUzI1NiIs..."
|
||||
verified: true
|
||||
email: "user@example.com"
|
||||
|
||||
companyCreateSuccess:
|
||||
summary: "[30000] Компания создана"
|
||||
value:
|
||||
msg_id: 30000
|
||||
message_code: 0
|
||||
message_desc: "Company created successfully"
|
||||
message_body:
|
||||
id: "company-uuid-123"
|
||||
company_name: "ООО Моя Компания"
|
||||
|
||||
tariffAddSuccess:
|
||||
summary: "[30001] Тариф добавлен"
|
||||
value:
|
||||
msg_id: 30001
|
||||
message_code: 0
|
||||
message_desc: "Tariff added successfully"
|
||||
message_body:
|
||||
tariff_name: "Премиум"
|
||||
tariff_type: "MONTHLY"
|
||||
|
||||
referralUserStatsSuccess:
|
||||
summary: "[30003] Статистика пользователя"
|
||||
value:
|
||||
msg_id: 30003
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
total_invitees: 15
|
||||
total_earned: 5000.00
|
||||
|
||||
paymentUserPaymentsSuccess:
|
||||
summary: "[30005] Список платежей"
|
||||
value:
|
||||
msg_id: 30005
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
payments:
|
||||
- payment_uuid: "payment-uuid-123"
|
||||
amount: 999.99
|
||||
|
||||
monitoringSetSuccess:
|
||||
summary: "[30007] Мониторинг установлен"
|
||||
value:
|
||||
msg_id: 30007
|
||||
message_code: 0
|
||||
message_desc: "Monitoring settings updated"
|
||||
message_body:
|
||||
file_id: "550e8400-e29b-41d4-a716-446655440000"
|
||||
monitoring_type: "MONITORING_DAILY"
|
||||
|
||||
violationListSuccess:
|
||||
summary: "[30009] Список нарушений"
|
||||
value:
|
||||
msg_id: 30009
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
violations: []
|
||||
total_elements: 25
|
||||
|
||||
globalSearchStatsSuccess:
|
||||
summary: "[30011] Статистика глобального поиска"
|
||||
value:
|
||||
msg_id: 30011
|
||||
message_code: 0
|
||||
message_desc: ""
|
||||
message_body:
|
||||
total_searches: 150
|
||||
|
||||
complaintCreateSuccess:
|
||||
summary: "[30013] Жалоба создана"
|
||||
value:
|
||||
msg_id: 30013
|
||||
message_code: 0
|
||||
message_desc: "Complaint created successfully"
|
||||
message_body:
|
||||
id: 1
|
||||
status: "OPEN"
|
||||
|
||||
notificationListSuccess:
|
||||
summary: "[30015] Список уведомлений"
|
||||
value:
|
||||
msg_id: 30015
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
notifications: []
|
||||
unread_count: 5
|
||||
|
||||
lawCaseCreateSuccess:
|
||||
summary: "[30017] Юридическое дело создано"
|
||||
value:
|
||||
msg_id: 30017
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
id: 1
|
||||
name: "Дело о нарушении"
|
||||
|
||||
tokenOpListSuccess:
|
||||
summary: "[30018] Список операций с токенами"
|
||||
value:
|
||||
msg_id: 30018
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
operations: []
|
||||
total_elements: 50
|
||||
|
||||
monitoringStatisticSuccess:
|
||||
summary: "[30027] Статистика мониторинга"
|
||||
value:
|
||||
msg_id: 30027
|
||||
message_code: 0
|
||||
message_desc: "Operation successful"
|
||||
message_body:
|
||||
day: 10
|
||||
month: 5
|
||||
weekly: 7
|
||||
|
||||
invalidMsgId:
|
||||
summary: Неверный msg_id
|
||||
summary: "[Common] Неверный msg_id"
|
||||
value:
|
||||
msg_id: 99999
|
||||
message_code: 4
|
||||
message_desc: "Message id not found"
|
||||
message_body: {}
|
||||
|
||||
# ========== FILE UPLOAD ENDPOINTS ==========
|
||||
/api/v{version}/files/chunk:
|
||||
post:
|
||||
tags:
|
||||
@@ -719,7 +1110,6 @@ paths:
|
||||
file_path: "/uploads/user123/doc.pdf"
|
||||
remaining_chunks: 2
|
||||
|
||||
# ========== FILE DOWNLOAD ENDPOINTS ==========
|
||||
/api/v{version}/files/download/{fileId}:
|
||||
get:
|
||||
tags:
|
||||
@@ -763,7 +1153,7 @@ paths:
|
||||
type: string
|
||||
description: Имя файла для сохранения
|
||||
example: 'attachment; filename="document.pdf"'
|
||||
'200-json':
|
||||
'403':
|
||||
description: Ошибка при скачивании
|
||||
content:
|
||||
application/json:
|
||||
@@ -838,7 +1228,6 @@ paths:
|
||||
type: string
|
||||
format: binary
|
||||
|
||||
# ========== FILE SIMILARITY ENDPOINTS ==========
|
||||
/api/v{version}/files/{fileId}/similar:
|
||||
get:
|
||||
tags:
|
||||
@@ -919,7 +1308,6 @@ paths:
|
||||
has_previous: false
|
||||
|
||||
|
||||
|
||||
/api/check/{fileId}:
|
||||
get:
|
||||
tags:
|
||||
@@ -962,7 +1350,6 @@ paths:
|
||||
DOCUMENT: 45
|
||||
AUDIO: 12
|
||||
|
||||
# ========== COMPONENTS ==========
|
||||
components:
|
||||
schemas:
|
||||
BaseRequest:
|
||||
@@ -1025,42 +1412,24 @@ components:
|
||||
properties:
|
||||
action:
|
||||
type: string
|
||||
description: |
|
||||
Действие с загрузкой:
|
||||
- init - инициализация загрузки
|
||||
- file_types - получение доступных типов файлов
|
||||
- file_extension - получение расширений для типа
|
||||
- chunks - статус чанков
|
||||
- cancel - отмена загрузки
|
||||
- progress - прогресс загрузки
|
||||
enum: [init, file_types, file_extension, chunks, cancel, progress]
|
||||
example: init
|
||||
file_name:
|
||||
type: string
|
||||
description: Имя файла (для action=init)
|
||||
example: "document.pdf"
|
||||
file_type:
|
||||
type: string
|
||||
description: Тип файла (image, document, audio)
|
||||
enum: [IMAGE, DOCUMENT, AUDIO]
|
||||
example: DOCUMENT
|
||||
extension:
|
||||
type: string
|
||||
description: Расширение файла
|
||||
example: "pdf"
|
||||
convert_to:
|
||||
type: string
|
||||
description: Формат конвертации
|
||||
example: "protected"
|
||||
file_size:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Размер файла в байтах
|
||||
example: 1048576
|
||||
upload_id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: ID сессии загрузки (для action=cancel, chunks, progress)
|
||||
|
||||
InitFileResponse:
|
||||
type: object
|
||||
@@ -1068,20 +1437,14 @@ components:
|
||||
upload_id:
|
||||
type: string
|
||||
format: uuid
|
||||
description: ID сессии загрузки
|
||||
file_name:
|
||||
type: string
|
||||
description: Имя файла
|
||||
total_chunks:
|
||||
type: integer
|
||||
description: Общее количество чанков
|
||||
chunk_size:
|
||||
type: integer
|
||||
description: Размер одного чанка в байтах
|
||||
status:
|
||||
type: string
|
||||
description: Статус загрузки
|
||||
example: "INITIALIZED"
|
||||
|
||||
ChunkUploadResponse:
|
||||
type: object
|
||||
@@ -1162,10 +1525,8 @@ components:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example: ["IMAGE", "DOCUMENT", "AUDIO"]
|
||||
count:
|
||||
type: integer
|
||||
example: 3
|
||||
|
||||
FileExtensionResponse:
|
||||
type: object
|
||||
@@ -1174,13 +1535,11 @@ components:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
example: ["jpg", "jpeg", "png", "gif"]
|
||||
count:
|
||||
type: integer
|
||||
max_file_size:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Максимальный размер файла в байтах
|
||||
|
||||
CanceledUploadResponse:
|
||||
type: object
|
||||
@@ -0,0 +1,350 @@
|
||||
openapi: 3.0.3
|
||||
info:
|
||||
title: NoCopy API - API Keys
|
||||
description: API для управления пользовательскими API ключами
|
||||
version: 1.0.0
|
||||
contact:
|
||||
name: NoCopy
|
||||
|
||||
servers:
|
||||
- url: http://localhost:8080
|
||||
description: Локальный
|
||||
- url: https://dev-workspace.not-copy.com/
|
||||
description: Дев
|
||||
|
||||
tags:
|
||||
- name: User
|
||||
description: Управление пользовательскими данными и API ключами
|
||||
|
||||
paths:
|
||||
/api/user/api-keys:
|
||||
post:
|
||||
tags:
|
||||
- User
|
||||
summary: Создание API ключа
|
||||
description: |
|
||||
Создаёт новый API ключ для пользователя.
|
||||
- Требуется авторизация (Bearer токен)
|
||||
- Если имя не указано, будет присвоено "Unnamed key"
|
||||
- Возвращает полный ключ только один раз при создании
|
||||
- Префикс ключа можно использовать для идентификации без раскрытия секрета
|
||||
operationId: createApiKey
|
||||
security:
|
||||
- BearerAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: Название ключа для идентификации (опционально)
|
||||
example: "My API Key"
|
||||
maxLength: 255
|
||||
examples:
|
||||
withName:
|
||||
summary: С указанием названия
|
||||
value:
|
||||
name: "Production Key"
|
||||
withDescription:
|
||||
summary: С описательным названием
|
||||
value:
|
||||
name: "Key for mobile app"
|
||||
withoutName:
|
||||
summary: Без названия (по умолчанию "Unnamed key")
|
||||
value: {}
|
||||
minimalExample:
|
||||
summary: Пустое тело запроса
|
||||
value: {}
|
||||
responses:
|
||||
'200':
|
||||
description: Ключ успешно создан
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BaseResponse'
|
||||
examples:
|
||||
success:
|
||||
summary: API ключ создан
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 0
|
||||
message_desc: "API key created successfully"
|
||||
message_body:
|
||||
apiKey: "sk-live-abc123def456789ghi012jkl345mno678"
|
||||
successWithDescription:
|
||||
summary: API ключ с описанием создан
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 0
|
||||
message_desc: "API key created successfully"
|
||||
message_body:
|
||||
apiKey: "sk-test-xyz987abc654def321ghi098jkl765mno"
|
||||
'401':
|
||||
description: Неавторизованный доступ
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BaseResponse'
|
||||
examples:
|
||||
unauthorized:
|
||||
summary: Токен не предоставлен или недействителен
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 7
|
||||
message_desc: "Authentication required"
|
||||
message_body: null
|
||||
|
||||
get:
|
||||
tags:
|
||||
- User
|
||||
summary: Получение списка API ключей
|
||||
description: |
|
||||
Возвращает все API ключи текущего пользователя.
|
||||
|
||||
**Особенности:**
|
||||
- Требуется авторизация (Bearer токен)
|
||||
- Полные ключи не возвращаются, только префиксы
|
||||
- Включает информацию об активности и времени использования
|
||||
operationId: listApiKeys
|
||||
security:
|
||||
- BearerAuth: []
|
||||
responses:
|
||||
'200':
|
||||
description: Список ключей пользователя
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BaseResponse'
|
||||
examples:
|
||||
success:
|
||||
summary: Список с несколькими ключами
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 0
|
||||
message_desc: null
|
||||
message_body:
|
||||
- id: 1
|
||||
name: "Production Key"
|
||||
prefix: "sk-live-abc123..."
|
||||
isActive: true
|
||||
createdAt: "2025-01-15T10:30:00Z"
|
||||
lastUsedAt: "2025-06-30T14:22:00Z"
|
||||
- id: 2
|
||||
name: "Key for mobile app"
|
||||
prefix: "sk-live-def456..."
|
||||
isActive: true
|
||||
createdAt: "2025-03-20T08:00:00Z"
|
||||
lastUsedAt: "2025-06-29T18:45:00Z"
|
||||
- id: 3
|
||||
name: "Old Development Key"
|
||||
prefix: "sk-test-ghi789..."
|
||||
isActive: false
|
||||
createdAt: "2025-02-10T12:00:00Z"
|
||||
lastUsedAt: "2025-05-15T09:30:00Z"
|
||||
singleKey:
|
||||
summary: Один активный ключ
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 0
|
||||
message_desc: null
|
||||
message_body:
|
||||
- id: 1
|
||||
name: "My API Key"
|
||||
prefix: "sk-live-abc123..."
|
||||
isActive: true
|
||||
createdAt: "2025-06-01T00:00:00Z"
|
||||
lastUsedAt: null
|
||||
empty:
|
||||
summary: Нет созданных ключей
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 0
|
||||
message_desc: null
|
||||
message_body: []
|
||||
'401':
|
||||
description: Неавторизованный доступ
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BaseResponse'
|
||||
examples:
|
||||
unauthorized:
|
||||
summary: Токен не предоставлен или недействителен
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 7
|
||||
message_desc: "Authentication required"
|
||||
message_body: null
|
||||
|
||||
/api/user/api-keys/{keyId}:
|
||||
delete:
|
||||
tags:
|
||||
- User
|
||||
summary: Отзыв (удаление) API ключа
|
||||
description: |
|
||||
Деактивирует API ключ пользователя. Ключ становится неактивным и больше не может использоваться.
|
||||
|
||||
**Особенности:**
|
||||
- Требуется авторизация (Bearer токен)
|
||||
- Пользователь может отозвать только свои ключи
|
||||
- Отозванный ключ нельзя восстановить (нужно создавать новый)
|
||||
operationId: revokeApiKey
|
||||
security:
|
||||
- BearerAuth: []
|
||||
parameters:
|
||||
- name: keyId
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
description: ID ключа для отзыва
|
||||
example: 1
|
||||
responses:
|
||||
'200':
|
||||
description: Ключ успешно отозван
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BaseResponse'
|
||||
examples:
|
||||
success:
|
||||
summary: Ключ отозван
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 0
|
||||
message_desc: null
|
||||
message_body: null
|
||||
'401':
|
||||
description: Неавторизованный доступ
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BaseResponse'
|
||||
examples:
|
||||
unauthorized:
|
||||
summary: Токен не предоставлен или недействителен
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 7
|
||||
message_desc: "Authentication required"
|
||||
message_body: null
|
||||
'403':
|
||||
description: Доступ запрещён (ключ не принадлежит пользователю)
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BaseResponse'
|
||||
examples:
|
||||
forbidden:
|
||||
summary: Ключ принадлежит другому пользователю
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 6
|
||||
message_desc: "Access denied"
|
||||
message_body: null
|
||||
'404':
|
||||
description: Ключ не найден
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BaseResponse'
|
||||
examples:
|
||||
notFound:
|
||||
summary: Ключ с указанным ID не существует
|
||||
value:
|
||||
msg_id: null
|
||||
message_code: 4
|
||||
message_desc: "API key not found"
|
||||
message_body:
|
||||
keyId: 999
|
||||
|
||||
components:
|
||||
schemas:
|
||||
BaseResponse:
|
||||
type: object
|
||||
properties:
|
||||
msg_id:
|
||||
type: integer
|
||||
description: Идентификатор сообщения (может быть null)
|
||||
nullable: true
|
||||
example: null
|
||||
message_code:
|
||||
type: integer
|
||||
description: |
|
||||
Код результата:
|
||||
- 0 - Успешно
|
||||
- 4 - Ресурс не найден
|
||||
- 6 - Доступ запрещён
|
||||
- 7 - Требуется авторизация
|
||||
example: 0
|
||||
message_desc:
|
||||
type: string
|
||||
description: Описание результата операции (может быть null)
|
||||
nullable: true
|
||||
example: "API key created successfully"
|
||||
message_body:
|
||||
description: Данные ответа
|
||||
nullable: true
|
||||
oneOf:
|
||||
- type: object
|
||||
properties:
|
||||
apiKey:
|
||||
type: string
|
||||
description: Полный API ключ (только при создании)
|
||||
example: "sk-live-abc123def456..."
|
||||
description: Ответ при создании ключа
|
||||
- type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ApiKeyInfo'
|
||||
description: Список ключей пользователя
|
||||
- type: object
|
||||
description: Пустой объект или null
|
||||
nullable: true
|
||||
example: null
|
||||
|
||||
ApiKeyInfo:
|
||||
type: object
|
||||
description: Информация об API ключе
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Уникальный идентификатор ключа
|
||||
example: 1
|
||||
name:
|
||||
type: string
|
||||
description: Название ключа
|
||||
example: "Production Key"
|
||||
prefix:
|
||||
type: string
|
||||
description: Префикс ключа для идентификации
|
||||
example: "sk-live-abc123..."
|
||||
isActive:
|
||||
type: boolean
|
||||
description: Активен ли ключ
|
||||
example: true
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Дата и время создания ключа
|
||||
example: "2025-01-15T10:30:00Z"
|
||||
lastUsedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
description: Дата и время последнего использования (null если не использовался)
|
||||
example: "2025-06-30T14:22:00Z"
|
||||
|
||||
securitySchemes:
|
||||
BearerAuth:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
description: JWT токен для авторизации (получить через /api/auth)
|
||||
|
||||
security:
|
||||
- BearerAuth: []
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user