Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(openapi): add api-keys, evals, mcp-servers and usage to the v1 API (#18141)

Rdmclin27abba9672f06
diff --git a/locales/ar/auth.json b/locales/ar/auth.json
index 7b1069692f5..55fe7fd34f1 100644
--- a/locales/ar/auth.json
+++ b/locales/ar/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "الدردشة",
"apikey.scopes.groups.file": "الملفات",
"apikey.scopes.groups.knowledge": "المعرفة",
+ "apikey.scopes.groups.mcp": "خوادم MCP",
"apikey.scopes.groups.model": "النماذج",
+ "apikey.scopes.groups.usage": "الاستخدام",
"apikey.scopes.groups.user": "المستخدم",
"apikey.scopes.groups.workspace": "مساحة العمل",
"apikey.scopes.invoke": "استدعاء",
diff --git a/locales/bg-BG/auth.json b/locales/bg-BG/auth.json
index d381c181330..ffb6a66f990 100644
--- a/locales/bg-BG/auth.json
+++ b/locales/bg-BG/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Чат",
"apikey.scopes.groups.file": "Файлове",
"apikey.scopes.groups.knowledge": "Знания",
+ "apikey.scopes.groups.mcp": "MCP сървъри",
"apikey.scopes.groups.model": "Модели",
+ "apikey.scopes.groups.usage": "Употреба",
"apikey.scopes.groups.user": "Потребител",
"apikey.scopes.groups.workspace": "Работно пространство",
"apikey.scopes.invoke": "Извикване",
diff --git a/locales/de-DE/auth.json b/locales/de-DE/auth.json
index 98b3505f5ac..017a74c0731 100644
--- a/locales/de-DE/auth.json
+++ b/locales/de-DE/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Chat",
"apikey.scopes.groups.file": "Dateien",
"apikey.scopes.groups.knowledge": "Wissen",
+ "apikey.scopes.groups.mcp": "MCP-Server",
"apikey.scopes.groups.model": "Modelle",
+ "apikey.scopes.groups.usage": "Nutzung",
"apikey.scopes.groups.user": "Benutzer",
"apikey.scopes.groups.workspace": "Arbeitsbereich",
"apikey.scopes.invoke": "Aufrufen",
diff --git a/locales/en-US/auth.json b/locales/en-US/auth.json
index ef917cae8a8..113d0c33170 100644
--- a/locales/en-US/auth.json
+++ b/locales/en-US/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Chat",
"apikey.scopes.groups.file": "Files",
"apikey.scopes.groups.knowledge": "Knowledge",
+ "apikey.scopes.groups.mcp": "MCP servers",
"apikey.scopes.groups.model": "Models",
+ "apikey.scopes.groups.usage": "Usage",
"apikey.scopes.groups.user": "User",
"apikey.scopes.groups.workspace": "Workspace",
"apikey.scopes.invoke": "Invoke",
diff --git a/locales/es-ES/auth.json b/locales/es-ES/auth.json
index a1340d0d63f..103ba2312b2 100644
--- a/locales/es-ES/auth.json
+++ b/locales/es-ES/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Chat",
"apikey.scopes.groups.file": "Archivos",
"apikey.scopes.groups.knowledge": "Conocimiento",
+ "apikey.scopes.groups.mcp": "Servidores MCP",
"apikey.scopes.groups.model": "Modelos",
+ "apikey.scopes.groups.usage": "Uso",
"apikey.scopes.groups.user": "Usuario",
"apikey.scopes.groups.workspace": "Espacio de trabajo",
"apikey.scopes.invoke": "Invocar",
diff --git a/locales/fa-IR/auth.json b/locales/fa-IR/auth.json
index 9ecf6b241a6..1f2c27d5046 100644
--- a/locales/fa-IR/auth.json
+++ b/locales/fa-IR/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "چت",
"apikey.scopes.groups.file": "فایل‌ها",
"apikey.scopes.groups.knowledge": "دانش",
+ "apikey.scopes.groups.mcp": "سرورهای MCP",
"apikey.scopes.groups.model": "مدل‌ها",
+ "apikey.scopes.groups.usage": "استفاده",
"apikey.scopes.groups.user": "کاربر",
"apikey.scopes.groups.workspace": "محیط کار",
"apikey.scopes.invoke": "فراخوانی",
diff --git a/locales/fr-FR/auth.json b/locales/fr-FR/auth.json
index a64d7445f98..469edecb025 100644
--- a/locales/fr-FR/auth.json
+++ b/locales/fr-FR/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Chat",
"apikey.scopes.groups.file": "Fichiers",
"apikey.scopes.groups.knowledge": "Connaissances",
+ "apikey.scopes.groups.mcp": "Serveurs MCP",
"apikey.scopes.groups.model": "Modèles",
+ "apikey.scopes.groups.usage": "Utilisation",
"apikey.scopes.groups.user": "Utilisateur",
"apikey.scopes.groups.workspace": "Espace de travail",
"apikey.scopes.invoke": "Invoquer",
diff --git a/locales/it-IT/auth.json b/locales/it-IT/auth.json
index 9c9be1ca271..fd1fcd62047 100644
--- a/locales/it-IT/auth.json
+++ b/locales/it-IT/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Chat",
"apikey.scopes.groups.file": "File",
"apikey.scopes.groups.knowledge": "Conoscenza",
+ "apikey.scopes.groups.mcp": "Server MCP",
"apikey.scopes.groups.model": "Modelli",
+ "apikey.scopes.groups.usage": "Utilizzo",
"apikey.scopes.groups.user": "Utente",
"apikey.scopes.groups.workspace": "Spazio di lavoro",
"apikey.scopes.invoke": "Invoca",
diff --git a/locales/ja-JP/auth.json b/locales/ja-JP/auth.json
index e51a880e70d..1d09612d234 100644
--- a/locales/ja-JP/auth.json
+++ b/locales/ja-JP/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "チャット",
"apikey.scopes.groups.file": "ファイル",
"apikey.scopes.groups.knowledge": "ナレッジ",
+ "apikey.scopes.groups.mcp": "MCPサーバー",
"apikey.scopes.groups.model": "モデル",
+ "apikey.scopes.groups.usage": "使用状況",
"apikey.scopes.groups.user": "ユーザー",
"apikey.scopes.groups.workspace": "ワークスペース",
"apikey.scopes.invoke": "呼び出し",
diff --git a/locales/ko-KR/auth.json b/locales/ko-KR/auth.json
index fcb5725358a..cebb7cabb12 100644
--- a/locales/ko-KR/auth.json
+++ b/locales/ko-KR/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "채팅",
"apikey.scopes.groups.file": "파일",
"apikey.scopes.groups.knowledge": "지식",
+ "apikey.scopes.groups.mcp": "MCP 서버",
"apikey.scopes.groups.model": "모델",
+ "apikey.scopes.groups.usage": "사용량",
"apikey.scopes.groups.user": "사용자",
"apikey.scopes.groups.workspace": "작업 공간",
"apikey.scopes.invoke": "호출",
diff --git a/locales/nl-NL/auth.json b/locales/nl-NL/auth.json
index ba7324350ce..36b77d69047 100644
--- a/locales/nl-NL/auth.json
+++ b/locales/nl-NL/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Chat",
"apikey.scopes.groups.file": "Bestanden",
"apikey.scopes.groups.knowledge": "Kennis",
+ "apikey.scopes.groups.mcp": "MCP-servers",
"apikey.scopes.groups.model": "Modellen",
+ "apikey.scopes.groups.usage": "Gebruik",
"apikey.scopes.groups.user": "Gebruiker",
"apikey.scopes.groups.workspace": "Werkruimte",
"apikey.scopes.invoke": "Aanroepen",
diff --git a/locales/pl-PL/auth.json b/locales/pl-PL/auth.json
index 8ff983fd33f..c3409854d34 100644
--- a/locales/pl-PL/auth.json
+++ b/locales/pl-PL/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Czat",
"apikey.scopes.groups.file": "Pliki",
"apikey.scopes.groups.knowledge": "Wiedza",
+ "apikey.scopes.groups.mcp": "Serwery MCP",
"apikey.scopes.groups.model": "Modele",
+ "apikey.scopes.groups.usage": "Użycie",
"apikey.scopes.groups.user": "Użytkownik",
"apikey.scopes.groups.workspace": "Przestrzeń robocza",
"apikey.scopes.invoke": "Wywołaj",
diff --git a/locales/pt-BR/auth.json b/locales/pt-BR/auth.json
index e447df9bbb9..e192ab29f0e 100644
--- a/locales/pt-BR/auth.json
+++ b/locales/pt-BR/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Chat",
"apikey.scopes.groups.file": "Arquivos",
"apikey.scopes.groups.knowledge": "Conhecimento",
+ "apikey.scopes.groups.mcp": "Servidores MCP",
"apikey.scopes.groups.model": "Modelos",
+ "apikey.scopes.groups.usage": "Uso",
"apikey.scopes.groups.user": "Usuário",
"apikey.scopes.groups.workspace": "Espaço de trabalho",
"apikey.scopes.invoke": "Invocar",
diff --git a/locales/ru-RU/auth.json b/locales/ru-RU/auth.json
index 45972a72bbc..01c6d1a77b6 100644
--- a/locales/ru-RU/auth.json
+++ b/locales/ru-RU/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Чат",
"apikey.scopes.groups.file": "Файлы",
"apikey.scopes.groups.knowledge": "Знания",
+ "apikey.scopes.groups.mcp": "Серверы MCP",
"apikey.scopes.groups.model": "Модели",
+ "apikey.scopes.groups.usage": "Использование",
"apikey.scopes.groups.user": "Пользователь",
"apikey.scopes.groups.workspace": "Рабочая область",
"apikey.scopes.invoke": "Вызов",
diff --git a/locales/tr-TR/auth.json b/locales/tr-TR/auth.json
index badcbafed8e..c336588ad33 100644
--- a/locales/tr-TR/auth.json
+++ b/locales/tr-TR/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Sohbet",
"apikey.scopes.groups.file": "Dosyalar",
"apikey.scopes.groups.knowledge": "Bilgi",
+ "apikey.scopes.groups.mcp": "MCP sunucuları",
"apikey.scopes.groups.model": "Modeller",
+ "apikey.scopes.groups.usage": "Kullanım",
"apikey.scopes.groups.user": "Kullanıcı",
"apikey.scopes.groups.workspace": "Çalışma Alanı",
"apikey.scopes.invoke": "Çağır",
diff --git a/locales/vi-VN/auth.json b/locales/vi-VN/auth.json
index edf9b966c5f..02dd61f65a4 100644
--- a/locales/vi-VN/auth.json
+++ b/locales/vi-VN/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "Trò chuyện",
"apikey.scopes.groups.file": "Tệp",
"apikey.scopes.groups.knowledge": "Kiến thức",
+ "apikey.scopes.groups.mcp": "Máy chủ MCP",
"apikey.scopes.groups.model": "Mô hình",
+ "apikey.scopes.groups.usage": "Sử dụng",
"apikey.scopes.groups.user": "Người dùng",
"apikey.scopes.groups.workspace": "Không gian làm việc",
"apikey.scopes.invoke": "Gọi",
diff --git a/locales/zh-CN/auth.json b/locales/zh-CN/auth.json
index 56dd93059e5..2a5f2df633d 100644
--- a/locales/zh-CN/auth.json
+++ b/locales/zh-CN/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "会话",
"apikey.scopes.groups.file": "文件",
"apikey.scopes.groups.knowledge": "知识库",
+ "apikey.scopes.groups.mcp": "MCP 服务器",
"apikey.scopes.groups.model": "模型",
+ "apikey.scopes.groups.usage": "用量",
"apikey.scopes.groups.user": "用户",
"apikey.scopes.groups.workspace": "工作区",
"apikey.scopes.invoke": "调用",
diff --git a/locales/zh-TW/auth.json b/locales/zh-TW/auth.json
index f20b1ab905f..df9cd9b06ca 100644
--- a/locales/zh-TW/auth.json
+++ b/locales/zh-TW/auth.json
@@ -53,7 +53,9 @@
"apikey.scopes.groups.chat": "聊天",
"apikey.scopes.groups.file": "檔案",
"apikey.scopes.groups.knowledge": "知識",
+ "apikey.scopes.groups.mcp": "MCP 伺服器",
"apikey.scopes.groups.model": "模型",
+ "apikey.scopes.groups.usage": "使用情況",
"apikey.scopes.groups.user": "使用者",
"apikey.scopes.groups.workspace": "工作區",
"apikey.scopes.invoke": "調用",
diff --git a/packages/business-server/src/openapiUsage.ts b/packages/business-server/src/openapiUsage.ts
new file mode 100644
index 00000000000..46b8f681846
--- /dev/null
+++ b/packages/business-server/src/openapiUsage.ts
@@ -0,0 +1,37 @@
+export interface OpenApiUsageSummary {
+ available: boolean;
+ currency: 'USD';
+ daily: Array<{ date: string; value: number }>;
+ period: { since: string; until: string };
+ remainingBalance: number | null;
+ scope: 'personal' | 'workspace';
+ spent: number;
+ usageByType: Array<{ count: number | null; spend: number; type: string }>;
+}
+
+export interface GetOpenApiUsageParams {
+ userId: string;
+ workspaceId?: string;
+}
+
+/**
+ * Optional usage/quota integration point. Self-hosted deployments without a
+ * metered budget provider expose an unavailable, zero-usage summary.
+ */
+export const getOpenApiUsage = async (
+ params: GetOpenApiUsageParams,
+): Promise<OpenApiUsageSummary> => {
+ const until = new Date();
+ const since = new Date(until.getTime() - 29 * 86_400_000);
+
+ return {
+ available: false,
+ currency: 'USD',
+ daily: [],
+ period: { since: since.toISOString(), until: until.toISOString() },
+ remainingBalance: null,
+ scope: params.workspaceId ? 'workspace' : 'personal',
+ spent: 0,
+ usageByType: [],
+ };
+};
diff --git a/packages/const/src/apiKeyScope.test.ts b/packages/const/src/apiKeyScope.test.ts
index d7eb344a5c4..2da1e011d81 100644
--- a/packages/const/src/apiKeyScope.test.ts
+++ b/packages/const/src/apiKeyScope.test.ts
@@ -39,6 +39,7 @@ describe('hasApiKeyScope', () => {
it('write implies read', () => {
expect(hasApiKeyScope(['chat:write'], 'chat:read')).toBe(true);
expect(hasApiKeyScope(['chat:read'], 'chat:write')).toBe(false);
+ expect(hasApiKeyScope(['mcp:write'], 'mcp:read')).toBe(true);
});
it('full access satisfies everything', () => {
@@ -153,6 +154,10 @@ describe('requiredApiKeyScopeForTrpc', () => {
expect(requiredApiKeyScopeForTrpc('workspaceMember.remove', 'mutation')).toEqual({
blocked: true,
});
+ expect(requiredApiKeyScopeForTrpc('usage.findByMonth', 'query')).toEqual({
+ scopes: ['usage:read'],
+ });
+ expect(requiredApiKeyScopeForTrpc('usage.reset', 'mutation')).toEqual({ blocked: true });
});
it('blocks sensitive nested sub-surfaces regardless of the parent namespace', () => {
diff --git a/packages/const/src/apiKeyScope.ts b/packages/const/src/apiKeyScope.ts
index 4da01347339..c7762dee341 100644
--- a/packages/const/src/apiKeyScope.ts
+++ b/packages/const/src/apiKeyScope.ts
@@ -24,7 +24,7 @@ export const API_KEY_FULL_ACCESS_SCOPE = '*';
* Deliberately absent (a restricted key can never obtain them):
* - `api_key:*` — keys must not mint keys (self-provisioning)
* - `rbac:*`, member/role management — privilege escalation surface
- * - billing (spend / subscription / top-up / credits)
+ * - billing administration (spend / subscription / top-up / credits)
*/
export const API_KEY_SCOPES = [
API_KEY_FULL_ACCESS_SCOPE,
@@ -39,6 +39,9 @@ export const API_KEY_SCOPES = [
'file:write',
'knowledge:read',
'knowledge:write',
+ 'mcp:read',
+ 'mcp:write',
+ 'usage:read',
'workspace:read',
'workspace:write',
'user:read',
@@ -247,7 +250,7 @@ export const TRPC_NAMESPACE_API_KEY_RULES: Record<string, TrpcNamespaceScopeRule
topic: rw('chat:read', 'chat:write'),
topicComment: rw('chat:read', 'chat:write'),
upload: rw('file:read', 'file:write'),
- usage: 'blocked',
+ usage: rw('usage:read', null),
user: rw('user:read', 'user:write'),
userMemories: rw('user:read', 'user:write'),
userMemory: rw('user:read', 'user:write'),
diff --git a/packages/database/src/models/__tests__/apiKey.test.ts b/packages/database/src/models/__tests__/apiKey.test.ts
index 0c2e14c8e7d..38af06f3e1e 100644
--- a/packages/database/src/models/__tests__/apiKey.test.ts
+++ b/packages/database/src/models/__tests__/apiKey.test.ts
@@ -68,6 +68,16 @@ describe('ApiKeyModel', () => {
expect(result.expiresAt).toEqual(expiresAt);
});
+
+ it('reveals plaintext only through the explicit one-time create method', async () => {
+ const created = await apiKeyModel.createWithPlaintext({ name: 'One-time Key' });
+
+ expect(created.key).toMatch(/^sk-lh-[\da-z]{16}$/);
+
+ const stored = await apiKeyModel.findById(created.id);
+ expect(stored?.key).not.toBe(created.key);
+ expect(stored?.key).toContain(':');
+ });
});
describe('delete', () => {
@@ -148,6 +158,14 @@ describe('ApiKeyModel', () => {
expect(keys[0].key).toMatch(/^sk-lh-[\da-z]{16}$/);
});
+ it('keeps metadata queries free of decrypted plaintext', async () => {
+ const created = await apiKeyModel.createWithPlaintext({ name: 'Metadata Key' });
+ const [metadata] = await apiKeyModel.queryMetadata();
+
+ expect(metadata.key).not.toBe(created.key);
+ expect(metadata.key).toContain(':');
+ });
+
it('should query API keys ordered by updatedAt desc', async () => {
const key1 = await apiKeyModel.create({ name: 'Key 1', enabled: true });
// Wait a bit to ensure different timestamps
diff --git a/packages/database/src/models/__tests__/connector.test.ts b/packages/database/src/models/__tests__/connector.test.ts
index 03a179e7df0..329a2944e0d 100644
--- a/packages/database/src/models/__tests__/connector.test.ts
+++ b/packages/database/src/models/__tests__/connector.test.ts
@@ -196,6 +196,44 @@ describe('ConnectorModel', () => {
});
});
+ describe('public metadata reads', () => {
+ it('does not select or decrypt credential and private config fields', async () => {
+ const model = new ConnectorModel(serverDB, userId, undefined, gateKeeper);
+ const created = await model.create({
+ credentials: JSON.stringify(apikeyCredentials),
+ identifier: 'public-mcp',
+ mcpConnectionType: 'http',
+ mcpServerUrl: 'https://mcp.example.com',
+ metadata: {
+ customHeaders: { 'X-Private': 'secret' },
+ description: 'Public description',
+ },
+ name: 'Public MCP',
+ oidcConfig: { clientSecret: 'secret', scheme: 'pre_registration' },
+ sourceType: 'custom',
+ status: 'connected',
+ });
+ gateKeeper.decrypt.mockClear();
+
+ const [listed, found] = await Promise.all([
+ model.queryPublic(),
+ model.findPublicById(created.id),
+ ]);
+
+ expect(listed).toHaveLength(1);
+ expect(found).toEqual(listed[0]);
+ expect(found).toMatchObject({
+ description: 'Public description',
+ hasCredentials: true,
+ id: created.id,
+ });
+ expect(found).not.toHaveProperty('credentials');
+ expect(found).not.toHaveProperty('metadata');
+ expect(found).not.toHaveProperty('oidcConfig');
+ expect(gateKeeper.decrypt).not.toHaveBeenCalled();
+ });
+ });
+
describe('queryByIdentifiers', () => {
it('returns an empty array for an empty identifier list', async () => {
const model = new ConnectorModel(serverDB, userId);
diff --git a/packages/database/src/models/agentEval/__tests__/run.test.ts b/packages/database/src/models/agentEval/__tests__/run.test.ts
index d947261f20b..96b3710dedb 100644
--- a/packages/database/src/models/agentEval/__tests__/run.test.ts
+++ b/packages/database/src/models/agentEval/__tests__/run.test.ts
@@ -139,7 +139,7 @@ describe('AgentEvalRunModel', () => {
.returning();
// Insert runs
- const [run1, run2, run3, run4] = await serverDB
+ await serverDB
.insert(agentEvalRuns)
.values([
{
@@ -483,6 +483,27 @@ describe('AgentEvalRunModel', () => {
});
});
+ describe('queue', () => {
+ it('atomically transitions an idle run only once', async () => {
+ const [run] = await serverDB
+ .insert(agentEvalRuns)
+ .values({ datasetId, userId, status: 'idle' })
+ .returning();
+
+ expect((await runModel.queue(run.id))?.status).toBe('pending');
+ expect(await runModel.queue(run.id)).toBeUndefined();
+ });
+
+ it('does not queue another user’s run', async () => {
+ const [run] = await serverDB
+ .insert(agentEvalRuns)
+ .values({ datasetId, userId: userId2, status: 'idle' })
+ .returning();
+
+ expect(await runModel.queue(run.id)).toBeUndefined();
+ });
+ });
+
describe('claim', () => {
it('should transition a pending run to running and set startedAt', async () => {
const [run] = await serverDB
diff --git a/packages/database/src/models/agentEval/run.ts b/packages/database/src/models/agentEval/run.ts
index 87c49a4865a..98727fff4ef 100644
--- a/packages/database/src/models/agentEval/run.ts
+++ b/packages/database/src/models/agentEval/run.ts
@@ -105,6 +105,19 @@ export class AgentEvalRunModel {
return result;
};
+ /**
+ * Atomically queue a newly-created idle run. This prevents idempotent REST
+ * retries from dispatching the same QStash workflow more than once.
+ */
+ queue = async (id: string) => {
+ const [result] = await this.db
+ .update(agentEvalRuns)
+ .set({ status: 'pending', updatedAt: new Date() })
+ .where(and(eq(agentEvalRuns.id, id), eq(agentEvalRuns.status, 'idle'), this.ownership()))
+ .returning();
+ return result;
+ };
+
/**
* Atomically claim a pending run (pending -> running) via a single
* conditional update. Returns the updated run, or undefined when the run is
diff --git a/packages/database/src/models/apiKey.ts b/packages/database/src/models/apiKey.ts
index cbded382698..7c333aa85ee 100644
--- a/packages/database/src/models/apiKey.ts
+++ b/packages/database/src/models/apiKey.ts
@@ -59,7 +59,9 @@ export class ApiKeyModel {
return this.gateKeeperPromise;
}
- create = async (params: Omit<NewApiKeyItem, 'userId' | 'id' | 'key' | 'keyHash'>) => {
+ private createRecord = async (
+ params: Omit<NewApiKeyItem, 'userId' | 'id' | 'key' | 'keyHash'>,
+ ) => {
const key = generateApiKey();
const keyHash = hashApiKey(key);
const gateKeeper = await this.getGateKeeper();
@@ -75,7 +77,21 @@ export class ApiKeyModel {
)
.returning();
- return result;
+ return { key, record: result };
+ };
+
+ create = async (params: Omit<NewApiKeyItem, 'userId' | 'id' | 'key' | 'keyHash'>) =>
+ (await this.createRecord(params)).record;
+
+ /**
+ * Create a key and reveal its plaintext exactly once to a trusted transport.
+ * List/detail methods continue to return only the stored encrypted record.
+ */
+ createWithPlaintext = async (
+ params: Omit<NewApiKeyItem, 'userId' | 'id' | 'key' | 'keyHash'>,
+ ) => {
+ const { key, record } = await this.createRecord(params);
+ return { ...record, key };
};
delete = async (id: string) => {
@@ -142,6 +158,14 @@ export class ApiKeyModel {
);
};
+ /** Metadata-only list for public API transports that must never reveal keys. */
+ queryMetadata = async () => {
+ return this.db.query.apiKeys.findMany({
+ orderBy: desc(apiKeys.updatedAt),
+ where: this.ownership(),
+ });
+ };
+
findByKey = async (key: string) => {
if (!validateApiKeyFormat(key)) return null;
diff --git a/packages/database/src/models/connector.ts b/packages/database/src/models/connector.ts
index d8c50946f95..99ab0f5cd7f 100644
--- a/packages/database/src/models/connector.ts
+++ b/packages/database/src/models/connector.ts
@@ -20,6 +20,25 @@ export interface ConnectorReference {
status: string;
}
+export interface PublicConnectorRecord {
+ agentId: string | null;
+ avatar: string | null;
+ createdAt: Date;
+ description: string | null;
+ hasCredentials: boolean;
+ id: string;
+ identifier: string;
+ isEnabled: boolean;
+ mcpConnectionType: string | null;
+ mcpServerUrl: string | null;
+ name: string;
+ sourceType: string;
+ status: string;
+ updatedAt: Date;
+ /** Row creator. Needed for row-level manage checks; never surfaced to API responses. */
+ userId: string;
+}
+
export interface ComposioConnectorReference extends ConnectorReference {
composio?: {
appSlug: string;
@@ -61,6 +80,24 @@ export class ConnectorModel {
*/
private baseScope = () => and(this.ownership(), isNull(userConnectors.agentId));
+ private publicSelection = {
+ agentId: userConnectors.agentId,
+ avatar: sql<string | null>`${userConnectors.metadata} ->> 'avatar'`,
+ createdAt: userConnectors.createdAt,
+ description: sql<string | null>`${userConnectors.metadata} ->> 'description'`,
+ hasCredentials: sql<boolean>`${userConnectors.credentials} IS NOT NULL`,
+ id: userConnectors.id,
+ identifier: userConnectors.identifier,
+ isEnabled: userConnectors.isEnabled,
+ mcpConnectionType: userConnectors.mcpConnectionType,
+ mcpServerUrl: userConnectors.mcpServerUrl,
+ name: userConnectors.name,
+ sourceType: userConnectors.sourceType,
+ status: userConnectors.status,
+ updatedAt: userConnectors.updatedAt,
+ userId: userConnectors.userId,
+ };
+
/**
* Candidate rows for agent-aware resolution within the current scope. For an
* agent this is:
@@ -194,6 +231,14 @@ export class ConnectorModel {
return Promise.all(rows.map((r) => decryptRow(r, gateKeeper)));
};
+ /**
+ * Query base-scope connector metadata without selecting or decrypting any
+ * credential/OIDC fields. Intended for public API and read-only inventory.
+ */
+ queryPublic = async (): Promise<PublicConnectorRecord[]> => {
+ return this.db.select(this.publicSelection).from(userConnectors).where(this.baseScope());
+ };
+
/**
* All connectors that belong to an agent's "Agent Tools" view: agent-OWNED
* rows (`agent_id = agentId` — Copy / Connect-new) plus base rows MOUNTED by
@@ -380,6 +425,19 @@ export class ConnectorModel {
return decryptRow(row, gateKeeper);
};
+ /**
+ * Find connector metadata without selecting or decrypting credentials.
+ */
+ findPublicById = async (id: string): Promise<PublicConnectorRecord | null> => {
+ const [row] = await this.db
+ .select(this.publicSelection)
+ .from(userConnectors)
+ .where(and(eq(userConnectors.id, id), this.ownership()))
+ .limit(1);
+
+ return row ?? null;
+ };
+
update = async (
id: string,
patch: UpdateConnectorParams,
diff --git a/packages/database/src/schemas/message.ts b/packages/database/src/schemas/message.ts
index b62c728c5bc..d9cb2bff56e 100644
--- a/packages/database/src/schemas/message.ts
+++ b/packages/database/src/schemas/message.ts
@@ -174,6 +174,8 @@ export const messages = pgTable(
],
);
+export type MessageItem = typeof messages.$inferSelect;
+
// if the message container a plugin
export const messagePlugins = pgTable(
'message_plugins',
diff --git a/packages/locales/src/default/auth.ts b/packages/locales/src/default/auth.ts
index 1dd478e4205..426acbbf868 100644
--- a/packages/locales/src/default/auth.ts
+++ b/packages/locales/src/default/auth.ts
@@ -59,7 +59,9 @@ export default {
'apikey.scopes.groups.chat': 'Chat',
'apikey.scopes.groups.file': 'Files',
'apikey.scopes.groups.knowledge': 'Knowledge',
+ 'apikey.scopes.groups.mcp': 'MCP servers',
'apikey.scopes.groups.model': 'Models',
+ 'apikey.scopes.groups.usage': 'Usage',
'apikey.scopes.groups.user': 'User',
'apikey.scopes.groups.workspace': 'Workspace',
'apikey.scopes.invoke': 'Invoke',
diff --git a/packages/openapi/openapi.yml b/packages/openapi/openapi.yml
index a9bc451d4d2..52be945369a 100644
--- a/packages/openapi/openapi.yml
+++ b/packages/openapi/openapi.yml
@@ -1,5 +1,951 @@
openapi: 3.1.0
components:
+ schemas:
+ ApiError:
+ additionalProperties: false
+ properties:
+ error:
+ type: string
+ success:
+ const: false
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - error
+ - success
+ - timestamp
+ type: object
+ ApiKey:
+ additionalProperties: false
+ properties:
+ createdAt:
+ format: date-time
+ type: string
+ enabled:
+ type:
+ - boolean
+ - "null"
+ expiresAt:
+ format: date-time
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ lastUsedAt:
+ format: date-time
+ type:
+ - string
+ - "null"
+ name:
+ type: string
+ scopes:
+ items:
+ enum:
+ - "*"
+ - agent:read
+ - agent:write
+ - chat:read
+ - chat:write
+ - model:invoke
+ - model:read
+ - model:write
+ - file:read
+ - file:write
+ - knowledge:read
+ - knowledge:write
+ - mcp:read
+ - mcp:write
+ - usage:read
+ - workspace:read
+ - workspace:write
+ - user:read
+ - user:write
+ type: string
+ type:
+ - array
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ required:
+ - id
+ - name
+ - createdAt
+ - updatedAt
+ type: object
+ Agent:
+ additionalProperties: false
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ chatConfig:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ createdAt:
+ format: date-time
+ type: string
+ description:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ model:
+ type:
+ - string
+ - "null"
+ params:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ provider:
+ type:
+ - string
+ - "null"
+ slug:
+ type:
+ - string
+ - "null"
+ systemRole:
+ type:
+ - string
+ - "null"
+ title:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ required:
+ - id
+ - createdAt
+ - updatedAt
+ type: object
+ AgentGroup:
+ additionalProperties: false
+ properties:
+ createdAt:
+ format: date-time
+ type: string
+ id:
+ type: string
+ name:
+ type: string
+ sort:
+ type:
+ - integer
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ required:
+ - id
+ - name
+ - createdAt
+ - updatedAt
+ type: object
+ ChatResponse:
+ additionalProperties: false
+ properties:
+ content:
+ type: string
+ model:
+ type:
+ - string
+ - "null"
+ provider:
+ type:
+ - string
+ - "null"
+ usage:
+ additionalProperties: false
+ properties:
+ completion_tokens:
+ type:
+ - integer
+ - "null"
+ prompt_tokens:
+ type:
+ - integer
+ - "null"
+ total_tokens:
+ type:
+ - integer
+ - "null"
+ type:
+ - object
+ - "null"
+ required:
+ - content
+ type: object
+ EvalRun:
+ additionalProperties: false
+ properties:
+ createdAt:
+ format: date-time
+ type: string
+ datasetId:
+ type: string
+ id:
+ type: string
+ metrics:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ name:
+ type:
+ - string
+ - "null"
+ startedAt:
+ format: date-time
+ type:
+ - string
+ - "null"
+ status:
+ enum:
+ - idle
+ - pending
+ - running
+ - completed
+ - failed
+ - aborted
+ - external
+ type: string
+ targetAgentId:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ required:
+ - id
+ - datasetId
+ - status
+ - createdAt
+ - updatedAt
+ type: object
+ EvalRunResult:
+ additionalProperties: false
+ properties:
+ createdAt:
+ format: date-time
+ type: string
+ input:
+ type: string
+ passed:
+ type:
+ - boolean
+ - "null"
+ result:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ score:
+ type:
+ - number
+ - "null"
+ status:
+ type:
+ - string
+ - "null"
+ testCaseId:
+ type: string
+ topicId:
+ type: string
+ required:
+ - testCaseId
+ - topicId
+ - input
+ - createdAt
+ type: object
+ File:
+ additionalProperties: true
+ properties:
+ createdAt:
+ format: date-time
+ type: string
+ fileType:
+ type: string
+ id:
+ type: string
+ metadata:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ name:
+ type: string
+ parentId:
+ type:
+ - string
+ - "null"
+ size:
+ type: integer
+ source:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ url:
+ type: string
+ visibility:
+ enum:
+ - private
+ - public
+ type: string
+ required:
+ - id
+ - fileType
+ - name
+ - size
+ - url
+ - createdAt
+ - updatedAt
+ type: object
+ KnowledgeBase:
+ additionalProperties: true
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ createdAt:
+ format: date-time
+ type: string
+ description:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ isPublic:
+ type:
+ - boolean
+ - "null"
+ name:
+ type: string
+ settings:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ type:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ visibility:
+ enum:
+ - private
+ - public
+ type: string
+ required:
+ - id
+ - name
+ - createdAt
+ - updatedAt
+ type: object
+ Message:
+ additionalProperties: true
+ properties:
+ agentId:
+ type:
+ - string
+ - "null"
+ content:
+ type:
+ - string
+ - "null"
+ createdAt:
+ format: date-time
+ type: string
+ error:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ favorite:
+ type:
+ - boolean
+ - "null"
+ id:
+ type: string
+ metadata:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ model:
+ type:
+ - string
+ - "null"
+ parentId:
+ type:
+ - string
+ - "null"
+ provider:
+ type:
+ - string
+ - "null"
+ reasoning:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ role:
+ type: string
+ search:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ threadId:
+ type:
+ - string
+ - "null"
+ tools:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ topicId:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ usage:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ required:
+ - id
+ - role
+ - createdAt
+ - updatedAt
+ type: object
+ McpServer:
+ additionalProperties: false
+ properties:
+ createdAt:
+ format: date-time
+ type: string
+ description:
+ type:
+ - string
+ - "null"
+ hasCredentials:
+ type: boolean
+ id:
+ format: uuid
+ type: string
+ identifier:
+ type: string
+ isEnabled:
+ type: boolean
+ name:
+ type: string
+ serverUrl:
+ format: uri
+ type: string
+ status:
+ enum:
+ - connected
+ - disconnected
+ - error
+ type: string
+ tools:
+ items:
+ additionalProperties: false
+ properties:
+ description:
+ type:
+ - string
+ - "null"
+ id:
+ format: uuid
+ type: string
+ inputSchema:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ name:
+ type: string
+ permission:
+ enum:
+ - auto
+ - needs_approval
+ - disabled
+ type: string
+ required:
+ - id
+ - name
+ - permission
+ type: object
+ type: array
+ updatedAt:
+ format: date-time
+ type: string
+ required:
+ - id
+ - identifier
+ - name
+ - serverUrl
+ - status
+ - isEnabled
+ - hasCredentials
+ - tools
+ - createdAt
+ - updatedAt
+ type: object
+ Model:
+ additionalProperties: false
+ properties:
+ abilities:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ config:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ contextWindowTokens:
+ type:
+ - integer
+ - "null"
+ createdAt:
+ format: date-time
+ type: string
+ description:
+ type:
+ - string
+ - "null"
+ displayName:
+ type:
+ - string
+ - "null"
+ enabled:
+ type:
+ - boolean
+ - "null"
+ id:
+ type: string
+ organization:
+ type:
+ - string
+ - "null"
+ parameters:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ pricing:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ providerId:
+ type: string
+ releasedAt:
+ type:
+ - string
+ - "null"
+ settings:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ sort:
+ type:
+ - integer
+ - "null"
+ source:
+ type:
+ - string
+ - "null"
+ type:
+ type: string
+ updatedAt:
+ format: date-time
+ type: string
+ required:
+ - id
+ - providerId
+ - type
+ - createdAt
+ - updatedAt
+ type: object
+ Permission:
+ additionalProperties: false
+ properties:
+ category:
+ type: string
+ code:
+ type: string
+ createdAt:
+ format: date-time
+ type: string
+ description:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ isActive:
+ type:
+ - boolean
+ - "null"
+ name:
+ type: string
+ updatedAt:
+ format: date-time
+ type: string
+ required:
+ - id
+ - code
+ - name
+ - category
+ - createdAt
+ - updatedAt
+ type: object
+ Provider:
+ additionalProperties: false
+ properties:
+ checkModel:
+ type:
+ - string
+ - "null"
+ config:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ createdAt:
+ format: date-time
+ type: string
+ description:
+ type:
+ - string
+ - "null"
+ enabled:
+ type:
+ - boolean
+ - "null"
+ fetchOnClient:
+ type:
+ - boolean
+ - "null"
+ id:
+ type: string
+ logo:
+ type:
+ - string
+ - "null"
+ name:
+ type:
+ - string
+ - "null"
+ settings:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ sort:
+ type:
+ - integer
+ - "null"
+ source:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ required:
+ - id
+ - createdAt
+ - updatedAt
+ type: object
+ Role:
+ additionalProperties: false
+ properties:
+ createdAt:
+ format: date-time
+ type: string
+ description:
+ type:
+ - string
+ - "null"
+ displayName:
+ type: string
+ id:
+ type: string
+ isActive:
+ type:
+ - boolean
+ - "null"
+ isSystem:
+ type:
+ - boolean
+ - "null"
+ name:
+ type: string
+ updatedAt:
+ format: date-time
+ type: string
+ required:
+ - id
+ - name
+ - displayName
+ - createdAt
+ - updatedAt
+ type: object
+ Topic:
+ additionalProperties: true
+ properties:
+ agentId:
+ type:
+ - string
+ - "null"
+ completedAt:
+ format: date-time
+ type:
+ - string
+ - "null"
+ content:
+ type:
+ - string
+ - "null"
+ cost:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ createdAt:
+ format: date-time
+ type: string
+ description:
+ type:
+ - string
+ - "null"
+ favorite:
+ type:
+ - boolean
+ - "null"
+ groupId:
+ type:
+ - string
+ - "null"
+ historySummary:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ metadata:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ mode:
+ type:
+ - string
+ - "null"
+ model:
+ type:
+ - string
+ - "null"
+ provider:
+ type:
+ - string
+ - "null"
+ sessionId:
+ type:
+ - string
+ - "null"
+ status:
+ type:
+ - string
+ - "null"
+ title:
+ type:
+ - string
+ - "null"
+ totalCost:
+ type:
+ - number
+ - "null"
+ totalInputTokens:
+ type:
+ - integer
+ - "null"
+ totalOutputTokens:
+ type:
+ - integer
+ - "null"
+ totalTokens:
+ type:
+ - integer
+ - "null"
+ trigger:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ usage:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ required:
+ - id
+ - createdAt
+ - updatedAt
+ type: object
+ User:
+ additionalProperties: true
+ properties:
+ avatar:
+ type:
+ - string
+ - "null"
+ createdAt:
+ format: date-time
+ type: string
+ email:
+ type:
+ - string
+ - "null"
+ firstName:
+ type:
+ - string
+ - "null"
+ fullName:
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ isOnboarded:
+ type:
+ - boolean
+ - "null"
+ lastName:
+ type:
+ - string
+ - "null"
+ phone:
+ type:
+ - string
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ username:
+ type:
+ - string
+ - "null"
+ required:
+ - id
+ - createdAt
+ - updatedAt
+ type: object
+ Usage:
+ additionalProperties: false
+ properties:
+ available:
+ type: boolean
+ currency:
+ const: USD
+ type: string
+ daily:
+ items:
+ additionalProperties: false
+ properties:
+ date:
+ type: string
+ value:
+ type: number
+ required:
+ - date
+ - value
+ type: object
+ type: array
+ period:
+ additionalProperties: false
+ properties:
+ since:
+ format: date-time
+ type: string
+ until:
+ format: date-time
+ type: string
+ required:
+ - since
+ - until
+ type: object
+ remainingBalance:
+ type:
+ - number
+ - "null"
+ scope:
+ enum:
+ - personal
+ - workspace
+ type: string
+ spent:
+ type: number
+ usageByType:
+ items:
+ additionalProperties: false
+ properties:
+ count:
+ type:
+ - integer
+ - "null"
+ spend:
+ type: number
+ type:
+ type: string
+ required:
+ - count
+ - spend
+ - type
+ type: object
+ type: array
+ required:
+ - available
+ - currency
+ - daily
+ - period
+ - remainingBalance
+ - scope
+ - spent
+ - usageByType
+ type: object
securitySchemes:
bearerAuth:
bearerFormat: API Key (sk-lh-...) or OIDC JWT
@@ -24,7 +970,67 @@ paths:
- health
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ service:
+ type: string
+ status:
+ const: ok
+ type: string
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - service
+ - status
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
/api/v1/agent-groups:
get:
operationId: getApiV1AgentGroups
@@ -33,7 +1039,70 @@ paths:
- agent-groups
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ items:
+ $ref: "#/components/schemas/AgentGroup"
+ type: array
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
post:
operationId: postApiV1AgentGroups
requestBody:
@@ -54,7 +1123,76 @@ paths:
- name
responses:
"200":
- description: Successful response (schema pending)
+ description: Response
+ "201":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ id:
+ type: string
+ required:
+ - id
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- agent-groups
/api/v1/agent-groups/{id}:
@@ -69,7 +1207,68 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/AgentGroup"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- agent-groups
patch:
@@ -99,7 +1298,68 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/AgentGroup"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- agent-groups
delete:
@@ -113,7 +1373,71 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- agent-groups
/api/v1/agents:
@@ -134,7 +1458,79 @@ paths:
type: string
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ properties:
+ agents:
+ items:
+ $ref: "#/components/schemas/Agent"
+ type: array
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - agents
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- agents
post:
@@ -389,7 +1785,68 @@ paths:
- title
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Agent"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- agents
/api/v1/agents/{id}:
@@ -404,7 +1861,68 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Agent"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- agents
patch:
@@ -664,7 +2182,68 @@ paths:
minLength: 1
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Agent"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- agents
delete:
@@ -678,9 +2257,1317 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- agents
+ /api/v1/api-keys:
+ get:
+ operationId: getApiV1ApiKeys
+ summary: List API keys
+ tags:
+ - api-keys
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ items:
+ $ref: "#/components/schemas/ApiKey"
+ type: array
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ post:
+ operationId: postApiV1ApiKeys
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ expiresAt:
+ anyOf:
+ - type: string
+ format: date-time
+ pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
+ - type: "null"
+ name:
+ type: string
+ minLength: 1
+ maxLength: 256
+ scopes:
+ anyOf:
+ - minItems: 1
+ type: array
+ items:
+ type: string
+ enum:
+ - "*"
+ - agent:read
+ - agent:write
+ - chat:read
+ - chat:write
+ - model:invoke
+ - model:read
+ - model:write
+ - file:read
+ - file:write
+ - knowledge:read
+ - knowledge:write
+ - mcp:read
+ - mcp:write
+ - usage:read
+ - workspace:read
+ - workspace:write
+ - user:read
+ - user:write
+ - type: "null"
+ required:
+ - name
+ additionalProperties: false
+ responses:
+ "200":
+ description: Response
+ "201":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ createdAt:
+ format: date-time
+ type: string
+ enabled:
+ type:
+ - boolean
+ - "null"
+ expiresAt:
+ format: date-time
+ type:
+ - string
+ - "null"
+ id:
+ type: string
+ lastUsedAt:
+ format: date-time
+ type:
+ - string
+ - "null"
+ name:
+ type: string
+ scopes:
+ items:
+ enum:
+ - "*"
+ - agent:read
+ - agent:write
+ - chat:read
+ - chat:write
+ - model:invoke
+ - model:read
+ - model:write
+ - file:read
+ - file:write
+ - knowledge:read
+ - knowledge:write
+ - mcp:read
+ - mcp:write
+ - usage:read
+ - workspace:read
+ - workspace:write
+ - user:read
+ - user:write
+ type: string
+ type:
+ - array
+ - "null"
+ updatedAt:
+ format: date-time
+ type: string
+ key:
+ type: string
+ required:
+ - id
+ - name
+ - key
+ - createdAt
+ - updatedAt
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - api-keys
+ /api/v1/api-keys/{id}:
+ get:
+ operationId: getApiV1ApiKeysById
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 16
+ maxLength: 16
+ required: true
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/ApiKey"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - api-keys
+ patch:
+ operationId: patchApiV1ApiKeysById
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 16
+ maxLength: 16
+ required: true
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ enabled:
+ type: boolean
+ expiresAt:
+ anyOf:
+ - type: string
+ format: date-time
+ pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
+ - type: "null"
+ name:
+ type: string
+ minLength: 1
+ maxLength: 256
+ additionalProperties: false
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/ApiKey"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - api-keys
+ delete:
+ operationId: deleteApiV1ApiKeysById
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 16
+ maxLength: 16
+ required: true
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - api-keys
+ /api/v1/chat:
+ post:
+ operationId: postApiV1Chat
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ frequency_penalty:
+ type: number
+ minimum: -2
+ maximum: 2
+ max_tokens:
+ anyOf:
+ - type: integer
+ minimum: 1
+ maximum: 1000000
+ - type: "null"
+ messages:
+ minItems: 1
+ maxItems: 1000
+ type: array
+ items:
+ type: object
+ properties:
+ content:
+ type: string
+ minLength: 1
+ maxLength: 1000000
+ role:
+ type: string
+ enum:
+ - user
+ - assistant
+ - system
+ required:
+ - content
+ - role
+ model:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 150
+ - type: "null"
+ presence_penalty:
+ type: number
+ minimum: -2
+ maximum: 2
+ provider:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 64
+ - type: "null"
+ stream:
+ anyOf:
+ - type: boolean
+ - type: "null"
+ temperature:
+ anyOf:
+ - type: number
+ minimum: 0
+ maximum: 2
+ - type: "null"
+ top_p:
+ type: number
+ minimum: 0
+ maximum: 1
+ required:
+ - messages
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/ChatResponse"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - chat
+ /api/v1/chat/translate:
+ post:
+ operationId: postApiV1ChatTranslate
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ from:
+ type: string
+ minLength: 1
+ maxLength: 32
+ model:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 150
+ - type: "null"
+ provider:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 64
+ - type: "null"
+ text:
+ type: string
+ minLength: 1
+ maxLength: 1000000
+ to:
+ type: string
+ minLength: 1
+ maxLength: 32
+ required:
+ - text
+ - to
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ translatedText:
+ type: string
+ required:
+ - translatedText
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - chat
+ /api/v1/chat/generate-reply:
+ post:
+ operationId: postApiV1ChatGenerateReply
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ agentId:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 64
+ - type: "null"
+ chatConfig:
+ anyOf:
+ - type: object
+ properties:
+ disableContextCaching:
+ anyOf:
+ - type: boolean
+ - type: "null"
+ displayMode:
+ anyOf:
+ - type: string
+ enum:
+ - chat
+ - docs
+ - type: "null"
+ enableCompressHistory:
+ anyOf:
+ - type: boolean
+ - type: "null"
+ enableHistoryCount:
+ anyOf:
+ - type: boolean
+ - type: "null"
+ enableMaxTokens:
+ anyOf:
+ - type: boolean
+ - type: "null"
+ enableReasoning:
+ anyOf:
+ - type: boolean
+ - type: "null"
+ enableReasoningEffort:
+ anyOf:
+ - type: boolean
+ - type: "null"
+ historyCount:
+ anyOf:
+ - type: integer
+ minimum: 0
+ maximum: 1000
+ - type: "null"
+ inputTemplate:
+ anyOf:
+ - type: string
+ maxLength: 100000
+ - type: "null"
+ reasoningBudgetToken:
+ anyOf:
+ - type: integer
+ minimum: 0
+ maximum: 1000000
+ - type: "null"
+ reasoningEffort:
+ anyOf:
+ - type: string
+ enum:
+ - low
+ - medium
+ - high
+ - type: "null"
+ searchMode:
+ anyOf:
+ - type: string
+ enum:
+ - off
+ - on
+ - auto
+ - type: "null"
+ thinkingBudget:
+ anyOf:
+ - type: integer
+ minimum: 0
+ maximum: 1000000
+ - type: "null"
+ useModelBuiltinSearch:
+ anyOf:
+ - type: boolean
+ - type: "null"
+ - type: "null"
+ conversationHistory:
+ maxItems: 1000
+ type: array
+ items:
+ type: object
+ properties:
+ content:
+ type: string
+ minLength: 1
+ maxLength: 1000000
+ role:
+ type: string
+ enum:
+ - user
+ - assistant
+ - system
+ required:
+ - content
+ - role
+ model:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 150
+ - type: "null"
+ provider:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 64
+ - type: "null"
+ sessionId:
+ anyOf:
+ - type: string
+ minLength: 1
+ maxLength: 64
+ - type: "null"
+ userMessage:
+ type: string
+ minLength: 1
+ maxLength: 1000000
+ required:
+ - conversationHistory
+ - sessionId
+ - userMessage
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ reply:
+ type: string
+ required:
+ - reply
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - chat
+ /api/v1/eval/runs:
+ post:
+ operationId: postApiV1EvalRuns
+ description: Queues an asynchronous QStash-backed evaluation run and returns
+ immediately.
+ summary: Create an eval run
+ tags:
+ - eval
+ responses:
+ "202":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/EvalRun"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ config:
+ type: object
+ properties:
+ k:
+ type: integer
+ minimum: 1
+ maximum: 10
+ maxSteps:
+ type: integer
+ minimum: 1
+ maximum: 1000
+ timeout:
+ type: integer
+ minimum: 60000
+ maximum: 21600000
+ additionalProperties: false
+ datasetId:
+ type: string
+ minLength: 1
+ maxLength: 128
+ id:
+ type: string
+ minLength: 1
+ maxLength: 128
+ name:
+ type: string
+ minLength: 1
+ maxLength: 255
+ targetAgentId:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required:
+ - datasetId
+ - targetAgentId
+ additionalProperties: false
+ /api/v1/eval/runs/{id}:
+ get:
+ operationId: getApiV1EvalRunsById
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required: true
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/EvalRun"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - eval
+ /api/v1/eval/runs/{id}/results:
+ get:
+ operationId: getApiV1EvalRunsByIdResults
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ minLength: 1
+ maxLength: 128
+ required: true
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ results:
+ items:
+ $ref: "#/components/schemas/EvalRunResult"
+ type: array
+ runId:
+ type: string
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - runId
+ - total
+ - results
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - eval
/api/v1/files:
get:
operationId: getApiV1Files
@@ -727,7 +3614,79 @@ paths:
type: string
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ properties:
+ files:
+ items:
+ $ref: "#/components/schemas/File"
+ type: array
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - files
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- files
post:
@@ -750,7 +3709,7 @@ paths:
type: string
skipCheckFileType:
type: boolean
- skipExist:
+ skipDeduplication:
type: boolean
required:
- file
@@ -761,7 +3720,76 @@ paths:
- files
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ file:
+ $ref: "#/components/schemas/File"
+ parsed:
+ type: object
+ required:
+ - file
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
/api/v1/files/{id}:
get:
operationId: getApiV1FilesById
@@ -774,7 +3802,76 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ file:
+ $ref: "#/components/schemas/File"
+ parsed:
+ type: object
+ required:
+ - file
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- files
patch:
@@ -799,7 +3896,68 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/File"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- files
delete:
@@ -813,7 +3971,71 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- files
/api/v1/files/{id}/url:
@@ -834,7 +4056,69 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- files
/api/v1/files/{id}/parses:
@@ -855,7 +4139,69 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- files
/api/v1/files/{id}/chunks:
@@ -881,7 +4227,69 @@ paths:
type: boolean
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- files
get:
@@ -895,7 +4303,69 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- files
/api/v1/files/batches:
@@ -914,6 +4384,8 @@ paths:
items:
format: binary
type: string
+ maxItems: 20
+ minItems: 1
type: array
knowledgeBaseId:
type: string
@@ -921,8 +4393,6 @@ paths:
type: string
skipCheckFileType:
type: boolean
- skipExist:
- type: boolean
required:
- files
type: object
@@ -932,7 +4402,116 @@ paths:
- files
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ failed:
+ items:
+ additionalProperties: false
+ properties:
+ error:
+ type: string
+ name:
+ type: string
+ required:
+ - error
+ - name
+ type: object
+ type: array
+ successful:
+ items:
+ additionalProperties: false
+ properties:
+ file:
+ $ref: "#/components/schemas/File"
+ parsed:
+ type: object
+ required:
+ - file
+ type: object
+ type: array
+ summary:
+ additionalProperties: false
+ properties:
+ failed:
+ minimum: 0
+ type: integer
+ successful:
+ minimum: 0
+ type: integer
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - failed
+ - successful
+ - total
+ type: object
+ required:
+ - failed
+ - successful
+ - summary
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
/api/v1/files/queries:
post:
operationId: postApiV1FilesQueries
@@ -953,7 +4532,106 @@ paths:
- fileIds
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ failed:
+ items:
+ additionalProperties: false
+ properties:
+ error:
+ type: string
+ fileId:
+ type: string
+ required:
+ - error
+ - fileId
+ type: object
+ type: array
+ files:
+ items:
+ additionalProperties: false
+ properties:
+ file:
+ $ref: "#/components/schemas/File"
+ parsed:
+ type: object
+ required:
+ - file
+ type: object
+ type: array
+ success:
+ minimum: 0
+ type: integer
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - failed
+ - files
+ - success
+ - total
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- files
/api/v1/knowledge-bases:
@@ -974,7 +4652,79 @@ paths:
type: string
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ properties:
+ knowledgeBases:
+ items:
+ $ref: "#/components/schemas/KnowledgeBase"
+ type: array
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - knowledgeBases
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- knowledge-bases
post:
@@ -1000,7 +4750,68 @@ paths:
- name
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/KnowledgeBase"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- knowledge-bases
/api/v1/knowledge-bases/{id}:
@@ -1015,7 +4826,68 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/KnowledgeBase"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- knowledge-bases
patch:
@@ -1046,7 +4918,68 @@ paths:
maxLength: 255
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/KnowledgeBase"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- knowledge-bases
delete:
@@ -1060,7 +4993,71 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- knowledge-bases
/api/v1/knowledge-bases/{id}/files:
@@ -1093,7 +5090,69 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- knowledge-bases
/api/v1/knowledge-bases/{id}/files/batch:
@@ -1123,7 +5182,69 @@ paths:
- fileIds
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- knowledge-bases
delete:
@@ -1152,7 +5273,71 @@ paths:
- fileIds
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- knowledge-bases
/api/v1/knowledge-bases/{id}/files/move:
@@ -1186,9 +5371,685 @@ paths:
- targetKnowledgeBaseId
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- knowledge-bases
+ /api/v1/mcp-servers:
+ get:
+ operationId: getApiV1McpServers
+ summary: List remote MCP servers
+ tags:
+ - mcp-servers
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ items:
+ $ref: "#/components/schemas/McpServer"
+ type: array
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ post:
+ operationId: postApiV1McpServers
+ summary: Add a remote MCP server
+ tags:
+ - mcp-servers
+ responses:
+ "201":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/McpServer"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ credentials:
+ oneOf:
+ - type: object
+ properties:
+ token:
+ type: string
+ minLength: 1
+ maxLength: 10000
+ type:
+ type: string
+ const: bearer
+ required:
+ - token
+ - type
+ additionalProperties: false
+ - type: object
+ properties:
+ apiKey:
+ type: string
+ minLength: 1
+ maxLength: 10000
+ type:
+ type: string
+ const: apikey
+ required:
+ - apiKey
+ - type
+ additionalProperties: false
+ - type: object
+ properties:
+ headers:
+ type: object
+ propertyNames:
+ type: string
+ minLength: 1
+ maxLength: 256
+ additionalProperties:
+ type: string
+ maxLength: 10000
+ type:
+ type: string
+ const: header
+ required:
+ - headers
+ - type
+ additionalProperties: false
+ description:
+ type: string
+ maxLength: 2000
+ identifier:
+ type: string
+ minLength: 1
+ maxLength: 255
+ pattern: ^[a-z\d](?:[\w-]*[a-z\d])?$
+ isEnabled:
+ default: true
+ type: boolean
+ name:
+ type: string
+ minLength: 1
+ maxLength: 255
+ serverUrl:
+ type: string
+ maxLength: 2048
+ format: uri
+ required:
+ - identifier
+ - name
+ - serverUrl
+ additionalProperties: false
+ /api/v1/mcp-servers/{id}:
+ get:
+ operationId: getApiV1McpServersById
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ format: uuid
+ pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
+ required: true
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/McpServer"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - mcp-servers
+ patch:
+ operationId: patchApiV1McpServersById
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ format: uuid
+ pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
+ required: true
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ credentials:
+ anyOf:
+ - oneOf:
+ - type: object
+ properties:
+ token:
+ type: string
+ minLength: 1
+ maxLength: 10000
+ type:
+ type: string
+ const: bearer
+ required:
+ - token
+ - type
+ additionalProperties: false
+ - type: object
+ properties:
+ apiKey:
+ type: string
+ minLength: 1
+ maxLength: 10000
+ type:
+ type: string
+ const: apikey
+ required:
+ - apiKey
+ - type
+ additionalProperties: false
+ - type: object
+ properties:
+ headers:
+ type: object
+ propertyNames:
+ type: string
+ minLength: 1
+ maxLength: 256
+ additionalProperties:
+ type: string
+ maxLength: 10000
+ type:
+ type: string
+ const: header
+ required:
+ - headers
+ - type
+ additionalProperties: false
+ - type: "null"
+ description:
+ anyOf:
+ - type: string
+ maxLength: 2000
+ - type: "null"
+ isEnabled:
+ type: boolean
+ name:
+ type: string
+ minLength: 1
+ maxLength: 255
+ serverUrl:
+ type: string
+ maxLength: 2048
+ format: uri
+ additionalProperties: false
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/McpServer"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - mcp-servers
+ delete:
+ operationId: deleteApiV1McpServersById
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ format: uuid
+ pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
+ required: true
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ tags:
+ - mcp-servers
+ /api/v1/mcp-servers/{id}/sync:
+ post:
+ operationId: postApiV1McpServersByIdSync
+ summary: Discover and sync MCP tools
+ tags:
+ - mcp-servers
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ id:
+ format: uuid
+ type: string
+ status:
+ const: connected
+ type: string
+ toolCount:
+ minimum: 0
+ type: integer
+ required:
+ - id
+ - status
+ - toolCount
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
+ parameters:
+ - in: path
+ name: id
+ schema:
+ type: string
+ format: uuid
+ pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
+ required: true
/api/v1/message-translations/{messageId}:
post:
operationId: postApiV1MessageTranslationsByMessageId
@@ -1223,7 +6084,69 @@ paths:
- to
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- message-translations
get:
@@ -1237,7 +6160,69 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- message-translations
patch:
@@ -1275,7 +6260,69 @@ paths:
- to
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- message-translations
delete:
@@ -1289,7 +6336,69 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- message-translations
/api/v1/messages/count:
@@ -1310,7 +6419,75 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: false
+ properties:
+ count:
+ minimum: 0
+ type: integer
+ required:
+ - count
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- messages
/api/v1/messages:
@@ -1354,7 +6531,79 @@ paths:
type: string
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ properties:
+ messages:
+ items:
+ $ref: "#/components/schemas/Message"
+ type: array
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - messages
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- messages
post:
@@ -1462,7 +6711,68 @@ paths:
- role
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Message"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- messages
delete:
@@ -1484,7 +6794,71 @@ paths:
- messageIds
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- messages
/api/v1/messages/{id}:
@@ -1499,7 +6873,68 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Message"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- messages
delete:
@@ -1513,7 +6948,71 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- messages
/api/v1/messages/replies:
@@ -1618,7 +7117,70 @@ paths:
- role
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ anyOf:
+ - $ref: "#/components/schemas/Message"
+ - type: "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- messages
/api/v1/models:
@@ -1669,7 +7231,79 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ properties:
+ models:
+ items:
+ $ref: "#/components/schemas/Model"
+ type: array
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - models
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- models
post:
@@ -1776,7 +7410,68 @@ paths:
- providerId
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Model"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- models
/api/v1/models/{providerId}/{modelId}:
@@ -1799,7 +7494,69 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- models
patch:
@@ -1909,7 +7666,69 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- models
/api/v1/permissions:
@@ -1943,7 +7762,79 @@ paths:
type: string
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ properties:
+ permissions:
+ items:
+ $ref: "#/components/schemas/Permission"
+ type: array
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - permissions
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- permissions
post:
@@ -1979,7 +7870,68 @@ paths:
- name
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Permission"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- permissions
/api/v1/permissions/{id}:
@@ -1995,7 +7947,68 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Permission"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- permissions
patch:
@@ -2035,7 +8048,68 @@ paths:
minLength: 1
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Permission"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- permissions
delete:
@@ -2050,7 +8124,71 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- permissions
/api/v1/providers:
@@ -2075,7 +8213,79 @@ paths:
type: boolean
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ properties:
+ providers:
+ items:
+ $ref: "#/components/schemas/Provider"
+ type: array
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - providers
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- providers
post:
@@ -2144,7 +8354,68 @@ paths:
- id
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Provider"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- providers
/api/v1/providers/{id}:
@@ -2160,7 +8431,68 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Provider"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- providers
patch:
@@ -2234,7 +8566,68 @@ paths:
- custom
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Provider"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- providers
delete:
@@ -2249,7 +8642,71 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- providers
/api/v1/responses:
@@ -2522,7 +8979,78 @@ paths:
additionalProperties: {}
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: true
+ properties:
+ id:
+ type: string
+ object:
+ const: response
+ type: string
+ output:
+ items:
+ type: object
+ type: array
+ status:
+ type: string
+ usage:
+ type:
+ - object
+ - "null"
+ required:
+ - id
+ - object
+ - output
+ - status
+ type: object
+ text/event-stream:
+ schema:
+ type: string
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- responses
/api/v1/roles:
@@ -2555,7 +9083,79 @@ paths:
type: string
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ properties:
+ roles:
+ items:
+ $ref: "#/components/schemas/Role"
+ type: array
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - roles
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- roles
post:
@@ -2592,7 +9192,68 @@ paths:
- name
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Role"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- roles
/api/v1/roles/{id}:
@@ -2607,7 +9268,68 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Role"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- roles
patch:
@@ -2648,7 +9370,68 @@ paths:
minLength: 1
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Role"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- roles
delete:
@@ -2662,7 +9445,71 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- roles
/api/v1/roles/{id}/permissions:
@@ -2689,7 +9536,69 @@ paths:
type: string
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- roles
patch:
@@ -2724,7 +9633,69 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- roles
delete:
@@ -2738,7 +9709,71 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- roles
/api/v1/topics:
@@ -2787,7 +9822,79 @@ paths:
type: string
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ properties:
+ topics:
+ items:
+ $ref: "#/components/schemas/Topic"
+ type: array
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - topics
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- topics
post:
@@ -2818,7 +9925,68 @@ paths:
- title
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Topic"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- topics
/api/v1/topics/{id}:
@@ -2833,7 +10001,68 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Topic"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- topics
patch:
@@ -2872,7 +10101,68 @@ paths:
minLength: 1
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Topic"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- topics
delete:
@@ -2886,7 +10176,71 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- topics
/api/v1/users/me:
@@ -2897,7 +10251,76 @@ paths:
- users
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ anyOf:
+ - $ref: "#/components/schemas/User"
+ - additionalProperties: false
+ properties:
+ id:
+ type: string
+ required:
+ - id
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
/api/v1/users:
get:
operationId: getApiV1Users
@@ -2916,7 +10339,79 @@ paths:
type: string
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ properties:
+ users:
+ items:
+ $ref: "#/components/schemas/User"
+ type: array
+ total:
+ minimum: 0
+ type: integer
+ required:
+ - users
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- users
post:
@@ -2972,7 +10467,68 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/User"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- users
/api/v1/users/{id}:
@@ -2987,7 +10543,68 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/User"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- users
patch:
@@ -3054,7 +10671,68 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/User"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- users
delete:
@@ -3068,7 +10746,71 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- users
/api/v1/users/{id}/roles:
@@ -3083,7 +10825,69 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- users
patch:
@@ -3129,7 +10933,69 @@ paths:
- type: "null"
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type: object
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- users
delete:
@@ -3143,6 +11009,140 @@ paths:
required: true
responses:
"200":
- description: Successful response (schema pending)
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ additionalProperties: true
+ type:
+ - object
+ - "null"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
tags:
- users
+ /api/v1/usage:
+ get:
+ operationId: getApiV1Usage
+ summary: Get usage and quota summary
+ tags:
+ - usage
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ additionalProperties: false
+ properties:
+ data:
+ $ref: "#/components/schemas/Usage"
+ message:
+ type: string
+ success:
+ const: true
+ type: boolean
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - success
+ - timestamp
+ type: object
+ description: Successful response
+ "400":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Invalid request
+ "401":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Authentication required
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Insufficient permission
+ "404":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource not found
+ "409":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Resource conflict
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Rate limit exceeded
+ "500":
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ApiError"
+ description: Internal server error
diff --git a/packages/openapi/scripts/generate-openapi.test.ts b/packages/openapi/scripts/generate-openapi.test.ts
index b554053fd7f..89a7b4c00f8 100644
--- a/packages/openapi/scripts/generate-openapi.test.ts
+++ b/packages/openapi/scripts/generate-openapi.test.ts
@@ -33,23 +33,55 @@ describe('generate-openapi', () => {
expect(spec.openapi).toBe('3.1.0');
expect(spec.info.title).toBe('LobeHub API');
expect(spec.components.securitySchemes.bearerAuth.scheme).toBe('bearer');
+ expect(spec.components.schemas.Agent.additionalProperties).toBe(false);
+ expect(spec.components.schemas.Agent.properties).not.toHaveProperty('clientId');
+ expect(spec.components.schemas.Agent.properties).not.toHaveProperty('marketIdentifier');
+ expect(spec.components.schemas.Agent.properties).not.toHaveProperty('userId');
+ expect(spec.components.schemas.Agent.properties).not.toHaveProperty('workspaceId');
+ expect(spec.components.schemas.Provider.properties).not.toHaveProperty('keyVaults');
+ expect(spec.components.schemas.ChatResponse.additionalProperties).toBe(false);
+ expect(spec.components.schemas.McpServer.properties).not.toHaveProperty('credentials');
+ expect(spec.components.schemas.McpServer.properties).not.toHaveProperty('oidcConfig');
+ expect(spec.components.schemas.ApiKey.properties.scopes.items.enum).toEqual(
+ expect.arrayContaining(['mcp:read', 'mcp:write', 'usage:read']),
+ );
+ expect(
+ spec.paths['/api/v1/api-keys'].post.requestBody.content['application/json'].schema.properties
+ .scopes.anyOf[0].items.enum,
+ ).toEqual(expect.arrayContaining(['mcp:read', 'mcp:write', 'usage:read']));
+ expect(spec.paths['/api/v1/chat'].post.responses['200'].content).toBeTruthy();
+ expect(spec.paths['/api/v1/chat/translate'].post.responses['200'].content).toBeTruthy();
+ expect(spec.paths['/api/v1/chat/generate-reply'].post.responses['200'].content).toBeTruthy();
const operations = Object.values(spec.paths as Record<string, object>).flatMap((item) =>
Object.keys(item).filter((method) =>
['delete', 'get', 'patch', 'post', 'put'].includes(method),
),
);
- // 78 business endpoints + /health; grows as routes are added.
- expect(operations.length).toBeGreaterThanOrEqual(79);
+ // Business endpoints + /health; grows as routes are added.
+ expect(operations.length).toBeGreaterThanOrEqual(97);
// Every response object must carry a description (required by OpenAPI).
for (const item of Object.values(spec.paths as Record<string, Record<string, any>>)) {
for (const op of Object.values(item)) {
if (!op.responses) continue;
+ expect(
+ op.responses['200']?.content ??
+ op.responses['201']?.content ??
+ op.responses['202']?.content,
+ ).toBeTruthy();
+ expect(op.responses['400']?.content).toBeTruthy();
+ expect(op.responses['401']?.content).toBeTruthy();
+ expect(op.responses['403']?.content).toBeTruthy();
+ expect(op.responses['404']?.content).toBeTruthy();
+ expect(op.responses['409']?.content).toBeTruthy();
+ expect(op.responses['429']?.content).toBeTruthy();
+ expect(op.responses['500']?.content).toBeTruthy();
for (const response of Object.values(
op.responses as Record<string, { description?: string }>,
)) {
expect(response.description).toBeTruthy();
+ expect(response.description).not.toContain('schema pending');
}
}
}
diff --git a/packages/openapi/src/common/base.controller.test.ts b/packages/openapi/src/common/base.controller.test.ts
new file mode 100644
index 00000000000..ed1e990bfc1
--- /dev/null
+++ b/packages/openapi/src/common/base.controller.test.ts
@@ -0,0 +1,38 @@
+import type { Context } from 'hono';
+import { Hono } from 'hono';
+import { describe, expect, it, vi } from 'vitest';
+
+import { BaseController } from './base.controller';
+
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: vi.fn().mockResolvedValue({}) }));
+
+class TestController extends BaseController {
+ respond(c: Context, error: Error) {
+ return this.handleError(c, error);
+ }
+}
+
+const requestError = async (name: string) => {
+ const app = new Hono();
+ app.get('/', (c) => {
+ const error = new Error('test error');
+ error.name = name;
+ return new TestController().respond(c, error);
+ });
+ return app.request('/');
+};
+
+describe('BaseController.handleError', () => {
+ it.each([
+ ['BusinessError', 400],
+ ['ValidationError', 400],
+ ['AuthenticationError', 401],
+ ['AuthorizationError', 403],
+ ['NotFoundError', 404],
+ ['ConflictError', 409],
+ ])('maps %s to HTTP %i', async (name, status) => {
+ const response = await requestError(name as string);
+ expect(response.status).toBe(status);
+ await expect(response.json()).resolves.toMatchObject({ error: 'test error', success: false });
+ });
+});
diff --git a/packages/openapi/src/common/base.controller.ts b/packages/openapi/src/common/base.controller.ts
index 333d5cd5c42..fcfd4b7e10d 100644
--- a/packages/openapi/src/common/base.controller.ts
+++ b/packages/openapi/src/common/base.controller.ts
@@ -34,7 +34,7 @@ export abstract class BaseController {
* @param message Response message
* @returns Formatted success response
*/
- protected success<T>(c: Context, data?: T, message?: string): Response {
+ protected success<T>(c: Context, data?: T, message?: string, statusCode: number = 200): Response {
const response: ApiResponse<T> = {
data,
message,
@@ -42,7 +42,7 @@ export abstract class BaseController {
timestamp: new Date().toISOString(),
};
- return c.json(response);
+ return c.json(response, statusCode as any);
}
/**
@@ -93,11 +93,19 @@ export abstract class BaseController {
return this.error(c, error.message, 403);
}
+ if (error.name === 'ConflictError') {
+ return this.error(c, error.message, 409);
+ }
+
// Handle not found errors
if (error.name === 'NotFoundError') {
return this.error(c, error.message, 404);
}
+ if (error.name === 'ValidationError') {
+ return this.error(c, error.message, 400);
+ }
+
// Other errors
return this.error(c, error.message, 500);
}
diff --git a/packages/openapi/src/common/base.service.ts b/packages/openapi/src/common/base.service.ts
index d58c1126f3e..d832a5610e1 100644
--- a/packages/openapi/src/common/base.service.ts
+++ b/packages/openapi/src/common/base.service.ts
@@ -91,6 +91,15 @@ export abstract class BaseService implements IBaseService {
return error;
}
+ /**
+ * Conflict error class
+ */
+ protected createConflictError(message: string): Error {
+ const error = new Error(message);
+ error.name = 'ConflictError';
+ return error;
+ }
+
/**
* Not found error class
*/
@@ -132,6 +141,7 @@ export abstract class BaseService implements IBaseService {
'BusinessError',
'AuthenticationError',
'AuthorizationError',
+ 'ConflictError',
'NotFoundError',
'ValidationError',
].includes(error.name)
@@ -202,6 +212,31 @@ export abstract class BaseService implements IBaseService {
});
}
+ /**
+ * Row-level creator check for workspace-shared rows, mirroring the tRPC
+ * routers' `assertWorkspaceRowManageable`. Model ownership predicates are
+ * workspace-wide, so a role gate alone lets any member mutate rows created by
+ * someone else. Callers holding the `:all` scope keep managing every row.
+ *
+ * @param rowUserId - `userId` of the row being mutated
+ * @param permissionKey - permission whose `:all` scope grants workspace-wide management
+ * @param resource - resource name used in the error message
+ */
+ protected async assertRowManageable(
+ rowUserId: string | null | undefined,
+ permissionKey: keyof typeof PERMISSION_ACTIONS,
+ resource: string,
+ ): Promise<void> {
+ // Personal mode: the model's ownership filter already scopes rows to the caller.
+ if (!this.workspaceId) return;
+ if (await this.hasGlobalPermission(permissionKey)) return;
+ if (rowUserId !== this.userId) {
+ throw this.createAuthorizationError(
+ `Only the creator or a workspace owner can modify this ${resource}`,
+ );
+ }
+ }
+
/**
* Get the user ID that a resource belongs to
* @param target Target resource condition. If not provided, defaults to current user scope. If ALL is passed, returns full data query.
diff --git a/packages/openapi/src/common/validator.test.ts b/packages/openapi/src/common/validator.test.ts
new file mode 100644
index 00000000000..630cfbf4756
--- /dev/null
+++ b/packages/openapi/src/common/validator.test.ts
@@ -0,0 +1,22 @@
+import { Hono } from 'hono';
+import { describe, expect, it } from 'vitest';
+import { z } from 'zod';
+
+import { zValidator } from './validator';
+
+describe('zValidator', () => {
+ it('returns the shared public error envelope for invalid input', async () => {
+ const app = new Hono();
+ app.get('/', zValidator('query', z.object({ page: z.coerce.number().int().min(1) })), (c) =>
+ c.json({ success: true }),
+ );
+
+ const response = await app.request('/?page=0');
+ const body = await response.json();
+
+ expect(response.status).toBe(400);
+ expect(body).toMatchObject({ success: false });
+ expect(body.error).toEqual(expect.any(String));
+ expect(new Date(body.timestamp).toISOString()).toBe(body.timestamp);
+ });
+});
diff --git a/packages/openapi/src/common/validator.ts b/packages/openapi/src/common/validator.ts
index 93b9084a66d..00cc4654b58 100644
--- a/packages/openapi/src/common/validator.ts
+++ b/packages/openapi/src/common/validator.ts
@@ -5,20 +5,18 @@ import { validator } from 'hono-openapi';
* `hono-openapi`'s validator so every request schema is registered into the
* generated OpenAPI spec (see `scripts/generate-openapi.ts`).
*
- * The failure hook reproduces `@hono/zod-validator`'s default 400 response
- * shape (`{ success: false, error: { name: 'ZodError', message } }`) so the
- * swap is invisible to API consumers.
+ * Validation failures use the same public error envelope as controller errors.
+ * Keeping `error` a string and including `timestamp` makes runtime responses
+ * conform to the shared `ApiError` schema advertised by the generated spec.
*/
export const zValidator = ((target: never, schema: never) =>
validator(target, schema, (result, c) => {
if (!result.success) {
return c.json(
{
- error: {
- message: JSON.stringify(result.error, null, 2),
- name: 'ZodError',
- },
+ error: JSON.stringify(result.error, null, 2),
success: false,
+ timestamp: new Date().toISOString(),
},
400,
);
diff --git a/packages/openapi/src/controllers/agent-group.controller.ts b/packages/openapi/src/controllers/agent-group.controller.ts
index 29681da3ea3..b5c39a97b42 100644
--- a/packages/openapi/src/controllers/agent-group.controller.ts
+++ b/packages/openapi/src/controllers/agent-group.controller.ts
@@ -85,15 +85,7 @@ export class AgentGroupController extends BaseController {
);
const groupId = await agentGroupService.createAgentGroup(body);
- return c.json(
- {
- data: { id: groupId },
- message: 'Agent category created successfully',
- success: true,
- timestamp: new Date().toISOString(),
- },
- 201,
- );
+ return this.success(c, { id: groupId }, 'Agent category created successfully', 201);
} catch (error) {
return this.handleError(c, error);
}
diff --git a/packages/openapi/src/controllers/api-key.controller.ts b/packages/openapi/src/controllers/api-key.controller.ts
new file mode 100644
index 00000000000..c623af70dff
--- /dev/null
+++ b/packages/openapi/src/controllers/api-key.controller.ts
@@ -0,0 +1,62 @@
+import type { Context } from 'hono';
+
+import { BaseController } from '../common/base.controller';
+import { ApiKeyService } from '../services/api-key.service';
+import type { CreateApiKeyRequest, UpdateApiKeyRequest } from '../types/api-key.type';
+
+export class ApiKeyController extends BaseController {
+ private async getService(c: Context) {
+ const db = await this.getDatabase();
+ return new ApiKeyService(db, this.getUserId(c)!, this.getWorkspaceId(c));
+ }
+
+ async createApiKey(c: Context) {
+ try {
+ const service = await this.getService(c);
+ const result = await service.createApiKey((await this.getBody<CreateApiKeyRequest>(c))!);
+ return this.success(c, result, 'API key created', 201);
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async getApiKeys(c: Context) {
+ try {
+ const service = await this.getService(c);
+ return this.success(c, await service.getApiKeys(), 'API keys retrieved');
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async getApiKey(c: Context) {
+ try {
+ const { id } = this.getParams<{ id: string }>(c);
+ const service = await this.getService(c);
+ return this.success(c, await service.getApiKey(id), 'API key retrieved');
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async updateApiKey(c: Context) {
+ try {
+ const { id } = this.getParams<{ id: string }>(c);
+ const request = (await this.getBody<UpdateApiKeyRequest>(c))!;
+ const service = await this.getService(c);
+ return this.success(c, await service.updateApiKey(id, request), 'API key updated');
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async deleteApiKey(c: Context) {
+ try {
+ const { id } = this.getParams<{ id: string }>(c);
+ const service = await this.getService(c);
+ return this.success(c, await service.deleteApiKey(id), 'API key deleted');
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+}
diff --git a/packages/openapi/src/controllers/chat.controller.ts b/packages/openapi/src/controllers/chat.controller.ts
index 1d2ba6c89c5..7b221de6b31 100644
--- a/packages/openapi/src/controllers/chat.controller.ts
+++ b/packages/openapi/src/controllers/chat.controller.ts
@@ -22,11 +22,6 @@ export class ChatController extends BaseController {
const db = await this.getDatabase();
const chatService = new ChatService(db, userId, this.getWorkspaceId(c));
- // If streaming response, return directly
- if (chatParams.stream) {
- return await chatService.chat(chatParams);
- }
-
const result = await chatService.chat(chatParams);
return this.success(c, result, 'Chat completed successfully');
} catch (error) {
diff --git a/packages/openapi/src/controllers/eval.controller.ts b/packages/openapi/src/controllers/eval.controller.ts
new file mode 100644
index 00000000000..4ddecfaa66d
--- /dev/null
+++ b/packages/openapi/src/controllers/eval.controller.ts
@@ -0,0 +1,44 @@
+import type { Context } from 'hono';
+
+import { BaseController } from '../common/base.controller';
+import { EvalService } from '../services/eval.service';
+import type { CreateEvalRunRequest } from '../types/eval.type';
+
+export class EvalController extends BaseController {
+ private async getService(c: Context) {
+ const db = await this.getDatabase();
+ return new EvalService(db, this.getUserId(c)!, this.getWorkspaceId(c));
+ }
+
+ async createRun(c: Context) {
+ try {
+ const request = (await this.getBody<CreateEvalRunRequest>(c))!;
+ const run = await (await this.getService(c)).createRun(request);
+ return this.success(c, run, 'Eval run accepted', 202);
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async getRun(c: Context) {
+ try {
+ const { id } = this.getParams<{ id: string }>(c);
+ return this.success(c, await (await this.getService(c)).getRun(id), 'Eval run retrieved');
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async getRunResults(c: Context) {
+ try {
+ const { id } = this.getParams<{ id: string }>(c);
+ return this.success(
+ c,
+ await (await this.getService(c)).getRunResults(id),
+ 'Eval results retrieved',
+ );
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+}
diff --git a/packages/openapi/src/controllers/file.controller.ts b/packages/openapi/src/controllers/file.controller.ts
index 42256ad0cfb..e831aa7774f 100644
--- a/packages/openapi/src/controllers/file.controller.ts
+++ b/packages/openapi/src/controllers/file.controller.ts
@@ -1,17 +1,43 @@
import type { Context } from 'hono';
+import { HTTPException } from 'hono/http-exception';
import { BaseController } from '../common/base.controller';
import { FileUploadService } from '../services/file.service';
import type {
+ BatchFileUploadFormFields,
BatchFileUploadRequest,
BatchGetFilesRequest,
FileChunkRequest,
FileListQuery,
FileParseRequest,
+ FileUploadFormFields,
FileUrlRequest,
PublicFileUploadRequest,
UpdateFileRequest,
} from '../types/file.type';
+import { BatchFileUploadFormFieldsSchema, FileUploadFormFieldsSchema } from '../types/file.type';
+
+const getMultipartTextFields = (formData: FormData, fields: readonly string[]) =>
+ Object.fromEntries(
+ fields.map((field) => {
+ const value = formData.get(field);
+ return [field, typeof value === 'string' ? value : undefined];
+ }),
+ );
+
+const parseMultipartFields = <T>(result: {
+ error?: { issues: Array<{ message: string }> };
+ success: boolean;
+ data?: T;
+}): T => {
+ if (!result.success) {
+ throw new HTTPException(400, {
+ message: result.error?.issues[0]?.message ?? 'Invalid multipart form fields',
+ });
+ }
+
+ return result.data!;
+};
/**
* File upload controller
@@ -41,27 +67,39 @@ export class FileController extends BaseController {
}
for (const file of fileEntries) {
- if (file instanceof File) files.push(file);
+ if (!(file instanceof File)) {
+ throw new HTTPException(400, { message: 'Every files entry must be a binary file' });
+ }
+ files.push(file);
}
if (!files.length) {
return this.error(c, 'No files provided', 400);
}
- // Get other parameters
- const knowledgeBaseId = (formData.get('knowledgeBaseId') as string | null) || null;
- const skipCheckFileType = formData.get('skipCheckFileType') === 'true';
- const directory = (formData.get('directory') as string | null) || null;
- const agentId = (formData.get('agentId') as string | null) || null;
- const sessionId = (formData.get('sessionId') as string | null) || null;
+ if (files.length > 20) {
+ return this.error(c, 'A batch can contain at most 20 files', 400);
+ }
+
+ const fields = parseMultipartFields<BatchFileUploadFormFields>(
+ BatchFileUploadFormFieldsSchema.safeParse(
+ getMultipartTextFields(formData, [
+ 'agentId',
+ 'directory',
+ 'knowledgeBaseId',
+ 'sessionId',
+ 'skipCheckFileType',
+ ]),
+ ),
+ );
const request: BatchFileUploadRequest = {
- agentId: agentId || undefined,
- directory: directory || undefined,
+ agentId: fields.agentId,
+ directory: fields.directory,
files,
- knowledgeBaseId: knowledgeBaseId || undefined,
- sessionId: sessionId || undefined,
- skipCheckFileType,
+ knowledgeBaseId: fields.knowledgeBaseId,
+ sessionId: fields.sessionId,
+ skipCheckFileType: fields.skipCheckFileType,
};
const result = await fileService.uploadFiles(request);
@@ -154,27 +192,27 @@ export class FileController extends BaseController {
const fileService = new FileUploadService(db, userId, this.getWorkspaceId(c));
const formData = await this.getFormData(c);
- const file = formData.get('file') as File | null;
+ const file = formData.get('file');
- if (!file) {
+ if (!(file instanceof File)) {
return this.error(c, 'No file provided', 400);
}
- // Get other parameters
- const knowledgeBaseId = (formData.get('knowledgeBaseId') as string | null) || null;
- const skipCheckFileType = formData.get('skipCheckFileType') === 'true';
- const directory = (formData.get('directory') as string | null) || null;
- const agentId = (formData.get('agentId') as string | null) || null;
- const sessionId = (formData.get('sessionId') as string | null) || null;
- const skipDeduplication = formData.get('skipDeduplication') === 'true';
+ const fields = parseMultipartFields<FileUploadFormFields>(
+ FileUploadFormFieldsSchema.safeParse(
+ getMultipartTextFields(formData, [
+ 'agentId',
+ 'directory',
+ 'knowledgeBaseId',
+ 'sessionId',
+ 'skipCheckFileType',
+ 'skipDeduplication',
+ ]),
+ ),
+ );
const options: PublicFileUploadRequest = {
- agentId: agentId || undefined,
- directory: directory || undefined,
- knowledgeBaseId: knowledgeBaseId || undefined,
- sessionId: sessionId || undefined,
- skipCheckFileType,
- skipDeduplication,
+ ...fields,
};
const result = await fileService.uploadFile(file, options);
diff --git a/packages/openapi/src/controllers/index.ts b/packages/openapi/src/controllers/index.ts
index 98c062cd63f..d16f367358b 100644
--- a/packages/openapi/src/controllers/index.ts
+++ b/packages/openapi/src/controllers/index.ts
@@ -1,7 +1,10 @@
export * from './agent.controller';
export * from './agent-group.controller';
+export * from './api-key.controller';
export * from './chat.controller';
+export * from './eval.controller';
export * from './file.controller';
+export * from './mcp-server.controller';
export * from './message.controller';
export * from './message-translation.controller';
export * from './model.controller';
@@ -9,4 +12,5 @@ export * from './permission.controller';
export * from './provider.controller';
export * from './role.controller';
export * from './topic.controller';
+export * from './usage.controller';
export * from './user.controller';
diff --git a/packages/openapi/src/controllers/mcp-server.controller.ts b/packages/openapi/src/controllers/mcp-server.controller.ts
new file mode 100644
index 00000000000..d5c2b226ad7
--- /dev/null
+++ b/packages/openapi/src/controllers/mcp-server.controller.ts
@@ -0,0 +1,83 @@
+import type { Context } from 'hono';
+
+import { BaseController } from '../common/base.controller';
+import { McpServerService } from '../services/mcp-server.service';
+import type { CreateMcpServerRequest, UpdateMcpServerRequest } from '../types/mcp-server.type';
+
+export class McpServerController extends BaseController {
+ private async getService(c: Context) {
+ const db = await this.getDatabase();
+ return new McpServerService(db, this.getUserId(c)!, this.getWorkspaceId(c));
+ }
+
+ async listServers(c: Context) {
+ try {
+ return this.success(
+ c,
+ await (await this.getService(c)).listServers(),
+ 'MCP servers retrieved',
+ );
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async getServer(c: Context) {
+ try {
+ const { id } = this.getParams<{ id: string }>(c);
+ return this.success(
+ c,
+ await (await this.getService(c)).getServer(id),
+ 'MCP server retrieved',
+ );
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async createServer(c: Context) {
+ try {
+ const request = (await this.getBody<CreateMcpServerRequest>(c))!;
+ const data = await (await this.getService(c)).createServer(request);
+ return this.success(c, data, 'MCP server created', 201);
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async updateServer(c: Context) {
+ try {
+ const { id } = this.getParams<{ id: string }>(c);
+ const request = (await this.getBody<UpdateMcpServerRequest>(c))!;
+ return this.success(
+ c,
+ await (await this.getService(c)).updateServer(id, request),
+ 'MCP server updated',
+ );
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async deleteServer(c: Context) {
+ try {
+ const { id } = this.getParams<{ id: string }>(c);
+ return this.success(
+ c,
+ await (await this.getService(c)).deleteServer(id),
+ 'MCP server deleted',
+ );
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+
+ async syncServer(c: Context) {
+ try {
+ const { id } = this.getParams<{ id: string }>(c);
+ return this.success(c, await (await this.getService(c)).syncServer(id), 'MCP server synced');
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+}
diff --git a/packages/openapi/src/controllers/usage.controller.ts b/packages/openapi/src/controllers/usage.controller.ts
new file mode 100644
index 00000000000..040815b5a04
--- /dev/null
+++ b/packages/openapi/src/controllers/usage.controller.ts
@@ -0,0 +1,19 @@
+import type { Context } from 'hono';
+
+import { getOpenApiUsage } from '@/business/server/openapiUsage';
+
+import { BaseController } from '../common/base.controller';
+
+export class UsageController extends BaseController {
+ async getUsage(c: Context) {
+ try {
+ const result = await getOpenApiUsage({
+ userId: this.getUserId(c)!,
+ workspaceId: this.getWorkspaceId(c),
+ });
+ return this.success(c, result, 'Usage and quota retrieved');
+ } catch (error) {
+ return this.handleError(c, error);
+ }
+ }
+}
diff --git a/packages/openapi/src/helpers/pagination.test.ts b/packages/openapi/src/helpers/pagination.test.ts
new file mode 100644
index 00000000000..92742eace0b
--- /dev/null
+++ b/packages/openapi/src/helpers/pagination.test.ts
@@ -0,0 +1,24 @@
+import { describe, expect, it } from 'vitest';
+
+import { processPaginationConditions } from './pagination';
+
+describe('processPaginationConditions', () => {
+ it('bounds an omitted pagination request to the first 20 rows', () => {
+ expect(processPaginationConditions({})).toEqual({ limit: 20, offset: 0 });
+ });
+
+ it('uses the default page size when only page is provided', () => {
+ expect(processPaginationConditions({ page: 3 })).toEqual({ limit: 20, offset: 40 });
+ });
+
+ it('uses the first page when only pageSize is provided', () => {
+ expect(processPaginationConditions({ pageSize: 50 })).toEqual({ limit: 50, offset: 0 });
+ });
+
+ it('defensively clamps values even when called outside a validated route', () => {
+ expect(processPaginationConditions({ page: -1, pageSize: 1000 })).toEqual({
+ limit: 100,
+ offset: 0,
+ });
+ });
+});
diff --git a/packages/openapi/src/helpers/pagination.ts b/packages/openapi/src/helpers/pagination.ts
index 9faa8d8772f..03e780d96fd 100644
--- a/packages/openapi/src/helpers/pagination.ts
+++ b/packages/openapi/src/helpers/pagination.ts
@@ -1,41 +1,22 @@
import type { IPaginationQuery } from '../types';
const DEFAULT_PAGE_SIZE = 20;
+const MAX_PAGE_SIZE = 100;
/**
* Process pagination query parameters
* @param request Query parameter object
- * @returns { limit, offset } if pagination parameters are provided; otherwise an empty object
+ * @returns a bounded limit/offset pair; omitted pagination defaults to page 1 / 20 items
*/
export function processPaginationConditions(request: Record<string, any> & IPaginationQuery): {
limit?: number;
offset?: number;
} {
- const { page, pageSize } = request;
-
- // If neither page nor pageSize is provided, skip pagination (return all data)
- if (page === undefined && pageSize === undefined) {
- return {};
- }
-
- // If only page is provided, default pageSize to 20
- if (page !== undefined && pageSize === undefined) {
- return {
- limit: DEFAULT_PAGE_SIZE,
- offset: (page - 1) * DEFAULT_PAGE_SIZE,
- };
- }
-
- // If only pageSize is provided, default page to 1
- if (page === undefined && pageSize !== undefined) {
- return {
- limit: pageSize,
- offset: 0,
- };
- }
+ const page = Math.max(1, request.page ?? 1);
+ const pageSize = Math.min(MAX_PAGE_SIZE, Math.max(1, request.pageSize ?? DEFAULT_PAGE_SIZE));
return {
limit: pageSize,
- offset: (page! - 1) * pageSize!,
+ offset: (page - 1) * pageSize,
};
}
diff --git a/packages/openapi/src/helpers/public-fields.test.ts b/packages/openapi/src/helpers/public-fields.test.ts
new file mode 100644
index 00000000000..3c7f30210c2
--- /dev/null
+++ b/packages/openapi/src/helpers/public-fields.test.ts
@@ -0,0 +1,97 @@
+import { describe, expect, it } from 'vitest';
+
+import type { AgentItem, AiProviderSelectItem, FileItem, UserItem } from '@/database/schemas';
+
+import {
+ projectPublicAgent,
+ projectPublicFile,
+ projectPublicProvider,
+ projectPublicUser,
+ PUBLIC_AGENT_FIELDS,
+} from './public-fields';
+
+describe('public response field projections', () => {
+ it('keeps the Agent contract at the documented 12-field allowlist', () => {
+ const projected = projectPublicAgent({
+ avatar: null,
+ chatConfig: null,
+ clientId: 'internal-client',
+ createdAt: new Date('2026-08-01T00:00:00.000Z'),
+ description: null,
+ id: 'agent-1',
+ marketIdentifier: 'internal-market-id',
+ model: 'model-1',
+ params: {},
+ provider: 'provider-1',
+ slug: 'agent-slug',
+ systemRole: null,
+ title: 'Agent',
+ updatedAt: new Date('2026-08-01T00:00:00.000Z'),
+ userId: 'user-1',
+ workspaceId: 'workspace-1',
+ } as unknown as AgentItem);
+
+ expect(Object.keys(projected).sort()).toEqual([...PUBLIC_AGENT_FIELDS].sort());
+ expect(projected).not.toHaveProperty('clientId');
+ expect(projected).not.toHaveProperty('marketIdentifier');
+ expect(projected).not.toHaveProperty('userId');
+ expect(projected).not.toHaveProperty('workspaceId');
+ });
+
+ it('never returns Provider ownership fields, surrogate ids, or credentials', () => {
+ const projected = projectPublicProvider({
+ _id: 'internal-id',
+ createdAt: new Date(),
+ id: 'openai',
+ keyVaults: 'encrypted-secret',
+ updatedAt: new Date(),
+ userId: 'user-1',
+ workspaceId: 'workspace-1',
+ } as unknown as AiProviderSelectItem);
+
+ expect(projected).not.toHaveProperty('_id');
+ expect(projected).not.toHaveProperty('keyVaults');
+ expect(projected).not.toHaveProperty('userId');
+ expect(projected).not.toHaveProperty('workspaceId');
+ });
+
+ it('does not expose internal file identity or hashing fields', () => {
+ const projected = projectPublicFile({
+ clientId: 'internal-client',
+ createdAt: new Date(),
+ fileHash: 'internal-hash',
+ fileType: 'text/plain',
+ id: 'file-1',
+ name: 'notes.txt',
+ size: 12,
+ updatedAt: new Date(),
+ url: '/files/notes.txt',
+ userId: 'user-1',
+ workspaceId: 'workspace-1',
+ } as unknown as FileItem);
+
+ expect(projected).not.toHaveProperty('clientId');
+ expect(projected).not.toHaveProperty('fileHash');
+ expect(projected).not.toHaveProperty('userId');
+ expect(projected).not.toHaveProperty('workspaceId');
+ });
+
+ it('returns only the stable public profile instead of the full auth row', () => {
+ const projected = projectPublicUser({
+ banReason: 'internal',
+ createdAt: new Date(),
+ email: '[email protected]',
+ id: 'user-1',
+ normalizedEmail: '[email protected]',
+ onboarding: { finishedAt: 'secret-state' },
+ preference: { telemetry: true },
+ updatedAt: new Date(),
+ } as unknown as UserItem);
+
+ expect(projected).toMatchObject({ email: '[email protected]', id: 'user-1' });
+ expect(projected).not.toHaveProperty('banReason');
+ expect(projected).not.toHaveProperty('normalizedEmail');
+ expect(projected).not.toHaveProperty('onboarding');
+ expect(projected).not.toHaveProperty('preference');
+ });
+});
diff --git a/packages/openapi/src/helpers/public-fields.ts b/packages/openapi/src/helpers/public-fields.ts
new file mode 100644
index 00000000000..e2397728612
--- /dev/null
+++ b/packages/openapi/src/helpers/public-fields.ts
@@ -0,0 +1,272 @@
+import type {
+ AgentItem,
+ AiModelSelectItem,
+ AiProviderSelectItem,
+ FileItem,
+ KnowledgeBaseItem,
+ MessageItem,
+ PermissionItem,
+ RoleItem,
+ SessionGroupItem,
+ SessionItem,
+ TopicItem,
+ UserItem,
+} from '@/database/schemas';
+
+const pickPublicFields = <T extends object, K extends readonly (keyof T)[]>(
+ value: T,
+ fields: K,
+): Pick<T, K[number]> => {
+ const result = {} as Pick<T, K[number]>;
+
+ for (const field of fields) {
+ result[field] = value[field];
+ }
+
+ return result;
+};
+
+export const PUBLIC_AGENT_FIELDS = [
+ 'avatar',
+ 'chatConfig',
+ 'createdAt',
+ 'description',
+ 'id',
+ 'model',
+ 'params',
+ 'provider',
+ 'slug',
+ 'systemRole',
+ 'title',
+ 'updatedAt',
+] as const satisfies readonly (keyof AgentItem)[];
+
+export const PUBLIC_USER_FIELDS = [
+ 'avatar',
+ 'createdAt',
+ 'email',
+ 'firstName',
+ 'fullName',
+ 'id',
+ 'isOnboarded',
+ 'lastName',
+ 'phone',
+ 'updatedAt',
+ 'username',
+] as const satisfies readonly (keyof UserItem)[];
+
+export const PUBLIC_PROVIDER_FIELDS = [
+ 'checkModel',
+ 'config',
+ 'createdAt',
+ 'description',
+ 'enabled',
+ 'fetchOnClient',
+ 'id',
+ 'logo',
+ 'name',
+ 'settings',
+ 'sort',
+ 'source',
+ 'updatedAt',
+] as const satisfies readonly (keyof AiProviderSelectItem)[];
+
+export const PUBLIC_MODEL_FIELDS = [
+ 'abilities',
+ 'config',
+ 'contextWindowTokens',
+ 'createdAt',
+ 'description',
+ 'displayName',
+ 'enabled',
+ 'id',
+ 'organization',
+ 'parameters',
+ 'pricing',
+ 'providerId',
+ 'releasedAt',
+ 'settings',
+ 'sort',
+ 'source',
+ 'type',
+ 'updatedAt',
+] as const satisfies readonly (keyof AiModelSelectItem)[];
+
+export const PUBLIC_FILE_FIELDS = [
+ 'createdAt',
+ 'fileType',
+ 'id',
+ 'metadata',
+ 'name',
+ 'parentId',
+ 'size',
+ 'source',
+ 'updatedAt',
+ 'url',
+ 'visibility',
+] as const satisfies readonly (keyof FileItem)[];
+
+export const PUBLIC_KNOWLEDGE_BASE_FIELDS = [
+ 'avatar',
+ 'createdAt',
+ 'description',
+ 'id',
+ 'isPublic',
+ 'name',
+ 'settings',
+ 'type',
+ 'updatedAt',
+ 'visibility',
+] as const satisfies readonly (keyof KnowledgeBaseItem)[];
+
+export const PUBLIC_AGENT_GROUP_FIELDS = [
+ 'createdAt',
+ 'id',
+ 'name',
+ 'sort',
+ 'updatedAt',
+] as const satisfies readonly (keyof SessionGroupItem)[];
+
+export const PUBLIC_SESSION_FIELDS = [
+ 'avatar',
+ 'backgroundColor',
+ 'createdAt',
+ 'description',
+ 'groupId',
+ 'id',
+ 'pinned',
+ 'slug',
+ 'title',
+ 'type',
+ 'updatedAt',
+] as const satisfies readonly (keyof SessionItem)[];
+
+export const PUBLIC_TOPIC_FIELDS = [
+ 'agentId',
+ 'completedAt',
+ 'content',
+ 'cost',
+ 'createdAt',
+ 'description',
+ 'favorite',
+ 'groupId',
+ 'historySummary',
+ 'id',
+ 'metadata',
+ 'mode',
+ 'model',
+ 'provider',
+ 'sessionId',
+ 'status',
+ 'title',
+ 'totalCost',
+ 'totalInputTokens',
+ 'totalOutputTokens',
+ 'totalTokens',
+ 'trigger',
+ 'updatedAt',
+ 'usage',
+] as const satisfies readonly (keyof TopicItem)[];
+
+export const PUBLIC_MESSAGE_FIELDS = [
+ 'agentId',
+ 'content',
+ 'createdAt',
+ 'error',
+ 'favorite',
+ 'groupId',
+ 'id',
+ 'messageGroupId',
+ 'metadata',
+ 'model',
+ 'observationId',
+ 'parentId',
+ 'provider',
+ 'quotaId',
+ 'reasoning',
+ 'role',
+ 'search',
+ 'sessionId',
+ 'summary',
+ 'targetId',
+ 'threadId',
+ 'tools',
+ 'topicId',
+ 'traceId',
+ 'updatedAt',
+ 'usage',
+] as const satisfies readonly (keyof MessageItem)[];
+
+export const PUBLIC_ROLE_FIELDS = [
+ 'createdAt',
+ 'description',
+ 'displayName',
+ 'id',
+ 'isActive',
+ 'isSystem',
+ 'name',
+ 'updatedAt',
+] as const satisfies readonly (keyof RoleItem)[];
+
+export const PUBLIC_PERMISSION_FIELDS = [
+ 'category',
+ 'code',
+ 'createdAt',
+ 'description',
+ 'id',
+ 'isActive',
+ 'name',
+ 'updatedAt',
+] as const satisfies readonly (keyof PermissionItem)[];
+
+export type PublicAgent = Pick<AgentItem, (typeof PUBLIC_AGENT_FIELDS)[number]>;
+export type PublicUser = Pick<UserItem, (typeof PUBLIC_USER_FIELDS)[number]>;
+export type PublicProvider = Pick<AiProviderSelectItem, (typeof PUBLIC_PROVIDER_FIELDS)[number]>;
+export type PublicModel = Pick<AiModelSelectItem, (typeof PUBLIC_MODEL_FIELDS)[number]>;
+export type PublicFile = Pick<FileItem, (typeof PUBLIC_FILE_FIELDS)[number]>;
+export type PublicKnowledgeBase = Pick<
+ KnowledgeBaseItem,
+ (typeof PUBLIC_KNOWLEDGE_BASE_FIELDS)[number]
+>;
+export type PublicAgentGroup = Pick<SessionGroupItem, (typeof PUBLIC_AGENT_GROUP_FIELDS)[number]>;
+export type PublicSession = Pick<SessionItem, (typeof PUBLIC_SESSION_FIELDS)[number]>;
+export type PublicTopic = Pick<TopicItem, (typeof PUBLIC_TOPIC_FIELDS)[number]>;
+export type PublicMessage = Pick<MessageItem, (typeof PUBLIC_MESSAGE_FIELDS)[number]>;
+export type PublicRole = Pick<RoleItem, (typeof PUBLIC_ROLE_FIELDS)[number]>;
+export type PublicPermission = Pick<PermissionItem, (typeof PUBLIC_PERMISSION_FIELDS)[number]>;
+
+export const projectPublicAgent = (value: AgentItem): PublicAgent =>
+ pickPublicFields(value, PUBLIC_AGENT_FIELDS);
+
+export const projectPublicUser = (value: UserItem): PublicUser =>
+ pickPublicFields(value, PUBLIC_USER_FIELDS);
+
+export const projectPublicProvider = (value: AiProviderSelectItem): PublicProvider =>
+ pickPublicFields(value, PUBLIC_PROVIDER_FIELDS);
+
+export const projectPublicModel = (value: AiModelSelectItem): PublicModel =>
+ pickPublicFields(value, PUBLIC_MODEL_FIELDS);
+
+export const projectPublicFile = (value: FileItem): PublicFile =>
+ pickPublicFields(value, PUBLIC_FILE_FIELDS);
+
+export const projectPublicKnowledgeBase = (value: KnowledgeBaseItem): PublicKnowledgeBase =>
+ pickPublicFields(value, PUBLIC_KNOWLEDGE_BASE_FIELDS);
+
+export const projectPublicAgentGroup = (value: SessionGroupItem): PublicAgentGroup =>
+ pickPublicFields(value, PUBLIC_AGENT_GROUP_FIELDS);
+
+export const projectPublicSession = (value: SessionItem): PublicSession =>
+ pickPublicFields(value, PUBLIC_SESSION_FIELDS);
+
+export const projectPublicTopic = (value: TopicItem): PublicTopic =>
+ pickPublicFields(value, PUBLIC_TOPIC_FIELDS);
+
+export const projectPublicMessage = (value: MessageItem): PublicMessage =>
+ pickPublicFields(value, PUBLIC_MESSAGE_FIELDS);
+
+export const projectPublicRole = (value: RoleItem): PublicRole =>
+ pickPublicFields(value, PUBLIC_ROLE_FIELDS);
+
+export const projectPublicPermission = (value: PermissionItem): PublicPermission =>
+ pickPublicFields(value, PUBLIC_PERMISSION_FIELDS);
diff --git a/packages/openapi/src/middleware/permission-check.test.ts b/packages/openapi/src/middleware/permission-check.test.ts
index bca081a235c..4abeab6cfd7 100644
--- a/packages/openapi/src/middleware/permission-check.test.ts
+++ b/packages/openapi/src/middleware/permission-check.test.ts
@@ -1,12 +1,22 @@
import { Hono } from 'hono';
import { describe, expect, it, vi } from 'vitest';
-import { requireApiKeyScope } from './permission-check';
+import {
+ requireAnyPermission,
+ requireAnyPermissionWithApiKeyScope,
+ requireApiKeyScope,
+} from './permission-check';
+
+const hasAnyPermissions = vi.hoisted(() => vi.fn().mockResolvedValue(true));
// `requireApiKeyScope` never touches the database — stub the db imports pulled
// in by the sibling `requirePermission` middleware to keep this test light
-vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: vi.fn() }));
-vi.mock('@/database/models/rbac', () => ({ RbacModel: class {} }));
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: vi.fn().mockResolvedValue({}) }));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = hasAnyPermissions;
+ },
+}));
const buildApp = (auth: { authType?: string; scopes?: string[] | null }) => {
const app = new Hono();
@@ -14,9 +24,17 @@ const buildApp = (auth: { authType?: string; scopes?: string[] | null }) => {
app.use('*', async (c, next) => {
if (auth.authType) c.set('authType' as never, auth.authType as never);
c.set('apiKeyScopes' as never, auth.scopes as never);
+ c.set('userId' as never, 'user-1' as never);
await next();
});
app.post('/replies', requireApiKeyScope('model:invoke'), (c) => c.json({ ok: true }));
+ app.get('/api-keys', requireAnyPermission(['api_key:create']), (c) => c.json({ ok: true }));
+ app.get('/mcp-servers', requireAnyPermissionWithApiKeyScope(['agent:read'], 'mcp:read'), (c) =>
+ c.json({ ok: true }),
+ );
+ app.get('/usage', requireAnyPermissionWithApiKeyScope(['api_key:read'], 'usage:read'), (c) =>
+ c.json({ ok: true }),
+ );
return app;
};
@@ -52,4 +70,56 @@ describe('requireApiKeyScope', () => {
const res = await app.request('/replies', { method: 'POST' });
expect(res.status).toBe(200);
});
+
+ it('blocks restricted keys from API key administration even with other scopes', async () => {
+ const app = buildApp({ authType: 'apikey', scopes: ['user:write'] });
+ const response = await app.request('/api-keys');
+
+ expect(response.status).toBe(403);
+ expect(await response.text()).toContain('not available to restricted API keys');
+ });
+
+ it('projects internal RBAC permissions onto an explicit public API scope', async () => {
+ const mcpResponse = await buildApp({ authType: 'apikey', scopes: ['mcp:read'] }).request(
+ '/mcp-servers',
+ );
+ const usageResponse = await buildApp({ authType: 'apikey', scopes: ['usage:read'] }).request(
+ '/usage',
+ );
+
+ expect(mcpResponse.status).toBe(200);
+ expect(usageResponse.status).toBe(200);
+ });
+
+ it('does not accept the RBAC resource scope in place of the explicit public scope', async () => {
+ const mcpResponse = await buildApp({ authType: 'apikey', scopes: ['agent:read'] }).request(
+ '/mcp-servers',
+ );
+ const usageResponse = await buildApp({ authType: 'apikey', scopes: ['user:read'] }).request(
+ '/usage',
+ );
+
+ expect(mcpResponse.status).toBe(403);
+ expect(await mcpResponse.text()).toContain('mcp:read');
+ expect(usageResponse.status).toBe(403);
+ expect(await usageResponse.text()).toContain('usage:read');
+ });
+
+ it('still requires issuer RBAC when the API key has the explicit scope', async () => {
+ hasAnyPermissions.mockResolvedValueOnce(false);
+ const response = await buildApp({ authType: 'apikey', scopes: ['mcp:read'] }).request(
+ '/mcp-servers',
+ );
+
+ expect(response.status).toBe(403);
+ expect(await response.text()).toContain('Insufficient permissions');
+ });
+
+ it('lets an MCP write scope satisfy MCP reads', async () => {
+ const response = await buildApp({ authType: 'apikey', scopes: ['mcp:write'] }).request(
+ '/mcp-servers',
+ );
+
+ expect(response.status).toBe(200);
+ });
});
diff --git a/packages/openapi/src/middleware/permission-check.ts b/packages/openapi/src/middleware/permission-check.ts
index 0a2009786f8..ef595510a7a 100644
--- a/packages/openapi/src/middleware/permission-check.ts
+++ b/packages/openapi/src/middleware/permission-check.ts
@@ -15,6 +15,13 @@ import { RbacModel } from '@/database/models/rbac';
const log = debug('lobe-hono:permission-middleware');
export interface PermissionCheckOptions {
+ /**
+ * Explicit scope for API-key-authenticated requests when the public API
+ * capability does not map 1:1 to the RBAC resource used for issuer checks.
+ * This only changes the API key narrowing step; RBAC is still enforced.
+ */
+ apiKeyScope?: ApiKeyScope;
+
/**
* Custom error message when permission check fails
*/
@@ -56,13 +63,20 @@ export interface PermissionCheckOptions {
* the key holds; `'AND'` needs all of them. Permissions that map to no scope
* (api_key/rbac/roles) can never be satisfied by a restricted key.
*/
-const assertApiKeyScopesAllow = (c: Context, permissionCodes: string[], operator: 'AND' | 'OR') => {
+const assertApiKeyScopesAllow = (
+ c: Context,
+ permissionCodes: string[],
+ operator: 'AND' | 'OR',
+ apiKeyScope?: ApiKeyScope,
+) => {
if (c.get('authType') !== 'apikey') return;
const scopes = c.get('apiKeyScopes') as string[] | null | undefined;
if (isFullAccessApiKey(scopes)) return;
- const requiredScopes = permissionCodes.map((code) => requiredApiKeyScopeForPermission(code));
+ const requiredScopes = apiKeyScope
+ ? [apiKeyScope]
+ : permissionCodes.map((code) => requiredApiKeyScopeForPermission(code));
const satisfies = (scope: ApiKeyScope | null) => !!scope && hasApiKeyScope(scopes, scope);
const allowed =
operator === 'AND' ? requiredScopes.every(satisfies) : requiredScopes.some(satisfies);
@@ -144,7 +158,7 @@ const requirePermission = (options: PermissionCheckOptions) => {
}
// RBAC passed — now narrow by the API key's capability scopes
- assertApiKeyScopesAllow(c, permissionCodes, operator);
+ assertApiKeyScopesAllow(c, permissionCodes, operator, options.apiKeyScope);
log('Permission check passed for user %s', userId);
@@ -213,6 +227,24 @@ export const requireAnyPermission = (permissionCodes: string[], errorMessage?: s
});
};
+/**
+ * Require issuer RBAC while projecting the route onto an explicit API key
+ * scope. Use this for public capabilities such as MCP configuration or usage
+ * summaries whose RBAC permission belongs to a different internal resource.
+ */
+export const requireAnyPermissionWithApiKeyScope = (
+ permissionCodes: string[],
+ apiKeyScope: ApiKeyScope,
+ errorMessage?: string,
+) => {
+ return requirePermission({
+ apiKeyScope,
+ errorMessage,
+ operator: 'OR',
+ permissions: permissionCodes,
+ });
+};
+
/**
* Standalone API key scope gate for routes that declare no RBAC permissions
* (e.g. `POST /responses`). No-op for session/OIDC auth and full-access keys;
diff --git a/packages/openapi/src/middleware/workspace.test.ts b/packages/openapi/src/middleware/workspace.test.ts
index b032898f7eb..97c1d3bddbe 100644
--- a/packages/openapi/src/middleware/workspace.test.ts
+++ b/packages/openapi/src/middleware/workspace.test.ts
@@ -2,7 +2,11 @@ import { Hono } from 'hono';
import { HTTPException } from 'hono/http-exception';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { OPENAPI_WORKSPACE_HEADER, workspaceAuthMiddleware } from './workspace';
+import {
+ OPENAPI_WORKSPACE_HEADER,
+ requireWorkspaceRoleWhenScoped,
+ workspaceAuthMiddleware,
+} from './workspace';
interface TestHonoEnv {
Variables: {
@@ -260,4 +264,37 @@ describe('OpenAPI workspace middleware', () => {
expect(response.status).toBe(200);
expect(mockCanUseWorkspaceApiKeys).toHaveBeenCalledWith('workspace-1');
});
+
+ // `workspaceAuthMiddleware` only admin-gates `apikey` auth, so an OIDC/session
+ // member previously reached routes whose model predicate is workspace-wide.
+ describe('requireWorkspaceRoleWhenScoped', () => {
+ const roleApp = (role: string | undefined, workspaceId: string | undefined) => {
+ const app = new Hono<TestHonoEnv>();
+ app.use('*', async (c, next) => {
+ c.set('workspaceId', workspaceId);
+ c.set('workspaceRole', role);
+ return next();
+ });
+ app.get('/guarded', requireWorkspaceRoleWhenScoped('admin'), (c) => c.json({ ok: true }));
+ app.onError((error) =>
+ error instanceof HTTPException ? error.getResponse() : new Response(null, { status: 500 }),
+ );
+ return app;
+ };
+
+ it.each(['member', 'viewer', undefined])(
+ 'rejects an OIDC workspace request from role %s',
+ async (role) => {
+ expect((await roleApp(role, 'workspace-1').request('/guarded')).status).toBe(403);
+ },
+ );
+
+ it.each(['admin', 'owner'])('allows role %s', async (role) => {
+ expect((await roleApp(role, 'workspace-1').request('/guarded')).status).toBe(200);
+ });
+
+ it('passes through personal (non-workspace) requests', async () => {
+ expect((await roleApp(undefined, undefined).request('/guarded')).status).toBe(200);
+ });
+ });
});
diff --git a/packages/openapi/src/middleware/workspace.ts b/packages/openapi/src/middleware/workspace.ts
index 913e75c3c53..e636cef782d 100644
--- a/packages/openapi/src/middleware/workspace.ts
+++ b/packages/openapi/src/middleware/workspace.ts
@@ -37,6 +37,35 @@ const resolveWorkspaceId = (c: Context): string | undefined => {
return apiKeyWorkspaceId;
};
+/**
+ * Built-in workspace roles, lowest to highest. `workspace_members.role` is the
+ * single source of truth, so ordering here is the whole role model.
+ */
+const WORKSPACE_ROLE_ORDER = ['viewer', 'member', 'admin', 'owner'];
+
+const hasMinWorkspaceRole = (role: string | undefined, minRole: string) =>
+ !!role && WORKSPACE_ROLE_ORDER.indexOf(role) >= WORKSPACE_ROLE_ORDER.indexOf(minRole);
+
+/**
+ * Require at least `minRole` for workspace-scoped requests; personal requests
+ * pass through untouched.
+ *
+ * `workspaceAuthMiddleware` only enforces the admin role for `apikey` auth, so
+ * without this an OIDC/session-authenticated member could reach routes whose
+ * models use a workspace-wide (not row-owner) predicate. Mirrors the tRPC
+ * `requireWorkspaceRoleWhenScoped` guard so both transports gate identically.
+ */
+export const requireWorkspaceRoleWhenScoped =
+ (minRole: 'admin' | 'owner') => async (c: Context, next: Next) => {
+ if (!c.get('workspaceId')) return next();
+
+ if (!hasMinWorkspaceRole(c.get('workspaceRole'), minRole)) {
+ throw new HTTPException(403, { message: `Requires ${minRole} role or higher` });
+ }
+
+ return next();
+ };
+
export const workspaceAuthMiddleware = async (c: Context, next: Next) => {
const workspaceId = resolveWorkspaceId(c);
diff --git a/packages/openapi/src/routes/api-keys.route.ts b/packages/openapi/src/routes/api-keys.route.ts
new file mode 100644
index 00000000000..6d4a1bed715
--- /dev/null
+++ b/packages/openapi/src/routes/api-keys.route.ts
@@ -0,0 +1,71 @@
+import { Hono } from 'hono';
+import { describeRoute } from 'hono-openapi';
+
+import { getAllScopePermissions } from '@/utils/rbac';
+
+import { zValidator } from '../common/validator';
+import { ApiKeyController } from '../controllers/api-key.controller';
+import { requireAuth } from '../middleware/auth';
+import { requireAnyPermission } from '../middleware/permission-check';
+import { requireWorkspaceRoleWhenScoped } from '../middleware/workspace';
+import {
+ ApiKeyIdParamSchema,
+ CreateApiKeyRequestSchema,
+ UpdateApiKeyRequestSchema,
+} from '../types/api-key.type';
+
+const app = new Hono();
+
+// API keys are credentials and `ApiKeyModel`'s predicate is workspace-wide, so
+// every route here is admin-gated when workspace-scoped — matching the tRPC
+// `apiKeyProcedure`, which applies `requireWorkspaceRoleWhenScoped('admin')` to
+// the whole router.
+const requireWorkspaceAdmin = requireWorkspaceRoleWhenScoped('admin');
+
+app.get(
+ '/',
+ describeRoute({ summary: 'List API keys', tags: ['api-keys'] }),
+ requireAuth,
+ requireWorkspaceAdmin,
+ requireAnyPermission(getAllScopePermissions('API_KEY_READ')),
+ async (c) => new ApiKeyController().getApiKeys(c),
+);
+
+app.post(
+ '/',
+ requireAuth,
+ requireWorkspaceAdmin,
+ requireAnyPermission(getAllScopePermissions('API_KEY_CREATE')),
+ zValidator('json', CreateApiKeyRequestSchema),
+ async (c) => new ApiKeyController().createApiKey(c),
+);
+
+app.get(
+ '/:id',
+ requireAuth,
+ requireWorkspaceAdmin,
+ requireAnyPermission(getAllScopePermissions('API_KEY_READ')),
+ zValidator('param', ApiKeyIdParamSchema),
+ async (c) => new ApiKeyController().getApiKey(c),
+);
+
+app.patch(
+ '/:id',
+ requireAuth,
+ requireWorkspaceAdmin,
+ requireAnyPermission(getAllScopePermissions('API_KEY_UPDATE')),
+ zValidator('param', ApiKeyIdParamSchema),
+ zValidator('json', UpdateApiKeyRequestSchema),
+ async (c) => new ApiKeyController().updateApiKey(c),
+);
+
+app.delete(
+ '/:id',
+ requireAuth,
+ requireWorkspaceAdmin,
+ requireAnyPermission(getAllScopePermissions('API_KEY_DELETE')),
+ zValidator('param', ApiKeyIdParamSchema),
+ async (c) => new ApiKeyController().deleteApiKey(c),
+);
+
+export default app;
diff --git a/packages/openapi/src/routes/chat.route.ts b/packages/openapi/src/routes/chat.route.ts
new file mode 100644
index 00000000000..4d08884d337
--- /dev/null
+++ b/packages/openapi/src/routes/chat.route.ts
@@ -0,0 +1,42 @@
+import { Hono } from 'hono';
+
+import { getAllScopePermissions } from '@/utils/rbac';
+
+import { zValidator } from '../common/validator';
+import { ChatController } from '../controllers/chat.controller';
+import { requireAuth } from '../middleware/auth';
+import { requireAnyPermission } from '../middleware/permission-check';
+import {
+ ChatServiceParamsSchema,
+ MessageGenerationParamsSchema,
+ TranslateServiceParamsSchema,
+} from '../types/chat.type';
+
+const app = new Hono();
+const requireModelInvoke = requireAnyPermission(getAllScopePermissions('AI_MODEL_INVOKE'));
+
+app.post(
+ '/',
+ requireAuth,
+ requireModelInvoke,
+ zValidator('json', ChatServiceParamsSchema),
+ async (c) => new ChatController().handleChat(c),
+);
+
+app.post(
+ '/translate',
+ requireAuth,
+ requireModelInvoke,
+ zValidator('json', TranslateServiceParamsSchema),
+ async (c) => new ChatController().handleTranslate(c),
+);
+
+app.post(
+ '/generate-reply',
+ requireAuth,
+ requireModelInvoke,
+ zValidator('json', MessageGenerationParamsSchema),
+ async (c) => new ChatController().handleGenerateReply(c),
+);
+
+export default app;
diff --git a/packages/openapi/src/routes/eval.route.test.ts b/packages/openapi/src/routes/eval.route.test.ts
new file mode 100644
index 00000000000..efe4211bc0d
--- /dev/null
+++ b/packages/openapi/src/routes/eval.route.test.ts
@@ -0,0 +1,64 @@
+import { Hono } from 'hono';
+import { describe, expect, it, vi } from 'vitest';
+
+import type * as PermissionCheck from '../middleware/permission-check';
+
+// The route module pulls in the db graph (via the permission middleware) and the
+// better-auth graph (via `requireAuth`) at import time; this test is only about
+// which gates the route itself declares.
+vi.mock('@/database/core/db-adaptor', () => ({ getServerDB: vi.fn() }));
+vi.mock('@/database/models/rbac', () => ({ RbacModel: class {} }));
+vi.mock('../middleware/auth', () => ({
+ requireAuth: async (_c: any, next: any) => next(),
+}));
+vi.mock('../middleware/permission-check', async (importOriginal) => {
+ const actual = await importOriginal<typeof PermissionCheck>();
+ return { ...actual, requireAnyPermission: () => async (_c: any, next: any) => next() };
+});
+vi.mock('../controllers/eval.controller', () => ({
+ EvalController: class {
+ createRun(c: any) {
+ return c.json({ data: { id: 'run-1' }, success: true });
+ }
+ },
+}));
+
+const { default: EvalRoutes } = await import('./eval.route');
+
+/**
+ * `/eval/runs` queues an internal run, which pre-creates real chat topics via
+ * `TopicModel` and keeps writing topic/message state from the QStash workflow.
+ * A key deliberately denied `chat:write` must not be able to persist chat
+ * artifacts through this entry point — same boundary `/responses` enforces.
+ */
+describe('POST /eval/runs API-key scopes', () => {
+ const requestAs = (apiKeyScopes: string[]) => {
+ const app = new Hono();
+
+ app.use('*', async (c, next) => {
+ c.set('userId' as never, 'user-1' as never);
+ c.set('authType' as never, 'apikey' as never);
+ c.set('apiKeyScopes' as never, apiKeyScopes as never);
+ await next();
+ });
+ app.route('/', EvalRoutes);
+
+ return app.request('/runs', {
+ body: JSON.stringify({ datasetId: 'dataset-1', targetAgentId: 'agent-1' }),
+ headers: { 'content-type': 'application/json' },
+ method: 'POST',
+ });
+ };
+
+ it('rejects a key holding agent:write and model:invoke but not chat:write', async () => {
+ const res = await requestAs(['agent:write', 'model:invoke']);
+
+ expect(res.status).toBe(403);
+ });
+
+ it('accepts a key holding the full agent-run trio', async () => {
+ const res = await requestAs(['agent:write', 'chat:write', 'model:invoke']);
+
+ expect(res.status).toBe(200);
+ });
+});
diff --git a/packages/openapi/src/routes/eval.route.ts b/packages/openapi/src/routes/eval.route.ts
new file mode 100644
index 00000000000..855c0c5e7ec
--- /dev/null
+++ b/packages/openapi/src/routes/eval.route.ts
@@ -0,0 +1,50 @@
+import { Hono } from 'hono';
+import { describeRoute } from 'hono-openapi';
+
+import { getAllScopePermissions } from '@/utils/rbac';
+
+import { zValidator } from '../common/validator';
+import { EvalController } from '../controllers/eval.controller';
+import { requireAuth } from '../middleware/auth';
+import { requireAnyPermission, requireApiKeyScope } from '../middleware/permission-check';
+import { CreateEvalRunRequestSchema, EvalRunIdParamSchema } from '../types/eval.type';
+
+const app = new Hono();
+const requireRead = requireAnyPermission(getAllScopePermissions('AGENT_READ'));
+const requireWrite = requireAnyPermission(getAllScopePermissions('AGENT_UPDATE'));
+
+app.post(
+ '/runs',
+ describeRoute({
+ description: 'Queues an asynchronous QStash-backed evaluation run and returns immediately.',
+ summary: 'Create an eval run',
+ tags: ['eval'],
+ }),
+ requireAuth,
+ requireWrite,
+ requireApiKeyScope('model:invoke'),
+ // An internal run pre-creates real chat topics through `TopicModel`, and the
+ // QStash workflow keeps writing topic/message state, so a restricted key needs
+ // the same `chat:write` gate as `/responses` and the tRPC agent-run entries.
+ requireApiKeyScope('chat:write'),
+ zValidator('json', CreateEvalRunRequestSchema),
+ async (c) => new EvalController().createRun(c),
+);
+
+app.get(
+ '/runs/:id',
+ requireAuth,
+ requireRead,
+ zValidator('param', EvalRunIdParamSchema),
+ async (c) => new EvalController().getRun(c),
+);
+
+app.get(
+ '/runs/:id/results',
+ requireAuth,
+ requireRead,
+ zValidator('param', EvalRunIdParamSchema),
+ async (c) => new EvalController().getRunResults(c),
+);
+
+export default app;
diff --git a/packages/openapi/src/routes/files.route.ts b/packages/openapi/src/routes/files.route.ts
index 296e8df71d2..bfae1f4c8d2 100644
--- a/packages/openapi/src/routes/files.route.ts
+++ b/packages/openapi/src/routes/files.route.ts
@@ -60,7 +60,7 @@ app.get(
* - sessionId: string (optional) - Session ID; if provided, creates a file-session association
* - skipCheckFileType: boolean (optional) - Whether to skip file type check
* - directory: string (optional) - Upload directory
- * - skipExist: boolean (optional) - Whether to skip existing parse results, default false
+ * - skipDeduplication: boolean (optional) - Whether to skip content deduplication
*/
app.post(
'/',
@@ -76,7 +76,7 @@ app.post(
knowledgeBaseId: { type: 'string' },
sessionId: { type: 'string' },
skipCheckFileType: { type: 'boolean' },
- skipExist: { type: 'boolean' },
+ skipDeduplication: { type: 'boolean' },
},
required: ['file'],
type: 'object',
@@ -201,7 +201,6 @@ app.delete(
* - id: string (required) - File ID
*
* Query parameters:
- * - skipExist: boolean (optional) - Whether to skip existing parse results, default false
*
* Features:
* - Parses the text content of document files (PDF, Word, Excel, etc.)
@@ -299,11 +298,15 @@ app.post(
properties: {
agentId: { type: 'string' },
directory: { type: 'string' },
- files: { items: { format: 'binary', type: 'string' }, type: 'array' },
+ files: {
+ items: { format: 'binary', type: 'string' },
+ maxItems: 20,
+ minItems: 1,
+ type: 'array',
+ },
knowledgeBaseId: { type: 'string' },
sessionId: { type: 'string' },
skipCheckFileType: { type: 'boolean' },
- skipExist: { type: 'boolean' },
},
required: ['files'],
type: 'object',
diff --git a/packages/openapi/src/routes/index.ts b/packages/openapi/src/routes/index.ts
index b97f6112d2f..fc80a5b1987 100644
--- a/packages/openapi/src/routes/index.ts
+++ b/packages/openapi/src/routes/index.ts
@@ -1,7 +1,11 @@
import AgentGroupsRoutes from './agent-groups.route';
import AgentsRoutes from './agents.route';
+import ApiKeysRoutes from './api-keys.route';
+import ChatRoutes from './chat.route';
+import EvalRoutes from './eval.route';
import FileRoutes from './files.route';
import KnowledgeBasesRoutes from './knowledge-bases.route';
+import McpServersRoutes from './mcp-servers.route';
import MessageTranslationsRoutes from './message-translations.route';
import MessagesRoutes from './messages.route';
import ModelsRoutes from './models.route';
@@ -10,13 +14,18 @@ import ProvidersRoutes from './providers.route';
import ResponsesRoutes from './responses.route';
import RolesRoutes from './roles.route';
import TopicsRoutes from './topics.route';
+import UsageRoutes from './usage.route';
import UsersRoutes from './users.route';
export default {
'agent-groups': AgentGroupsRoutes,
'agents': AgentsRoutes,
+ 'api-keys': ApiKeysRoutes,
+ 'chat': ChatRoutes,
+ 'eval': EvalRoutes,
'files': FileRoutes,
'knowledge-bases': KnowledgeBasesRoutes,
+ 'mcp-servers': McpServersRoutes,
'message-translations': MessageTranslationsRoutes,
'messages': MessagesRoutes,
'models': ModelsRoutes,
@@ -26,4 +35,5 @@ export default {
'roles': RolesRoutes,
'topics': TopicsRoutes,
'users': UsersRoutes,
+ 'usage': UsageRoutes,
};
diff --git a/packages/openapi/src/routes/knowledge-bases.route.ts b/packages/openapi/src/routes/knowledge-bases.route.ts
index 2dd02efdf3e..463ed1b35c4 100644
--- a/packages/openapi/src/routes/knowledge-bases.route.ts
+++ b/packages/openapi/src/routes/knowledge-bases.route.ts
@@ -153,7 +153,7 @@ app.delete(
* - keyword: string (optional) - Search keyword (matches file name)
*
* Notes:
- * - When neither page nor pageSize is provided, returns all data without pagination
+ * - When page/pageSize are omitted, defaults to page 1 with 20 items
*/
app.get(
'/:id/files',
diff --git a/packages/openapi/src/routes/mcp-servers.route.ts b/packages/openapi/src/routes/mcp-servers.route.ts
new file mode 100644
index 00000000000..4f4674efe8b
--- /dev/null
+++ b/packages/openapi/src/routes/mcp-servers.route.ts
@@ -0,0 +1,73 @@
+import { Hono } from 'hono';
+import { describeRoute } from 'hono-openapi';
+
+import { getAllScopePermissions } from '@/utils/rbac';
+
+import { zValidator } from '../common/validator';
+import { McpServerController } from '../controllers/mcp-server.controller';
+import { requireAuth } from '../middleware/auth';
+import { requireAnyPermissionWithApiKeyScope } from '../middleware/permission-check';
+import {
+ CreateMcpServerRequestSchema,
+ McpServerIdParamSchema,
+ UpdateMcpServerRequestSchema,
+} from '../types/mcp-server.type';
+
+const app = new Hono();
+const requireRead = requireAnyPermissionWithApiKeyScope(
+ getAllScopePermissions('AGENT_READ'),
+ 'mcp:read',
+);
+const requireWrite = requireAnyPermissionWithApiKeyScope(
+ getAllScopePermissions('AGENT_UPDATE'),
+ 'mcp:write',
+);
+
+app.get(
+ '/',
+ describeRoute({ summary: 'List remote MCP servers', tags: ['mcp-servers'] }),
+ requireAuth,
+ requireRead,
+ async (c) => new McpServerController().listServers(c),
+);
+
+app.post(
+ '/',
+ describeRoute({ summary: 'Add a remote MCP server', tags: ['mcp-servers'] }),
+ requireAuth,
+ requireWrite,
+ zValidator('json', CreateMcpServerRequestSchema),
+ async (c) => new McpServerController().createServer(c),
+);
+
+app.get('/:id', requireAuth, requireRead, zValidator('param', McpServerIdParamSchema), async (c) =>
+ new McpServerController().getServer(c),
+);
+
+app.patch(
+ '/:id',
+ requireAuth,
+ requireWrite,
+ zValidator('param', McpServerIdParamSchema),
+ zValidator('json', UpdateMcpServerRequestSchema),
+ async (c) => new McpServerController().updateServer(c),
+);
+
+app.delete(
+ '/:id',
+ requireAuth,
+ requireWrite,
+ zValidator('param', McpServerIdParamSchema),
+ async (c) => new McpServerController().deleteServer(c),
+);
+
+app.post(
+ '/:id/sync',
+ describeRoute({ summary: 'Discover and sync MCP tools', tags: ['mcp-servers'] }),
+ requireAuth,
+ requireWrite,
+ zValidator('param', McpServerIdParamSchema),
+ async (c) => new McpServerController().syncServer(c),
+);
+
+export default app;
diff --git a/packages/openapi/src/routes/usage.route.ts b/packages/openapi/src/routes/usage.route.ts
new file mode 100644
index 00000000000..cca59cfa376
--- /dev/null
+++ b/packages/openapi/src/routes/usage.route.ts
@@ -0,0 +1,20 @@
+import { Hono } from 'hono';
+import { describeRoute } from 'hono-openapi';
+
+import { getAllScopePermissions } from '@/utils/rbac';
+
+import { UsageController } from '../controllers/usage.controller';
+import { requireAuth } from '../middleware/auth';
+import { requireAnyPermissionWithApiKeyScope } from '../middleware/permission-check';
+
+const app = new Hono();
+
+app.get(
+ '/',
+ describeRoute({ summary: 'Get usage and quota summary', tags: ['usage'] }),
+ requireAuth,
+ requireAnyPermissionWithApiKeyScope(getAllScopePermissions('API_KEY_READ'), 'usage:read'),
+ async (c) => new UsageController().getUsage(c),
+);
+
+export default app;
diff --git a/packages/openapi/src/services/agent-group.service.ts b/packages/openapi/src/services/agent-group.service.ts
index 5ce32f5e826..91a5aab8a2a 100644
--- a/packages/openapi/src/services/agent-group.service.ts
+++ b/packages/openapi/src/services/agent-group.service.ts
@@ -5,6 +5,7 @@ import { sessionGroups } from '@/database/schemas';
import type { LobeChatDatabase } from '@/database/type';
import { BaseService } from '../common/base.service';
+import { projectPublicAgentGroup } from '../helpers/public-fields';
import type { ServiceResult } from '../types';
import type {
AgentGroupListResponse,
@@ -52,7 +53,7 @@ export class AgentGroupService extends BaseService {
this.log('info', `Found ${agentGroupList.length} agent groups`);
- return agentGroupList;
+ return agentGroupList.map(projectPublicAgentGroup);
} catch (error) {
this.handleServiceError(error, '获取助理分类列表');
}
@@ -88,7 +89,7 @@ export class AgentGroupService extends BaseService {
return null;
}
- return agentGroup;
+ return projectPublicAgentGroup(agentGroup);
} catch (error) {
this.handleServiceError(error, '获取助理分类详情');
}
diff --git a/packages/openapi/src/services/agent.service.ts b/packages/openapi/src/services/agent.service.ts
index 26bf8c8aca4..897583105c9 100644
--- a/packages/openapi/src/services/agent.service.ts
+++ b/packages/openapi/src/services/agent.service.ts
@@ -1,13 +1,18 @@
import { and, count, desc, eq, ilike, inArray, isNull, or } from 'drizzle-orm';
import { AgentModel } from '@/database/models/agent';
-import type { NewAgent } from '@/database/schemas';
+import type { FileItem, KnowledgeBaseItem, NewAgent } from '@/database/schemas';
import { agents, agentsToSessions } from '@/database/schemas';
import type { LobeChatDatabase } from '@/database/type';
import { idGenerator, randomSlug } from '@/database/utils/idGenerator';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
+import {
+ projectPublicAgent,
+ projectPublicFile,
+ projectPublicKnowledgeBase,
+} from '../helpers/public-fields';
import type { ServiceResult } from '../types';
import type {
AgentDeleteRequest,
@@ -61,7 +66,7 @@ export class AgentService extends BaseService {
this.log('info', `found ${agentsList.length} agents`);
return {
- agents: agentsList,
+ agents: agentsList.map(projectPublicAgent),
total: totalResult[0]?.count ?? 0,
};
} catch (error) {
@@ -104,7 +109,7 @@ export class AgentService extends BaseService {
slug: createdAgent.slug,
});
- return createdAgent;
+ return projectPublicAgent(createdAgent);
});
} catch (error) {
this.handleServiceError(error, 'create agent');
@@ -185,7 +190,7 @@ export class AgentService extends BaseService {
id: updatedAgent.id,
slug: updatedAgent.slug,
});
- return updatedAgent;
+ return projectPublicAgent(updatedAgent);
});
} catch (error) {
this.handleServiceError(error, 'update agent');
@@ -292,7 +297,21 @@ export class AgentService extends BaseService {
return null;
}
- return agent as AgentDetailResponse;
+ return {
+ ...projectPublicAgent(agent),
+ files: agent.files
+ .filter((file) => file.id)
+ .map((file) => ({
+ ...projectPublicFile(file as FileItem),
+ enabled: file.enabled,
+ })),
+ knowledgeBases: agent.knowledgeBases
+ .filter((knowledgeBase) => knowledgeBase.id)
+ .map((knowledgeBase) => ({
+ ...projectPublicKnowledgeBase(knowledgeBase as KnowledgeBaseItem),
+ enabled: knowledgeBase.enabled,
+ })),
+ };
} catch (error) {
this.handleServiceError(error, 'get agent details');
}
diff --git a/packages/openapi/src/services/api-key.service.ts b/packages/openapi/src/services/api-key.service.ts
new file mode 100644
index 00000000000..6032954452d
--- /dev/null
+++ b/packages/openapi/src/services/api-key.service.ts
@@ -0,0 +1,68 @@
+import { canUseWorkspaceApiKeys } from '@/business/server/workspaceApiKey';
+import { ApiKeyModel } from '@/database/models/apiKey';
+import type { ApiKeyItem } from '@/database/schemas';
+import type { LobeChatDatabase } from '@/database/type';
+
+import { BaseService } from '../common/base.service';
+import type {
+ ApiKeyResponse,
+ CreateApiKeyRequest,
+ CreatedApiKeyResponse,
+ UpdateApiKeyRequest,
+} from '../types/api-key.type';
+
+const projectApiKey = (value: ApiKeyItem): ApiKeyResponse => ({
+ createdAt: value.createdAt,
+ enabled: value.enabled,
+ expiresAt: value.expiresAt,
+ id: value.id,
+ lastUsedAt: value.lastUsedAt,
+ name: value.name,
+ scopes: value.scopes,
+ updatedAt: value.updatedAt,
+});
+
+export class ApiKeyService extends BaseService {
+ private apiKeyModel: ApiKeyModel;
+
+ constructor(db: LobeChatDatabase, userId: string, workspaceId?: string) {
+ super(db, userId, workspaceId);
+ this.apiKeyModel = new ApiKeyModel(db, userId, workspaceId);
+ }
+
+ async createApiKey(request: CreateApiKeyRequest): Promise<CreatedApiKeyResponse> {
+ if (this.workspaceId && !(await canUseWorkspaceApiKeys(this.workspaceId))) {
+ throw this.createBusinessError('Workspace API Key access is not available');
+ }
+
+ const created = await this.apiKeyModel.createWithPlaintext(request);
+ return { ...projectApiKey(created), key: created.key };
+ }
+
+ async getApiKeys(): Promise<ApiKeyResponse[]> {
+ const rows = await this.apiKeyModel.queryMetadata();
+ return rows.map(projectApiKey);
+ }
+
+ async getApiKey(id: string): Promise<ApiKeyResponse> {
+ const apiKey = await this.apiKeyModel.findById(id);
+ if (!apiKey) throw this.createNotFoundError('API key not found');
+ return projectApiKey(apiKey);
+ }
+
+ async updateApiKey(id: string, request: UpdateApiKeyRequest): Promise<ApiKeyResponse> {
+ const existing = await this.apiKeyModel.findById(id);
+ if (!existing) throw this.createNotFoundError('API key not found');
+
+ await this.apiKeyModel.update(id, request);
+ return this.getApiKey(id);
+ }
+
+ async deleteApiKey(id: string): Promise<{ id: string }> {
+ const existing = await this.apiKeyModel.findById(id);
+ if (!existing) throw this.createNotFoundError('API key not found');
+
+ await this.apiKeyModel.delete(id);
+ return { id };
+ }
+}
diff --git a/packages/openapi/src/services/chat.service.test.ts b/packages/openapi/src/services/chat.service.test.ts
new file mode 100644
index 00000000000..d15e9556279
--- /dev/null
+++ b/packages/openapi/src/services/chat.service.test.ts
@@ -0,0 +1,100 @@
+// @vitest-environment node
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import type { LobeChatDatabase } from '@/database/type';
+
+import { ChatService } from './chat.service';
+
+const { chatMock, initModelRuntimeWithUserPayloadMock } = vi.hoisted(() => ({
+ chatMock: vi.fn(),
+ initModelRuntimeWithUserPayloadMock: vi.fn(),
+}));
+
+vi.mock('@/const/rbac', () => ({ ALL_SCOPE: 'all' }));
+vi.mock('@lobechat/database', () => ({
+ buildWorkspacePayload: vi.fn(),
+ buildWorkspaceWhere: vi.fn(),
+}));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = vi.fn().mockResolvedValue(true);
+ },
+}));
+vi.mock('@/database/models/user', () => ({ UserModel: class {} }));
+vi.mock('@/database/schemas', () => ({
+ agents: {},
+ agentsToSessions: {},
+ aiModels: {},
+ aiProviders: {},
+ files: {},
+ knowledgeBases: {},
+ messages: {},
+ sessions: {},
+ topics: {},
+}));
+vi.mock('@/utils/rbac', () => ({ getScopePermissions: () => [] }));
+vi.mock('@/const/settings', () => ({
+ DEFAULT_AGENT_CHAT_CONFIG: {},
+ DEFAULT_SYSTEM_AGENT_CONFIG: {},
+}));
+vi.mock('@lobechat/model-runtime', () => ({ mergeModelRuntimeHooks: vi.fn() }));
+vi.mock('@lobechat/types', () => ({ RequestTrigger: { Api: 'api' } }));
+vi.mock('@/business/server/model-runtime', () => ({ getBusinessModelRuntimeHooks: vi.fn() }));
+vi.mock('@/server/modules/KeyVaultsEncrypt', () => ({
+ KeyVaultsGateKeeper: { initWithEnvKey: vi.fn() },
+}));
+vi.mock('@/server/services/llmGenerationTracing/hook', () => ({
+ createLLMGenerationTracingHook: vi.fn(),
+}));
+vi.mock('@/server/services/systemAgent/modelConfig', () => ({
+ resolveSystemAgentModelConfig: vi.fn(),
+}));
+vi.mock('@/server/modules/ModelRuntime', () => ({
+ initModelRuntimeWithUserPayload: initModelRuntimeWithUserPayloadMock,
+}));
+
+describe('ChatService payload construction', () => {
+ const buildService = () => {
+ const service = new ChatService({} as LobeChatDatabase, 'user-1');
+ // Bypass permission + credential resolution; only the payload is under test.
+ (service as any).resolveOperationPermission = vi.fn().mockResolvedValue({ isPermitted: true });
+ (service as any).getApiKey = vi.fn().mockResolvedValue(JSON.stringify({ apiKey: 'k' }));
+ (service as any).config = { defaultModel: 'm', defaultProvider: 'p' };
+ return service;
+ };
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ chatMock.mockResolvedValue(
+ new Response(JSON.stringify({ choices: [{ message: { content: 'hi' } }] }), {
+ headers: { 'content-type': 'application/json' },
+ }),
+ );
+ initModelRuntimeWithUserPayloadMock.mockResolvedValue({ chat: chatMock });
+ });
+
+ const messages = [{ content: 'hi', role: 'user' as const }];
+
+ // The schema accepts `temperature: 0`; a `||` fallback would silently promote a
+ // deterministic request to temperature 1.
+ it('preserves an explicit temperature of 0', async () => {
+ await buildService().chat({ messages, temperature: 0 } as any);
+
+ expect(chatMock.mock.calls[0][0]).toMatchObject({ temperature: 0 });
+ });
+
+ it.each([
+ ['undefined', undefined],
+ ['null', null],
+ ])('defaults temperature to 1 when %s', async (_label, temperature) => {
+ await buildService().chat({ messages, temperature } as any);
+
+ expect(chatMock.mock.calls[0][0]).toMatchObject({ temperature: 1 });
+ });
+
+ it('passes a non-zero temperature through unchanged', async () => {
+ await buildService().chat({ messages, temperature: 0.7 } as any);
+
+ expect(chatMock.mock.calls[0][0]).toMatchObject({ temperature: 0.7 });
+ });
+});
diff --git a/packages/openapi/src/services/chat.service.ts b/packages/openapi/src/services/chat.service.ts
index 70d8bfe5e67..f10803459f3 100644
--- a/packages/openapi/src/services/chat.service.ts
+++ b/packages/openapi/src/services/chat.service.ts
@@ -349,7 +349,9 @@ export class ChatService extends BaseService {
model,
presence_penalty: params.presence_penalty,
stream: params.stream,
- temperature: params.temperature || 1,
+ // `?? 1`, not `|| 1`: the schema accepts `temperature: 0`, and a falsy
+ // check would silently promote a deterministic request to temperature 1.
+ temperature: params.temperature ?? 1,
top_p: params.top_p,
...options,
};
@@ -397,8 +399,6 @@ export class ChatService extends BaseService {
// Improve error logging with more detailed error information
let errorDetails: any;
- console.error('error', error);
-
if (error instanceof Error) {
errorDetails = {
message: error.message,
diff --git a/packages/openapi/src/services/eval.service.ts b/packages/openapi/src/services/eval.service.ts
new file mode 100644
index 00000000000..8e29cfd02b6
--- /dev/null
+++ b/packages/openapi/src/services/eval.service.ts
@@ -0,0 +1,135 @@
+import type { EvalRunTopicResult } from '@lobechat/types';
+
+import { AgentEvalRunModel, AgentEvalRunTopicModel } from '@/database/models/agentEval';
+import type { AgentEvalRunItem } from '@/database/schemas';
+import type { LobeChatDatabase } from '@/database/type';
+import { AgentEvalRunService, RUN_CREATE_ID_CONFLICT } from '@/server/services/agentEvalRun';
+import { AgentEvalRunWorkflow } from '@/server/workflows/agentEvalRun';
+
+import { BaseService } from '../common/base.service';
+import type {
+ CreateEvalRunRequest,
+ EvalRunResponse,
+ EvalRunResultsResponse,
+} from '../types/eval.type';
+
+const projectRun = (run: AgentEvalRunItem): EvalRunResponse => ({
+ createdAt: run.createdAt,
+ datasetId: run.datasetId,
+ id: run.id,
+ metrics: run.metrics,
+ name: run.name,
+ startedAt: run.startedAt,
+ status: run.status,
+ targetAgentId: run.targetAgentId,
+ updatedAt: run.updatedAt,
+});
+
+const projectResult = (value: EvalRunTopicResult | null): EvalRunTopicResult | null => {
+ if (!value) return null;
+ return {
+ awaitingExternalEval: value.awaitingExternalEval,
+ completionReason: value.completionReason,
+ cost: value.cost,
+ duration: value.duration,
+ error: value.error,
+ extractedAnswer: value.extractedAnswer,
+ llmCalls: value.llmCalls,
+ passAllK: value.passAllK,
+ passAtK: value.passAtK,
+ rubricScores: value.rubricScores,
+ steps: value.steps,
+ threads: value.threads?.map((thread) => ({
+ completionReason: thread.completionReason,
+ cost: thread.cost,
+ duration: thread.duration,
+ error: thread.error,
+ llmCalls: thread.llmCalls,
+ passed: thread.passed,
+ rubricScores: thread.rubricScores,
+ score: thread.score,
+ status: thread.status,
+ steps: thread.steps,
+ threadId: thread.threadId,
+ tokens: thread.tokens,
+ toolCalls: thread.toolCalls,
+ })),
+ tokens: value.tokens,
+ toolCalls: value.toolCalls,
+ totalCost: value.totalCost,
+ totalDuration: value.totalDuration,
+ totalTokens: value.totalTokens,
+ };
+};
+
+export class EvalService extends BaseService {
+ private runModel: AgentEvalRunModel;
+ private runService: AgentEvalRunService;
+ private runTopicModel: AgentEvalRunTopicModel;
+
+ constructor(db: LobeChatDatabase, userId: string, workspaceId?: string) {
+ super(db, userId, workspaceId);
+ this.runModel = new AgentEvalRunModel(db, userId, workspaceId);
+ this.runService = new AgentEvalRunService(db, userId, workspaceId);
+ this.runTopicModel = new AgentEvalRunTopicModel(db, userId, workspaceId);
+ }
+
+ async createRun(request: CreateEvalRunRequest): Promise<EvalRunResponse> {
+ let run: AgentEvalRunItem;
+ try {
+ run = await this.runService.createRun({ ...request, mode: 'internal' });
+ } catch (error) {
+ if (error instanceof Error && error.message === RUN_CREATE_ID_CONFLICT) {
+ throw this.createConflictError('Eval run id already exists with different parameters');
+ }
+ throw this.createBusinessError(
+ error instanceof Error ? error.message : 'Failed to create eval run',
+ );
+ }
+
+ // queue() is conditional idle -> pending. An idempotent retry sees the
+ // existing pending/running/terminal run and does not dispatch twice.
+ const queued = await this.runModel.queue(run.id);
+ if (queued) {
+ try {
+ await AgentEvalRunWorkflow.triggerRunBenchmark({ runId: run.id, userId: this.userId });
+ } catch (error) {
+ await this.runModel.update(run.id, { status: 'idle' });
+ throw this.createBusinessError(
+ `Failed to queue eval run: ${error instanceof Error ? error.message : 'unknown error'}`,
+ );
+ }
+ run = queued;
+ }
+
+ return projectRun(run);
+ }
+
+ async getRun(id: string): Promise<EvalRunResponse> {
+ // getRunDetails also applies the existing timeout reconciliation logic.
+ const detail = await this.runService.getRunDetails(id);
+ if (!detail) throw this.createNotFoundError('Eval run not found');
+ return projectRun(detail);
+ }
+
+ async getRunResults(id: string): Promise<EvalRunResultsResponse> {
+ const run = await this.runModel.findById(id);
+ if (!run) throw this.createNotFoundError('Eval run not found');
+ const topics = await this.runTopicModel.findByRunId(id);
+
+ return {
+ results: topics.map((topic) => ({
+ createdAt: topic.createdAt,
+ input: topic.testCase?.content.input ?? '',
+ passed: topic.passed,
+ result: projectResult(topic.evalResult),
+ score: topic.score,
+ status: topic.status,
+ testCaseId: topic.testCaseId,
+ topicId: topic.topicId,
+ })),
+ runId: id,
+ total: topics.length,
+ };
+ }
+}
diff --git a/packages/openapi/src/services/file.service.ts b/packages/openapi/src/services/file.service.ts
index 90ba1c510ff..bbce27e202a 100644
--- a/packages/openapi/src/services/file.service.ts
+++ b/packages/openapi/src/services/file.service.ts
@@ -29,6 +29,7 @@ import { nanoid } from '@/utils/uuid';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
+import { projectPublicFile, projectPublicUser } from '../helpers/public-fields';
import type {
AsyncTaskErrorResponse,
BatchFileUploadRequest,
@@ -108,7 +109,7 @@ export class FileUploadService extends BaseService {
const fullUrl = await this.ensureFullUrl(file.url);
return {
- ...file,
+ ...projectPublicFile(file),
url: fullUrl || file.url,
};
}
@@ -1377,7 +1378,7 @@ export class FileUploadService extends BaseService {
// Avoid adding the same user twice
const existingUsers = hashUsersMap.get(file.fileHash)!;
if (!existingUsers.some((u) => u.id === user.id)) {
- existingUsers.push(user);
+ existingUsers.push(projectPublicUser(user as Parameters<typeof projectPublicUser>[0]));
}
}
}
@@ -1454,7 +1455,7 @@ export class FileUploadService extends BaseService {
? usersData.find((u) => u.id === file.userId) || null
: file.user || null;
if (currentUser) {
- fileUsers = [currentUser];
+ fileUsers = [projectPublicUser(currentUser as Parameters<typeof projectPublicUser>[0])];
}
}
@@ -1507,14 +1508,13 @@ export class FileUploadService extends BaseService {
throw this.createAuthorizationError(permissionResult.message || '无权更新文件');
}
- // 2. Query file
- const file = await this.findFileByIdWithPermission(fileId, permissionResult);
+ // 2. Verify the file exists and is writable by the caller.
+ await this.findFileByIdWithPermission(fileId, permissionResult);
// 3. Handle knowledge base association
if ('knowledgeBaseId' in updateData) {
await this.db.transaction(async (trx) => {
- // Delete existing knowledge base association (for global permission users, use the file's actual userId)
- const targetUserId = file.userId;
+ // Delete the existing knowledge base association within the active workspace scope.
await trx
.delete(knowledgeBaseFiles)
.where(
diff --git a/packages/openapi/src/services/index.ts b/packages/openapi/src/services/index.ts
index fae9649e2f2..bf18fdba0ac 100644
--- a/packages/openapi/src/services/index.ts
+++ b/packages/openapi/src/services/index.ts
@@ -1,7 +1,10 @@
export * from './agent.service';
export * from './agent-group.service';
+export * from './api-key.service';
export * from './chat.service';
+export * from './eval.service';
export * from './file.service';
+export * from './mcp-server.service';
export * from './message.service';
export * from './message-translations.service';
export * from './model.service';
diff --git a/packages/openapi/src/services/knowledge-base.service.ts b/packages/openapi/src/services/knowledge-base.service.ts
index d9608c2c83b..2432ee83290 100644
--- a/packages/openapi/src/services/knowledge-base.service.ts
+++ b/packages/openapi/src/services/knowledge-base.service.ts
@@ -8,6 +8,7 @@ import { FileService as CoreFileService } from '@/server/services/file';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
+import { projectPublicKnowledgeBase } from '../helpers/public-fields';
import type {
CreateKnowledgeBaseRequest,
CreateKnowledgeBaseResponse,
@@ -80,7 +81,7 @@ export class KnowledgeBaseService extends BaseService {
const accessType: KnowledgeBaseAccessType = 'owner';
return {
- ...item,
+ ...projectPublicKnowledgeBase(item),
accessType,
} as KnowledgeBaseListItem;
});
@@ -123,7 +124,7 @@ export class KnowledgeBaseService extends BaseService {
this.log('info', 'Knowledge base detail retrieved successfully', { id });
return {
- knowledgeBase,
+ knowledgeBase: projectPublicKnowledgeBase(knowledgeBase),
};
} catch (error) {
this.handleServiceError(error, '获取知识库详情');
@@ -164,7 +165,7 @@ export class KnowledgeBaseService extends BaseService {
});
return {
- knowledgeBase,
+ knowledgeBase: projectPublicKnowledgeBase(knowledgeBase),
};
} catch (error) {
this.handleServiceError(error, '创建知识库');
@@ -208,7 +209,7 @@ export class KnowledgeBaseService extends BaseService {
this.log('info', 'Knowledge base updated successfully', { id });
return {
- knowledgeBase: updatedKb as KnowledgeBaseItem,
+ knowledgeBase: projectPublicKnowledgeBase(updatedKb as KnowledgeBaseItem),
};
} catch (error) {
this.handleServiceError(error, '更新知识库');
diff --git a/packages/openapi/src/services/mcp-server.service.test.ts b/packages/openapi/src/services/mcp-server.service.test.ts
new file mode 100644
index 00000000000..de9d166170f
--- /dev/null
+++ b/packages/openapi/src/services/mcp-server.service.test.ts
@@ -0,0 +1,145 @@
+// @vitest-environment node
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import type { LobeChatDatabase } from '@/database/type';
+
+import { McpServerService } from './mcp-server.service';
+
+const { connectorInstances, hasAnyPermissionMock, syncConnectorToolsByIdMock } = vi.hoisted(() => ({
+ connectorInstances: [] as any[],
+ hasAnyPermissionMock: vi.fn(),
+ syncConnectorToolsByIdMock: vi.fn(),
+}));
+
+vi.mock('@/const/rbac', () => ({ ALL_SCOPE: 'all' }));
+vi.mock('@lobechat/database', () => ({
+ buildWorkspacePayload: vi.fn(),
+ buildWorkspaceWhere: vi.fn(),
+}));
+vi.mock('@/database/models/rbac', () => ({
+ RbacModel: class {
+ hasAnyPermission = hasAnyPermissionMock;
+ },
+}));
+vi.mock('@/database/schemas', () => ({
+ ConnectorMcpConnectionType: { http: 'http' },
+ ConnectorSourceType: { custom: 'custom' },
+ ConnectorStatus: { connected: 'connected', disconnected: 'disconnected' },
+ agents: {},
+ aiModels: {},
+ aiProviders: {},
+ files: {},
+ knowledgeBases: {},
+ messages: {},
+ sessions: {},
+ topics: {},
+}));
+vi.mock('@/utils/rbac', () => ({ getScopePermissions: () => [] }));
+vi.mock('@/server/modules/KeyVaultsEncrypt', () => ({
+ KeyVaultsGateKeeper: { initWithEnvKey: vi.fn().mockResolvedValue({}) },
+}));
+vi.mock('@/server/services/connector/sync', () => ({
+ syncConnectorToolsById: syncConnectorToolsByIdMock,
+}));
+vi.mock('@/database/models/connectorTool', () => ({
+ ConnectorToolModel: class {
+ queryByConnector = vi.fn().mockResolvedValue([]);
+ },
+}));
+vi.mock('@/database/models/connector', () => ({
+ ConnectorModel: class {
+ delete = vi.fn();
+ findById = vi.fn().mockResolvedValue({ id: 'mcp-1', metadata: {} });
+ findPublicById = vi.fn().mockResolvedValue({
+ agentId: null,
+ id: 'mcp-1',
+ mcpConnectionType: 'http',
+ mcpServerUrl: 'https://example.com/mcp',
+ sourceType: 'custom',
+ // The row was created by a different workspace member.
+ userId: 'other-member',
+ });
+ update = vi.fn();
+ constructor() {
+ connectorInstances.push(this);
+ }
+ },
+}));
+
+const OWNER = 'me';
+const WORKSPACE = 'ws-1';
+
+describe('McpServerService row-level manage checks', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ connectorInstances.length = 0;
+ // Caller holds only the `:owner` scope, not workspace-wide `:all`.
+ hasAnyPermissionMock.mockResolvedValue(false);
+ });
+
+ const service = () => new McpServerService({} as LobeChatDatabase, OWNER, WORKSPACE);
+
+ it.each(['updateServer', 'deleteServer', 'syncServer'] as const)(
+ 'refuses %s on a row created by another workspace member',
+ async (method) => {
+ const svc = service();
+ const call =
+ method === 'updateServer' ? svc.updateServer('mcp-1', { name: 'x' }) : svc[method]('mcp-1');
+
+ await expect(call).rejects.toThrow(/Only the creator or a workspace owner/);
+ expect(connectorInstances.every((it) => it.update.mock.calls.length === 0)).toBe(true);
+ expect(connectorInstances.every((it) => it.delete.mock.calls.length === 0)).toBe(true);
+ expect(syncConnectorToolsByIdMock).not.toHaveBeenCalled();
+ },
+ );
+
+ it('allows a workspace-wide (:all scope) caller to manage another member row', async () => {
+ hasAnyPermissionMock.mockResolvedValue(true);
+
+ await expect(service().deleteServer('mcp-1')).resolves.toEqual({ id: 'mcp-1' });
+ });
+
+ it('allows managing a row the caller created', async () => {
+ const svc = service();
+ connectorInstances.forEach((it) =>
+ it.findPublicById.mockResolvedValue({
+ agentId: null,
+ id: 'mcp-1',
+ mcpConnectionType: 'http',
+ mcpServerUrl: 'https://example.com/mcp',
+ sourceType: 'custom',
+ userId: OWNER,
+ }),
+ );
+
+ await expect(svc.deleteServer('mcp-1')).resolves.toEqual({ id: 'mcp-1' });
+ });
+
+ // The list route only surfaces base connectors (`agent_id IS NULL`), and the
+ // connector router unpins an agent's plugin on delete. Reaching an
+ // agent-scoped row through an id route would skip that cleanup.
+ it.each(['getServer', 'updateServer', 'deleteServer', 'syncServer'] as const)(
+ 'treats an agent-scoped connector as not found for %s',
+ async (method) => {
+ hasAnyPermissionMock.mockResolvedValue(true);
+ const svc = service();
+ connectorInstances.forEach((it) =>
+ it.findPublicById.mockResolvedValue({
+ agentId: 'agent-1',
+ id: 'mcp-1',
+ mcpConnectionType: 'http',
+ mcpServerUrl: 'https://example.com/mcp',
+ sourceType: 'custom',
+ userId: OWNER,
+ }),
+ );
+
+ const call =
+ method === 'updateServer' ? svc.updateServer('mcp-1', { name: 'x' }) : svc[method]('mcp-1');
+
+ await expect(call).rejects.toThrow(/MCP server not found/);
+ expect(connectorInstances.every((it) => it.delete.mock.calls.length === 0)).toBe(true);
+ expect(syncConnectorToolsByIdMock).not.toHaveBeenCalled();
+ },
+ );
+});
diff --git a/packages/openapi/src/services/mcp-server.service.ts b/packages/openapi/src/services/mcp-server.service.ts
new file mode 100644
index 00000000000..f1e596c5432
--- /dev/null
+++ b/packages/openapi/src/services/mcp-server.service.ts
@@ -0,0 +1,173 @@
+import { ConnectorModel, type PublicConnectorRecord } from '@/database/models/connector';
+import { ConnectorToolModel } from '@/database/models/connectorTool';
+import {
+ ConnectorMcpConnectionType,
+ ConnectorSourceType,
+ ConnectorStatus,
+} from '@/database/schemas';
+import type { LobeChatDatabase } from '@/database/type';
+import { KeyVaultsGateKeeper } from '@/server/modules/KeyVaultsEncrypt';
+import { syncConnectorToolsById } from '@/server/services/connector/sync';
+
+import { BaseService } from '../common/base.service';
+import type {
+ CreateMcpServerRequest,
+ McpServerResponse,
+ McpServerToolResponse,
+ UpdateMcpServerRequest,
+} from '../types/mcp-server.type';
+
+/**
+ * Base-scope only (`agent_id IS NULL`), matching `queryPublic()`. Without the
+ * `agentId` check the id routes could reach agent-scoped connectors that the
+ * list route cannot even surface, and deleting one here would skip the
+ * connector router's agent-plugin unpin, leaving the agent with a dangling
+ * pinned tool. Agent-scoped connectors are managed through the agent profile.
+ */
+const isPublicMcpServer = (value: PublicConnectorRecord) =>
+ value.agentId === null &&
+ value.sourceType === ConnectorSourceType.custom &&
+ value.mcpConnectionType === ConnectorMcpConnectionType.http &&
+ !!value.mcpServerUrl;
+
+export class McpServerService extends BaseService {
+ private connectorModel: ConnectorModel;
+ private connectorToolModel: ConnectorToolModel;
+
+ constructor(db: LobeChatDatabase, userId: string, workspaceId?: string) {
+ super(db, userId, workspaceId);
+ this.connectorModel = new ConnectorModel(db, userId, workspaceId);
+ this.connectorToolModel = new ConnectorToolModel(db, userId, workspaceId);
+ }
+
+ private async getCredentialConnectorModel() {
+ const gateKeeper = await KeyVaultsGateKeeper.initWithEnvKey();
+ return new ConnectorModel(this.db, this.userId, this.workspaceId, gateKeeper);
+ }
+
+ private async projectServer(value: PublicConnectorRecord): Promise<McpServerResponse> {
+ const tools = await this.connectorToolModel.queryByConnector(value.id);
+ return {
+ createdAt: value.createdAt,
+ description: value.description,
+ hasCredentials: value.hasCredentials,
+ id: value.id,
+ identifier: value.identifier,
+ isEnabled: value.isEnabled,
+ name: value.name,
+ serverUrl: value.mcpServerUrl!,
+ status: value.status,
+ tools: tools.map((tool): McpServerToolResponse => ({
+ description: tool.description,
+ id: tool.id,
+ inputSchema: tool.inputSchema as null | Record<string, unknown>,
+ name: tool.toolName,
+ permission: tool.permission,
+ })),
+ updatedAt: value.updatedAt,
+ };
+ }
+
+ private async requireServer(id: string) {
+ const server = await this.connectorModel.findPublicById(id);
+ if (!server || !isPublicMcpServer(server)) {
+ throw this.createNotFoundError('MCP server not found');
+ }
+ return server;
+ }
+
+ /**
+ * `ConnectorModel`'s ownership predicate is workspace-wide, so a member holding
+ * only `agent:update:owner` could otherwise mutate a shared MCP server created
+ * by someone else. Mirrors the connector tRPC mutations.
+ */
+ private async requireManageableServer(id: string) {
+ const server = await this.requireServer(id);
+ await this.assertRowManageable(server.userId, 'AGENT_UPDATE', 'MCP server');
+ return server;
+ }
+
+ async listServers(): Promise<McpServerResponse[]> {
+ const servers = (await this.connectorModel.queryPublic()).filter(isPublicMcpServer);
+ return Promise.all(servers.map((server) => this.projectServer(server)));
+ }
+
+ async getServer(id: string): Promise<McpServerResponse> {
+ const server = await this.requireServer(id);
+ return this.projectServer(server);
+ }
+
+ async createServer(request: CreateMcpServerRequest): Promise<McpServerResponse> {
+ const model = await this.getCredentialConnectorModel();
+ const existing = (await this.connectorModel.queryPublic()).find(
+ (connector) => connector.identifier === request.identifier,
+ );
+ if (existing) throw this.createConflictError('MCP server identifier already exists');
+
+ const created = await model.create({
+ agentId: null,
+ credentials: request.credentials ? JSON.stringify(request.credentials) : null,
+ identifier: request.identifier,
+ isEnabled: request.isEnabled ?? true,
+ mcpConnectionType: ConnectorMcpConnectionType.http,
+ mcpServerUrl: request.serverUrl,
+ metadata: request.description ? { description: request.description } : null,
+ name: request.name,
+ oidcConfig: null,
+ sourceType: ConnectorSourceType.custom,
+ status: ConnectorStatus.disconnected,
+ tokenExpiresAt: null,
+ });
+
+ const publicRecord = await this.connectorModel.findPublicById(created.id);
+ if (!publicRecord) throw this.createCommonError('Failed to read the created MCP server');
+ return this.projectServer(publicRecord);
+ }
+
+ async updateServer(id: string, request: UpdateMcpServerRequest): Promise<McpServerResponse> {
+ await this.requireManageableServer(id);
+ const model = await this.getCredentialConnectorModel();
+ // The decrypted row is needed only to preserve non-public metadata during a
+ // patch. It is never logged or returned; GET paths use findPublicById and
+ // therefore do not even select the credentials column.
+ const current = await model.findById(id);
+ if (!current) throw this.createNotFoundError('MCP server not found');
+
+ const connectionChanged = request.serverUrl !== undefined || request.credentials !== undefined;
+ await model.update(id, {
+ ...(request.credentials === undefined
+ ? {}
+ : { credentials: request.credentials ? JSON.stringify(request.credentials) : null }),
+ ...(request.description === undefined
+ ? {}
+ : {
+ metadata: {
+ ...current.metadata,
+ description: request.description ?? undefined,
+ },
+ }),
+ ...(request.isEnabled === undefined ? {} : { isEnabled: request.isEnabled }),
+ ...(request.name === undefined ? {} : { name: request.name }),
+ ...(request.serverUrl === undefined ? {} : { mcpServerUrl: request.serverUrl }),
+ ...(connectionChanged ? { status: ConnectorStatus.disconnected } : {}),
+ });
+
+ return this.getServer(id);
+ }
+
+ async deleteServer(id: string): Promise<{ id: string }> {
+ await this.requireManageableServer(id);
+ await this.connectorModel.delete(id);
+ return { id };
+ }
+
+ async syncServer(id: string): Promise<{ id: string; status: string; toolCount: number }> {
+ await this.requireManageableServer(id);
+ const model = await this.getCredentialConnectorModel();
+ const { toolCount } = await syncConnectorToolsById(id, {
+ connectorModel: model,
+ connectorToolModel: this.connectorToolModel,
+ });
+ return { id, status: ConnectorStatus.connected, toolCount };
+ }
+}
diff --git a/packages/openapi/src/services/message.service.ts b/packages/openapi/src/services/message.service.ts
index 18495d30439..8bf5a428c54 100644
--- a/packages/openapi/src/services/message.service.ts
+++ b/packages/openapi/src/services/message.service.ts
@@ -1,5 +1,6 @@
import { and, asc, count, desc, eq, ilike, inArray, isNull } from 'drizzle-orm';
+import type { FileItem, MessageItem, SessionItem, TopicItem } from '@/database/schemas';
import { messages, messagesFiles } from '@/database/schemas';
import type { LobeChatDatabase } from '@/database/type';
import { idGenerator } from '@/database/utils/idGenerator';
@@ -7,6 +8,12 @@ import { FileService as CoreFileService } from '@/server/services/file';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
+import {
+ projectPublicFile,
+ projectPublicMessage,
+ projectPublicSession,
+ projectPublicTopic,
+} from '../helpers/public-fields';
import type { ServiceResult } from '../types';
import type {
MessageListResponse,
@@ -53,23 +60,23 @@ export class MessageService extends BaseService {
return await Promise.all(
messages.map(async (message) => {
- const messageWithoutFiles = { ...message };
- delete (messageWithoutFiles as any).filesToMessages;
-
return {
- ...messageWithoutFiles,
+ ...projectPublicMessage(message as MessageItem),
files: await Promise.all(
message.filesToMessages?.map(async ({ file }) => {
+ const publicFile = projectPublicFile(file as FileItem);
if (file.url.startsWith('http')) {
- return file;
+ return publicFile;
}
return {
- ...file,
+ ...publicFile,
url: await this.coreFileService.getFullFileUrl(file.url),
};
}) ?? [],
),
+ session: message.session ? projectPublicSession(message.session as SessionItem) : null,
+ topic: message.topic ? projectPublicTopic(message.topic as TopicItem) : null,
};
}),
);
diff --git a/packages/openapi/src/services/model.service.ts b/packages/openapi/src/services/model.service.ts
index 8dae6dab609..ced6064855b 100644
--- a/packages/openapi/src/services/model.service.ts
+++ b/packages/openapi/src/services/model.service.ts
@@ -5,6 +5,7 @@ import type { LobeChatDatabase } from '@/database/type';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
+import { projectPublicModel } from '../helpers/public-fields';
import type { ServiceResult } from '../types';
import type {
CreateModelRequest,
@@ -103,7 +104,9 @@ export class ModelService extends BaseService {
]);
return {
- models: result.map((model) => ({ ...model, type: normalizeModelType(model.type) })),
+ models: result.map((model) =>
+ projectPublicModel({ ...model, type: normalizeModelType(model.type) }),
+ ),
total: totalResult[0]?.count ?? 0,
};
} catch (error) {
@@ -137,7 +140,7 @@ export class ModelService extends BaseService {
throw this.createNotFoundError(`模型 ${providerId}/${modelId} 不存在`);
}
- return { ...model, type: normalizeModelType(model.type) };
+ return projectPublicModel({ ...model, type: normalizeModelType(model.type) });
} catch (error) {
this.handleServiceError(error, '获取模型详情');
}
@@ -194,7 +197,7 @@ export class ModelService extends BaseService {
})
.returning();
- return created;
+ return projectPublicModel(created);
});
} catch (error) {
this.handleServiceError(error, '创建模型');
@@ -264,7 +267,7 @@ export class ModelService extends BaseService {
throw this.createBusinessError('更新模型失败');
}
- return updated;
+ return projectPublicModel(updated);
});
} catch (error) {
this.handleServiceError(error, '更新模型');
diff --git a/packages/openapi/src/services/permission.service.ts b/packages/openapi/src/services/permission.service.ts
index a7948fcb8c5..d51d6d0f409 100644
--- a/packages/openapi/src/services/permission.service.ts
+++ b/packages/openapi/src/services/permission.service.ts
@@ -1,11 +1,11 @@
import { and, count, desc, eq, ilike, or } from 'drizzle-orm';
-import type { PermissionItem } from '@/database/schemas/rbac';
import { permissions, rolePermissions } from '@/database/schemas/rbac';
import type { LobeChatDatabase } from '@/database/type';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
+import { projectPublicPermission, type PublicPermission } from '../helpers/public-fields';
import type { ServiceResult } from '../types';
import type {
CreatePermissionRequest,
@@ -61,7 +61,7 @@ export class PermissionService extends BaseService {
const [listResult, totalResult] = await Promise.all([listQuery, countQuery]);
return {
- permissions: listResult,
+ permissions: listResult.map(projectPublicPermission),
total: totalResult[0]?.count || 0,
};
} catch (error) {
@@ -72,13 +72,13 @@ export class PermissionService extends BaseService {
/**
* Get permission detail by ID
*/
- async getPermissionById(id: string): ServiceResult<PermissionItem | null> {
+ async getPermissionById(id: string): ServiceResult<PublicPermission | null> {
try {
const permission = await this.db.query.permissions.findFirst({
where: eq(permissions.id, id),
});
- return permission || null;
+ return permission ? projectPublicPermission(permission) : null;
} catch (error) {
this.handleServiceError(error, '获取权限详情');
}
@@ -87,7 +87,7 @@ export class PermissionService extends BaseService {
/**
* Create a new permission record
*/
- async createPermission(payload: CreatePermissionRequest): ServiceResult<PermissionItem> {
+ async createPermission(payload: CreatePermissionRequest): ServiceResult<PublicPermission> {
try {
// Ensure permission code is unique
const existing = await this.db.query.permissions.findFirst({
@@ -109,7 +109,7 @@ export class PermissionService extends BaseService {
})
.returning();
- return created;
+ return projectPublicPermission(created);
} catch (error) {
this.handleServiceError(error, '创建权限');
}
@@ -121,7 +121,7 @@ export class PermissionService extends BaseService {
async updatePermission(
id: string,
payload: UpdatePermissionRequest,
- ): ServiceResult<PermissionItem> {
+ ): ServiceResult<PublicPermission> {
try {
const existingPermission = await this.db.query.permissions.findFirst({
where: eq(permissions.id, id),
@@ -160,7 +160,7 @@ export class PermissionService extends BaseService {
.where(eq(permissions.id, id))
.returning();
- return updated;
+ return projectPublicPermission(updated);
} catch (error) {
this.handleServiceError(error, '更新权限');
}
diff --git a/packages/openapi/src/services/provider.service.test.ts b/packages/openapi/src/services/provider.service.test.ts
index 1aeb31637d9..1bd55870e56 100644
--- a/packages/openapi/src/services/provider.service.test.ts
+++ b/packages/openapi/src/services/provider.service.test.ts
@@ -11,6 +11,11 @@ vi.mock('@/const/rbac', () => ({
ALL_SCOPE: 'all',
}));
+vi.mock('@lobechat/database', () => ({
+ buildWorkspacePayload: vi.fn(),
+ buildWorkspaceWhere: vi.fn(),
+}));
+
vi.mock('@/database/models/rbac', () => ({
RbacModel: class {},
}));
diff --git a/packages/openapi/src/services/provider.service.ts b/packages/openapi/src/services/provider.service.ts
index 36d45b13fdf..cd0e6c9a8d1 100644
--- a/packages/openapi/src/services/provider.service.ts
+++ b/packages/openapi/src/services/provider.service.ts
@@ -8,6 +8,7 @@ import { KeyVaultsGateKeeper } from '@/server/modules/KeyVaultsEncrypt';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
+import { projectPublicProvider } from '../helpers/public-fields';
import type { ServiceResult } from '../types';
import type {
CreateProviderRequest,
@@ -75,13 +76,7 @@ export class ProviderService extends BaseService {
private async transformProviderRecord(
provider: AiProviderSelectItem,
): Promise<ProviderDetailResponse> {
- const { fetchOnClient, ...rest } = provider;
-
- return {
- ...rest,
- fetchOnClient: typeof fetchOnClient === 'boolean' ? fetchOnClient : null,
- keyVaults: await this.decryptKeyVaults(provider.keyVaults),
- };
+ return projectPublicProvider(provider);
}
async getProviders(request: ProviderListQuery = {}): ServiceResult<GetProvidersResponse> {
@@ -200,8 +195,6 @@ export class ProviderService extends BaseService {
throw this.createAuthorizationError(permissionResult.message || '无权创建 Provider');
}
- const ownerId = permissionResult.condition?.userId ?? this.userId;
-
const existed = await this.db.query.aiProviders.findFirst({
where: and(eq(aiProviders.id, request.id), this.buildWorkspaceWhere(aiProviders)),
});
diff --git a/packages/openapi/src/services/role.service.ts b/packages/openapi/src/services/role.service.ts
index 86647437778..5d562240b3f 100644
--- a/packages/openapi/src/services/role.service.ts
+++ b/packages/openapi/src/services/role.service.ts
@@ -1,12 +1,12 @@
import type { SQL } from 'drizzle-orm';
import { and, count, eq, ilike, inArray, isNull, or, sql } from 'drizzle-orm';
-import type { RoleItem } from '@/database/schemas/rbac';
import { permissions, rolePermissions, roles, userRoles } from '@/database/schemas/rbac';
import type { LobeChatDatabase } from '@/database/type';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
+import { projectPublicRole, type PublicRole } from '../helpers/public-fields';
import type { ServiceResult } from '../types';
import type {
CreateRoleRequest,
@@ -44,7 +44,9 @@ export class RoleService extends BaseService {
// Permission check
const permissionResult = await this.resolveOperationPermission('RBAC_ROLE_READ');
if (!permissionResult.isPermitted) {
- throw this.createAuthorizationError(permissionResult.message || 'No permission to access role list');
+ throw this.createAuthorizationError(
+ permissionResult.message || 'No permission to access role list',
+ );
}
const conditions = [];
@@ -83,7 +85,7 @@ export class RoleService extends BaseService {
]);
return {
- roles: listResult,
+ roles: listResult.map(projectPublicRole),
total: totalResult[0]?.count || 0,
};
} catch (error) {
@@ -95,18 +97,21 @@ export class RoleService extends BaseService {
* Get all active roles in the system
* @returns Promise<RoleItem[]> - Array of active roles
*/
- async getActiveRoles(): ServiceResult<RoleItem[]> {
+ async getActiveRoles(): ServiceResult<PublicRole[]> {
// Permission check
const permissionResult = await this.resolveOperationPermission('RBAC_ROLE_READ');
if (!permissionResult.isPermitted) {
- throw this.createAuthorizationError(permissionResult.message || 'No permission to access active role list');
+ throw this.createAuthorizationError(
+ permissionResult.message || 'No permission to access active role list',
+ );
}
try {
- return await this.db.query.roles.findMany({
+ const activeRoles = await this.db.query.roles.findMany({
orderBy: [roles.isSystem, roles.createdAt],
where: and(eq(roles.isActive, true), this.getRoleScopeWhere()),
});
+ return activeRoles.map(projectPublicRole);
} catch (error) {
this.handleServiceError(error, 'get active role list');
}
@@ -117,18 +122,20 @@ export class RoleService extends BaseService {
* @param id - Role ID
* @returns Promise<RoleItem | undefined> - Role item or undefined if not found
*/
- async getRoleById(id: string): ServiceResult<RoleItem | null> {
+ async getRoleById(id: string): ServiceResult<PublicRole | null> {
// Permission check
const permissionResult = await this.resolveOperationPermission('RBAC_ROLE_READ');
if (!permissionResult.isPermitted) {
- throw this.createAuthorizationError(permissionResult.message || 'No permission to access this role');
+ throw this.createAuthorizationError(
+ permissionResult.message || 'No permission to access this role',
+ );
}
try {
const role = await this.db.query.roles.findFirst({
where: and(eq(roles.id, id), this.getRoleScopeWhere()),
});
- return role || null;
+ return role ? projectPublicRole(role) : null;
} catch (error) {
this.handleServiceError(error, 'get role details');
}
@@ -139,18 +146,20 @@ export class RoleService extends BaseService {
* @param name - Role name
* @returns Promise<RoleItem | undefined> - Role item or undefined if not found
*/
- async getRoleByName(name: string): ServiceResult<RoleItem | null> {
+ async getRoleByName(name: string): ServiceResult<PublicRole | null> {
// Permission check
const permissionResult = await this.resolveOperationPermission('RBAC_ROLE_READ');
if (!permissionResult.isPermitted) {
- throw this.createAuthorizationError(permissionResult.message || 'No permission to access this role');
+ throw this.createAuthorizationError(
+ permissionResult.message || 'No permission to access this role',
+ );
}
try {
const role = await this.db.query.roles.findFirst({
where: and(eq(roles.name, name), this.getRoleScopeWhere()),
});
- return role || null;
+ return role ? projectPublicRole(role) : null;
} catch (error) {
this.handleServiceError(error, 'get role details');
}
@@ -159,12 +168,14 @@ export class RoleService extends BaseService {
/**
* Create a new role
*/
- async createRole(payload: CreateRoleRequest): ServiceResult<RoleItem> {
+ async createRole(payload: CreateRoleRequest): ServiceResult<PublicRole> {
this.log('info', 'create role', { payload });
const permissionResult = await this.resolveOperationPermission('RBAC_ROLE_CREATE');
if (!permissionResult.isPermitted) {
- throw this.createAuthorizationError(permissionResult.message || 'No permission to create role');
+ throw this.createAuthorizationError(
+ permissionResult.message || 'No permission to create role',
+ );
}
try {
@@ -189,8 +200,11 @@ export class RoleService extends BaseService {
})
.returning();
- this.log('info', 'role created successfully', { roleId: createdRole.id, roleName: createdRole.name });
- return createdRole;
+ this.log('info', 'role created successfully', {
+ roleId: createdRole.id,
+ roleName: createdRole.name,
+ });
+ return projectPublicRole(createdRole);
});
} catch (error) {
this.handleServiceError(error, 'create role');
@@ -209,7 +223,9 @@ export class RoleService extends BaseService {
// Permission check
const permissionResult = await this.resolveOperationPermission('RBAC_PERMISSION_READ');
if (!permissionResult.isPermitted) {
- throw this.createAuthorizationError(permissionResult.message || 'No permission to access role permissions');
+ throw this.createAuthorizationError(
+ permissionResult.message || 'No permission to access role permissions',
+ );
}
const conditions: SQL<unknown>[] = [eq(rolePermissions.roleId, request.roleId)];
@@ -273,7 +289,9 @@ export class RoleService extends BaseService {
const permissionResult = await this.resolveOperationPermission('RBAC_ROLE_UPDATE');
if (!permissionResult.isPermitted) {
- throw this.createAuthorizationError(permissionResult.message || 'No permission to update role permissions');
+ throw this.createAuthorizationError(
+ permissionResult.message || 'No permission to update role permissions',
+ );
}
const rawGrantIds = payload.grant ?? [];
@@ -377,13 +395,15 @@ export class RoleService extends BaseService {
* @param updateData - Role update data
* @returns Promise<RoleItem> - Updated role item
*/
- async updateRole(id: string, updateData: UpdateRoleRequest): ServiceResult<RoleItem> {
+ async updateRole(id: string, updateData: UpdateRoleRequest): ServiceResult<PublicRole> {
this.log('info', 'update role info', { roleId: id, updateData });
// Permission check
const permissionResult = await this.resolveOperationPermission('RBAC_ROLE_UPDATE');
if (!permissionResult.isPermitted) {
- throw this.createAuthorizationError(permissionResult.message || 'No permission to update role');
+ throw this.createAuthorizationError(
+ permissionResult.message || 'No permission to update role',
+ );
}
try {
@@ -399,7 +419,9 @@ export class RoleService extends BaseService {
// Check if it is a system role; system roles cannot have certain fields modified
if (existingRole.isSystem && (updateData.name || updateData.isSystem === false)) {
- throw this.createBusinessError('System roles cannot have their name or system attribute modified');
+ throw this.createBusinessError(
+ 'System roles cannot have their name or system attribute modified',
+ );
}
// If the role name is being modified, check whether the new name already exists
@@ -431,7 +453,7 @@ export class RoleService extends BaseService {
.returning();
this.log('info', 'role updated successfully', { roleId: id, roleName: updatedRole.name });
- return updatedRole;
+ return projectPublicRole(updatedRole);
});
} catch (error) {
this.handleServiceError(error, 'update role');
@@ -447,7 +469,9 @@ export class RoleService extends BaseService {
// Permission check
const permissionResult = await this.resolveOperationPermission('RBAC_ROLE_UPDATE');
if (!permissionResult.isPermitted) {
- throw this.createAuthorizationError(permissionResult.message || 'No permission to clear role permissions');
+ throw this.createAuthorizationError(
+ permissionResult.message || 'No permission to clear role permissions',
+ );
}
try {
@@ -481,7 +505,9 @@ export class RoleService extends BaseService {
const permissionResult = await this.resolveOperationPermission('RBAC_ROLE_DELETE');
if (!permissionResult.isPermitted) {
- throw this.createAuthorizationError(permissionResult.message || 'No permission to delete role');
+ throw this.createAuthorizationError(
+ permissionResult.message || 'No permission to delete role',
+ );
}
try {
@@ -502,7 +528,9 @@ export class RoleService extends BaseService {
where: and(eq(userRoles.roleId, id), this.getUserRoleScopeWhere()),
});
if (linkedUser) {
- throw this.createBusinessError('Role is still associated with users and cannot be deleted');
+ throw this.createBusinessError(
+ 'Role is still associated with users and cannot be deleted',
+ );
}
const [deletedRole] = await tx
diff --git a/packages/openapi/src/services/topic.service.ts b/packages/openapi/src/services/topic.service.ts
index e123094bf8a..a687bed0cd5 100644
--- a/packages/openapi/src/services/topic.service.ts
+++ b/packages/openapi/src/services/topic.service.ts
@@ -6,6 +6,7 @@ import { idGenerator } from '@/database/utils/idGenerator';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
+import { projectPublicTopic, projectPublicUser } from '../helpers/public-fields';
import type {
TopicCreateRequest,
TopicListQuery,
@@ -109,9 +110,9 @@ export class TopicService extends BaseService {
return {
topics: result.map((item) => ({
- ...item.topic,
+ ...projectPublicTopic(item.topic),
messageCount: item.messageCount,
- user: item.user,
+ user: projectPublicUser(item.user),
})),
total: countResult.count,
};
@@ -156,9 +157,9 @@ export class TopicService extends BaseService {
}
return {
- ...result.topic,
+ ...projectPublicTopic(result.topic),
messageCount: result.messageCount,
- user: result.user,
+ user: projectPublicUser(result.user),
};
} catch (error) {
return this.handleServiceError(error, '获取话题');
diff --git a/packages/openapi/src/services/user.service.ts b/packages/openapi/src/services/user.service.ts
index c6a9ece8c63..18801dde372 100644
--- a/packages/openapi/src/services/user.service.ts
+++ b/packages/openapi/src/services/user.service.ts
@@ -10,6 +10,7 @@ import { idGenerator } from '@/database/utils/idGenerator';
import { BaseService } from '../common/base.service';
import { processPaginationConditions } from '../helpers/pagination';
+import { projectPublicRole, projectPublicUser } from '../helpers/public-fields';
import type { ServiceResult } from '../types';
import type {
CreateUserRequest,
@@ -59,8 +60,8 @@ export class UserService extends BaseService {
.where(and(eq(userRoles.userId, userId), this.buildPermissionWhere(userRoles, { userId })));
return {
- ...user,
- roles: userRoleResults.map((r) => r.roles),
+ ...projectPublicUser(user),
+ roles: userRoleResults.map((r) => projectPublicRole(r.roles)),
};
}
@@ -79,9 +80,9 @@ export class UserService extends BaseService {
]);
return {
- ...user,
+ ...projectPublicUser(user),
messageCount: messageCountResult[0]?.count || 0,
- roles: userRoleResults.map((r) => r.roles),
+ roles: userRoleResults.map((r) => projectPublicRole(r.roles)),
};
}
@@ -147,9 +148,9 @@ export class UserService extends BaseService {
.where(eq(messages.userId, userRow.id));
return {
- ...userRow,
+ ...projectPublicUser(userRow),
messageCount: messageCountResult[0]?.count || 0,
- roles: userRoleResults.map((r) => r.roles),
+ roles: userRoleResults.map((r) => projectPublicRole(r.roles)),
};
}),
);
diff --git a/packages/openapi/src/spec.ts b/packages/openapi/src/spec.ts
index 7b1679fd7de..1cacd618cf1 100644
--- a/packages/openapi/src/spec.ts
+++ b/packages/openapi/src/spec.ts
@@ -1,5 +1,7 @@
import { generateSpecs } from 'hono-openapi';
+import { API_KEY_SCOPES } from '@/const/apiKeyScope';
+
const HTTP_METHODS = new Set(['DELETE', 'GET', 'PATCH', 'POST', 'PUT']);
type GenerateSpecsApp = Parameters<typeof generateSpecs>[0];
@@ -10,6 +12,661 @@ interface OperationObject {
tags?: string[];
}
+type SchemaObject = Record<string, unknown>;
+
+const dateTime = { format: 'date-time', type: 'string' } as const;
+const nullableString = { type: ['string', 'null'] } as const;
+const nullableBoolean = { type: ['boolean', 'null'] } as const;
+const nullableNumber = { type: ['number', 'null'] } as const;
+const nullableObject = { additionalProperties: true, type: ['object', 'null'] } as const;
+
+const resourceSchemas: Record<string, SchemaObject> = {
+ ApiKey: {
+ additionalProperties: false,
+ properties: {
+ createdAt: dateTime,
+ enabled: nullableBoolean,
+ expiresAt: { ...dateTime, type: ['string', 'null'] },
+ id: { type: 'string' },
+ lastUsedAt: { ...dateTime, type: ['string', 'null'] },
+ name: { type: 'string' },
+ scopes: { items: { enum: API_KEY_SCOPES, type: 'string' }, type: ['array', 'null'] },
+ updatedAt: dateTime,
+ },
+ required: ['id', 'name', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ Agent: {
+ additionalProperties: false,
+ properties: {
+ avatar: nullableString,
+ chatConfig: nullableObject,
+ createdAt: dateTime,
+ description: nullableString,
+ id: { type: 'string' },
+ model: nullableString,
+ params: nullableObject,
+ provider: nullableString,
+ slug: nullableString,
+ systemRole: nullableString,
+ title: nullableString,
+ updatedAt: dateTime,
+ },
+ required: ['id', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ AgentGroup: {
+ additionalProperties: false,
+ properties: {
+ createdAt: dateTime,
+ id: { type: 'string' },
+ name: { type: 'string' },
+ sort: { type: ['integer', 'null'] },
+ updatedAt: dateTime,
+ },
+ required: ['id', 'name', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ ChatResponse: {
+ additionalProperties: false,
+ properties: {
+ content: { type: 'string' },
+ model: nullableString,
+ provider: nullableString,
+ usage: {
+ additionalProperties: false,
+ properties: {
+ completion_tokens: { type: ['integer', 'null'] },
+ prompt_tokens: { type: ['integer', 'null'] },
+ total_tokens: { type: ['integer', 'null'] },
+ },
+ type: ['object', 'null'],
+ },
+ },
+ required: ['content'],
+ type: 'object',
+ },
+ EvalRun: {
+ additionalProperties: false,
+ properties: {
+ createdAt: dateTime,
+ datasetId: { type: 'string' },
+ id: { type: 'string' },
+ metrics: nullableObject,
+ name: nullableString,
+ startedAt: { ...dateTime, type: ['string', 'null'] },
+ status: {
+ enum: ['idle', 'pending', 'running', 'completed', 'failed', 'aborted', 'external'],
+ type: 'string',
+ },
+ targetAgentId: nullableString,
+ updatedAt: dateTime,
+ },
+ required: ['id', 'datasetId', 'status', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ EvalRunResult: {
+ additionalProperties: false,
+ properties: {
+ createdAt: dateTime,
+ input: { type: 'string' },
+ passed: nullableBoolean,
+ result: nullableObject,
+ score: nullableNumber,
+ status: nullableString,
+ testCaseId: { type: 'string' },
+ topicId: { type: 'string' },
+ },
+ required: ['testCaseId', 'topicId', 'input', 'createdAt'],
+ type: 'object',
+ },
+ File: {
+ additionalProperties: true,
+ properties: {
+ createdAt: dateTime,
+ fileType: { type: 'string' },
+ id: { type: 'string' },
+ metadata: nullableObject,
+ name: { type: 'string' },
+ parentId: nullableString,
+ size: { type: 'integer' },
+ source: nullableString,
+ updatedAt: dateTime,
+ url: { type: 'string' },
+ visibility: { enum: ['private', 'public'], type: 'string' },
+ },
+ required: ['id', 'fileType', 'name', 'size', 'url', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ KnowledgeBase: {
+ additionalProperties: true,
+ properties: {
+ avatar: nullableString,
+ createdAt: dateTime,
+ description: nullableString,
+ id: { type: 'string' },
+ isPublic: nullableBoolean,
+ name: { type: 'string' },
+ settings: nullableObject,
+ type: nullableString,
+ updatedAt: dateTime,
+ visibility: { enum: ['private', 'public'], type: 'string' },
+ },
+ required: ['id', 'name', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ Message: {
+ additionalProperties: true,
+ properties: {
+ agentId: nullableString,
+ content: nullableString,
+ createdAt: dateTime,
+ error: nullableObject,
+ favorite: nullableBoolean,
+ id: { type: 'string' },
+ metadata: nullableObject,
+ model: nullableString,
+ parentId: nullableString,
+ provider: nullableString,
+ reasoning: nullableObject,
+ role: { type: 'string' },
+ search: nullableObject,
+ threadId: nullableString,
+ tools: nullableObject,
+ topicId: nullableString,
+ updatedAt: dateTime,
+ usage: nullableObject,
+ },
+ required: ['id', 'role', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ McpServer: {
+ additionalProperties: false,
+ properties: {
+ createdAt: dateTime,
+ description: nullableString,
+ hasCredentials: { type: 'boolean' },
+ id: { format: 'uuid', type: 'string' },
+ identifier: { type: 'string' },
+ isEnabled: { type: 'boolean' },
+ name: { type: 'string' },
+ serverUrl: { format: 'uri', type: 'string' },
+ status: { enum: ['connected', 'disconnected', 'error'], type: 'string' },
+ tools: {
+ items: {
+ additionalProperties: false,
+ properties: {
+ description: nullableString,
+ id: { format: 'uuid', type: 'string' },
+ inputSchema: nullableObject,
+ name: { type: 'string' },
+ permission: { enum: ['auto', 'needs_approval', 'disabled'], type: 'string' },
+ },
+ required: ['id', 'name', 'permission'],
+ type: 'object',
+ },
+ type: 'array',
+ },
+ updatedAt: dateTime,
+ },
+ required: [
+ 'id',
+ 'identifier',
+ 'name',
+ 'serverUrl',
+ 'status',
+ 'isEnabled',
+ 'hasCredentials',
+ 'tools',
+ 'createdAt',
+ 'updatedAt',
+ ],
+ type: 'object',
+ },
+ Model: {
+ additionalProperties: false,
+ properties: {
+ abilities: nullableObject,
+ config: nullableObject,
+ contextWindowTokens: { type: ['integer', 'null'] },
+ createdAt: dateTime,
+ description: nullableString,
+ displayName: nullableString,
+ enabled: nullableBoolean,
+ id: { type: 'string' },
+ organization: nullableString,
+ parameters: nullableObject,
+ pricing: nullableObject,
+ providerId: { type: 'string' },
+ releasedAt: nullableString,
+ settings: nullableObject,
+ sort: { type: ['integer', 'null'] },
+ source: nullableString,
+ type: { type: 'string' },
+ updatedAt: dateTime,
+ },
+ required: ['id', 'providerId', 'type', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ Permission: {
+ additionalProperties: false,
+ properties: {
+ category: { type: 'string' },
+ code: { type: 'string' },
+ createdAt: dateTime,
+ description: nullableString,
+ id: { type: 'string' },
+ isActive: nullableBoolean,
+ name: { type: 'string' },
+ updatedAt: dateTime,
+ },
+ required: ['id', 'code', 'name', 'category', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ Provider: {
+ additionalProperties: false,
+ properties: {
+ checkModel: nullableString,
+ config: nullableObject,
+ createdAt: dateTime,
+ description: nullableString,
+ enabled: nullableBoolean,
+ fetchOnClient: nullableBoolean,
+ id: { type: 'string' },
+ logo: nullableString,
+ name: nullableString,
+ settings: nullableObject,
+ sort: { type: ['integer', 'null'] },
+ source: nullableString,
+ updatedAt: dateTime,
+ },
+ required: ['id', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ Role: {
+ additionalProperties: false,
+ properties: {
+ createdAt: dateTime,
+ description: nullableString,
+ displayName: { type: 'string' },
+ id: { type: 'string' },
+ isActive: nullableBoolean,
+ isSystem: nullableBoolean,
+ name: { type: 'string' },
+ updatedAt: dateTime,
+ },
+ required: ['id', 'name', 'displayName', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ Topic: {
+ additionalProperties: true,
+ properties: {
+ agentId: nullableString,
+ completedAt: { ...dateTime, type: ['string', 'null'] },
+ content: nullableString,
+ cost: nullableObject,
+ createdAt: dateTime,
+ description: nullableString,
+ favorite: nullableBoolean,
+ groupId: nullableString,
+ historySummary: nullableString,
+ id: { type: 'string' },
+ metadata: nullableObject,
+ mode: nullableString,
+ model: nullableString,
+ provider: nullableString,
+ sessionId: nullableString,
+ status: nullableString,
+ title: nullableString,
+ totalCost: nullableNumber,
+ totalInputTokens: { type: ['integer', 'null'] },
+ totalOutputTokens: { type: ['integer', 'null'] },
+ totalTokens: { type: ['integer', 'null'] },
+ trigger: nullableString,
+ updatedAt: dateTime,
+ usage: nullableObject,
+ },
+ required: ['id', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ User: {
+ additionalProperties: true,
+ properties: {
+ avatar: nullableString,
+ createdAt: dateTime,
+ email: nullableString,
+ firstName: nullableString,
+ fullName: nullableString,
+ id: { type: 'string' },
+ isOnboarded: nullableBoolean,
+ lastName: nullableString,
+ phone: nullableString,
+ updatedAt: dateTime,
+ username: nullableString,
+ },
+ required: ['id', 'createdAt', 'updatedAt'],
+ type: 'object',
+ },
+ Usage: {
+ additionalProperties: false,
+ properties: {
+ available: { type: 'boolean' },
+ currency: { const: 'USD', type: 'string' },
+ daily: {
+ items: {
+ additionalProperties: false,
+ properties: { date: { type: 'string' }, value: { type: 'number' } },
+ required: ['date', 'value'],
+ type: 'object',
+ },
+ type: 'array',
+ },
+ period: {
+ additionalProperties: false,
+ properties: { since: dateTime, until: dateTime },
+ required: ['since', 'until'],
+ type: 'object',
+ },
+ remainingBalance: nullableNumber,
+ scope: { enum: ['personal', 'workspace'], type: 'string' },
+ spent: { type: 'number' },
+ usageByType: {
+ items: {
+ additionalProperties: false,
+ properties: {
+ count: { type: ['integer', 'null'] },
+ spend: { type: 'number' },
+ type: { type: 'string' },
+ },
+ required: ['count', 'spend', 'type'],
+ type: 'object',
+ },
+ type: 'array',
+ },
+ },
+ required: [
+ 'available',
+ 'currency',
+ 'daily',
+ 'period',
+ 'remainingBalance',
+ 'scope',
+ 'spent',
+ 'usageByType',
+ ],
+ type: 'object',
+ },
+};
+
+const groupResources: Record<string, { listKey: string; schema: string }> = {
+ 'agent-groups': { listKey: 'agentGroups', schema: 'AgentGroup' },
+ 'agents': { listKey: 'agents', schema: 'Agent' },
+ 'api-keys': { listKey: 'apiKeys', schema: 'ApiKey' },
+ 'files': { listKey: 'files', schema: 'File' },
+ 'knowledge-bases': { listKey: 'knowledgeBases', schema: 'KnowledgeBase' },
+ 'messages': { listKey: 'messages', schema: 'Message' },
+ 'mcp-servers': { listKey: 'mcpServers', schema: 'McpServer' },
+ 'models': { listKey: 'models', schema: 'Model' },
+ 'permissions': { listKey: 'permissions', schema: 'Permission' },
+ 'providers': { listKey: 'providers', schema: 'Provider' },
+ 'roles': { listKey: 'roles', schema: 'Role' },
+ 'topics': { listKey: 'topics', schema: 'Topic' },
+ 'users': { listKey: 'users', schema: 'User' },
+ 'usage': { listKey: 'usage', schema: 'Usage' },
+};
+
+const ref = (schema: string): SchemaObject => ({ $ref: `#/components/schemas/${schema}` });
+
+const successEnvelope = (data: SchemaObject): SchemaObject => ({
+ additionalProperties: false,
+ properties: {
+ data,
+ message: { type: 'string' },
+ success: { const: true, type: 'boolean' },
+ timestamp: dateTime,
+ },
+ required: ['success', 'timestamp'],
+ type: 'object',
+});
+
+const getSuccessSchema = (group: string, rest: string, method: string): SchemaObject => {
+ if (group === 'health') {
+ return {
+ additionalProperties: false,
+ properties: {
+ service: { type: 'string' },
+ status: { const: 'ok', type: 'string' },
+ timestamp: dateTime,
+ },
+ required: ['service', 'status', 'timestamp'],
+ type: 'object',
+ };
+ }
+
+ if (group === 'responses') {
+ return {
+ additionalProperties: true,
+ properties: {
+ id: { type: 'string' },
+ object: { const: 'response', type: 'string' },
+ output: { items: { type: 'object' }, type: 'array' },
+ status: { type: 'string' },
+ usage: { type: ['object', 'null'] },
+ },
+ required: ['id', 'object', 'output', 'status'],
+ type: 'object',
+ };
+ }
+
+ if (group === 'chat') {
+ if (rest === 'translate') {
+ return successEnvelope({
+ additionalProperties: false,
+ properties: { translatedText: { type: 'string' } },
+ required: ['translatedText'],
+ type: 'object',
+ });
+ }
+
+ if (rest === 'generate-reply') {
+ return successEnvelope({
+ additionalProperties: false,
+ properties: { reply: { type: 'string' } },
+ required: ['reply'],
+ type: 'object',
+ });
+ }
+
+ return successEnvelope(ref('ChatResponse'));
+ }
+
+ if (group === 'eval') {
+ if (rest.endsWith('/results')) {
+ return successEnvelope({
+ additionalProperties: false,
+ properties: {
+ results: { items: ref('EvalRunResult'), type: 'array' },
+ runId: { type: 'string' },
+ total: { minimum: 0, type: 'integer' },
+ },
+ required: ['runId', 'total', 'results'],
+ type: 'object',
+ });
+ }
+ return successEnvelope(ref('EvalRun'));
+ }
+
+ const resource = groupResources[group];
+ if (!resource) return successEnvelope({ additionalProperties: true, type: 'object' });
+
+ if (group === 'usage') return successEnvelope(ref('Usage'));
+
+ const isRootList = method === 'get' && rest === '';
+ if (isRootList) {
+ if (group === 'agent-groups' || group === 'api-keys' || group === 'mcp-servers') {
+ return successEnvelope({ items: ref(resource.schema), type: 'array' });
+ }
+
+ return successEnvelope({
+ additionalProperties: true,
+ properties: {
+ [resource.listKey]: { items: ref(resource.schema), type: 'array' },
+ total: { minimum: 0, type: 'integer' },
+ },
+ required: [resource.listKey],
+ type: 'object',
+ });
+ }
+
+ if (method === 'delete') {
+ return successEnvelope({ additionalProperties: true, type: ['object', 'null'] });
+ }
+
+ if (group === 'agent-groups' && method === 'post' && rest === '') {
+ return successEnvelope({
+ additionalProperties: false,
+ properties: { id: { type: 'string' } },
+ required: ['id'],
+ type: 'object',
+ });
+ }
+
+ if (group === 'api-keys' && method === 'post' && rest === '') {
+ const apiKey = resourceSchemas.ApiKey as { properties: Record<string, unknown> };
+ return successEnvelope({
+ additionalProperties: false,
+ properties: { ...apiKey.properties, key: { type: 'string' } },
+ required: ['id', 'name', 'key', 'createdAt', 'updatedAt'],
+ type: 'object',
+ });
+ }
+
+ if (group === 'mcp-servers' && method === 'post' && rest.endsWith('/sync')) {
+ return successEnvelope({
+ additionalProperties: false,
+ properties: {
+ id: { format: 'uuid', type: 'string' },
+ status: { const: 'connected', type: 'string' },
+ toolCount: { minimum: 0, type: 'integer' },
+ },
+ required: ['id', 'status', 'toolCount'],
+ type: 'object',
+ });
+ }
+
+ // The file controllers wrap their payloads instead of returning the bare
+ // resource, so the one-segment fallback below would advertise `File` and make
+ // generated clients mistype every one of these. Keep these explicit.
+ if (group === 'files') {
+ const fileDetail: SchemaObject = {
+ additionalProperties: false,
+ properties: { file: ref('File'), parsed: { type: 'object' } },
+ required: ['file'],
+ type: 'object',
+ };
+
+ if ((method === 'post' && rest === '') || (method === 'get' && rest === '{id}')) {
+ return successEnvelope(fileDetail);
+ }
+
+ if (method === 'post' && rest === 'batches') {
+ return successEnvelope({
+ additionalProperties: false,
+ properties: {
+ failed: {
+ items: {
+ additionalProperties: false,
+ properties: { error: { type: 'string' }, name: { type: 'string' } },
+ required: ['error', 'name'],
+ type: 'object',
+ },
+ type: 'array',
+ },
+ successful: { items: fileDetail, type: 'array' },
+ summary: {
+ additionalProperties: false,
+ properties: {
+ failed: { minimum: 0, type: 'integer' },
+ successful: { minimum: 0, type: 'integer' },
+ total: { minimum: 0, type: 'integer' },
+ },
+ required: ['failed', 'successful', 'total'],
+ type: 'object',
+ },
+ },
+ required: ['failed', 'successful', 'summary'],
+ type: 'object',
+ });
+ }
+
+ if (method === 'post' && rest === 'queries') {
+ return successEnvelope({
+ additionalProperties: false,
+ properties: {
+ failed: {
+ items: {
+ additionalProperties: false,
+ properties: { error: { type: 'string' }, fileId: { type: 'string' } },
+ required: ['error', 'fileId'],
+ type: 'object',
+ },
+ type: 'array',
+ },
+ files: { items: fileDetail, type: 'array' },
+ success: { minimum: 0, type: 'integer' },
+ total: { minimum: 0, type: 'integer' },
+ },
+ required: ['failed', 'files', 'success', 'total'],
+ type: 'object',
+ });
+ }
+ }
+
+ if (group === 'messages' && rest === 'count') {
+ return successEnvelope({
+ additionalProperties: false,
+ properties: { count: { minimum: 0, type: 'integer' } },
+ required: ['count'],
+ type: 'object',
+ });
+ }
+
+ // Returns the created message, or nothing when generation produced no reply.
+ if (group === 'messages' && rest === 'replies') {
+ return successEnvelope({ anyOf: [ref('Message'), { type: 'null' }] });
+ }
+
+ // A caller without `user:read` deliberately receives only `{ id }`.
+ if (group === 'users' && rest === 'me') {
+ return successEnvelope({
+ anyOf: [
+ ref('User'),
+ {
+ additionalProperties: false,
+ properties: { id: { type: 'string' } },
+ required: ['id'],
+ type: 'object',
+ },
+ ],
+ });
+ }
+
+ // Only true resource operations get the resource schema: the collection root
+ // and the `{id}` item. Every other single segment is a named sub-operation
+ // (`count`, `me`, `batches`, …) whose payload is its own shape, so it must be
+ // described explicitly above — falling back to a permissive object here keeps
+ // an undescribed route merely vague rather than confidently wrong.
+ const isResourceOperation = rest === '' || rest === '{id}';
+ return isResourceOperation
+ ? successEnvelope(ref(resource.schema))
+ : successEnvelope({ additionalProperties: true, type: 'object' });
+};
+
+const errorResponse = (description: string) => ({
+ content: { 'application/json': { schema: ref('ApiError') } },
+ description,
+});
+
/**
* Build the OpenAPI 3.1 document from the live Hono app.
*
@@ -21,6 +678,19 @@ export const buildSpecDocument = async (app: GenerateSpecsApp) => {
const spec = await generateSpecs(app, {
documentation: {
components: {
+ schemas: {
+ ApiError: {
+ additionalProperties: false,
+ properties: {
+ error: { type: 'string' },
+ success: { const: false, type: 'boolean' },
+ timestamp: dateTime,
+ },
+ required: ['error', 'success', 'timestamp'],
+ type: 'object',
+ },
+ ...resourceSchemas,
+ },
securitySchemes: {
bearerAuth: {
bearerFormat: 'API Key (sk-lh-...) or OIDC JWT',
@@ -53,15 +723,41 @@ export const buildSpecDocument = async (app: GenerateSpecsApp) => {
op.tags ??= [group];
op.operationId ??= `${group}.${method}${rest ? `_${rest.replaceAll(/[{}]/g, '').replaceAll('/', '_')}` : ''}`;
- // OpenAPI requires a responses object and a description on every response.
- // Response schemas are still pending (tracked in the spec rollout plan),
- // so fill placeholders where the routes have not declared them yet.
- if (!op.responses || Object.keys(op.responses).length === 0) {
- op.responses = { 200: { description: 'Successful response (schema pending)' } };
+ op.responses ??= {};
+ const successSchema = getSuccessSchema(group, rest, method);
+ const successContent: Record<string, unknown> = {
+ 'application/json': { schema: successSchema },
+ };
+ if (group === 'responses') {
+ successContent['text/event-stream'] = { schema: { type: 'string' } };
}
+
+ const successStatus =
+ group === 'eval' && method === 'post' && rest === 'runs'
+ ? 202
+ : ['agent-groups', 'api-keys', 'mcp-servers'].includes(group) &&
+ method === 'post' &&
+ rest === ''
+ ? 201
+ : 200;
+ const currentSuccess = (op.responses[successStatus] ?? {}) as Record<string, unknown>;
+ op.responses[successStatus] = {
+ ...currentSuccess,
+ content: currentSuccess.content ?? successContent,
+ description: currentSuccess.description ?? 'Successful response',
+ };
+
+ op.responses[400] ??= errorResponse('Invalid request');
+ op.responses[401] ??= errorResponse('Authentication required');
+ op.responses[403] ??= errorResponse('Insufficient permission');
+ op.responses[404] ??= errorResponse('Resource not found');
+ op.responses[409] ??= errorResponse('Resource conflict');
+ op.responses[429] ??= errorResponse('Rate limit exceeded');
+ op.responses[500] ??= errorResponse('Internal server error');
+
for (const response of Object.values(op.responses)) {
const responseObject = response as { description?: string };
- responseObject.description ??= 'Successful response (schema pending)';
+ responseObject.description ??= 'Response';
}
}
}
diff --git a/packages/openapi/src/types/agent-group.type.ts b/packages/openapi/src/types/agent-group.type.ts
index 32c6e832ad7..b68310aaa3e 100644
--- a/packages/openapi/src/types/agent-group.type.ts
+++ b/packages/openapi/src/types/agent-group.type.ts
@@ -1,7 +1,6 @@
import { z } from 'zod';
-import type { SessionGroupItem } from '@/database/schemas';
-
+import type { PublicAgentGroup } from '../helpers/public-fields';
// ==================== Agent Group CRUD Types ====================
// Agent group (stored in sessionGroups table) related type definitions
@@ -44,7 +43,7 @@ export interface DeleteAgentGroupRequest {
/**
* Agent group list response type
*/
-export type AgentGroupListResponse = SessionGroupItem[];
+export type AgentGroupListResponse = PublicAgentGroup[];
// ==================== Common Schemas ====================
diff --git a/packages/openapi/src/types/agent.type.ts b/packages/openapi/src/types/agent.type.ts
index a6d277dc8bb..d94b94b7ff7 100644
--- a/packages/openapi/src/types/agent.type.ts
+++ b/packages/openapi/src/types/agent.type.ts
@@ -2,8 +2,7 @@ import type { LobeAgentChatConfig } from '@lobechat/types';
import { ReasoningGraphSchema } from '@lobechat/types';
import { z } from 'zod';
-import type { AgentItem } from '@/database/schemas';
-
+import type { PublicAgent, PublicFile, PublicKnowledgeBase } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
// ==================== Agent CRUD Types ====================
@@ -160,37 +159,15 @@ export interface AgentSessionRelation {
* Agent list response type
*/
export type AgentListResponse = PaginationQueryResponse<{
- agents: AgentItem[];
+ agents: PublicAgent[];
}>;
/**
* Agent detail response type, includes complete configuration information
*/
-export interface AgentDetailResponse extends AgentItem {
- agentsFiles?: Array<{
- file: {
- fileType: string;
- id: string;
- name: string;
- size: number;
- };
- }>;
- agentsKnowledgeBases?: Array<{
- knowledgeBase: {
- description: string | null;
- id: string;
- name: string;
- };
- }>;
- agentsToSessions?: Array<{
- session: {
- avatar: string | null;
- description: string | null;
- id: string;
- title: string | null;
- updatedAt: Date;
- };
- }>;
+export interface AgentDetailResponse extends PublicAgent {
+ files?: Array<PublicFile & { enabled?: boolean | null }>;
+ knowledgeBases?: Array<PublicKnowledgeBase & { enabled?: boolean | null }>;
}
// ==================== Common Schemas ====================
diff --git a/packages/openapi/src/types/api-key.type.test.ts b/packages/openapi/src/types/api-key.type.test.ts
new file mode 100644
index 00000000000..e4e6e4bbe7a
--- /dev/null
+++ b/packages/openapi/src/types/api-key.type.test.ts
@@ -0,0 +1,37 @@
+import { describe, expect, it } from 'vitest';
+
+import { CreateApiKeyRequestSchema, UpdateApiKeyRequestSchema } from './api-key.type';
+
+describe('API key management request schemas', () => {
+ it('normalizes explicit full access and rejects unknown scopes', () => {
+ expect(
+ CreateApiKeyRequestSchema.parse({ name: 'SDK', scopes: ['*', 'agent:read'] }).scopes,
+ ).toEqual(['*']);
+ expect(() =>
+ CreateApiKeyRequestSchema.parse({ name: 'SDK', scopes: ['billing:write'] }),
+ ).toThrow('Unknown API key scope');
+ });
+
+ it('accepts the MCP and usage scopes exposed by the public API', () => {
+ expect(
+ CreateApiKeyRequestSchema.parse({
+ name: 'Operations',
+ scopes: ['mcp:read', 'mcp:write', 'usage:read'],
+ }).scopes,
+ ).toEqual(['mcp:read', 'mcp:write', 'usage:read']);
+ });
+
+ it('accepts ISO expiration and rejects empty updates', () => {
+ expect(
+ CreateApiKeyRequestSchema.parse({
+ expiresAt: '2027-01-01T00:00:00.000Z',
+ name: 'Expiring',
+ }).expiresAt,
+ ).toBeInstanceOf(Date);
+ expect(UpdateApiKeyRequestSchema.safeParse({}).success).toBe(false);
+ });
+
+ it('keeps scopes immutable after creation', () => {
+ expect(UpdateApiKeyRequestSchema.safeParse({ scopes: ['agent:read'] }).success).toBe(false);
+ });
+});
diff --git a/packages/openapi/src/types/api-key.type.ts b/packages/openapi/src/types/api-key.type.ts
new file mode 100644
index 00000000000..1627b959ebb
--- /dev/null
+++ b/packages/openapi/src/types/api-key.type.ts
@@ -0,0 +1,56 @@
+import { API_KEY_FULL_ACCESS_SCOPE, API_KEY_SCOPES } from '@lobechat/const';
+import { z } from 'zod';
+
+const ApiKeyScopesSchema = z
+ .array(z.enum(API_KEY_SCOPES, { error: 'Unknown API key scope' }))
+ .min(1)
+ .refine((scopes) => new Set(scopes).size === scopes.length, 'API key scopes must be unique')
+ .transform((scopes) =>
+ scopes.includes(API_KEY_FULL_ACCESS_SCOPE) ? [API_KEY_FULL_ACCESS_SCOPE] : scopes,
+ );
+
+const ExpiresAtSchema = z
+ .string()
+ .datetime({ offset: true })
+ .transform((value) => new Date(value))
+ .nullable();
+
+export const CreateApiKeyRequestSchema = z
+ .object({
+ expiresAt: ExpiresAtSchema.optional(),
+ name: z.string().trim().min(1).max(256),
+ scopes: ApiKeyScopesSchema.nullish(),
+ })
+ .strict();
+
+export const UpdateApiKeyRequestSchema = z
+ .object({
+ enabled: z.boolean().optional(),
+ expiresAt: ExpiresAtSchema.optional(),
+ name: z.string().trim().min(1).max(256).optional(),
+ })
+ .strict()
+ .refine((value) => Object.values(value).some((field) => field !== undefined), {
+ message: 'At least one field must be provided',
+ });
+
+export const ApiKeyIdParamSchema = z.object({ id: z.string().length(16) });
+
+export type CreateApiKeyRequest = z.infer<typeof CreateApiKeyRequestSchema>;
+export type UpdateApiKeyRequest = z.infer<typeof UpdateApiKeyRequestSchema>;
+
+export interface ApiKeyResponse {
+ createdAt: Date;
+ enabled: boolean | null;
+ expiresAt: Date | null;
+ id: string;
+ lastUsedAt: Date | null;
+ name: string;
+ scopes: string[] | null;
+ updatedAt: Date;
+}
+
+export interface CreatedApiKeyResponse extends ApiKeyResponse {
+ /** Plaintext is returned only by the create operation. */
+ key: string;
+}
diff --git a/packages/openapi/src/types/chat.type.test.ts b/packages/openapi/src/types/chat.type.test.ts
new file mode 100644
index 00000000000..a75fd4d9866
--- /dev/null
+++ b/packages/openapi/src/types/chat.type.test.ts
@@ -0,0 +1,70 @@
+import { describe, expect, it } from 'vitest';
+
+import {
+ ChatServiceParamsSchema,
+ MessageGenerationParamsSchema,
+ TranslateServiceParamsSchema,
+} from './chat.type';
+
+describe('ChatServiceParamsSchema', () => {
+ const message = { content: 'Hello', role: 'user' as const };
+
+ it('preserves supported model parameters', () => {
+ const result = ChatServiceParamsSchema.parse({
+ frequency_penalty: -0.5,
+ messages: [message],
+ presence_penalty: 0.5,
+ stream: false,
+ top_p: 0.8,
+ });
+
+ expect(result).toMatchObject({
+ frequency_penalty: -0.5,
+ presence_penalty: 0.5,
+ stream: false,
+ top_p: 0.8,
+ });
+ });
+
+ // `n` never reached ChatStreamPayload and this endpoint returns a single content
+ // string, so accepting it would promise multiple choices and deliver one.
+ it('does not accept a multi-choice n parameter', () => {
+ const result = ChatServiceParamsSchema.parse({ messages: [message], n: 2 });
+
+ expect(result).not.toHaveProperty('n');
+ });
+
+ it('rejects streaming because /chat returns a JSON envelope', () => {
+ const result = ChatServiceParamsSchema.safeParse({ messages: [message], stream: true });
+
+ expect(result.success).toBe(false);
+ expect(result.error?.issues[0]?.message).toContain('/responses');
+ });
+
+ it('rejects unbounded input arrays', () => {
+ const result = ChatServiceParamsSchema.safeParse({
+ messages: Array.from({ length: 1001 }, () => message),
+ });
+
+ expect(result.success).toBe(false);
+ });
+});
+
+describe('Chat helper schemas', () => {
+ it('requires translation text and target language', () => {
+ expect(TranslateServiceParamsSchema.safeParse({ text: '', to: 'zh-CN' }).success).toBe(false);
+ expect(TranslateServiceParamsSchema.safeParse({ text: 'Hello', to: 'zh-CN' }).success).toBe(
+ true,
+ );
+ });
+
+ it('requires a user message for reply generation', () => {
+ const result = MessageGenerationParamsSchema.safeParse({
+ conversationHistory: [],
+ sessionId: null,
+ userMessage: '',
+ });
+
+ expect(result.success).toBe(false);
+ });
+});
diff --git a/packages/openapi/src/types/chat.type.ts b/packages/openapi/src/types/chat.type.ts
index e1a90c10bb3..00d9065cfe2 100644
--- a/packages/openapi/src/types/chat.type.ts
+++ b/packages/openapi/src/types/chat.type.ts
@@ -19,23 +19,32 @@ export interface ChatServiceParams {
top_p?: number;
}
-export const ChatServiceParamsSchema = z.object({
- max_tokens: z.number().min(1).nullish(),
- messages: z
- .array(
- z.object({
- content: z.string().min(1, 'Message content cannot be empty'),
- role: z.enum(['user', 'assistant', 'system'], {
- error: 'Role must be user, assistant, or system',
+export const ChatServiceParamsSchema = z
+ .object({
+ frequency_penalty: z.number().min(-2).max(2).optional(),
+ max_tokens: z.number().int().min(1).max(1_000_000).nullish(),
+ messages: z
+ .array(
+ z.object({
+ content: z.string().min(1, 'Message content cannot be empty').max(1_000_000),
+ role: z.enum(['user', 'assistant', 'system'], {
+ error: 'Role must be user, assistant, or system',
+ }),
}),
- }),
- )
- .min(1, 'Message list cannot be empty'),
- model: z.string().nullish(),
- provider: z.string().nullish(),
- stream: z.boolean().nullish(),
- temperature: z.number().min(0).max(2).nullish(),
-});
+ )
+ .min(1, 'Message list cannot be empty')
+ .max(1000),
+ model: z.string().min(1).max(150).nullish(),
+ presence_penalty: z.number().min(-2).max(2).optional(),
+ provider: z.string().min(1).max(64).nullish(),
+ stream: z.boolean().nullish(),
+ temperature: z.number().min(0).max(2).nullish(),
+ top_p: z.number().min(0).max(1).optional(),
+ })
+ .refine((value) => value.stream !== true, {
+ message: 'Streaming is not supported on /chat; use /responses with stream=true',
+ path: ['stream'],
+ });
/**
* Chat response
@@ -66,11 +75,11 @@ export interface TranslateServiceParams {
}
export const TranslateServiceParamsSchema = z.object({
- from: z.string().min(1, 'Source language cannot be empty').optional(),
- model: z.string().nullish(),
- provider: z.string().nullish(),
- text: z.string().min(1, 'Text to translate cannot be empty'),
- to: z.string().min(1, 'Target language cannot be empty'),
+ from: z.string().min(1, 'Source language cannot be empty').max(32).optional(),
+ model: z.string().min(1).max(150).nullish(),
+ provider: z.string().min(1).max(64).nullish(),
+ text: z.string().min(1, 'Text to translate cannot be empty').max(1_000_000),
+ to: z.string().min(1, 'Target language cannot be empty').max(32),
});
// ==================== Message Generation Types ====================
@@ -92,7 +101,7 @@ export interface MessageGenerationParams {
}
export const MessageGenerationParamsSchema = z.object({
- agentId: z.string().nullish(),
+ agentId: z.string().min(1).max(64).nullish(),
chatConfig: z
.object({
disableContextCaching: z.boolean().nullish(),
@@ -102,25 +111,27 @@ export const MessageGenerationParamsSchema = z.object({
enableMaxTokens: z.boolean().nullish(),
enableReasoning: z.boolean().nullish(),
enableReasoningEffort: z.boolean().nullish(),
- historyCount: z.number().nullish(),
- inputTemplate: z.string().nullish(),
- reasoningBudgetToken: z.number().nullish(),
+ historyCount: z.number().int().min(0).max(1000).nullish(),
+ inputTemplate: z.string().max(100_000).nullish(),
+ reasoningBudgetToken: z.number().int().min(0).max(1_000_000).nullish(),
reasoningEffort: z.enum(['low', 'medium', 'high']).nullish(),
searchMode: z.enum(['off', 'on', 'auto']).nullish(),
- thinkingBudget: z.number().nullish(),
+ thinkingBudget: z.number().int().min(0).max(1_000_000).nullish(),
useModelBuiltinSearch: z.boolean().nullish(),
})
.nullish(),
- conversationHistory: z.array(
- z.object({
- content: z.string().min(1, 'Message content cannot be empty'),
- role: z.enum(['user', 'assistant', 'system']),
- }),
- ),
- model: z.string().nullish(),
- provider: z.string().nullish(),
- sessionId: z.string().nullable(),
- userMessage: z.string().nullish(),
+ conversationHistory: z
+ .array(
+ z.object({
+ content: z.string().min(1, 'Message content cannot be empty').max(1_000_000),
+ role: z.enum(['user', 'assistant', 'system']),
+ }),
+ )
+ .max(1000),
+ model: z.string().min(1).max(150).nullish(),
+ provider: z.string().min(1).max(64).nullish(),
+ sessionId: z.string().min(1).max(64).nullable(),
+ userMessage: z.string().min(1).max(1_000_000),
});
// ==================== Configuration Types ====================
diff --git a/packages/openapi/src/types/eval.type.test.ts b/packages/openapi/src/types/eval.type.test.ts
new file mode 100644
index 00000000000..1cae9bf2aa1
--- /dev/null
+++ b/packages/openapi/src/types/eval.type.test.ts
@@ -0,0 +1,39 @@
+import { describe, expect, it } from 'vitest';
+
+import { CreateEvalRunRequestSchema } from './eval.type';
+
+describe('CreateEvalRunRequestSchema', () => {
+ const base = { datasetId: 'dataset-1', targetAgentId: 'agent-1' };
+
+ it('accepts bounded asynchronous run configuration', () => {
+ const parsed = CreateEvalRunRequestSchema.parse({
+ ...base,
+ config: { k: 3, maxSteps: 50, timeout: 120_000 },
+ id: 'external-idempotency-key',
+ });
+ expect(parsed.config?.k).toBe(3);
+ });
+
+ it('rejects out-of-range execution bounds', () => {
+ expect(CreateEvalRunRequestSchema.safeParse({ ...base, config: { k: 11 } }).success).toBe(
+ false,
+ );
+ expect(
+ CreateEvalRunRequestSchema.safeParse({ ...base, config: { maxSteps: 1001 } }).success,
+ ).toBe(false);
+ expect(
+ CreateEvalRunRequestSchema.safeParse({ ...base, config: { timeout: 1000 } }).success,
+ ).toBe(false);
+ });
+
+ // Only knobs the run path actually honors belong in the public contract.
+ // `caseSelection` is storage-only for internal runs (this endpoint always creates
+ // `mode: 'internal'`, which pre-creates topics for every case), and
+ // `maxConcurrency` is consumed nowhere — accepting either would silently run the
+ // whole dataset or no-op.
+ it.each(['caseSelection', 'maxConcurrency'])('rejects the inert config knob %s', (key) => {
+ const config = key === 'caseSelection' ? { caseSelection: { mode: 'all' } } : { [key]: 5 };
+
+ expect(CreateEvalRunRequestSchema.safeParse({ ...base, config }).success).toBe(false);
+ });
+});
diff --git a/packages/openapi/src/types/eval.type.ts b/packages/openapi/src/types/eval.type.ts
new file mode 100644
index 00000000000..a34c120c98c
--- /dev/null
+++ b/packages/openapi/src/types/eval.type.ts
@@ -0,0 +1,57 @@
+import type { EvalRunMetrics, EvalRunTopicResult } from '@lobechat/types';
+import { z } from 'zod';
+
+export const CreateEvalRunRequestSchema = z
+ .object({
+ config: z
+ .object({
+ k: z.number().int().min(1).max(10).optional(),
+ maxSteps: z.number().int().min(1).max(1000).optional(),
+ timeout: z
+ .number()
+ .int()
+ .min(60_000)
+ .max(6 * 3_600_000)
+ .optional(),
+ })
+ .strict()
+ .optional(),
+ datasetId: z.string().min(1).max(128),
+ id: z.string().min(1).max(128).optional(),
+ name: z.string().trim().min(1).max(255).optional(),
+ targetAgentId: z.string().min(1).max(128),
+ })
+ .strict();
+
+export const EvalRunIdParamSchema = z.object({ id: z.string().min(1).max(128) });
+
+export type CreateEvalRunRequest = z.infer<typeof CreateEvalRunRequestSchema>;
+
+export interface EvalRunResponse {
+ createdAt: Date;
+ datasetId: string;
+ id: string;
+ metrics: EvalRunMetrics | null;
+ name: null | string;
+ startedAt: Date | null;
+ status: string;
+ targetAgentId: null | string;
+ updatedAt: Date;
+}
+
+export interface EvalRunResultResponse {
+ createdAt: Date;
+ input: string;
+ passed: boolean | null;
+ result: EvalRunTopicResult | null;
+ score: null | number;
+ status: null | string;
+ testCaseId: string;
+ topicId: string;
+}
+
+export interface EvalRunResultsResponse {
+ results: EvalRunResultResponse[];
+ runId: string;
+ total: number;
+}
diff --git a/packages/openapi/src/types/file.type.test.ts b/packages/openapi/src/types/file.type.test.ts
new file mode 100644
index 00000000000..3b3bc0345ff
--- /dev/null
+++ b/packages/openapi/src/types/file.type.test.ts
@@ -0,0 +1,35 @@
+import { describe, expect, it } from 'vitest';
+
+import { BatchFileUploadFormFieldsSchema, FileUploadFormFieldsSchema } from './file.type';
+
+describe('multipart upload field schemas', () => {
+ it('parses explicit boolean fields without truthy-string coercion', () => {
+ expect(
+ FileUploadFormFieldsSchema.parse({
+ skipCheckFileType: 'false',
+ skipDeduplication: 'true',
+ }),
+ ).toMatchObject({ skipCheckFileType: false, skipDeduplication: true });
+ });
+
+ it('rejects invalid booleans and overlong ids', () => {
+ expect(() => FileUploadFormFieldsSchema.parse({ skipCheckFileType: 'yes' })).toThrow();
+ expect(() => FileUploadFormFieldsSchema.parse({ agentId: 'a'.repeat(256) })).toThrow();
+ });
+
+ it('rejects single-upload-only fields from batch payloads', () => {
+ expect(BatchFileUploadFormFieldsSchema.safeParse({ skipDeduplication: 'true' }).success).toBe(
+ false,
+ );
+ expect(BatchFileUploadFormFieldsSchema.shape).not.toHaveProperty('skipDeduplication');
+ });
+
+ // `pathname` was advertised in the multipart schema but never reached the storage
+ // key, so a client could not actually control the object path. Keep it rejected
+ // rather than silently ignored.
+ it('rejects a client-supplied pathname on both upload schemas', () => {
+ expect(FileUploadFormFieldsSchema.safeParse({ pathname: 'custom/path' }).success).toBe(false);
+ expect(FileUploadFormFieldsSchema.shape).not.toHaveProperty('pathname');
+ expect(BatchFileUploadFormFieldsSchema.shape).not.toHaveProperty('pathname');
+ });
+});
diff --git a/packages/openapi/src/types/file.type.ts b/packages/openapi/src/types/file.type.ts
index cbdaf8e9f26..3c554a2b104 100644
--- a/packages/openapi/src/types/file.type.ts
+++ b/packages/openapi/src/types/file.type.ts
@@ -1,7 +1,6 @@
import { z } from 'zod';
-import type { FileItem, KnowledgeBaseItem } from '@/database/schemas';
-
+import type { PublicFile, PublicKnowledgeBase } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
import { PaginationQuerySchema } from './common.type';
@@ -19,8 +18,6 @@ export interface FileUploadRequest {
file: File;
/** Knowledge base ID (optional) */
knowledgeBaseId?: string;
- /** Custom path (optional) */
- pathname?: string;
/** Session ID (optional) */
sessionId?: string;
/** Whether to skip file type check */
@@ -55,6 +52,31 @@ export interface PublicFileUploadRequest {
skipDeduplication?: boolean;
}
+const MultipartOptionalIdSchema = z.string().trim().min(1).max(255).optional();
+const MultipartOptionalPathSchema = z.string().trim().min(1).max(1024).optional();
+const MultipartBooleanSchema = z
+ .enum(['true', 'false'])
+ .transform((value) => value === 'true')
+ .optional();
+
+export const FileUploadFormFieldsSchema = z
+ .object({
+ agentId: MultipartOptionalIdSchema,
+ directory: MultipartOptionalPathSchema,
+ knowledgeBaseId: MultipartOptionalIdSchema,
+ sessionId: MultipartOptionalIdSchema,
+ skipCheckFileType: MultipartBooleanSchema,
+ skipDeduplication: MultipartBooleanSchema,
+ })
+ .strict();
+
+export const BatchFileUploadFormFieldsSchema = FileUploadFormFieldsSchema.omit({
+ skipDeduplication: true,
+});
+
+export type FileUploadFormFields = z.infer<typeof FileUploadFormFieldsSchema>;
+export type BatchFileUploadFormFields = z.infer<typeof BatchFileUploadFormFieldsSchema>;
+
// ==================== File Management Types ====================
/**
@@ -298,13 +320,13 @@ export interface FileUserItem {
/**
* File list item (includes optional chunking status info)
*/
-export interface FileListItem extends Partial<FileItem> {
+export interface FileListItem extends Partial<PublicFile> {
/** Chunking task info (includes basic async task info and chunk count) */
chunking?: FileAsyncTaskResponse | null;
/** Embedding task info (includes basic async task info) */
embedding?: FileAsyncTaskResponse | null;
/** Associated knowledge base list */
- knowledgeBases?: Array<KnowledgeBaseItem>;
+ knowledgeBases?: Array<PublicKnowledgeBase>;
/** Associated user list (all users with the same fileHash) */
users?: Array<FileUserItem>;
}
diff --git a/packages/openapi/src/types/index.ts b/packages/openapi/src/types/index.ts
index 0e4a024b7ad..e037941526c 100644
--- a/packages/openapi/src/types/index.ts
+++ b/packages/openapi/src/types/index.ts
@@ -56,10 +56,13 @@ export interface TBatchTarget {
// ==================== Export All Types ====================
export * from './agent.type';
export * from './agent-group.type';
+export * from './api-key.type';
export * from './chat.type';
export * from './common.type';
+export * from './eval.type';
export * from './file.type';
export * from './knowledge-base.type';
+export * from './mcp-server.type';
export * from './message.type';
export * from './message-translations.type';
export * from './model.type';
diff --git a/packages/openapi/src/types/knowledge-base.type.ts b/packages/openapi/src/types/knowledge-base.type.ts
index 2b170fc114c..4d21e7ccd93 100644
--- a/packages/openapi/src/types/knowledge-base.type.ts
+++ b/packages/openapi/src/types/knowledge-base.type.ts
@@ -1,7 +1,6 @@
import { z } from 'zod';
-import type { KnowledgeBaseItem } from '@/database/schemas';
-
+import type { PublicKnowledgeBase } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
import { PaginationQuerySchema } from './common.type';
@@ -37,7 +36,9 @@ export interface KnowledgeBaseFileBatchRequest {
}
export const KnowledgeBaseFileBatchSchema = z.object({
- fileIds: z.array(z.string().min(1, 'File ID cannot be empty')).min(1, 'File ID list cannot be empty'),
+ fileIds: z
+ .array(z.string().min(1, 'File ID cannot be empty'))
+ .min(1, 'File ID list cannot be empty'),
});
/**
@@ -83,7 +84,7 @@ export interface MoveKnowledgeBaseFilesResponse {
*/
export type KnowledgeBaseAccessType = 'owner' | 'userGrant' | 'roleGrant' | 'public';
-export interface KnowledgeBaseListItem extends KnowledgeBaseItem {
+export interface KnowledgeBaseListItem extends PublicKnowledgeBase {
/** The access source type for the current user on this knowledge base */
accessType?: KnowledgeBaseAccessType;
}
@@ -117,7 +118,10 @@ export interface CreateKnowledgeBaseRequest {
export const CreateKnowledgeBaseSchema = z.object({
avatar: z.string().url('Avatar must be a valid URL').optional(),
description: z.string().max(1000, 'Knowledge base description is too long').optional(),
- name: z.string().min(1, 'Knowledge base name cannot be empty').max(255, 'Knowledge base name is too long'),
+ name: z
+ .string()
+ .min(1, 'Knowledge base name cannot be empty')
+ .max(255, 'Knowledge base name is too long'),
});
/**
@@ -125,7 +129,7 @@ export const CreateKnowledgeBaseSchema = z.object({
*/
export interface CreateKnowledgeBaseResponse {
/** Knowledge base info */
- knowledgeBase: KnowledgeBaseItem;
+ knowledgeBase: PublicKnowledgeBase;
}
/**
@@ -143,7 +147,11 @@ export interface UpdateKnowledgeBaseRequest {
export const UpdateKnowledgeBaseSchema = z.object({
avatar: z.string().url('Avatar must be a valid URL').optional(),
description: z.string().max(1000, 'Knowledge base description is too long').optional(),
- name: z.string().min(1, 'Knowledge base name cannot be empty').max(255, 'Knowledge base name is too long').optional(),
+ name: z
+ .string()
+ .min(1, 'Knowledge base name cannot be empty')
+ .max(255, 'Knowledge base name is too long')
+ .optional(),
});
/**
@@ -151,7 +159,7 @@ export const UpdateKnowledgeBaseSchema = z.object({
*/
export interface KnowledgeBaseDetailResponse {
/** Knowledge base info */
- knowledgeBase: KnowledgeBaseItem;
+ knowledgeBase: PublicKnowledgeBase;
}
/**
diff --git a/packages/openapi/src/types/mcp-server.type.test.ts b/packages/openapi/src/types/mcp-server.type.test.ts
new file mode 100644
index 00000000000..2fae380deb5
--- /dev/null
+++ b/packages/openapi/src/types/mcp-server.type.test.ts
@@ -0,0 +1,38 @@
+import { describe, expect, it } from 'vitest';
+
+import { CreateMcpServerRequestSchema, UpdateMcpServerRequestSchema } from './mcp-server.type';
+
+describe('MCP server request schemas', () => {
+ it('accepts a remote HTTP server with write-only credentials', () => {
+ const parsed = CreateMcpServerRequestSchema.parse({
+ credentials: { token: 'secret', type: 'bearer' },
+ identifier: 'linear-mcp',
+ name: 'Linear',
+ serverUrl: 'https://mcp.example.com/server',
+ });
+
+ expect(parsed.credentials).toEqual({ token: 'secret', type: 'bearer' });
+ });
+
+ it('rejects non-HTTP transports and credentials embedded in URLs', () => {
+ expect(
+ CreateMcpServerRequestSchema.safeParse({
+ identifier: 'stdio',
+ name: 'stdio',
+ serverUrl: 'file:///tmp/server',
+ }).success,
+ ).toBe(false);
+ expect(
+ CreateMcpServerRequestSchema.safeParse({
+ identifier: 'embedded-secret',
+ name: 'unsafe',
+ serverUrl: 'https://user:[email protected]/mcp',
+ }).success,
+ ).toBe(false);
+ });
+
+ it('requires a non-empty update and supports explicit credential removal', () => {
+ expect(UpdateMcpServerRequestSchema.safeParse({}).success).toBe(false);
+ expect(UpdateMcpServerRequestSchema.safeParse({ credentials: null }).success).toBe(true);
+ });
+});
diff --git a/packages/openapi/src/types/mcp-server.type.ts b/packages/openapi/src/types/mcp-server.type.ts
new file mode 100644
index 00000000000..e403932aaa3
--- /dev/null
+++ b/packages/openapi/src/types/mcp-server.type.ts
@@ -0,0 +1,81 @@
+import { z } from 'zod';
+
+const HttpMcpServerUrlSchema = z
+ .url()
+ .max(2048)
+ .refine((value) => ['http:', 'https:'].includes(new URL(value).protocol), {
+ message: 'MCP server URL must use http or https',
+ })
+ .refine((value) => {
+ const url = new URL(value);
+ return !url.username && !url.password;
+ }, 'MCP server URL must not contain embedded credentials');
+
+export const McpServerCredentialsSchema = z.discriminatedUnion('type', [
+ z.object({ token: z.string().min(1).max(10_000), type: z.literal('bearer') }).strict(),
+ z.object({ apiKey: z.string().min(1).max(10_000), type: z.literal('apikey') }).strict(),
+ z
+ .object({
+ headers: z
+ .record(z.string().min(1).max(256), z.string().max(10_000))
+ .refine((headers) => Object.keys(headers).length <= 20, 'At most 20 headers are allowed'),
+ type: z.literal('header'),
+ })
+ .strict(),
+]);
+
+export const CreateMcpServerRequestSchema = z
+ .object({
+ credentials: McpServerCredentialsSchema.optional(),
+ description: z.string().trim().max(2000).optional(),
+ identifier: z
+ .string()
+ .trim()
+ .min(1)
+ .max(255)
+ .regex(/^[a-z\d](?:[\w-]*[a-z\d])?$/i, 'Invalid MCP server identifier'),
+ isEnabled: z.boolean().default(true).optional(),
+ name: z.string().trim().min(1).max(255),
+ serverUrl: HttpMcpServerUrlSchema,
+ })
+ .strict();
+
+export const UpdateMcpServerRequestSchema = z
+ .object({
+ credentials: McpServerCredentialsSchema.nullish(),
+ description: z.string().trim().max(2000).nullable().optional(),
+ isEnabled: z.boolean().optional(),
+ name: z.string().trim().min(1).max(255).optional(),
+ serverUrl: HttpMcpServerUrlSchema.optional(),
+ })
+ .strict()
+ .refine((value) => Object.values(value).some((field) => field !== undefined), {
+ message: 'At least one field must be provided',
+ });
+
+export const McpServerIdParamSchema = z.object({ id: z.uuid() });
+
+export type CreateMcpServerRequest = z.infer<typeof CreateMcpServerRequestSchema>;
+export type UpdateMcpServerRequest = z.infer<typeof UpdateMcpServerRequestSchema>;
+
+export interface McpServerToolResponse {
+ description: null | string;
+ id: string;
+ inputSchema: null | Record<string, unknown>;
+ name: string;
+ permission: string;
+}
+
+export interface McpServerResponse {
+ createdAt: Date;
+ description: null | string;
+ hasCredentials: boolean;
+ id: string;
+ identifier: string;
+ isEnabled: boolean;
+ name: string;
+ serverUrl: string;
+ status: string;
+ tools: McpServerToolResponse[];
+ updatedAt: Date;
+}
diff --git a/packages/openapi/src/types/message.type.ts b/packages/openapi/src/types/message.type.ts
index 2b7be59d6f1..1586b6d5d07 100644
--- a/packages/openapi/src/types/message.type.ts
+++ b/packages/openapi/src/types/message.type.ts
@@ -1,8 +1,11 @@
-import type { DBMessageItem, FileItem } from '@lobechat/types';
import { z } from 'zod';
-import type { SessionItem, TopicItem } from '@/database/schemas';
-
+import type {
+ PublicFile,
+ PublicMessage,
+ PublicSession,
+ PublicTopic,
+} from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
import { PaginationQuerySchema } from './common.type';
@@ -190,7 +193,9 @@ export interface MessagesDeleteBatchRequest {
}
export const MessagesDeleteBatchRequestSchema = z.object({
- messageIds: z.array(z.string().min(1, 'Message ID cannot be empty')).min(1, 'Message ID array cannot be empty'),
+ messageIds: z
+ .array(z.string().min(1, 'Message ID cannot be empty'))
+ .min(1, 'Message ID array cannot be empty'),
});
// ==================== Message Response Types ====================
@@ -200,15 +205,15 @@ export interface MessageIdParam {
}
// Message type queried from database join, includes associated session and topic info
-export interface MessageResponseFromDatabase extends DBMessageItem {
- filesToMessages: { file: FileItem; messageId: string }[] | null;
- session: SessionItem | null;
- topic: TopicItem | null;
+export interface MessageResponseFromDatabase extends PublicMessage {
+ filesToMessages: { file: PublicFile; messageId: string }[] | null;
+ session: PublicSession | null;
+ topic: PublicTopic | null;
}
// Return type for message query, includes associated session and topic info
export interface MessageResponse extends Omit<MessageResponseFromDatabase, 'filesToMessages'> {
- files: FileItem[] | null;
+ files: PublicFile[] | null;
}
export type MessageListResponse = PaginationQueryResponse<{
diff --git a/packages/openapi/src/types/model.type.ts b/packages/openapi/src/types/model.type.ts
index 64f32affd12..9e730527620 100644
--- a/packages/openapi/src/types/model.type.ts
+++ b/packages/openapi/src/types/model.type.ts
@@ -1,7 +1,6 @@
import { z } from 'zod';
-import type { AiModelSelectItem } from '@/database/schemas';
-
+import type { PublicModel } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
import { PaginationQuerySchema } from './common.type';
@@ -45,12 +44,12 @@ export const ModelsListQuerySchema = PaginationQuerySchema.extend({
// ==================== Model Response Types ====================
export type GetModelsResponse = PaginationQueryResponse<{
- models?: AiModelSelectItem[];
+ models?: PublicModel[];
}>;
// ==================== Model Detail / Mutation Types ====================
-export type ModelDetailResponse = AiModelSelectItem;
+export type ModelDetailResponse = PublicModel;
const ModelPayloadBaseSchema = z.object({
abilities: z.record(z.string(), z.unknown()).nullish(),
diff --git a/packages/openapi/src/types/permission.type.ts b/packages/openapi/src/types/permission.type.ts
index f85f5fbafb1..e5078f2173a 100644
--- a/packages/openapi/src/types/permission.type.ts
+++ b/packages/openapi/src/types/permission.type.ts
@@ -1,7 +1,6 @@
import { z } from 'zod';
-import type { PermissionItem } from '@/database/schemas';
-
+import type { PublicPermission } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
import { PaginationQuerySchema } from './common.type';
@@ -27,7 +26,7 @@ export const PermissionsListQuerySchema = z
.extend(PaginationQuerySchema.shape);
export type PermissionsListResponse = PaginationQueryResponse<{
- permissions: PermissionItem[];
+ permissions: PublicPermission[];
}>;
// ==================== Permission CRUD Types ====================
diff --git a/packages/openapi/src/types/provider.type.ts b/packages/openapi/src/types/provider.type.ts
index 5d15ab9690e..4f1e77341b9 100644
--- a/packages/openapi/src/types/provider.type.ts
+++ b/packages/openapi/src/types/provider.type.ts
@@ -1,8 +1,8 @@
import { z } from 'zod';
-import type { AiProviderSelectItem } from '@/database/schemas';
import type { AiProviderConfig, AiProviderSettings } from '@/types/aiProvider';
+import type { PublicProvider } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
import { PaginationQuerySchema } from './common.type';
@@ -10,9 +10,7 @@ import { PaginationQuerySchema } from './common.type';
export type ProviderKeyVaults = Record<string, string | undefined>;
-export type ProviderDetailResponse = Omit<AiProviderSelectItem, 'keyVaults'> & {
- keyVaults?: ProviderKeyVaults;
-};
+export type ProviderDetailResponse = PublicProvider;
export type GetProvidersResponse = PaginationQueryResponse<{
providers: ProviderDetailResponse[];
diff --git a/packages/openapi/src/types/role.type.ts b/packages/openapi/src/types/role.type.ts
index 8ae69634ba1..8cd342ce7e7 100644
--- a/packages/openapi/src/types/role.type.ts
+++ b/packages/openapi/src/types/role.type.ts
@@ -1,7 +1,6 @@
import { z } from 'zod';
-import type { PermissionItem, RoleItem } from '@/database/schemas';
-
+import type { PublicPermission, PublicRole } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
import { PaginationQuerySchema } from './common.type';
@@ -31,7 +30,7 @@ export const RolesListQuerySchema = z
.extend(PaginationQuerySchema.shape);
export type RolesListResponse = PaginationQueryResponse<{
- roles: RoleItem[];
+ roles: PublicRole[];
}>;
// ==================== Role Permission Types ====================
@@ -43,7 +42,7 @@ export interface RolePermissionsListRequest extends IPaginationQuery {
}
export type RolePermissionsListResponse = PaginationQueryResponse<{
- permissions: Partial<PermissionItem>[];
+ permissions: Partial<PublicPermission>[];
}>;
// ==================== Role CRUD Types ====================
diff --git a/packages/openapi/src/types/topic.type.ts b/packages/openapi/src/types/topic.type.ts
index 91bdfb8be48..09130657bf4 100644
--- a/packages/openapi/src/types/topic.type.ts
+++ b/packages/openapi/src/types/topic.type.ts
@@ -1,8 +1,7 @@
import type { ChatTopicMetadata } from '@lobechat/types';
import { z } from 'zod';
-import type { TopicItem, UserItem } from '@/database/schemas';
-
+import type { PublicTopic, PublicUser } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
import { PaginationQuerySchema } from './common.type';
@@ -70,9 +69,9 @@ export const TopicUpdateRequestSchema = z.object({
// ==================== Topic Response Types ====================
-export interface TopicResponse extends TopicItem {
+export interface TopicResponse extends PublicTopic {
messageCount: number;
- user: UserItem;
+ user: PublicUser;
}
/**
diff --git a/packages/openapi/src/types/user.type.ts b/packages/openapi/src/types/user.type.ts
index 7fded0ca6c6..f408f123a73 100644
--- a/packages/openapi/src/types/user.type.ts
+++ b/packages/openapi/src/types/user.type.ts
@@ -1,7 +1,8 @@
import { z } from 'zod';
-import type { RoleItem, UserItem, UserRoleItem } from '@/database/schemas';
+import type { UserRoleItem } from '@/database/schemas';
+import type { PublicRole, PublicUser } from '../helpers/public-fields';
import type { IPaginationQuery, PaginationQueryResponse } from './common.type';
// ==================== User Base Types ====================
@@ -17,9 +18,9 @@ export interface GetUsersRequest {
/**
* Extended user info type including role information
*/
-export type UserWithRoles = UserItem & {
+export type UserWithRoles = PublicUser & {
messageCount?: number;
- roles?: RoleItem[];
+ roles?: PublicRole[];
};
// ==================== User CRUD Types ====================
@@ -153,7 +154,7 @@ export const UpdateUserRolesRequestSchema = z
* User role detail, including role info and association info
*/
export interface UserRoleDetail extends UserRoleItem {
- role: RoleItem;
+ role: PublicRole;
}
/**
diff --git a/packages/sdk/src/generated/index.ts b/packages/sdk/src/generated/index.ts
index 89c38a987b8..436db02553d 100644
--- a/packages/sdk/src/generated/index.ts
+++ b/packages/sdk/src/generated/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
-export { AgentGroups, Agents, Files, Health, KnowledgeBases, LobeHub, Messages, MessageTranslations, Models, type Options, Permissions, Providers, Responses, Roles, Topics, Users } from './sdk.gen';
-export type { ClientOptions, DeleteApiV1AgentGroupsByIdData, DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentsByIdData, DeleteApiV1AgentsByIdResponses, DeleteApiV1FilesByIdData, DeleteApiV1FilesByIdResponses, DeleteApiV1KnowledgeBasesByIdData, DeleteApiV1KnowledgeBasesByIdFilesBatchData, DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1MessagesByIdData, DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesData, DeleteApiV1MessagesResponses, DeleteApiV1MessageTranslationsByMessageIdData, DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1PermissionsByIdData, DeleteApiV1PermissionsByIdResponses, DeleteApiV1ProvidersByIdData, DeleteApiV1ProvidersByIdResponses, DeleteApiV1RolesByIdData, DeleteApiV1RolesByIdPermissionsData, DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdResponses, DeleteApiV1TopicsByIdData, DeleteApiV1TopicsByIdResponses, DeleteApiV1UsersByIdData, DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdRolesData, DeleteApiV1UsersByIdRolesResponses, GetApiV1AgentGroupsByIdData, GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsData, GetApiV1AgentGroupsResponses, GetApiV1AgentsByIdData, GetApiV1AgentsByIdResponses, GetApiV1AgentsData, GetApiV1AgentsResponses, GetApiV1FilesByIdChunksData, GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdData, GetApiV1FilesByIdResponses, GetApiV1FilesByIdUrlData, GetApiV1FilesByIdUrlResponses, GetApiV1FilesData, GetApiV1FilesResponses, GetApiV1HealthData, GetApiV1HealthResponses, GetApiV1KnowledgeBasesByIdData, GetApiV1KnowledgeBasesByIdFilesData, GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesData, GetApiV1KnowledgeBasesResponses, GetApiV1MessagesByIdData, GetApiV1MessagesByIdResponses, GetApiV1MessagesCountData, GetApiV1MessagesCountResponses, GetApiV1MessagesData, GetApiV1MessagesResponses, GetApiV1MessageTranslationsByMessageIdData, GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1ModelsByProviderIdByModelIdData, GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsData, GetApiV1ModelsResponses, GetApiV1PermissionsByIdData, GetApiV1PermissionsByIdResponses, GetApiV1PermissionsData, GetApiV1PermissionsResponses, GetApiV1ProvidersByIdData, GetApiV1ProvidersByIdResponses, GetApiV1ProvidersData, GetApiV1ProvidersResponses, GetApiV1RolesByIdData, GetApiV1RolesByIdPermissionsData, GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdResponses, GetApiV1RolesData, GetApiV1RolesResponses, GetApiV1TopicsByIdData, GetApiV1TopicsByIdResponses, GetApiV1TopicsData, GetApiV1TopicsResponses, GetApiV1UsersByIdData, GetApiV1UsersByIdResponses, GetApiV1UsersByIdRolesData, GetApiV1UsersByIdRolesResponses, GetApiV1UsersData, GetApiV1UsersMeData, GetApiV1UsersMeResponses, GetApiV1UsersResponses, PatchApiV1AgentGroupsByIdData, PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentsByIdData, PatchApiV1AgentsByIdResponses, PatchApiV1FilesByIdData, PatchApiV1FilesByIdResponses, PatchApiV1KnowledgeBasesByIdData, PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1MessageTranslationsByMessageIdData, PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1ModelsByProviderIdByModelIdData, PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1PermissionsByIdData, PatchApiV1PermissionsByIdResponses, PatchApiV1ProvidersByIdData, PatchApiV1ProvidersByIdResponses, PatchApiV1RolesByIdData, PatchApiV1RolesByIdPermissionsData, PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdResponses, PatchApiV1TopicsByIdData, PatchApiV1TopicsByIdResponses, PatchApiV1UsersByIdData, PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdRolesData, PatchApiV1UsersByIdRolesResponses, PostApiV1AgentGroupsData, PostApiV1AgentGroupsResponses, PostApiV1AgentsData, PostApiV1AgentsResponses, PostApiV1FilesBatchesData, PostApiV1FilesBatchesResponses, PostApiV1FilesByIdChunksData, PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdParsesData, PostApiV1FilesByIdParsesResponses, PostApiV1FilesData, PostApiV1FilesQueriesData, PostApiV1FilesQueriesResponses, PostApiV1FilesResponses, PostApiV1KnowledgeBasesByIdFilesBatchData, PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesMoveData, PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesData, PostApiV1KnowledgeBasesResponses, PostApiV1MessagesData, PostApiV1MessagesRepliesData, PostApiV1MessagesRepliesResponses, PostApiV1MessagesResponses, PostApiV1MessageTranslationsByMessageIdData, PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1ModelsData, PostApiV1ModelsResponses, PostApiV1PermissionsData, PostApiV1PermissionsResponses, PostApiV1ProvidersData, PostApiV1ProvidersResponses, PostApiV1ResponsesData, PostApiV1ResponsesResponses, PostApiV1RolesData, PostApiV1RolesResponses, PostApiV1TopicsData, PostApiV1TopicsResponses, PostApiV1UsersData, PostApiV1UsersResponses } from './types.gen';
+export { AgentGroups, Agents, ApiKeys, Chat, Eval, Files, Health, KnowledgeBases, LobeHub, McpServers, Messages, MessageTranslations, Models, type Options, Permissions, Providers, Responses, Roles, Topics, Usage as Usage2, Users } from './sdk.gen';
+export type { Agent, AgentGroup, ApiError, ApiKey, ChatResponse, ClientOptions, DeleteApiV1AgentGroupsByIdData, DeleteApiV1AgentGroupsByIdError, DeleteApiV1AgentGroupsByIdErrors, DeleteApiV1AgentGroupsByIdResponse, DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentsByIdData, DeleteApiV1AgentsByIdError, DeleteApiV1AgentsByIdErrors, DeleteApiV1AgentsByIdResponse, DeleteApiV1AgentsByIdResponses, DeleteApiV1ApiKeysByIdData, DeleteApiV1ApiKeysByIdError, DeleteApiV1ApiKeysByIdErrors, DeleteApiV1ApiKeysByIdResponse, DeleteApiV1ApiKeysByIdResponses, DeleteApiV1FilesByIdData, DeleteApiV1FilesByIdError, DeleteApiV1FilesByIdErrors, DeleteApiV1FilesByIdResponse, DeleteApiV1FilesByIdResponses, DeleteApiV1KnowledgeBasesByIdData, DeleteApiV1KnowledgeBasesByIdError, DeleteApiV1KnowledgeBasesByIdErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchData, DeleteApiV1KnowledgeBasesByIdFilesBatchError, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchResponse, DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdResponse, DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1McpServersByIdData, DeleteApiV1McpServersByIdError, DeleteApiV1McpServersByIdErrors, DeleteApiV1McpServersByIdResponse, DeleteApiV1McpServersByIdResponses, DeleteApiV1MessagesByIdData, DeleteApiV1MessagesByIdError, DeleteApiV1MessagesByIdErrors, DeleteApiV1MessagesByIdResponse, DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesData, DeleteApiV1MessagesError, DeleteApiV1MessagesErrors, DeleteApiV1MessagesResponse, DeleteApiV1MessagesResponses, DeleteApiV1MessageTranslationsByMessageIdData, DeleteApiV1MessageTranslationsByMessageIdError, DeleteApiV1MessageTranslationsByMessageIdErrors, DeleteApiV1MessageTranslationsByMessageIdResponse, DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1PermissionsByIdData, DeleteApiV1PermissionsByIdError, DeleteApiV1PermissionsByIdErrors, DeleteApiV1PermissionsByIdResponse, DeleteApiV1PermissionsByIdResponses, DeleteApiV1ProvidersByIdData, DeleteApiV1ProvidersByIdError, DeleteApiV1ProvidersByIdErrors, DeleteApiV1ProvidersByIdResponse, DeleteApiV1ProvidersByIdResponses, DeleteApiV1RolesByIdData, DeleteApiV1RolesByIdError, DeleteApiV1RolesByIdErrors, DeleteApiV1RolesByIdPermissionsData, DeleteApiV1RolesByIdPermissionsError, DeleteApiV1RolesByIdPermissionsErrors, DeleteApiV1RolesByIdPermissionsResponse, DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdResponse, DeleteApiV1RolesByIdResponses, DeleteApiV1TopicsByIdData, DeleteApiV1TopicsByIdError, DeleteApiV1TopicsByIdErrors, DeleteApiV1TopicsByIdResponse, DeleteApiV1TopicsByIdResponses, DeleteApiV1UsersByIdData, DeleteApiV1UsersByIdError, DeleteApiV1UsersByIdErrors, DeleteApiV1UsersByIdResponse, DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdRolesData, DeleteApiV1UsersByIdRolesError, DeleteApiV1UsersByIdRolesErrors, DeleteApiV1UsersByIdRolesResponse, DeleteApiV1UsersByIdRolesResponses, EvalRun, EvalRunResult, File, GetApiV1AgentGroupsByIdData, GetApiV1AgentGroupsByIdError, GetApiV1AgentGroupsByIdErrors, GetApiV1AgentGroupsByIdResponse, GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsData, GetApiV1AgentGroupsError, GetApiV1AgentGroupsErrors, GetApiV1AgentGroupsResponse, GetApiV1AgentGroupsResponses, GetApiV1AgentsByIdData, GetApiV1AgentsByIdError, GetApiV1AgentsByIdErrors, GetApiV1AgentsByIdResponse, GetApiV1AgentsByIdResponses, GetApiV1AgentsData, GetApiV1AgentsError, GetApiV1AgentsErrors, GetApiV1AgentsResponse, GetApiV1AgentsResponses, GetApiV1ApiKeysByIdData, GetApiV1ApiKeysByIdError, GetApiV1ApiKeysByIdErrors, GetApiV1ApiKeysByIdResponse, GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysData, GetApiV1ApiKeysError, GetApiV1ApiKeysErrors, GetApiV1ApiKeysResponse, GetApiV1ApiKeysResponses, GetApiV1EvalRunsByIdData, GetApiV1EvalRunsByIdError, GetApiV1EvalRunsByIdErrors, GetApiV1EvalRunsByIdResponse, GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdResultsData, GetApiV1EvalRunsByIdResultsError, GetApiV1EvalRunsByIdResultsErrors, GetApiV1EvalRunsByIdResultsResponse, GetApiV1EvalRunsByIdResultsResponses, GetApiV1FilesByIdChunksData, GetApiV1FilesByIdChunksError, GetApiV1FilesByIdChunksErrors, GetApiV1FilesByIdChunksResponse, GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdData, GetApiV1FilesByIdError, GetApiV1FilesByIdErrors, GetApiV1FilesByIdResponse, GetApiV1FilesByIdResponses, GetApiV1FilesByIdUrlData, GetApiV1FilesByIdUrlError, GetApiV1FilesByIdUrlErrors, GetApiV1FilesByIdUrlResponse, GetApiV1FilesByIdUrlResponses, GetApiV1FilesData, GetApiV1FilesError, GetApiV1FilesErrors, GetApiV1FilesResponse, GetApiV1FilesResponses, GetApiV1HealthData, GetApiV1HealthError, GetApiV1HealthErrors, GetApiV1HealthResponse, GetApiV1HealthResponses, GetApiV1KnowledgeBasesByIdData, GetApiV1KnowledgeBasesByIdError, GetApiV1KnowledgeBasesByIdErrors, GetApiV1KnowledgeBasesByIdFilesData, GetApiV1KnowledgeBasesByIdFilesError, GetApiV1KnowledgeBasesByIdFilesErrors, GetApiV1KnowledgeBasesByIdFilesResponse, GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdResponse, GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesData, GetApiV1KnowledgeBasesError, GetApiV1KnowledgeBasesErrors, GetApiV1KnowledgeBasesResponse, GetApiV1KnowledgeBasesResponses, GetApiV1McpServersByIdData, GetApiV1McpServersByIdError, GetApiV1McpServersByIdErrors, GetApiV1McpServersByIdResponse, GetApiV1McpServersByIdResponses, GetApiV1McpServersData, GetApiV1McpServersError, GetApiV1McpServersErrors, GetApiV1McpServersResponse, GetApiV1McpServersResponses, GetApiV1MessagesByIdData, GetApiV1MessagesByIdError, GetApiV1MessagesByIdErrors, GetApiV1MessagesByIdResponse, GetApiV1MessagesByIdResponses, GetApiV1MessagesCountData, GetApiV1MessagesCountError, GetApiV1MessagesCountErrors, GetApiV1MessagesCountResponse, GetApiV1MessagesCountResponses, GetApiV1MessagesData, GetApiV1MessagesError, GetApiV1MessagesErrors, GetApiV1MessagesResponse, GetApiV1MessagesResponses, GetApiV1MessageTranslationsByMessageIdData, GetApiV1MessageTranslationsByMessageIdError, GetApiV1MessageTranslationsByMessageIdErrors, GetApiV1MessageTranslationsByMessageIdResponse, GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1ModelsByProviderIdByModelIdData, GetApiV1ModelsByProviderIdByModelIdError, GetApiV1ModelsByProviderIdByModelIdErrors, GetApiV1ModelsByProviderIdByModelIdResponse, GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsData, GetApiV1ModelsError, GetApiV1ModelsErrors, GetApiV1ModelsResponse, GetApiV1ModelsResponses, GetApiV1PermissionsByIdData, GetApiV1PermissionsByIdError, GetApiV1PermissionsByIdErrors, GetApiV1PermissionsByIdResponse, GetApiV1PermissionsByIdResponses, GetApiV1PermissionsData, GetApiV1PermissionsError, GetApiV1PermissionsErrors, GetApiV1PermissionsResponse, GetApiV1PermissionsResponses, GetApiV1ProvidersByIdData, GetApiV1ProvidersByIdError, GetApiV1ProvidersByIdErrors, GetApiV1ProvidersByIdResponse, GetApiV1ProvidersByIdResponses, GetApiV1ProvidersData, GetApiV1ProvidersError, GetApiV1ProvidersErrors, GetApiV1ProvidersResponse, GetApiV1ProvidersResponses, GetApiV1RolesByIdData, GetApiV1RolesByIdError, GetApiV1RolesByIdErrors, GetApiV1RolesByIdPermissionsData, GetApiV1RolesByIdPermissionsError, GetApiV1RolesByIdPermissionsErrors, GetApiV1RolesByIdPermissionsResponse, GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdResponse, GetApiV1RolesByIdResponses, GetApiV1RolesData, GetApiV1RolesError, GetApiV1RolesErrors, GetApiV1RolesResponse, GetApiV1RolesResponses, GetApiV1TopicsByIdData, GetApiV1TopicsByIdError, GetApiV1TopicsByIdErrors, GetApiV1TopicsByIdResponse, GetApiV1TopicsByIdResponses, GetApiV1TopicsData, GetApiV1TopicsError, GetApiV1TopicsErrors, GetApiV1TopicsResponse, GetApiV1TopicsResponses, GetApiV1UsageData, GetApiV1UsageError, GetApiV1UsageErrors, GetApiV1UsageResponse, GetApiV1UsageResponses, GetApiV1UsersByIdData, GetApiV1UsersByIdError, GetApiV1UsersByIdErrors, GetApiV1UsersByIdResponse, GetApiV1UsersByIdResponses, GetApiV1UsersByIdRolesData, GetApiV1UsersByIdRolesError, GetApiV1UsersByIdRolesErrors, GetApiV1UsersByIdRolesResponse, GetApiV1UsersByIdRolesResponses, GetApiV1UsersData, GetApiV1UsersError, GetApiV1UsersErrors, GetApiV1UsersMeData, GetApiV1UsersMeError, GetApiV1UsersMeErrors, GetApiV1UsersMeResponse, GetApiV1UsersMeResponses, GetApiV1UsersResponse, GetApiV1UsersResponses, KnowledgeBase, McpServer, Message, Model, PatchApiV1AgentGroupsByIdData, PatchApiV1AgentGroupsByIdError, PatchApiV1AgentGroupsByIdErrors, PatchApiV1AgentGroupsByIdResponse, PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentsByIdData, PatchApiV1AgentsByIdError, PatchApiV1AgentsByIdErrors, PatchApiV1AgentsByIdResponse, PatchApiV1AgentsByIdResponses, PatchApiV1ApiKeysByIdData, PatchApiV1ApiKeysByIdError, PatchApiV1ApiKeysByIdErrors, PatchApiV1ApiKeysByIdResponse, PatchApiV1ApiKeysByIdResponses, PatchApiV1FilesByIdData, PatchApiV1FilesByIdError, PatchApiV1FilesByIdErrors, PatchApiV1FilesByIdResponse, PatchApiV1FilesByIdResponses, PatchApiV1KnowledgeBasesByIdData, PatchApiV1KnowledgeBasesByIdError, PatchApiV1KnowledgeBasesByIdErrors, PatchApiV1KnowledgeBasesByIdResponse, PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1McpServersByIdData, PatchApiV1McpServersByIdError, PatchApiV1McpServersByIdErrors, PatchApiV1McpServersByIdResponse, PatchApiV1McpServersByIdResponses, PatchApiV1MessageTranslationsByMessageIdData, PatchApiV1MessageTranslationsByMessageIdError, PatchApiV1MessageTranslationsByMessageIdErrors, PatchApiV1MessageTranslationsByMessageIdResponse, PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1ModelsByProviderIdByModelIdData, PatchApiV1ModelsByProviderIdByModelIdError, PatchApiV1ModelsByProviderIdByModelIdErrors, PatchApiV1ModelsByProviderIdByModelIdResponse, PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1PermissionsByIdData, PatchApiV1PermissionsByIdError, PatchApiV1PermissionsByIdErrors, PatchApiV1PermissionsByIdResponse, PatchApiV1PermissionsByIdResponses, PatchApiV1ProvidersByIdData, PatchApiV1ProvidersByIdError, PatchApiV1ProvidersByIdErrors, PatchApiV1ProvidersByIdResponse, PatchApiV1ProvidersByIdResponses, PatchApiV1RolesByIdData, PatchApiV1RolesByIdError, PatchApiV1RolesByIdErrors, PatchApiV1RolesByIdPermissionsData, PatchApiV1RolesByIdPermissionsError, PatchApiV1RolesByIdPermissionsErrors, PatchApiV1RolesByIdPermissionsResponse, PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdResponse, PatchApiV1RolesByIdResponses, PatchApiV1TopicsByIdData, PatchApiV1TopicsByIdError, PatchApiV1TopicsByIdErrors, PatchApiV1TopicsByIdResponse, PatchApiV1TopicsByIdResponses, PatchApiV1UsersByIdData, PatchApiV1UsersByIdError, PatchApiV1UsersByIdErrors, PatchApiV1UsersByIdResponse, PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdRolesData, PatchApiV1UsersByIdRolesError, PatchApiV1UsersByIdRolesErrors, PatchApiV1UsersByIdRolesResponse, PatchApiV1UsersByIdRolesResponses, Permission, PostApiV1AgentGroupsData, PostApiV1AgentGroupsError, PostApiV1AgentGroupsErrors, PostApiV1AgentGroupsResponse, PostApiV1AgentGroupsResponses, PostApiV1AgentsData, PostApiV1AgentsError, PostApiV1AgentsErrors, PostApiV1AgentsResponse, PostApiV1AgentsResponses, PostApiV1ApiKeysData, PostApiV1ApiKeysError, PostApiV1ApiKeysErrors, PostApiV1ApiKeysResponse, PostApiV1ApiKeysResponses, PostApiV1ChatData, PostApiV1ChatError, PostApiV1ChatErrors, PostApiV1ChatGenerateReplyData, PostApiV1ChatGenerateReplyError, PostApiV1ChatGenerateReplyErrors, PostApiV1ChatGenerateReplyResponse, PostApiV1ChatGenerateReplyResponses, PostApiV1ChatResponse, PostApiV1ChatResponses, PostApiV1ChatTranslateData, PostApiV1ChatTranslateError, PostApiV1ChatTranslateErrors, PostApiV1ChatTranslateResponse, PostApiV1ChatTranslateResponses, PostApiV1EvalRunsData, PostApiV1EvalRunsError, PostApiV1EvalRunsErrors, PostApiV1EvalRunsResponse, PostApiV1EvalRunsResponses, PostApiV1FilesBatchesData, PostApiV1FilesBatchesError, PostApiV1FilesBatchesErrors, PostApiV1FilesBatchesResponse, PostApiV1FilesBatchesResponses, PostApiV1FilesByIdChunksData, PostApiV1FilesByIdChunksError, PostApiV1FilesByIdChunksErrors, PostApiV1FilesByIdChunksResponse, PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdParsesData, PostApiV1FilesByIdParsesError, PostApiV1FilesByIdParsesErrors, PostApiV1FilesByIdParsesResponse, PostApiV1FilesByIdParsesResponses, PostApiV1FilesData, PostApiV1FilesError, PostApiV1FilesErrors, PostApiV1FilesQueriesData, PostApiV1FilesQueriesError, PostApiV1FilesQueriesErrors, PostApiV1FilesQueriesResponse, PostApiV1FilesQueriesResponses, PostApiV1FilesResponse, PostApiV1FilesResponses, PostApiV1KnowledgeBasesByIdFilesBatchData, PostApiV1KnowledgeBasesByIdFilesBatchError, PostApiV1KnowledgeBasesByIdFilesBatchErrors, PostApiV1KnowledgeBasesByIdFilesBatchResponse, PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesMoveData, PostApiV1KnowledgeBasesByIdFilesMoveError, PostApiV1KnowledgeBasesByIdFilesMoveErrors, PostApiV1KnowledgeBasesByIdFilesMoveResponse, PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesData, PostApiV1KnowledgeBasesError, PostApiV1KnowledgeBasesErrors, PostApiV1KnowledgeBasesResponse, PostApiV1KnowledgeBasesResponses, PostApiV1McpServersByIdSyncData, PostApiV1McpServersByIdSyncError, PostApiV1McpServersByIdSyncErrors, PostApiV1McpServersByIdSyncResponse, PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersData, PostApiV1McpServersError, PostApiV1McpServersErrors, PostApiV1McpServersResponse, PostApiV1McpServersResponses, PostApiV1MessagesData, PostApiV1MessagesError, PostApiV1MessagesErrors, PostApiV1MessagesRepliesData, PostApiV1MessagesRepliesError, PostApiV1MessagesRepliesErrors, PostApiV1MessagesRepliesResponse, PostApiV1MessagesRepliesResponses, PostApiV1MessagesResponse, PostApiV1MessagesResponses, PostApiV1MessageTranslationsByMessageIdData, PostApiV1MessageTranslationsByMessageIdError, PostApiV1MessageTranslationsByMessageIdErrors, PostApiV1MessageTranslationsByMessageIdResponse, PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1ModelsData, PostApiV1ModelsError, PostApiV1ModelsErrors, PostApiV1ModelsResponse, PostApiV1ModelsResponses, PostApiV1PermissionsData, PostApiV1PermissionsError, PostApiV1PermissionsErrors, PostApiV1PermissionsResponse, PostApiV1PermissionsResponses, PostApiV1ProvidersData, PostApiV1ProvidersError, PostApiV1ProvidersErrors, PostApiV1ProvidersResponse, PostApiV1ProvidersResponses, PostApiV1ResponsesData, PostApiV1ResponsesError, PostApiV1ResponsesErrors, PostApiV1ResponsesResponse, PostApiV1ResponsesResponses, PostApiV1RolesData, PostApiV1RolesError, PostApiV1RolesErrors, PostApiV1RolesResponse, PostApiV1RolesResponses, PostApiV1TopicsData, PostApiV1TopicsError, PostApiV1TopicsErrors, PostApiV1TopicsResponse, PostApiV1TopicsResponses, PostApiV1UsersData, PostApiV1UsersError, PostApiV1UsersErrors, PostApiV1UsersResponse, PostApiV1UsersResponses, Provider, Role, Topic, Usage, User } from './types.gen';
diff --git a/packages/sdk/src/generated/sdk.gen.ts b/packages/sdk/src/generated/sdk.gen.ts
index 201fc1ea395..e73c6e6d181 100644
--- a/packages/sdk/src/generated/sdk.gen.ts
+++ b/packages/sdk/src/generated/sdk.gen.ts
@@ -2,7 +2,7 @@
import { type Client, type ClientMeta, formDataBodySerializer, type Options as Options2, type RequestResult, type TDataShape } from './client';
import { client } from './client.gen';
-import type { DeleteApiV1AgentGroupsByIdData, DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentsByIdData, DeleteApiV1AgentsByIdResponses, DeleteApiV1FilesByIdData, DeleteApiV1FilesByIdResponses, DeleteApiV1KnowledgeBasesByIdData, DeleteApiV1KnowledgeBasesByIdFilesBatchData, DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1MessagesByIdData, DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesData, DeleteApiV1MessagesResponses, DeleteApiV1MessageTranslationsByMessageIdData, DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1PermissionsByIdData, DeleteApiV1PermissionsByIdResponses, DeleteApiV1ProvidersByIdData, DeleteApiV1ProvidersByIdResponses, DeleteApiV1RolesByIdData, DeleteApiV1RolesByIdPermissionsData, DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdResponses, DeleteApiV1TopicsByIdData, DeleteApiV1TopicsByIdResponses, DeleteApiV1UsersByIdData, DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdRolesData, DeleteApiV1UsersByIdRolesResponses, GetApiV1AgentGroupsByIdData, GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsData, GetApiV1AgentGroupsResponses, GetApiV1AgentsByIdData, GetApiV1AgentsByIdResponses, GetApiV1AgentsData, GetApiV1AgentsResponses, GetApiV1FilesByIdChunksData, GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdData, GetApiV1FilesByIdResponses, GetApiV1FilesByIdUrlData, GetApiV1FilesByIdUrlResponses, GetApiV1FilesData, GetApiV1FilesResponses, GetApiV1HealthData, GetApiV1HealthResponses, GetApiV1KnowledgeBasesByIdData, GetApiV1KnowledgeBasesByIdFilesData, GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesData, GetApiV1KnowledgeBasesResponses, GetApiV1MessagesByIdData, GetApiV1MessagesByIdResponses, GetApiV1MessagesCountData, GetApiV1MessagesCountResponses, GetApiV1MessagesData, GetApiV1MessagesResponses, GetApiV1MessageTranslationsByMessageIdData, GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1ModelsByProviderIdByModelIdData, GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsData, GetApiV1ModelsResponses, GetApiV1PermissionsByIdData, GetApiV1PermissionsByIdResponses, GetApiV1PermissionsData, GetApiV1PermissionsResponses, GetApiV1ProvidersByIdData, GetApiV1ProvidersByIdResponses, GetApiV1ProvidersData, GetApiV1ProvidersResponses, GetApiV1RolesByIdData, GetApiV1RolesByIdPermissionsData, GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdResponses, GetApiV1RolesData, GetApiV1RolesResponses, GetApiV1TopicsByIdData, GetApiV1TopicsByIdResponses, GetApiV1TopicsData, GetApiV1TopicsResponses, GetApiV1UsersByIdData, GetApiV1UsersByIdResponses, GetApiV1UsersByIdRolesData, GetApiV1UsersByIdRolesResponses, GetApiV1UsersData, GetApiV1UsersMeData, GetApiV1UsersMeResponses, GetApiV1UsersResponses, PatchApiV1AgentGroupsByIdData, PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentsByIdData, PatchApiV1AgentsByIdResponses, PatchApiV1FilesByIdData, PatchApiV1FilesByIdResponses, PatchApiV1KnowledgeBasesByIdData, PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1MessageTranslationsByMessageIdData, PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1ModelsByProviderIdByModelIdData, PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1PermissionsByIdData, PatchApiV1PermissionsByIdResponses, PatchApiV1ProvidersByIdData, PatchApiV1ProvidersByIdResponses, PatchApiV1RolesByIdData, PatchApiV1RolesByIdPermissionsData, PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdResponses, PatchApiV1TopicsByIdData, PatchApiV1TopicsByIdResponses, PatchApiV1UsersByIdData, PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdRolesData, PatchApiV1UsersByIdRolesResponses, PostApiV1AgentGroupsData, PostApiV1AgentGroupsResponses, PostApiV1AgentsData, PostApiV1AgentsResponses, PostApiV1FilesBatchesData, PostApiV1FilesBatchesResponses, PostApiV1FilesByIdChunksData, PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdParsesData, PostApiV1FilesByIdParsesResponses, PostApiV1FilesData, PostApiV1FilesQueriesData, PostApiV1FilesQueriesResponses, PostApiV1FilesResponses, PostApiV1KnowledgeBasesByIdFilesBatchData, PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesMoveData, PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesData, PostApiV1KnowledgeBasesResponses, PostApiV1MessagesData, PostApiV1MessagesRepliesData, PostApiV1MessagesRepliesResponses, PostApiV1MessagesResponses, PostApiV1MessageTranslationsByMessageIdData, PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1ModelsData, PostApiV1ModelsResponses, PostApiV1PermissionsData, PostApiV1PermissionsResponses, PostApiV1ProvidersData, PostApiV1ProvidersResponses, PostApiV1ResponsesData, PostApiV1ResponsesResponses, PostApiV1RolesData, PostApiV1RolesResponses, PostApiV1TopicsData, PostApiV1TopicsResponses, PostApiV1UsersData, PostApiV1UsersResponses } from './types.gen';
+import type { DeleteApiV1AgentGroupsByIdData, DeleteApiV1AgentGroupsByIdErrors, DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentsByIdData, DeleteApiV1AgentsByIdErrors, DeleteApiV1AgentsByIdResponses, DeleteApiV1ApiKeysByIdData, DeleteApiV1ApiKeysByIdErrors, DeleteApiV1ApiKeysByIdResponses, DeleteApiV1FilesByIdData, DeleteApiV1FilesByIdErrors, DeleteApiV1FilesByIdResponses, DeleteApiV1KnowledgeBasesByIdData, DeleteApiV1KnowledgeBasesByIdErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchData, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1McpServersByIdData, DeleteApiV1McpServersByIdErrors, DeleteApiV1McpServersByIdResponses, DeleteApiV1MessagesByIdData, DeleteApiV1MessagesByIdErrors, DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesData, DeleteApiV1MessagesErrors, DeleteApiV1MessagesResponses, DeleteApiV1MessageTranslationsByMessageIdData, DeleteApiV1MessageTranslationsByMessageIdErrors, DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1PermissionsByIdData, DeleteApiV1PermissionsByIdErrors, DeleteApiV1PermissionsByIdResponses, DeleteApiV1ProvidersByIdData, DeleteApiV1ProvidersByIdErrors, DeleteApiV1ProvidersByIdResponses, DeleteApiV1RolesByIdData, DeleteApiV1RolesByIdErrors, DeleteApiV1RolesByIdPermissionsData, DeleteApiV1RolesByIdPermissionsErrors, DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdResponses, DeleteApiV1TopicsByIdData, DeleteApiV1TopicsByIdErrors, DeleteApiV1TopicsByIdResponses, DeleteApiV1UsersByIdData, DeleteApiV1UsersByIdErrors, DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdRolesData, DeleteApiV1UsersByIdRolesErrors, DeleteApiV1UsersByIdRolesResponses, GetApiV1AgentGroupsByIdData, GetApiV1AgentGroupsByIdErrors, GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsData, GetApiV1AgentGroupsErrors, GetApiV1AgentGroupsResponses, GetApiV1AgentsByIdData, GetApiV1AgentsByIdErrors, GetApiV1AgentsByIdResponses, GetApiV1AgentsData, GetApiV1AgentsErrors, GetApiV1AgentsResponses, GetApiV1ApiKeysByIdData, GetApiV1ApiKeysByIdErrors, GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysData, GetApiV1ApiKeysErrors, GetApiV1ApiKeysResponses, GetApiV1EvalRunsByIdData, GetApiV1EvalRunsByIdErrors, GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdResultsData, GetApiV1EvalRunsByIdResultsErrors, GetApiV1EvalRunsByIdResultsResponses, GetApiV1FilesByIdChunksData, GetApiV1FilesByIdChunksErrors, GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdData, GetApiV1FilesByIdErrors, GetApiV1FilesByIdResponses, GetApiV1FilesByIdUrlData, GetApiV1FilesByIdUrlErrors, GetApiV1FilesByIdUrlResponses, GetApiV1FilesData, GetApiV1FilesErrors, GetApiV1FilesResponses, GetApiV1HealthData, GetApiV1HealthErrors, GetApiV1HealthResponses, GetApiV1KnowledgeBasesByIdData, GetApiV1KnowledgeBasesByIdErrors, GetApiV1KnowledgeBasesByIdFilesData, GetApiV1KnowledgeBasesByIdFilesErrors, GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesData, GetApiV1KnowledgeBasesErrors, GetApiV1KnowledgeBasesResponses, GetApiV1McpServersByIdData, GetApiV1McpServersByIdErrors, GetApiV1McpServersByIdResponses, GetApiV1McpServersData, GetApiV1McpServersErrors, GetApiV1McpServersResponses, GetApiV1MessagesByIdData, GetApiV1MessagesByIdErrors, GetApiV1MessagesByIdResponses, GetApiV1MessagesCountData, GetApiV1MessagesCountErrors, GetApiV1MessagesCountResponses, GetApiV1MessagesData, GetApiV1MessagesErrors, GetApiV1MessagesResponses, GetApiV1MessageTranslationsByMessageIdData, GetApiV1MessageTranslationsByMessageIdErrors, GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1ModelsByProviderIdByModelIdData, GetApiV1ModelsByProviderIdByModelIdErrors, GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsData, GetApiV1ModelsErrors, GetApiV1ModelsResponses, GetApiV1PermissionsByIdData, GetApiV1PermissionsByIdErrors, GetApiV1PermissionsByIdResponses, GetApiV1PermissionsData, GetApiV1PermissionsErrors, GetApiV1PermissionsResponses, GetApiV1ProvidersByIdData, GetApiV1ProvidersByIdErrors, GetApiV1ProvidersByIdResponses, GetApiV1ProvidersData, GetApiV1ProvidersErrors, GetApiV1ProvidersResponses, GetApiV1RolesByIdData, GetApiV1RolesByIdErrors, GetApiV1RolesByIdPermissionsData, GetApiV1RolesByIdPermissionsErrors, GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdResponses, GetApiV1RolesData, GetApiV1RolesErrors, GetApiV1RolesResponses, GetApiV1TopicsByIdData, GetApiV1TopicsByIdErrors, GetApiV1TopicsByIdResponses, GetApiV1TopicsData, GetApiV1TopicsErrors, GetApiV1TopicsResponses, GetApiV1UsageData, GetApiV1UsageErrors, GetApiV1UsageResponses, GetApiV1UsersByIdData, GetApiV1UsersByIdErrors, GetApiV1UsersByIdResponses, GetApiV1UsersByIdRolesData, GetApiV1UsersByIdRolesErrors, GetApiV1UsersByIdRolesResponses, GetApiV1UsersData, GetApiV1UsersErrors, GetApiV1UsersMeData, GetApiV1UsersMeErrors, GetApiV1UsersMeResponses, GetApiV1UsersResponses, PatchApiV1AgentGroupsByIdData, PatchApiV1AgentGroupsByIdErrors, PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentsByIdData, PatchApiV1AgentsByIdErrors, PatchApiV1AgentsByIdResponses, PatchApiV1ApiKeysByIdData, PatchApiV1ApiKeysByIdErrors, PatchApiV1ApiKeysByIdResponses, PatchApiV1FilesByIdData, PatchApiV1FilesByIdErrors, PatchApiV1FilesByIdResponses, PatchApiV1KnowledgeBasesByIdData, PatchApiV1KnowledgeBasesByIdErrors, PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1McpServersByIdData, PatchApiV1McpServersByIdErrors, PatchApiV1McpServersByIdResponses, PatchApiV1MessageTranslationsByMessageIdData, PatchApiV1MessageTranslationsByMessageIdErrors, PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1ModelsByProviderIdByModelIdData, PatchApiV1ModelsByProviderIdByModelIdErrors, PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1PermissionsByIdData, PatchApiV1PermissionsByIdErrors, PatchApiV1PermissionsByIdResponses, PatchApiV1ProvidersByIdData, PatchApiV1ProvidersByIdErrors, PatchApiV1ProvidersByIdResponses, PatchApiV1RolesByIdData, PatchApiV1RolesByIdErrors, PatchApiV1RolesByIdPermissionsData, PatchApiV1RolesByIdPermissionsErrors, PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdResponses, PatchApiV1TopicsByIdData, PatchApiV1TopicsByIdErrors, PatchApiV1TopicsByIdResponses, PatchApiV1UsersByIdData, PatchApiV1UsersByIdErrors, PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdRolesData, PatchApiV1UsersByIdRolesErrors, PatchApiV1UsersByIdRolesResponses, PostApiV1AgentGroupsData, PostApiV1AgentGroupsErrors, PostApiV1AgentGroupsResponses, PostApiV1AgentsData, PostApiV1AgentsErrors, PostApiV1AgentsResponses, PostApiV1ApiKeysData, PostApiV1ApiKeysErrors, PostApiV1ApiKeysResponses, PostApiV1ChatData, PostApiV1ChatErrors, PostApiV1ChatGenerateReplyData, PostApiV1ChatGenerateReplyErrors, PostApiV1ChatGenerateReplyResponses, PostApiV1ChatResponses, PostApiV1ChatTranslateData, PostApiV1ChatTranslateErrors, PostApiV1ChatTranslateResponses, PostApiV1EvalRunsData, PostApiV1EvalRunsErrors, PostApiV1EvalRunsResponses, PostApiV1FilesBatchesData, PostApiV1FilesBatchesErrors, PostApiV1FilesBatchesResponses, PostApiV1FilesByIdChunksData, PostApiV1FilesByIdChunksErrors, PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdParsesData, PostApiV1FilesByIdParsesErrors, PostApiV1FilesByIdParsesResponses, PostApiV1FilesData, PostApiV1FilesErrors, PostApiV1FilesQueriesData, PostApiV1FilesQueriesErrors, PostApiV1FilesQueriesResponses, PostApiV1FilesResponses, PostApiV1KnowledgeBasesByIdFilesBatchData, PostApiV1KnowledgeBasesByIdFilesBatchErrors, PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesMoveData, PostApiV1KnowledgeBasesByIdFilesMoveErrors, PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesData, PostApiV1KnowledgeBasesErrors, PostApiV1KnowledgeBasesResponses, PostApiV1McpServersByIdSyncData, PostApiV1McpServersByIdSyncErrors, PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersData, PostApiV1McpServersErrors, PostApiV1McpServersResponses, PostApiV1MessagesData, PostApiV1MessagesErrors, PostApiV1MessagesRepliesData, PostApiV1MessagesRepliesErrors, PostApiV1MessagesRepliesResponses, PostApiV1MessagesResponses, PostApiV1MessageTranslationsByMessageIdData, PostApiV1MessageTranslationsByMessageIdErrors, PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1ModelsData, PostApiV1ModelsErrors, PostApiV1ModelsResponses, PostApiV1PermissionsData, PostApiV1PermissionsErrors, PostApiV1PermissionsResponses, PostApiV1ProvidersData, PostApiV1ProvidersErrors, PostApiV1ProvidersResponses, PostApiV1ResponsesData, PostApiV1ResponsesErrors, PostApiV1ResponsesResponses, PostApiV1RolesData, PostApiV1RolesErrors, PostApiV1RolesResponses, PostApiV1TopicsData, PostApiV1TopicsErrors, PostApiV1TopicsResponses, PostApiV1UsersData, PostApiV1UsersErrors, PostApiV1UsersResponses } from './types.gen';
const mergeMethodHeaders = (
defaults: Record<string, unknown>,
@@ -65,8 +65,8 @@ export class Health extends HeyApiClient {
/**
* Health check
*/
- public check<ThrowOnError extends boolean = false>(options?: Options<GetApiV1HealthData, ThrowOnError>): RequestResult<GetApiV1HealthResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1HealthResponses, unknown, ThrowOnError>({
+ public check<ThrowOnError extends boolean = false>(options?: Options<GetApiV1HealthData, ThrowOnError>): RequestResult<GetApiV1HealthResponses, GetApiV1HealthErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1HealthResponses, GetApiV1HealthErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/health',
...options
@@ -78,16 +78,16 @@ export class AgentGroups extends HeyApiClient {
/**
* Get agent group list
*/
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1AgentGroupsData, ThrowOnError>): RequestResult<GetApiV1AgentGroupsResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1AgentGroupsResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1AgentGroupsData, ThrowOnError>): RequestResult<GetApiV1AgentGroupsResponses, GetApiV1AgentGroupsErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1AgentGroupsResponses, GetApiV1AgentGroupsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/agent-groups',
...options
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentGroupsData, ThrowOnError>): RequestResult<PostApiV1AgentGroupsResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1AgentGroupsResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentGroupsData, ThrowOnError>): RequestResult<PostApiV1AgentGroupsResponses, PostApiV1AgentGroupsErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1AgentGroupsResponses, PostApiV1AgentGroupsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/agent-groups',
...options,
@@ -95,24 +95,24 @@ export class AgentGroups extends HeyApiClient {
});
}
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<DeleteApiV1AgentGroupsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1AgentGroupsByIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentGroupsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1AgentGroupsByIdResponses, DeleteApiV1AgentGroupsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/agent-groups/{id}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<GetApiV1AgentGroupsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1AgentGroupsByIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1AgentGroupsByIdResponses, GetApiV1AgentGroupsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/agent-groups/{id}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<PatchApiV1AgentGroupsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1AgentGroupsByIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1AgentGroupsByIdData, ThrowOnError>): RequestResult<PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentGroupsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1AgentGroupsByIdResponses, PatchApiV1AgentGroupsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/agent-groups/{id}',
...options,
@@ -122,16 +122,16 @@ export class AgentGroups extends HeyApiClient {
}
export class Agents extends HeyApiClient {
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1AgentsData, ThrowOnError>): RequestResult<GetApiV1AgentsResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1AgentsResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1AgentsData, ThrowOnError>): RequestResult<GetApiV1AgentsResponses, GetApiV1AgentsErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1AgentsResponses, GetApiV1AgentsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/agents',
...options
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentsData, ThrowOnError>): RequestResult<PostApiV1AgentsResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1AgentsResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1AgentsData, ThrowOnError>): RequestResult<PostApiV1AgentsResponses, PostApiV1AgentsErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1AgentsResponses, PostApiV1AgentsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/agents',
...options,
@@ -139,24 +139,24 @@ export class Agents extends HeyApiClient {
});
}
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AgentsByIdData, ThrowOnError>): RequestResult<DeleteApiV1AgentsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1AgentsByIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1AgentsByIdData, ThrowOnError>): RequestResult<DeleteApiV1AgentsByIdResponses, DeleteApiV1AgentsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1AgentsByIdResponses, DeleteApiV1AgentsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/agents/{id}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentsByIdData, ThrowOnError>): RequestResult<GetApiV1AgentsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1AgentsByIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1AgentsByIdData, ThrowOnError>): RequestResult<GetApiV1AgentsByIdResponses, GetApiV1AgentsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1AgentsByIdResponses, GetApiV1AgentsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/agents/{id}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1AgentsByIdData, ThrowOnError>): RequestResult<PatchApiV1AgentsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1AgentsByIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1AgentsByIdData, ThrowOnError>): RequestResult<PatchApiV1AgentsByIdResponses, PatchApiV1AgentsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1AgentsByIdResponses, PatchApiV1AgentsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/agents/{id}',
...options,
@@ -165,9 +165,117 @@ export class Agents extends HeyApiClient {
}
}
+export class ApiKeys extends HeyApiClient {
+ /**
+ * List API keys
+ */
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ApiKeysData, ThrowOnError>): RequestResult<GetApiV1ApiKeysResponses, GetApiV1ApiKeysErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1ApiKeysResponses, GetApiV1ApiKeysErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/api-keys',
+ ...options
+ });
+ }
+
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ApiKeysData, ThrowOnError>): RequestResult<PostApiV1ApiKeysResponses, PostApiV1ApiKeysErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1ApiKeysResponses, PostApiV1ApiKeysErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/api-keys',
+ ...options,
+ headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
+ });
+ }
+
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ApiKeysByIdData, ThrowOnError>): RequestResult<DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ApiKeysByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1ApiKeysByIdResponses, DeleteApiV1ApiKeysByIdErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/api-keys/{id}',
+ ...options
+ });
+ }
+
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ApiKeysByIdData, ThrowOnError>): RequestResult<GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1ApiKeysByIdResponses, GetApiV1ApiKeysByIdErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/api-keys/{id}',
+ ...options
+ });
+ }
+
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ApiKeysByIdData, ThrowOnError>): RequestResult<PatchApiV1ApiKeysByIdResponses, PatchApiV1ApiKeysByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1ApiKeysByIdResponses, PatchApiV1ApiKeysByIdErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/api-keys/{id}',
+ ...options,
+ headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
+ });
+ }
+}
+
+export class Chat extends HeyApiClient {
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatData, ThrowOnError>): RequestResult<PostApiV1ChatResponses, PostApiV1ChatErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1ChatResponses, PostApiV1ChatErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/chat',
+ ...options,
+ headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
+ });
+ }
+
+ public createTranslate<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatTranslateData, ThrowOnError>): RequestResult<PostApiV1ChatTranslateResponses, PostApiV1ChatTranslateErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1ChatTranslateResponses, PostApiV1ChatTranslateErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/chat/translate',
+ ...options,
+ headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
+ });
+ }
+
+ public createGenerateReply<ThrowOnError extends boolean = false>(options: Options<PostApiV1ChatGenerateReplyData, ThrowOnError>): RequestResult<PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGenerateReplyErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1ChatGenerateReplyResponses, PostApiV1ChatGenerateReplyErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/chat/generate-reply',
+ ...options,
+ headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
+ });
+ }
+}
+
+export class Eval extends HeyApiClient {
+ /**
+ * Create an eval run
+ *
+ * Queues an asynchronous QStash-backed evaluation run and returns immediately.
+ */
+ public createRuns<ThrowOnError extends boolean = false>(options: Options<PostApiV1EvalRunsData, ThrowOnError>): RequestResult<PostApiV1EvalRunsResponses, PostApiV1EvalRunsErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1EvalRunsResponses, PostApiV1EvalRunsErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/eval/runs',
+ ...options,
+ headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
+ });
+ }
+
+ public getRuns<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalRunsByIdData, ThrowOnError>): RequestResult<GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1EvalRunsByIdResponses, GetApiV1EvalRunsByIdErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/eval/runs/{id}',
+ ...options
+ });
+ }
+
+ public listRunsResults<ThrowOnError extends boolean = false>(options: Options<GetApiV1EvalRunsByIdResultsData, ThrowOnError>): RequestResult<GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdResultsErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1EvalRunsByIdResultsResponses, GetApiV1EvalRunsByIdResultsErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/eval/runs/{id}/results',
+ ...options
+ });
+ }
+}
+
export class Files extends HeyApiClient {
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1FilesData, ThrowOnError>): RequestResult<GetApiV1FilesResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1FilesResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1FilesData, ThrowOnError>): RequestResult<GetApiV1FilesResponses, GetApiV1FilesErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1FilesResponses, GetApiV1FilesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files',
...options
@@ -177,8 +285,8 @@ export class Files extends HeyApiClient {
/**
* Upload a file and return the corresponding file record
*/
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesData, ThrowOnError>): RequestResult<PostApiV1FilesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1FilesResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesData, ThrowOnError>): RequestResult<PostApiV1FilesResponses, PostApiV1FilesErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1FilesResponses, PostApiV1FilesErrors, ThrowOnError>({
...formDataBodySerializer,
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files',
@@ -187,24 +295,24 @@ export class Files extends HeyApiClient {
});
}
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1FilesByIdData, ThrowOnError>): RequestResult<DeleteApiV1FilesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1FilesByIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1FilesByIdData, ThrowOnError>): RequestResult<DeleteApiV1FilesByIdResponses, DeleteApiV1FilesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1FilesByIdResponses, DeleteApiV1FilesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files/{id}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdData, ThrowOnError>): RequestResult<GetApiV1FilesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1FilesByIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdData, ThrowOnError>): RequestResult<GetApiV1FilesByIdResponses, GetApiV1FilesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1FilesByIdResponses, GetApiV1FilesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files/{id}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1FilesByIdData, ThrowOnError>): RequestResult<PatchApiV1FilesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1FilesByIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1FilesByIdData, ThrowOnError>): RequestResult<PatchApiV1FilesByIdResponses, PatchApiV1FilesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1FilesByIdResponses, PatchApiV1FilesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files/{id}',
...options,
@@ -212,32 +320,32 @@ export class Files extends HeyApiClient {
});
}
- public getUrl<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdUrlData, ThrowOnError>): RequestResult<GetApiV1FilesByIdUrlResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1FilesByIdUrlResponses, unknown, ThrowOnError>({
+ public getUrl<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdUrlData, ThrowOnError>): RequestResult<GetApiV1FilesByIdUrlResponses, GetApiV1FilesByIdUrlErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1FilesByIdUrlResponses, GetApiV1FilesByIdUrlErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files/{id}/url',
...options
});
}
- public parse<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesByIdParsesData, ThrowOnError>): RequestResult<PostApiV1FilesByIdParsesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1FilesByIdParsesResponses, unknown, ThrowOnError>({
+ public parse<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesByIdParsesData, ThrowOnError>): RequestResult<PostApiV1FilesByIdParsesResponses, PostApiV1FilesByIdParsesErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1FilesByIdParsesResponses, PostApiV1FilesByIdParsesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files/{id}/parses',
...options
});
}
- public listChunks<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdChunksData, ThrowOnError>): RequestResult<GetApiV1FilesByIdChunksResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1FilesByIdChunksResponses, unknown, ThrowOnError>({
+ public listChunks<ThrowOnError extends boolean = false>(options: Options<GetApiV1FilesByIdChunksData, ThrowOnError>): RequestResult<GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdChunksErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1FilesByIdChunksResponses, GetApiV1FilesByIdChunksErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files/{id}/chunks',
...options
});
}
- public createChunks<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesByIdChunksData, ThrowOnError>): RequestResult<PostApiV1FilesByIdChunksResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1FilesByIdChunksResponses, unknown, ThrowOnError>({
+ public createChunks<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesByIdChunksData, ThrowOnError>): RequestResult<PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdChunksErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1FilesByIdChunksResponses, PostApiV1FilesByIdChunksErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files/{id}/chunks',
...options,
@@ -248,8 +356,8 @@ export class Files extends HeyApiClient {
/**
* Batch file upload
*/
- public uploadBatch<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesBatchesData, ThrowOnError>): RequestResult<PostApiV1FilesBatchesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1FilesBatchesResponses, unknown, ThrowOnError>({
+ public uploadBatch<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesBatchesData, ThrowOnError>): RequestResult<PostApiV1FilesBatchesResponses, PostApiV1FilesBatchesErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1FilesBatchesResponses, PostApiV1FilesBatchesErrors, ThrowOnError>({
...formDataBodySerializer,
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files/batches',
@@ -258,8 +366,8 @@ export class Files extends HeyApiClient {
});
}
- public query<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesQueriesData, ThrowOnError>): RequestResult<PostApiV1FilesQueriesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1FilesQueriesResponses, unknown, ThrowOnError>({
+ public query<ThrowOnError extends boolean = false>(options: Options<PostApiV1FilesQueriesData, ThrowOnError>): RequestResult<PostApiV1FilesQueriesResponses, PostApiV1FilesQueriesErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1FilesQueriesResponses, PostApiV1FilesQueriesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/files/queries',
...options,
@@ -269,16 +377,16 @@ export class Files extends HeyApiClient {
}
export class KnowledgeBases extends HeyApiClient {
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1KnowledgeBasesData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1KnowledgeBasesResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1KnowledgeBasesData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesResponses, GetApiV1KnowledgeBasesErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1KnowledgeBasesResponses, GetApiV1KnowledgeBasesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/knowledge-bases',
...options
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1KnowledgeBasesResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesResponses, PostApiV1KnowledgeBasesErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1KnowledgeBasesResponses, PostApiV1KnowledgeBasesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/knowledge-bases',
...options,
@@ -286,24 +394,24 @@ export class KnowledgeBases extends HeyApiClient {
});
}
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<DeleteApiV1KnowledgeBasesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1KnowledgeBasesByIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1KnowledgeBasesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1KnowledgeBasesByIdResponses, DeleteApiV1KnowledgeBasesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/knowledge-bases/{id}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1KnowledgeBasesByIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1KnowledgeBasesByIdResponses, GetApiV1KnowledgeBasesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/knowledge-bases/{id}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<PatchApiV1KnowledgeBasesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1KnowledgeBasesByIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1KnowledgeBasesByIdData, ThrowOnError>): RequestResult<PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1KnowledgeBasesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1KnowledgeBasesByIdResponses, PatchApiV1KnowledgeBasesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/knowledge-bases/{id}',
...options,
@@ -311,16 +419,16 @@ export class KnowledgeBases extends HeyApiClient {
});
}
- public listFiles<ThrowOnError extends boolean = false>(options: Options<GetApiV1KnowledgeBasesByIdFilesData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesByIdFilesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1KnowledgeBasesByIdFilesResponses, unknown, ThrowOnError>({
+ public listFiles<ThrowOnError extends boolean = false>(options: Options<GetApiV1KnowledgeBasesByIdFilesData, ThrowOnError>): RequestResult<GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdFilesErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1KnowledgeBasesByIdFilesResponses, GetApiV1KnowledgeBasesByIdFilesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/knowledge-bases/{id}/files',
...options
});
}
- public removeFiles<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1KnowledgeBasesByIdFilesBatchData, ThrowOnError>): RequestResult<DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, unknown, ThrowOnError>({
+ public removeFiles<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1KnowledgeBasesByIdFilesBatchData, ThrowOnError>): RequestResult<DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1KnowledgeBasesByIdFilesBatchResponses, DeleteApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/knowledge-bases/{id}/files/batch',
...options,
@@ -328,8 +436,8 @@ export class KnowledgeBases extends HeyApiClient {
});
}
- public addFiles<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesByIdFilesBatchData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesByIdFilesBatchResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1KnowledgeBasesByIdFilesBatchResponses, unknown, ThrowOnError>({
+ public addFiles<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesByIdFilesBatchData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1KnowledgeBasesByIdFilesBatchResponses, PostApiV1KnowledgeBasesByIdFilesBatchErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/knowledge-bases/{id}/files/batch',
...options,
@@ -337,8 +445,8 @@ export class KnowledgeBases extends HeyApiClient {
});
}
- public moveFiles<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesByIdFilesMoveData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesByIdFilesMoveResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1KnowledgeBasesByIdFilesMoveResponses, unknown, ThrowOnError>({
+ public moveFiles<ThrowOnError extends boolean = false>(options: Options<PostApiV1KnowledgeBasesByIdFilesMoveData, ThrowOnError>): RequestResult<PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesByIdFilesMoveErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1KnowledgeBasesByIdFilesMoveResponses, PostApiV1KnowledgeBasesByIdFilesMoveErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/knowledge-bases/{id}/files/move',
...options,
@@ -347,25 +455,86 @@ export class KnowledgeBases extends HeyApiClient {
}
}
+export class McpServers extends HeyApiClient {
+ /**
+ * List remote MCP servers
+ */
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1McpServersData, ThrowOnError>): RequestResult<GetApiV1McpServersResponses, GetApiV1McpServersErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1McpServersResponses, GetApiV1McpServersErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/mcp-servers',
+ ...options
+ });
+ }
+
+ /**
+ * Add a remote MCP server
+ */
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1McpServersData, ThrowOnError>): RequestResult<PostApiV1McpServersResponses, PostApiV1McpServersErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1McpServersResponses, PostApiV1McpServersErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/mcp-servers',
+ ...options,
+ headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
+ });
+ }
+
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1McpServersByIdData, ThrowOnError>): RequestResult<DeleteApiV1McpServersByIdResponses, DeleteApiV1McpServersByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1McpServersByIdResponses, DeleteApiV1McpServersByIdErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/mcp-servers/{id}',
+ ...options
+ });
+ }
+
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1McpServersByIdData, ThrowOnError>): RequestResult<GetApiV1McpServersByIdResponses, GetApiV1McpServersByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1McpServersByIdResponses, GetApiV1McpServersByIdErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/mcp-servers/{id}',
+ ...options
+ });
+ }
+
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1McpServersByIdData, ThrowOnError>): RequestResult<PatchApiV1McpServersByIdResponses, PatchApiV1McpServersByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1McpServersByIdResponses, PatchApiV1McpServersByIdErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/mcp-servers/{id}',
+ ...options,
+ headers: mergeMethodHeaders({ 'Content-Type': 'application/json' }, options.headers)
+ });
+ }
+
+ /**
+ * Discover and sync MCP tools
+ */
+ public createSync<ThrowOnError extends boolean = false>(options: Options<PostApiV1McpServersByIdSyncData, ThrowOnError>): RequestResult<PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersByIdSyncErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1McpServersByIdSyncResponses, PostApiV1McpServersByIdSyncErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/mcp-servers/{id}/sync',
+ ...options
+ });
+ }
+}
+
export class MessageTranslations extends HeyApiClient {
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<DeleteApiV1MessageTranslationsByMessageIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1MessageTranslationsByMessageIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1MessageTranslationsByMessageIdResponses, DeleteApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/message-translations/{messageId}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<GetApiV1MessageTranslationsByMessageIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1MessageTranslationsByMessageIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1MessageTranslationsByMessageIdResponses, GetApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/message-translations/{messageId}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<PatchApiV1MessageTranslationsByMessageIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1MessageTranslationsByMessageIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1MessageTranslationsByMessageIdResponses, PatchApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/message-translations/{messageId}',
...options,
@@ -373,8 +542,8 @@ export class MessageTranslations extends HeyApiClient {
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<PostApiV1MessageTranslationsByMessageIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1MessageTranslationsByMessageIdResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessageTranslationsByMessageIdData, ThrowOnError>): RequestResult<PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1MessageTranslationsByMessageIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1MessageTranslationsByMessageIdResponses, PostApiV1MessageTranslationsByMessageIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/message-translations/{messageId}',
...options,
@@ -384,16 +553,16 @@ export class MessageTranslations extends HeyApiClient {
}
export class Messages extends HeyApiClient {
- public getCount<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MessagesCountData, ThrowOnError>): RequestResult<GetApiV1MessagesCountResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1MessagesCountResponses, unknown, ThrowOnError>({
+ public getCount<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MessagesCountData, ThrowOnError>): RequestResult<GetApiV1MessagesCountResponses, GetApiV1MessagesCountErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1MessagesCountResponses, GetApiV1MessagesCountErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/messages/count',
...options
});
}
- public deleteMany<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessagesData, ThrowOnError>): RequestResult<DeleteApiV1MessagesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1MessagesResponses, unknown, ThrowOnError>({
+ public deleteMany<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessagesData, ThrowOnError>): RequestResult<DeleteApiV1MessagesResponses, DeleteApiV1MessagesErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1MessagesResponses, DeleteApiV1MessagesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/messages',
...options,
@@ -401,16 +570,16 @@ export class Messages extends HeyApiClient {
});
}
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MessagesData, ThrowOnError>): RequestResult<GetApiV1MessagesResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1MessagesResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1MessagesData, ThrowOnError>): RequestResult<GetApiV1MessagesResponses, GetApiV1MessagesErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1MessagesResponses, GetApiV1MessagesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/messages',
...options
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessagesData, ThrowOnError>): RequestResult<PostApiV1MessagesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1MessagesResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessagesData, ThrowOnError>): RequestResult<PostApiV1MessagesResponses, PostApiV1MessagesErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1MessagesResponses, PostApiV1MessagesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/messages',
...options,
@@ -418,24 +587,24 @@ export class Messages extends HeyApiClient {
});
}
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessagesByIdData, ThrowOnError>): RequestResult<DeleteApiV1MessagesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1MessagesByIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1MessagesByIdData, ThrowOnError>): RequestResult<DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1MessagesByIdResponses, DeleteApiV1MessagesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/messages/{id}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1MessagesByIdData, ThrowOnError>): RequestResult<GetApiV1MessagesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1MessagesByIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1MessagesByIdData, ThrowOnError>): RequestResult<GetApiV1MessagesByIdResponses, GetApiV1MessagesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1MessagesByIdResponses, GetApiV1MessagesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/messages/{id}',
...options
});
}
- public createReply<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessagesRepliesData, ThrowOnError>): RequestResult<PostApiV1MessagesRepliesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1MessagesRepliesResponses, unknown, ThrowOnError>({
+ public createReply<ThrowOnError extends boolean = false>(options: Options<PostApiV1MessagesRepliesData, ThrowOnError>): RequestResult<PostApiV1MessagesRepliesResponses, PostApiV1MessagesRepliesErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1MessagesRepliesResponses, PostApiV1MessagesRepliesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/messages/replies',
...options,
@@ -445,16 +614,16 @@ export class Messages extends HeyApiClient {
}
export class Models extends HeyApiClient {
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ModelsData, ThrowOnError>): RequestResult<GetApiV1ModelsResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1ModelsResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ModelsData, ThrowOnError>): RequestResult<GetApiV1ModelsResponses, GetApiV1ModelsErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1ModelsResponses, GetApiV1ModelsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/models',
...options
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ModelsData, ThrowOnError>): RequestResult<PostApiV1ModelsResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1ModelsResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ModelsData, ThrowOnError>): RequestResult<PostApiV1ModelsResponses, PostApiV1ModelsErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1ModelsResponses, PostApiV1ModelsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/models',
...options,
@@ -462,16 +631,16 @@ export class Models extends HeyApiClient {
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ModelsByProviderIdByModelIdData, ThrowOnError>): RequestResult<GetApiV1ModelsByProviderIdByModelIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1ModelsByProviderIdByModelIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ModelsByProviderIdByModelIdData, ThrowOnError>): RequestResult<GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1ModelsByProviderIdByModelIdResponses, GetApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/models/{providerId}/{modelId}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ModelsByProviderIdByModelIdData, ThrowOnError>): RequestResult<PatchApiV1ModelsByProviderIdByModelIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1ModelsByProviderIdByModelIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ModelsByProviderIdByModelIdData, ThrowOnError>): RequestResult<PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1ModelsByProviderIdByModelIdResponses, PatchApiV1ModelsByProviderIdByModelIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/models/{providerId}/{modelId}',
...options,
@@ -481,16 +650,16 @@ export class Models extends HeyApiClient {
}
export class Permissions extends HeyApiClient {
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1PermissionsData, ThrowOnError>): RequestResult<GetApiV1PermissionsResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1PermissionsResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1PermissionsData, ThrowOnError>): RequestResult<GetApiV1PermissionsResponses, GetApiV1PermissionsErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1PermissionsResponses, GetApiV1PermissionsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/permissions',
...options
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1PermissionsData, ThrowOnError>): RequestResult<PostApiV1PermissionsResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1PermissionsResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1PermissionsData, ThrowOnError>): RequestResult<PostApiV1PermissionsResponses, PostApiV1PermissionsErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1PermissionsResponses, PostApiV1PermissionsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/permissions',
...options,
@@ -498,24 +667,24 @@ export class Permissions extends HeyApiClient {
});
}
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1PermissionsByIdData, ThrowOnError>): RequestResult<DeleteApiV1PermissionsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1PermissionsByIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1PermissionsByIdData, ThrowOnError>): RequestResult<DeleteApiV1PermissionsByIdResponses, DeleteApiV1PermissionsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1PermissionsByIdResponses, DeleteApiV1PermissionsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/permissions/{id}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1PermissionsByIdData, ThrowOnError>): RequestResult<GetApiV1PermissionsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1PermissionsByIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1PermissionsByIdData, ThrowOnError>): RequestResult<GetApiV1PermissionsByIdResponses, GetApiV1PermissionsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1PermissionsByIdResponses, GetApiV1PermissionsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/permissions/{id}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1PermissionsByIdData, ThrowOnError>): RequestResult<PatchApiV1PermissionsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1PermissionsByIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1PermissionsByIdData, ThrowOnError>): RequestResult<PatchApiV1PermissionsByIdResponses, PatchApiV1PermissionsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1PermissionsByIdResponses, PatchApiV1PermissionsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/permissions/{id}',
...options,
@@ -525,16 +694,16 @@ export class Permissions extends HeyApiClient {
}
export class Providers extends HeyApiClient {
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ProvidersData, ThrowOnError>): RequestResult<GetApiV1ProvidersResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1ProvidersResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1ProvidersData, ThrowOnError>): RequestResult<GetApiV1ProvidersResponses, GetApiV1ProvidersErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1ProvidersResponses, GetApiV1ProvidersErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/providers',
...options
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ProvidersData, ThrowOnError>): RequestResult<PostApiV1ProvidersResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1ProvidersResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ProvidersData, ThrowOnError>): RequestResult<PostApiV1ProvidersResponses, PostApiV1ProvidersErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1ProvidersResponses, PostApiV1ProvidersErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/providers',
...options,
@@ -542,24 +711,24 @@ export class Providers extends HeyApiClient {
});
}
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ProvidersByIdData, ThrowOnError>): RequestResult<DeleteApiV1ProvidersByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1ProvidersByIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1ProvidersByIdData, ThrowOnError>): RequestResult<DeleteApiV1ProvidersByIdResponses, DeleteApiV1ProvidersByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1ProvidersByIdResponses, DeleteApiV1ProvidersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/providers/{id}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ProvidersByIdData, ThrowOnError>): RequestResult<GetApiV1ProvidersByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1ProvidersByIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1ProvidersByIdData, ThrowOnError>): RequestResult<GetApiV1ProvidersByIdResponses, GetApiV1ProvidersByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1ProvidersByIdResponses, GetApiV1ProvidersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/providers/{id}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ProvidersByIdData, ThrowOnError>): RequestResult<PatchApiV1ProvidersByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1ProvidersByIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1ProvidersByIdData, ThrowOnError>): RequestResult<PatchApiV1ProvidersByIdResponses, PatchApiV1ProvidersByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1ProvidersByIdResponses, PatchApiV1ProvidersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/providers/{id}',
...options,
@@ -569,8 +738,8 @@ export class Providers extends HeyApiClient {
}
export class Responses extends HeyApiClient {
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ResponsesData, ThrowOnError>): RequestResult<PostApiV1ResponsesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1ResponsesResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1ResponsesData, ThrowOnError>): RequestResult<PostApiV1ResponsesResponses, PostApiV1ResponsesErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1ResponsesResponses, PostApiV1ResponsesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/responses',
...options,
@@ -580,16 +749,16 @@ export class Responses extends HeyApiClient {
}
export class Roles extends HeyApiClient {
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1RolesData, ThrowOnError>): RequestResult<GetApiV1RolesResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1RolesResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1RolesData, ThrowOnError>): RequestResult<GetApiV1RolesResponses, GetApiV1RolesErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1RolesResponses, GetApiV1RolesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/roles',
...options
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1RolesData, ThrowOnError>): RequestResult<PostApiV1RolesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1RolesResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1RolesData, ThrowOnError>): RequestResult<PostApiV1RolesResponses, PostApiV1RolesErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1RolesResponses, PostApiV1RolesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/roles',
...options,
@@ -597,24 +766,24 @@ export class Roles extends HeyApiClient {
});
}
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1RolesByIdData, ThrowOnError>): RequestResult<DeleteApiV1RolesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1RolesByIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1RolesByIdData, ThrowOnError>): RequestResult<DeleteApiV1RolesByIdResponses, DeleteApiV1RolesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1RolesByIdResponses, DeleteApiV1RolesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/roles/{id}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1RolesByIdData, ThrowOnError>): RequestResult<GetApiV1RolesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1RolesByIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1RolesByIdData, ThrowOnError>): RequestResult<GetApiV1RolesByIdResponses, GetApiV1RolesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1RolesByIdResponses, GetApiV1RolesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/roles/{id}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1RolesByIdData, ThrowOnError>): RequestResult<PatchApiV1RolesByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1RolesByIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1RolesByIdData, ThrowOnError>): RequestResult<PatchApiV1RolesByIdResponses, PatchApiV1RolesByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1RolesByIdResponses, PatchApiV1RolesByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/roles/{id}',
...options,
@@ -622,24 +791,24 @@ export class Roles extends HeyApiClient {
});
}
- public deletePermissions<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<DeleteApiV1RolesByIdPermissionsResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1RolesByIdPermissionsResponses, unknown, ThrowOnError>({
+ public deletePermissions<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdPermissionsErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1RolesByIdPermissionsResponses, DeleteApiV1RolesByIdPermissionsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/roles/{id}/permissions',
...options
});
}
- public listPermissions<ThrowOnError extends boolean = false>(options: Options<GetApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<GetApiV1RolesByIdPermissionsResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1RolesByIdPermissionsResponses, unknown, ThrowOnError>({
+ public listPermissions<ThrowOnError extends boolean = false>(options: Options<GetApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdPermissionsErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1RolesByIdPermissionsResponses, GetApiV1RolesByIdPermissionsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/roles/{id}/permissions',
...options
});
}
- public updatePermissions<ThrowOnError extends boolean = false>(options: Options<PatchApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<PatchApiV1RolesByIdPermissionsResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1RolesByIdPermissionsResponses, unknown, ThrowOnError>({
+ public updatePermissions<ThrowOnError extends boolean = false>(options: Options<PatchApiV1RolesByIdPermissionsData, ThrowOnError>): RequestResult<PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdPermissionsErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1RolesByIdPermissionsResponses, PatchApiV1RolesByIdPermissionsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/roles/{id}/permissions',
...options,
@@ -649,16 +818,16 @@ export class Roles extends HeyApiClient {
}
export class Topics extends HeyApiClient {
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1TopicsData, ThrowOnError>): RequestResult<GetApiV1TopicsResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1TopicsResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1TopicsData, ThrowOnError>): RequestResult<GetApiV1TopicsResponses, GetApiV1TopicsErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1TopicsResponses, GetApiV1TopicsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/topics',
...options
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1TopicsData, ThrowOnError>): RequestResult<PostApiV1TopicsResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1TopicsResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1TopicsData, ThrowOnError>): RequestResult<PostApiV1TopicsResponses, PostApiV1TopicsErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1TopicsResponses, PostApiV1TopicsErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/topics',
...options,
@@ -666,24 +835,24 @@ export class Topics extends HeyApiClient {
});
}
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1TopicsByIdData, ThrowOnError>): RequestResult<DeleteApiV1TopicsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1TopicsByIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1TopicsByIdData, ThrowOnError>): RequestResult<DeleteApiV1TopicsByIdResponses, DeleteApiV1TopicsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1TopicsByIdResponses, DeleteApiV1TopicsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/topics/{id}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1TopicsByIdData, ThrowOnError>): RequestResult<GetApiV1TopicsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1TopicsByIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1TopicsByIdData, ThrowOnError>): RequestResult<GetApiV1TopicsByIdResponses, GetApiV1TopicsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1TopicsByIdResponses, GetApiV1TopicsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/topics/{id}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1TopicsByIdData, ThrowOnError>): RequestResult<PatchApiV1TopicsByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1TopicsByIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1TopicsByIdData, ThrowOnError>): RequestResult<PatchApiV1TopicsByIdResponses, PatchApiV1TopicsByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1TopicsByIdResponses, PatchApiV1TopicsByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/topics/{id}',
...options,
@@ -696,24 +865,24 @@ export class Users extends HeyApiClient {
/**
* Get current authenticated user
*/
- public me<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsersMeData, ThrowOnError>): RequestResult<GetApiV1UsersMeResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1UsersMeResponses, unknown, ThrowOnError>({
+ public me<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsersMeData, ThrowOnError>): RequestResult<GetApiV1UsersMeResponses, GetApiV1UsersMeErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1UsersMeResponses, GetApiV1UsersMeErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/users/me',
...options
});
}
- public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsersData, ThrowOnError>): RequestResult<GetApiV1UsersResponses, unknown, ThrowOnError> {
- return (options?.client ?? this.client).get<GetApiV1UsersResponses, unknown, ThrowOnError>({
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsersData, ThrowOnError>): RequestResult<GetApiV1UsersResponses, GetApiV1UsersErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1UsersResponses, GetApiV1UsersErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/users',
...options
});
}
- public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1UsersData, ThrowOnError>): RequestResult<PostApiV1UsersResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).post<PostApiV1UsersResponses, unknown, ThrowOnError>({
+ public create<ThrowOnError extends boolean = false>(options: Options<PostApiV1UsersData, ThrowOnError>): RequestResult<PostApiV1UsersResponses, PostApiV1UsersErrors, ThrowOnError> {
+ return (options.client ?? this.client).post<PostApiV1UsersResponses, PostApiV1UsersErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/users',
...options,
@@ -721,24 +890,24 @@ export class Users extends HeyApiClient {
});
}
- public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1UsersByIdData, ThrowOnError>): RequestResult<DeleteApiV1UsersByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1UsersByIdResponses, unknown, ThrowOnError>({
+ public delete<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1UsersByIdData, ThrowOnError>): RequestResult<DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1UsersByIdResponses, DeleteApiV1UsersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/users/{id}',
...options
});
}
- public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1UsersByIdData, ThrowOnError>): RequestResult<GetApiV1UsersByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1UsersByIdResponses, unknown, ThrowOnError>({
+ public get<ThrowOnError extends boolean = false>(options: Options<GetApiV1UsersByIdData, ThrowOnError>): RequestResult<GetApiV1UsersByIdResponses, GetApiV1UsersByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1UsersByIdResponses, GetApiV1UsersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/users/{id}',
...options
});
}
- public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1UsersByIdData, ThrowOnError>): RequestResult<PatchApiV1UsersByIdResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1UsersByIdResponses, unknown, ThrowOnError>({
+ public update<ThrowOnError extends boolean = false>(options: Options<PatchApiV1UsersByIdData, ThrowOnError>): RequestResult<PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1UsersByIdResponses, PatchApiV1UsersByIdErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/users/{id}',
...options,
@@ -746,24 +915,24 @@ export class Users extends HeyApiClient {
});
}
- public deleteRoles<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<DeleteApiV1UsersByIdRolesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).delete<DeleteApiV1UsersByIdRolesResponses, unknown, ThrowOnError>({
+ public deleteRoles<ThrowOnError extends boolean = false>(options: Options<DeleteApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<DeleteApiV1UsersByIdRolesResponses, DeleteApiV1UsersByIdRolesErrors, ThrowOnError> {
+ return (options.client ?? this.client).delete<DeleteApiV1UsersByIdRolesResponses, DeleteApiV1UsersByIdRolesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/users/{id}/roles',
...options
});
}
- public listRoles<ThrowOnError extends boolean = false>(options: Options<GetApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<GetApiV1UsersByIdRolesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).get<GetApiV1UsersByIdRolesResponses, unknown, ThrowOnError>({
+ public listRoles<ThrowOnError extends boolean = false>(options: Options<GetApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<GetApiV1UsersByIdRolesResponses, GetApiV1UsersByIdRolesErrors, ThrowOnError> {
+ return (options.client ?? this.client).get<GetApiV1UsersByIdRolesResponses, GetApiV1UsersByIdRolesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/users/{id}/roles',
...options
});
}
- public updateRoles<ThrowOnError extends boolean = false>(options: Options<PatchApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<PatchApiV1UsersByIdRolesResponses, unknown, ThrowOnError> {
- return (options.client ?? this.client).patch<PatchApiV1UsersByIdRolesResponses, unknown, ThrowOnError>({
+ public updateRoles<ThrowOnError extends boolean = false>(options: Options<PatchApiV1UsersByIdRolesData, ThrowOnError>): RequestResult<PatchApiV1UsersByIdRolesResponses, PatchApiV1UsersByIdRolesErrors, ThrowOnError> {
+ return (options.client ?? this.client).patch<PatchApiV1UsersByIdRolesResponses, PatchApiV1UsersByIdRolesErrors, ThrowOnError>({
security: [{ scheme: 'bearer', type: 'http' }],
url: '/api/v1/users/{id}/roles',
...options,
@@ -772,6 +941,19 @@ export class Users extends HeyApiClient {
}
}
+export class Usage extends HeyApiClient {
+ /**
+ * Get usage and quota summary
+ */
+ public list<ThrowOnError extends boolean = false>(options?: Options<GetApiV1UsageData, ThrowOnError>): RequestResult<GetApiV1UsageResponses, GetApiV1UsageErrors, ThrowOnError> {
+ return (options?.client ?? this.client).get<GetApiV1UsageResponses, GetApiV1UsageErrors, ThrowOnError>({
+ security: [{ scheme: 'bearer', type: 'http' }],
+ url: '/api/v1/usage',
+ ...options
+ });
+ }
+}
+
export class LobeHub extends HeyApiClient {
public static readonly __registry: HeyApiRegistry<LobeHub> = new HeyApiRegistry<LobeHub>();
@@ -798,6 +980,21 @@ export class LobeHub extends HeyApiClient {
return this._agents ??= new Agents({ client: this.client });
}
+ private _apiKeys?: ApiKeys;
+ get apiKeys(): ApiKeys {
+ return this._apiKeys ??= new ApiKeys({ client: this.client });
+ }
+
+ private _chat?: Chat;
+ get chat(): Chat {
+ return this._chat ??= new Chat({ client: this.client });
+ }
+
+ private _eval?: Eval;
+ get eval(): Eval {
+ return this._eval ??= new Eval({ client: this.client });
+ }
+
private _files?: Files;
get files(): Files {
return this._files ??= new Files({ client: this.client });
@@ -808,6 +1005,11 @@ export class LobeHub extends HeyApiClient {
return this._knowledgeBases ??= new KnowledgeBases({ client: this.client });
}
+ private _mcpServers?: McpServers;
+ get mcpServers(): McpServers {
+ return this._mcpServers ??= new McpServers({ client: this.client });
+ }
+
private _messageTranslations?: MessageTranslations;
get messageTranslations(): MessageTranslations {
return this._messageTranslations ??= new MessageTranslations({ client: this.client });
@@ -852,4 +1054,9 @@ export class LobeHub extends HeyApiClient {
get users(): Users {
return this._users ??= new Users({ client: this.client });
}
+
+ private _usage?: Usage;
+ get usage(): Usage {
+ return this._usage ??= new Usage({ client: this.client });
+ }
}
diff --git a/packages/sdk/src/generated/types.gen.ts b/packages/sdk/src/generated/types.gen.ts
index f6907d2e32a..5401d3bc45b 100644
--- a/packages/sdk/src/generated/types.gen.ts
+++ b/packages/sdk/src/generated/types.gen.ts
@@ -4,6 +4,320 @@ export type ClientOptions = {
baseUrl: 'https://app.lobehub.com' | (string & {});
};
+export type ApiError = {
+ error: string;
+ success: false;
+ timestamp: string;
+};
+
+export type ApiKey = {
+ createdAt: string;
+ enabled?: boolean | null;
+ expiresAt?: string | null;
+ id: string;
+ lastUsedAt?: string | null;
+ name: string;
+ scopes?: Array<'*' | 'agent:read' | 'agent:write' | 'chat:read' | 'chat:write' | 'model:invoke' | 'model:read' | 'model:write' | 'file:read' | 'file:write' | 'knowledge:read' | 'knowledge:write' | 'mcp:read' | 'mcp:write' | 'usage:read' | 'workspace:read' | 'workspace:write' | 'user:read' | 'user:write'> | null;
+ updatedAt: string;
+};
+
+export type Agent = {
+ avatar?: string | null;
+ chatConfig?: {
+ [key: string]: unknown;
+ } | null;
+ createdAt: string;
+ description?: string | null;
+ id: string;
+ model?: string | null;
+ params?: {
+ [key: string]: unknown;
+ } | null;
+ provider?: string | null;
+ slug?: string | null;
+ systemRole?: string | null;
+ title?: string | null;
+ updatedAt: string;
+};
+
+export type AgentGroup = {
+ createdAt: string;
+ id: string;
+ name: string;
+ sort?: number | null;
+ updatedAt: string;
+};
+
+export type ChatResponse = {
+ content: string;
+ model?: string | null;
+ provider?: string | null;
+ usage?: {
+ completion_tokens?: number | null;
+ prompt_tokens?: number | null;
+ total_tokens?: number | null;
+ } | null;
+};
+
+export type EvalRun = {
+ createdAt: string;
+ datasetId: string;
+ id: string;
+ metrics?: {
+ [key: string]: unknown;
+ } | null;
+ name?: string | null;
+ startedAt?: string | null;
+ status: 'idle' | 'pending' | 'running' | 'completed' | 'failed' | 'aborted' | 'external';
+ targetAgentId?: string | null;
+ updatedAt: string;
+};
+
+export type EvalRunResult = {
+ createdAt: string;
+ input: string;
+ passed?: boolean | null;
+ result?: {
+ [key: string]: unknown;
+ } | null;
+ score?: number | null;
+ status?: string | null;
+ testCaseId: string;
+ topicId: string;
+};
+
+export type File = {
+ createdAt: string;
+ fileType: string;
+ id: string;
+ metadata?: {
+ [key: string]: unknown;
+ } | null;
+ name: string;
+ parentId?: string | null;
+ size: number;
+ source?: string | null;
+ updatedAt: string;
+ url: string;
+ visibility?: 'private' | 'public';
+ [key: string]: unknown;
+};
+
+export type KnowledgeBase = {
+ avatar?: string | null;
+ createdAt: string;
+ description?: string | null;
+ id: string;
+ isPublic?: boolean | null;
+ name: string;
+ settings?: {
+ [key: string]: unknown;
+ } | null;
+ type?: string | null;
+ updatedAt: string;
+ visibility?: 'private' | 'public';
+ [key: string]: unknown;
+};
+
+export type Message = {
+ agentId?: string | null;
+ content?: string | null;
+ createdAt: string;
+ error?: {
+ [key: string]: unknown;
+ } | null;
+ favorite?: boolean | null;
+ id: string;
+ metadata?: {
+ [key: string]: unknown;
+ } | null;
+ model?: string | null;
+ parentId?: string | null;
+ provider?: string | null;
+ reasoning?: {
+ [key: string]: unknown;
+ } | null;
+ role: string;
+ search?: {
+ [key: string]: unknown;
+ } | null;
+ threadId?: string | null;
+ tools?: {
+ [key: string]: unknown;
+ } | null;
+ topicId?: string | null;
+ updatedAt: string;
+ usage?: {
+ [key: string]: unknown;
+ } | null;
+ [key: string]: unknown;
+};
+
+export type McpServer = {
+ createdAt: string;
+ description?: string | null;
+ hasCredentials: boolean;
+ id: string;
+ identifier: string;
+ isEnabled: boolean;
+ name: string;
+ serverUrl: string;
+ status: 'connected' | 'disconnected' | 'error';
+ tools: Array<{
+ description?: string | null;
+ id: string;
+ inputSchema?: {
+ [key: string]: unknown;
+ } | null;
+ name: string;
+ permission: 'auto' | 'needs_approval' | 'disabled';
+ }>;
+ updatedAt: string;
+};
+
+export type Model = {
+ abilities?: {
+ [key: string]: unknown;
+ } | null;
+ config?: {
+ [key: string]: unknown;
+ } | null;
+ contextWindowTokens?: number | null;
+ createdAt: string;
+ description?: string | null;
+ displayName?: string | null;
+ enabled?: boolean | null;
+ id: string;
+ organization?: string | null;
+ parameters?: {
+ [key: string]: unknown;
+ } | null;
+ pricing?: {
+ [key: string]: unknown;
+ } | null;
+ providerId: string;
+ releasedAt?: string | null;
+ settings?: {
+ [key: string]: unknown;
+ } | null;
+ sort?: number | null;
+ source?: string | null;
+ type: string;
+ updatedAt: string;
+};
+
+export type Permission = {
+ category: string;
+ code: string;
+ createdAt: string;
+ description?: string | null;
+ id: string;
+ isActive?: boolean | null;
+ name: string;
+ updatedAt: string;
+};
+
+export type Provider = {
+ checkModel?: string | null;
+ config?: {
+ [key: string]: unknown;
+ } | null;
+ createdAt: string;
+ description?: string | null;
+ enabled?: boolean | null;
+ fetchOnClient?: boolean | null;
+ id: string;
+ logo?: string | null;
+ name?: string | null;
+ settings?: {
+ [key: string]: unknown;
+ } | null;
+ sort?: number | null;
+ source?: string | null;
+ updatedAt: string;
+};
+
+export type Role = {
+ createdAt: string;
+ description?: string | null;
+ displayName: string;
+ id: string;
+ isActive?: boolean | null;
+ isSystem?: boolean | null;
+ name: string;
+ updatedAt: string;
+};
+
+export type Topic = {
+ agentId?: string | null;
+ completedAt?: string | null;
+ content?: string | null;
+ cost?: {
+ [key: string]: unknown;
+ } | null;
+ createdAt: string;
+ description?: string | null;
+ favorite?: boolean | null;
+ groupId?: string | null;
+ historySummary?: string | null;
+ id: string;
+ metadata?: {
+ [key: string]: unknown;
+ } | null;
+ mode?: string | null;
+ model?: string | null;
+ provider?: string | null;
+ sessionId?: string | null;
+ status?: string | null;
+ title?: string | null;
+ totalCost?: number | null;
+ totalInputTokens?: number | null;
+ totalOutputTokens?: number | null;
+ totalTokens?: number | null;
+ trigger?: string | null;
+ updatedAt: string;
+ usage?: {
+ [key: string]: unknown;
+ } | null;
+ [key: string]: unknown;
+};
+
+export type User = {
+ avatar?: string | null;
+ createdAt: string;
+ email?: string | null;
+ firstName?: string | null;
+ fullName?: string | null;
+ id: string;
+ isOnboarded?: boolean | null;
+ lastName?: string | null;
+ phone?: string | null;
+ updatedAt: string;
+ username?: string | null;
+ [key: string]: unknown;
+};
+
+export type Usage = {
+ available: boolean;
+ currency: 'USD';
+ daily: Array<{
+ date: string;
+ value: number;
+ }>;
+ period: {
+ since: string;
+ until: string;
+ };
+ remainingBalance: number | null;
+ scope: 'personal' | 'workspace';
+ spent: number;
+ usageByType: Array<{
+ count: number | null;
+ spend: number;
+ type: string;
+ }>;
+};
+
export type GetApiV1HealthData = {
body?: never;
path?: never;
@@ -11,13 +325,52 @@ export type GetApiV1HealthData = {
url: '/api/v1/health';
};
+export type GetApiV1HealthErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1HealthError = GetApiV1HealthErrors[keyof GetApiV1HealthErrors];
+
export type GetApiV1HealthResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ service: string;
+ status: 'ok';
+ timestamp: string;
+ };
};
+export type GetApiV1HealthResponse = GetApiV1HealthResponses[keyof GetApiV1HealthResponses];
+
export type GetApiV1AgentGroupsData = {
body?: never;
path?: never;
@@ -25,13 +378,53 @@ export type GetApiV1AgentGroupsData = {
url: '/api/v1/agent-groups';
};
+export type GetApiV1AgentGroupsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1AgentGroupsError = GetApiV1AgentGroupsErrors[keyof GetApiV1AgentGroupsErrors];
+
export type GetApiV1AgentGroupsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Array<AgentGroup>;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1AgentGroupsResponse = GetApiV1AgentGroupsResponses[keyof GetApiV1AgentGroupsResponses];
+
export type PostApiV1AgentGroupsData = {
body: {
name: string;
@@ -42,13 +435,59 @@ export type PostApiV1AgentGroupsData = {
url: '/api/v1/agent-groups';
};
+export type PostApiV1AgentGroupsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1AgentGroupsError = PostApiV1AgentGroupsErrors[keyof PostApiV1AgentGroupsErrors];
+
export type PostApiV1AgentGroupsResponses = {
/**
- * Successful response (schema pending)
+ * Response
*/
200: unknown;
+ /**
+ * Successful response
+ */
+ 201: {
+ data?: {
+ id: string;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1AgentGroupsResponse = PostApiV1AgentGroupsResponses[keyof PostApiV1AgentGroupsResponses];
+
export type DeleteApiV1AgentGroupsByIdData = {
body?: never;
path: {
@@ -58,13 +497,55 @@ export type DeleteApiV1AgentGroupsByIdData = {
url: '/api/v1/agent-groups/{id}';
};
+export type DeleteApiV1AgentGroupsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1AgentGroupsByIdError = DeleteApiV1AgentGroupsByIdErrors[keyof DeleteApiV1AgentGroupsByIdErrors];
+
export type DeleteApiV1AgentGroupsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1AgentGroupsByIdResponse = DeleteApiV1AgentGroupsByIdResponses[keyof DeleteApiV1AgentGroupsByIdResponses];
+
export type GetApiV1AgentGroupsByIdData = {
body?: never;
path: {
@@ -74,13 +555,53 @@ export type GetApiV1AgentGroupsByIdData = {
url: '/api/v1/agent-groups/{id}';
};
+export type GetApiV1AgentGroupsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1AgentGroupsByIdError = GetApiV1AgentGroupsByIdErrors[keyof GetApiV1AgentGroupsByIdErrors];
+
export type GetApiV1AgentGroupsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: AgentGroup;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1AgentGroupsByIdResponse = GetApiV1AgentGroupsByIdResponses[keyof GetApiV1AgentGroupsByIdResponses];
+
export type PatchApiV1AgentGroupsByIdData = {
body: {
name?: string | null;
@@ -93,13 +614,53 @@ export type PatchApiV1AgentGroupsByIdData = {
url: '/api/v1/agent-groups/{id}';
};
+export type PatchApiV1AgentGroupsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1AgentGroupsByIdError = PatchApiV1AgentGroupsByIdErrors[keyof PatchApiV1AgentGroupsByIdErrors];
+
export type PatchApiV1AgentGroupsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: AgentGroup;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PatchApiV1AgentGroupsByIdResponse = PatchApiV1AgentGroupsByIdResponses[keyof PatchApiV1AgentGroupsByIdResponses];
+
export type GetApiV1AgentsData = {
body?: never;
path?: never;
@@ -111,13 +672,57 @@ export type GetApiV1AgentsData = {
url: '/api/v1/agents';
};
+export type GetApiV1AgentsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1AgentsError = GetApiV1AgentsErrors[keyof GetApiV1AgentsErrors];
+
export type GetApiV1AgentsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ agents: Array<Agent>;
+ total?: number;
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1AgentsResponse = GetApiV1AgentsResponses[keyof GetApiV1AgentsResponses];
+
export type PostApiV1AgentsData = {
body: {
avatar?: string | null;
@@ -199,13 +804,53 @@ export type PostApiV1AgentsData = {
url: '/api/v1/agents';
};
+export type PostApiV1AgentsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1AgentsError = PostApiV1AgentsErrors[keyof PostApiV1AgentsErrors];
+
export type PostApiV1AgentsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Agent;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1AgentsResponse = PostApiV1AgentsResponses[keyof PostApiV1AgentsResponses];
+
export type DeleteApiV1AgentsByIdData = {
body?: never;
path: {
@@ -215,13 +860,55 @@ export type DeleteApiV1AgentsByIdData = {
url: '/api/v1/agents/{id}';
};
+export type DeleteApiV1AgentsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1AgentsByIdError = DeleteApiV1AgentsByIdErrors[keyof DeleteApiV1AgentsByIdErrors];
+
export type DeleteApiV1AgentsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1AgentsByIdResponse = DeleteApiV1AgentsByIdResponses[keyof DeleteApiV1AgentsByIdResponses];
+
export type GetApiV1AgentsByIdData = {
body?: never;
path: {
@@ -231,13 +918,53 @@ export type GetApiV1AgentsByIdData = {
url: '/api/v1/agents/{id}';
};
+export type GetApiV1AgentsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1AgentsByIdError = GetApiV1AgentsByIdErrors[keyof GetApiV1AgentsByIdErrors];
+
export type GetApiV1AgentsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Agent;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1AgentsByIdResponse = GetApiV1AgentsByIdResponses[keyof GetApiV1AgentsByIdResponses];
+
export type PatchApiV1AgentsByIdData = {
body: {
avatar?: string | null;
@@ -321,382 +1048,2352 @@ export type PatchApiV1AgentsByIdData = {
url: '/api/v1/agents/{id}';
};
-export type PatchApiV1AgentsByIdResponses = {
+export type PatchApiV1AgentsByIdErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type GetApiV1FilesData = {
- body?: never;
+export type PatchApiV1AgentsByIdError = PatchApiV1AgentsByIdErrors[keyof PatchApiV1AgentsByIdErrors];
+
+export type PatchApiV1AgentsByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: Agent;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PatchApiV1AgentsByIdResponse = PatchApiV1AgentsByIdResponses[keyof PatchApiV1AgentsByIdResponses];
+
+export type GetApiV1ApiKeysData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v1/api-keys';
+};
+
+export type GetApiV1ApiKeysErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1ApiKeysError = GetApiV1ApiKeysErrors[keyof GetApiV1ApiKeysErrors];
+
+export type GetApiV1ApiKeysResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: Array<ApiKey>;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type GetApiV1ApiKeysResponse = GetApiV1ApiKeysResponses[keyof GetApiV1ApiKeysResponses];
+
+export type PostApiV1ApiKeysData = {
+ body: {
+ expiresAt?: string | null;
+ name: string;
+ scopes?: Array<'*' | 'agent:read' | 'agent:write' | 'chat:read' | 'chat:write' | 'model:invoke' | 'model:read' | 'model:write' | 'file:read' | 'file:write' | 'knowledge:read' | 'knowledge:write' | 'mcp:read' | 'mcp:write' | 'usage:read' | 'workspace:read' | 'workspace:write' | 'user:read' | 'user:write'> | null;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v1/api-keys';
+};
+
+export type PostApiV1ApiKeysErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1ApiKeysError = PostApiV1ApiKeysErrors[keyof PostApiV1ApiKeysErrors];
+
+export type PostApiV1ApiKeysResponses = {
+ /**
+ * Response
+ */
+ 200: unknown;
+ /**
+ * Successful response
+ */
+ 201: {
+ data?: {
+ createdAt: string;
+ enabled?: boolean | null;
+ expiresAt?: string | null;
+ id: string;
+ lastUsedAt?: string | null;
+ name: string;
+ scopes?: Array<'*' | 'agent:read' | 'agent:write' | 'chat:read' | 'chat:write' | 'model:invoke' | 'model:read' | 'model:write' | 'file:read' | 'file:write' | 'knowledge:read' | 'knowledge:write' | 'mcp:read' | 'mcp:write' | 'usage:read' | 'workspace:read' | 'workspace:write' | 'user:read' | 'user:write'> | null;
+ updatedAt: string;
+ key: string;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1ApiKeysResponse = PostApiV1ApiKeysResponses[keyof PostApiV1ApiKeysResponses];
+
+export type DeleteApiV1ApiKeysByIdData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/api-keys/{id}';
+};
+
+export type DeleteApiV1ApiKeysByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1ApiKeysByIdError = DeleteApiV1ApiKeysByIdErrors[keyof DeleteApiV1ApiKeysByIdErrors];
+
+export type DeleteApiV1ApiKeysByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type DeleteApiV1ApiKeysByIdResponse = DeleteApiV1ApiKeysByIdResponses[keyof DeleteApiV1ApiKeysByIdResponses];
+
+export type GetApiV1ApiKeysByIdData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/api-keys/{id}';
+};
+
+export type GetApiV1ApiKeysByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1ApiKeysByIdError = GetApiV1ApiKeysByIdErrors[keyof GetApiV1ApiKeysByIdErrors];
+
+export type GetApiV1ApiKeysByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: ApiKey;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type GetApiV1ApiKeysByIdResponse = GetApiV1ApiKeysByIdResponses[keyof GetApiV1ApiKeysByIdResponses];
+
+export type PatchApiV1ApiKeysByIdData = {
+ body: {
+ enabled?: boolean;
+ expiresAt?: string | null;
+ name?: string;
+ };
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/api-keys/{id}';
+};
+
+export type PatchApiV1ApiKeysByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1ApiKeysByIdError = PatchApiV1ApiKeysByIdErrors[keyof PatchApiV1ApiKeysByIdErrors];
+
+export type PatchApiV1ApiKeysByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: ApiKey;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PatchApiV1ApiKeysByIdResponse = PatchApiV1ApiKeysByIdResponses[keyof PatchApiV1ApiKeysByIdResponses];
+
+export type PostApiV1ChatData = {
+ body: {
+ frequency_penalty?: number;
+ max_tokens?: number | null;
+ messages: Array<{
+ content: string;
+ role: 'user' | 'assistant' | 'system';
+ }>;
+ model?: string | null;
+ presence_penalty?: number;
+ provider?: string | null;
+ stream?: boolean | null;
+ temperature?: number | null;
+ top_p?: number;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v1/chat';
+};
+
+export type PostApiV1ChatErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1ChatError = PostApiV1ChatErrors[keyof PostApiV1ChatErrors];
+
+export type PostApiV1ChatResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: ChatResponse;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1ChatResponse = PostApiV1ChatResponses[keyof PostApiV1ChatResponses];
+
+export type PostApiV1ChatTranslateData = {
+ body: {
+ from?: string;
+ model?: string | null;
+ provider?: string | null;
+ text: string;
+ to: string;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v1/chat/translate';
+};
+
+export type PostApiV1ChatTranslateErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1ChatTranslateError = PostApiV1ChatTranslateErrors[keyof PostApiV1ChatTranslateErrors];
+
+export type PostApiV1ChatTranslateResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ translatedText: string;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1ChatTranslateResponse = PostApiV1ChatTranslateResponses[keyof PostApiV1ChatTranslateResponses];
+
+export type PostApiV1ChatGenerateReplyData = {
+ body: {
+ agentId?: string | null;
+ chatConfig?: {
+ disableContextCaching?: boolean | null;
+ displayMode?: 'chat' | 'docs' | null;
+ enableCompressHistory?: boolean | null;
+ enableHistoryCount?: boolean | null;
+ enableMaxTokens?: boolean | null;
+ enableReasoning?: boolean | null;
+ enableReasoningEffort?: boolean | null;
+ historyCount?: number | null;
+ inputTemplate?: string | null;
+ reasoningBudgetToken?: number | null;
+ reasoningEffort?: 'low' | 'medium' | 'high' | null;
+ searchMode?: 'off' | 'on' | 'auto' | null;
+ thinkingBudget?: number | null;
+ useModelBuiltinSearch?: boolean | null;
+ } | null;
+ conversationHistory: Array<{
+ content: string;
+ role: 'user' | 'assistant' | 'system';
+ }>;
+ model?: string | null;
+ provider?: string | null;
+ sessionId: string | null;
+ userMessage: string;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v1/chat/generate-reply';
+};
+
+export type PostApiV1ChatGenerateReplyErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1ChatGenerateReplyError = PostApiV1ChatGenerateReplyErrors[keyof PostApiV1ChatGenerateReplyErrors];
+
+export type PostApiV1ChatGenerateReplyResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ reply: string;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1ChatGenerateReplyResponse = PostApiV1ChatGenerateReplyResponses[keyof PostApiV1ChatGenerateReplyResponses];
+
+export type PostApiV1EvalRunsData = {
+ body: {
+ config?: {
+ k?: number;
+ maxSteps?: number;
+ timeout?: number;
+ };
+ datasetId: string;
+ id?: string;
+ name?: string;
+ targetAgentId: string;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v1/eval/runs';
+};
+
+export type PostApiV1EvalRunsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1EvalRunsError = PostApiV1EvalRunsErrors[keyof PostApiV1EvalRunsErrors];
+
+export type PostApiV1EvalRunsResponses = {
+ /**
+ * Successful response
+ */
+ 202: {
+ data?: EvalRun;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1EvalRunsResponse = PostApiV1EvalRunsResponses[keyof PostApiV1EvalRunsResponses];
+
+export type GetApiV1EvalRunsByIdData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/eval/runs/{id}';
+};
+
+export type GetApiV1EvalRunsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1EvalRunsByIdError = GetApiV1EvalRunsByIdErrors[keyof GetApiV1EvalRunsByIdErrors];
+
+export type GetApiV1EvalRunsByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: EvalRun;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type GetApiV1EvalRunsByIdResponse = GetApiV1EvalRunsByIdResponses[keyof GetApiV1EvalRunsByIdResponses];
+
+export type GetApiV1EvalRunsByIdResultsData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/eval/runs/{id}/results';
+};
+
+export type GetApiV1EvalRunsByIdResultsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1EvalRunsByIdResultsError = GetApiV1EvalRunsByIdResultsErrors[keyof GetApiV1EvalRunsByIdResultsErrors];
+
+export type GetApiV1EvalRunsByIdResultsResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ results: Array<EvalRunResult>;
+ runId: string;
+ total: number;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type GetApiV1EvalRunsByIdResultsResponse = GetApiV1EvalRunsByIdResultsResponses[keyof GetApiV1EvalRunsByIdResultsResponses];
+
+export type GetApiV1FilesData = {
+ body?: never;
+ path?: never;
+ query?: {
+ keyword?: string;
+ page?: string;
+ pageSize?: string;
+ fileType?: string;
+ knowledgeBaseId?: string;
+ queryAll?: string;
+ updatedAtEnd?: string;
+ updatedAtStart?: string;
+ userId?: string;
+ };
+ url: '/api/v1/files';
+};
+
+export type GetApiV1FilesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1FilesError = GetApiV1FilesErrors[keyof GetApiV1FilesErrors];
+
+export type GetApiV1FilesResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ files: Array<File>;
+ total?: number;
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type GetApiV1FilesResponse = GetApiV1FilesResponses[keyof GetApiV1FilesResponses];
+
+export type PostApiV1FilesData = {
+ body: {
+ agentId?: string;
+ directory?: string;
+ file: Blob | File;
+ knowledgeBaseId?: string;
+ sessionId?: string;
+ skipCheckFileType?: boolean;
+ skipDeduplication?: boolean;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v1/files';
+};
+
+export type PostApiV1FilesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1FilesError = PostApiV1FilesErrors[keyof PostApiV1FilesErrors];
+
+export type PostApiV1FilesResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ file: File;
+ parsed?: {
+ [key: string]: unknown;
+ };
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1FilesResponse = PostApiV1FilesResponses[keyof PostApiV1FilesResponses];
+
+export type DeleteApiV1FilesByIdData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/files/{id}';
+};
+
+export type DeleteApiV1FilesByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1FilesByIdError = DeleteApiV1FilesByIdErrors[keyof DeleteApiV1FilesByIdErrors];
+
+export type DeleteApiV1FilesByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type DeleteApiV1FilesByIdResponse = DeleteApiV1FilesByIdResponses[keyof DeleteApiV1FilesByIdResponses];
+
+export type GetApiV1FilesByIdData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/files/{id}';
+};
+
+export type GetApiV1FilesByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1FilesByIdError = GetApiV1FilesByIdErrors[keyof GetApiV1FilesByIdErrors];
+
+export type GetApiV1FilesByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ file: File;
+ parsed?: {
+ [key: string]: unknown;
+ };
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type GetApiV1FilesByIdResponse = GetApiV1FilesByIdResponses[keyof GetApiV1FilesByIdResponses];
+
+export type PatchApiV1FilesByIdData = {
+ body: {
+ knowledgeBaseId?: string | null;
+ };
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/files/{id}';
+};
+
+export type PatchApiV1FilesByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1FilesByIdError = PatchApiV1FilesByIdErrors[keyof PatchApiV1FilesByIdErrors];
+
+export type PatchApiV1FilesByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: File;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PatchApiV1FilesByIdResponse = PatchApiV1FilesByIdResponses[keyof PatchApiV1FilesByIdResponses];
+
+export type GetApiV1FilesByIdUrlData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: {
+ expiresIn?: string | null;
+ };
+ url: '/api/v1/files/{id}/url';
+};
+
+export type GetApiV1FilesByIdUrlErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1FilesByIdUrlError = GetApiV1FilesByIdUrlErrors[keyof GetApiV1FilesByIdUrlErrors];
+
+export type GetApiV1FilesByIdUrlResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type GetApiV1FilesByIdUrlResponse = GetApiV1FilesByIdUrlResponses[keyof GetApiV1FilesByIdUrlResponses];
+
+export type PostApiV1FilesByIdParsesData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: {
+ skipExist?: string | null;
+ };
+ url: '/api/v1/files/{id}/parses';
+};
+
+export type PostApiV1FilesByIdParsesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1FilesByIdParsesError = PostApiV1FilesByIdParsesErrors[keyof PostApiV1FilesByIdParsesErrors];
+
+export type PostApiV1FilesByIdParsesResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1FilesByIdParsesResponse = PostApiV1FilesByIdParsesResponses[keyof PostApiV1FilesByIdParsesResponses];
+
+export type GetApiV1FilesByIdChunksData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/files/{id}/chunks';
+};
+
+export type GetApiV1FilesByIdChunksErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1FilesByIdChunksError = GetApiV1FilesByIdChunksErrors[keyof GetApiV1FilesByIdChunksErrors];
+
+export type GetApiV1FilesByIdChunksResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type GetApiV1FilesByIdChunksResponse = GetApiV1FilesByIdChunksResponses[keyof GetApiV1FilesByIdChunksResponses];
+
+export type PostApiV1FilesByIdChunksData = {
+ body: {
+ autoEmbedding?: boolean;
+ skipExist?: boolean;
+ };
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/files/{id}/chunks';
+};
+
+export type PostApiV1FilesByIdChunksErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1FilesByIdChunksError = PostApiV1FilesByIdChunksErrors[keyof PostApiV1FilesByIdChunksErrors];
+
+export type PostApiV1FilesByIdChunksResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1FilesByIdChunksResponse = PostApiV1FilesByIdChunksResponses[keyof PostApiV1FilesByIdChunksResponses];
+
+export type PostApiV1FilesBatchesData = {
+ body: {
+ agentId?: string;
+ directory?: string;
+ files: Array<Blob | File>;
+ knowledgeBaseId?: string;
+ sessionId?: string;
+ skipCheckFileType?: boolean;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v1/files/batches';
+};
+
+export type PostApiV1FilesBatchesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1FilesBatchesError = PostApiV1FilesBatchesErrors[keyof PostApiV1FilesBatchesErrors];
+
+export type PostApiV1FilesBatchesResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ failed: Array<{
+ error: string;
+ name: string;
+ }>;
+ successful: Array<{
+ file: File;
+ parsed?: {
+ [key: string]: unknown;
+ };
+ }>;
+ summary: {
+ failed: number;
+ successful: number;
+ total: number;
+ };
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1FilesBatchesResponse = PostApiV1FilesBatchesResponses[keyof PostApiV1FilesBatchesResponses];
+
+export type PostApiV1FilesQueriesData = {
+ body: {
+ fileIds: Array<string>;
+ };
+ path?: never;
+ query?: never;
+ url: '/api/v1/files/queries';
+};
+
+export type PostApiV1FilesQueriesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1FilesQueriesError = PostApiV1FilesQueriesErrors[keyof PostApiV1FilesQueriesErrors];
+
+export type PostApiV1FilesQueriesResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ failed: Array<{
+ error: string;
+ fileId: string;
+ }>;
+ files: Array<{
+ file: File;
+ parsed?: {
+ [key: string]: unknown;
+ };
+ }>;
+ success: number;
+ total: number;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1FilesQueriesResponse = PostApiV1FilesQueriesResponses[keyof PostApiV1FilesQueriesResponses];
+
+export type GetApiV1KnowledgeBasesData = {
+ body?: never;
path?: never;
query?: {
keyword?: string;
page?: string;
pageSize?: string;
- fileType?: string;
- knowledgeBaseId?: string;
- queryAll?: string;
- updatedAtEnd?: string;
- updatedAtStart?: string;
- userId?: string;
};
- url: '/api/v1/files';
+ url: '/api/v1/knowledge-bases';
+};
+
+export type GetApiV1KnowledgeBasesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type GetApiV1FilesResponses = {
+export type GetApiV1KnowledgeBasesError = GetApiV1KnowledgeBasesErrors[keyof GetApiV1KnowledgeBasesErrors];
+
+export type GetApiV1KnowledgeBasesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ knowledgeBases: Array<KnowledgeBase>;
+ total?: number;
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
-export type PostApiV1FilesData = {
+export type GetApiV1KnowledgeBasesResponse = GetApiV1KnowledgeBasesResponses[keyof GetApiV1KnowledgeBasesResponses];
+
+export type PostApiV1KnowledgeBasesData = {
body: {
- agentId?: string;
- directory?: string;
- file: Blob | File;
- knowledgeBaseId?: string;
- sessionId?: string;
- skipCheckFileType?: boolean;
- skipExist?: boolean;
+ avatar?: string;
+ description?: string;
+ name: string;
};
path?: never;
query?: never;
- url: '/api/v1/files';
+ url: '/api/v1/knowledge-bases';
};
-export type PostApiV1FilesResponses = {
+export type PostApiV1KnowledgeBasesErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type DeleteApiV1FilesByIdData = {
+export type PostApiV1KnowledgeBasesError = PostApiV1KnowledgeBasesErrors[keyof PostApiV1KnowledgeBasesErrors];
+
+export type PostApiV1KnowledgeBasesResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: KnowledgeBase;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1KnowledgeBasesResponse = PostApiV1KnowledgeBasesResponses[keyof PostApiV1KnowledgeBasesResponses];
+
+export type DeleteApiV1KnowledgeBasesByIdData = {
body?: never;
path: {
id: string;
};
query?: never;
- url: '/api/v1/files/{id}';
+ url: '/api/v1/knowledge-bases/{id}';
};
-export type DeleteApiV1FilesByIdResponses = {
+export type DeleteApiV1KnowledgeBasesByIdErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type GetApiV1FilesByIdData = {
+export type DeleteApiV1KnowledgeBasesByIdError = DeleteApiV1KnowledgeBasesByIdErrors[keyof DeleteApiV1KnowledgeBasesByIdErrors];
+
+export type DeleteApiV1KnowledgeBasesByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type DeleteApiV1KnowledgeBasesByIdResponse = DeleteApiV1KnowledgeBasesByIdResponses[keyof DeleteApiV1KnowledgeBasesByIdResponses];
+
+export type GetApiV1KnowledgeBasesByIdData = {
body?: never;
path: {
id: string;
};
query?: never;
- url: '/api/v1/files/{id}';
+ url: '/api/v1/knowledge-bases/{id}';
};
-export type GetApiV1FilesByIdResponses = {
+export type GetApiV1KnowledgeBasesByIdErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type PatchApiV1FilesByIdData = {
+export type GetApiV1KnowledgeBasesByIdError = GetApiV1KnowledgeBasesByIdErrors[keyof GetApiV1KnowledgeBasesByIdErrors];
+
+export type GetApiV1KnowledgeBasesByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: KnowledgeBase;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type GetApiV1KnowledgeBasesByIdResponse = GetApiV1KnowledgeBasesByIdResponses[keyof GetApiV1KnowledgeBasesByIdResponses];
+
+export type PatchApiV1KnowledgeBasesByIdData = {
body: {
- knowledgeBaseId?: string | null;
+ avatar?: string;
+ description?: string;
+ name?: string;
};
path: {
id: string;
};
query?: never;
- url: '/api/v1/files/{id}';
+ url: '/api/v1/knowledge-bases/{id}';
};
-export type PatchApiV1FilesByIdResponses = {
+export type PatchApiV1KnowledgeBasesByIdErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type GetApiV1FilesByIdUrlData = {
+export type PatchApiV1KnowledgeBasesByIdError = PatchApiV1KnowledgeBasesByIdErrors[keyof PatchApiV1KnowledgeBasesByIdErrors];
+
+export type PatchApiV1KnowledgeBasesByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: KnowledgeBase;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PatchApiV1KnowledgeBasesByIdResponse = PatchApiV1KnowledgeBasesByIdResponses[keyof PatchApiV1KnowledgeBasesByIdResponses];
+
+export type GetApiV1KnowledgeBasesByIdFilesData = {
body?: never;
path: {
id: string;
};
query?: {
- expiresIn?: string | null;
+ keyword?: string;
+ page?: string;
+ pageSize?: string;
+ fileType?: string | null;
};
- url: '/api/v1/files/{id}/url';
+ url: '/api/v1/knowledge-bases/{id}/files';
};
-export type GetApiV1FilesByIdUrlResponses = {
+export type GetApiV1KnowledgeBasesByIdFilesErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type PostApiV1FilesByIdParsesData = {
- body?: never;
+export type GetApiV1KnowledgeBasesByIdFilesError = GetApiV1KnowledgeBasesByIdFilesErrors[keyof GetApiV1KnowledgeBasesByIdFilesErrors];
+
+export type GetApiV1KnowledgeBasesByIdFilesResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type GetApiV1KnowledgeBasesByIdFilesResponse = GetApiV1KnowledgeBasesByIdFilesResponses[keyof GetApiV1KnowledgeBasesByIdFilesResponses];
+
+export type DeleteApiV1KnowledgeBasesByIdFilesBatchData = {
+ body: {
+ fileIds: Array<string>;
+ };
path: {
id: string;
};
- query?: {
- skipExist?: string | null;
- };
- url: '/api/v1/files/{id}/parses';
+ query?: never;
+ url: '/api/v1/knowledge-bases/{id}/files/batch';
};
-export type PostApiV1FilesByIdParsesResponses = {
+export type DeleteApiV1KnowledgeBasesByIdFilesBatchErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type GetApiV1FilesByIdChunksData = {
- body?: never;
+export type DeleteApiV1KnowledgeBasesByIdFilesBatchError = DeleteApiV1KnowledgeBasesByIdFilesBatchErrors[keyof DeleteApiV1KnowledgeBasesByIdFilesBatchErrors];
+
+export type DeleteApiV1KnowledgeBasesByIdFilesBatchResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type DeleteApiV1KnowledgeBasesByIdFilesBatchResponse = DeleteApiV1KnowledgeBasesByIdFilesBatchResponses[keyof DeleteApiV1KnowledgeBasesByIdFilesBatchResponses];
+
+export type PostApiV1KnowledgeBasesByIdFilesBatchData = {
+ body: {
+ fileIds: Array<string>;
+ };
path: {
id: string;
};
query?: never;
- url: '/api/v1/files/{id}/chunks';
+ url: '/api/v1/knowledge-bases/{id}/files/batch';
};
-export type GetApiV1FilesByIdChunksResponses = {
+export type PostApiV1KnowledgeBasesByIdFilesBatchErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type PostApiV1FilesByIdChunksData = {
+export type PostApiV1KnowledgeBasesByIdFilesBatchError = PostApiV1KnowledgeBasesByIdFilesBatchErrors[keyof PostApiV1KnowledgeBasesByIdFilesBatchErrors];
+
+export type PostApiV1KnowledgeBasesByIdFilesBatchResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PostApiV1KnowledgeBasesByIdFilesBatchResponse = PostApiV1KnowledgeBasesByIdFilesBatchResponses[keyof PostApiV1KnowledgeBasesByIdFilesBatchResponses];
+
+export type PostApiV1KnowledgeBasesByIdFilesMoveData = {
body: {
- autoEmbedding?: boolean;
- skipExist?: boolean;
+ fileIds: Array<string>;
+ targetKnowledgeBaseId: string;
};
path: {
id: string;
};
query?: never;
- url: '/api/v1/files/{id}/chunks';
+ url: '/api/v1/knowledge-bases/{id}/files/move';
};
-export type PostApiV1FilesByIdChunksResponses = {
+export type PostApiV1KnowledgeBasesByIdFilesMoveErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
/**
- * Successful response (schema pending)
+ * Internal server error
*/
- 200: unknown;
+ 500: ApiError;
};
-export type PostApiV1FilesBatchesData = {
- body: {
- agentId?: string;
- directory?: string;
- files: Array<Blob | File>;
- knowledgeBaseId?: string;
- sessionId?: string;
- skipCheckFileType?: boolean;
- skipExist?: boolean;
- };
- path?: never;
- query?: never;
- url: '/api/v1/files/batches';
-};
+export type PostApiV1KnowledgeBasesByIdFilesMoveError = PostApiV1KnowledgeBasesByIdFilesMoveErrors[keyof PostApiV1KnowledgeBasesByIdFilesMoveErrors];
-export type PostApiV1FilesBatchesResponses = {
+export type PostApiV1KnowledgeBasesByIdFilesMoveResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
-export type PostApiV1FilesQueriesData = {
- body: {
- fileIds: Array<string>;
- };
+export type PostApiV1KnowledgeBasesByIdFilesMoveResponse = PostApiV1KnowledgeBasesByIdFilesMoveResponses[keyof PostApiV1KnowledgeBasesByIdFilesMoveResponses];
+
+export type GetApiV1McpServersData = {
+ body?: never;
path?: never;
query?: never;
- url: '/api/v1/files/queries';
+ url: '/api/v1/mcp-servers';
};
-export type PostApiV1FilesQueriesResponses = {
+export type GetApiV1McpServersErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type GetApiV1KnowledgeBasesData = {
- body?: never;
- path?: never;
- query?: {
- keyword?: string;
- page?: string;
- pageSize?: string;
- };
- url: '/api/v1/knowledge-bases';
-};
+export type GetApiV1McpServersError = GetApiV1McpServersErrors[keyof GetApiV1McpServersErrors];
-export type GetApiV1KnowledgeBasesResponses = {
+export type GetApiV1McpServersResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Array<McpServer>;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
-export type PostApiV1KnowledgeBasesData = {
+export type GetApiV1McpServersResponse = GetApiV1McpServersResponses[keyof GetApiV1McpServersResponses];
+
+export type PostApiV1McpServersData = {
body: {
- avatar?: string;
+ credentials?: {
+ token: string;
+ type: 'bearer';
+ } | {
+ apiKey: string;
+ type: 'apikey';
+ } | {
+ headers: {
+ [key: string]: string;
+ };
+ type: 'header';
+ };
description?: string;
+ identifier: string;
+ isEnabled?: boolean;
name: string;
+ serverUrl: string;
};
path?: never;
query?: never;
- url: '/api/v1/knowledge-bases';
+ url: '/api/v1/mcp-servers';
};
-export type PostApiV1KnowledgeBasesResponses = {
+export type PostApiV1McpServersErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type DeleteApiV1KnowledgeBasesByIdData = {
- body?: never;
- path: {
- id: string;
- };
- query?: never;
- url: '/api/v1/knowledge-bases/{id}';
-};
+export type PostApiV1McpServersError = PostApiV1McpServersErrors[keyof PostApiV1McpServersErrors];
-export type DeleteApiV1KnowledgeBasesByIdResponses = {
+export type PostApiV1McpServersResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 201: {
+ data?: McpServer;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
-export type GetApiV1KnowledgeBasesByIdData = {
+export type PostApiV1McpServersResponse = PostApiV1McpServersResponses[keyof PostApiV1McpServersResponses];
+
+export type DeleteApiV1McpServersByIdData = {
body?: never;
path: {
id: string;
};
query?: never;
- url: '/api/v1/knowledge-bases/{id}';
+ url: '/api/v1/mcp-servers/{id}';
};
-export type GetApiV1KnowledgeBasesByIdResponses = {
+export type DeleteApiV1McpServersByIdErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type PatchApiV1KnowledgeBasesByIdData = {
- body: {
- avatar?: string;
- description?: string;
- name?: string;
+export type DeleteApiV1McpServersByIdError = DeleteApiV1McpServersByIdErrors[keyof DeleteApiV1McpServersByIdErrors];
+
+export type DeleteApiV1McpServersByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
};
+};
+
+export type DeleteApiV1McpServersByIdResponse = DeleteApiV1McpServersByIdResponses[keyof DeleteApiV1McpServersByIdResponses];
+
+export type GetApiV1McpServersByIdData = {
+ body?: never;
path: {
id: string;
};
query?: never;
- url: '/api/v1/knowledge-bases/{id}';
+ url: '/api/v1/mcp-servers/{id}';
};
-export type PatchApiV1KnowledgeBasesByIdResponses = {
+export type GetApiV1McpServersByIdErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type GetApiV1KnowledgeBasesByIdFilesData = {
- body?: never;
- path: {
- id: string;
- };
- query?: {
- keyword?: string;
- page?: string;
- pageSize?: string;
- fileType?: string | null;
- };
- url: '/api/v1/knowledge-bases/{id}/files';
-};
+export type GetApiV1McpServersByIdError = GetApiV1McpServersByIdErrors[keyof GetApiV1McpServersByIdErrors];
-export type GetApiV1KnowledgeBasesByIdFilesResponses = {
+export type GetApiV1McpServersByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: McpServer;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
-export type DeleteApiV1KnowledgeBasesByIdFilesBatchData = {
+export type GetApiV1McpServersByIdResponse = GetApiV1McpServersByIdResponses[keyof GetApiV1McpServersByIdResponses];
+
+export type PatchApiV1McpServersByIdData = {
body: {
- fileIds: Array<string>;
+ credentials?: {
+ token: string;
+ type: 'bearer';
+ } | {
+ apiKey: string;
+ type: 'apikey';
+ } | {
+ headers: {
+ [key: string]: string;
+ };
+ type: 'header';
+ } | null;
+ description?: string | null;
+ isEnabled?: boolean;
+ name?: string;
+ serverUrl?: string;
};
path: {
id: string;
};
query?: never;
- url: '/api/v1/knowledge-bases/{id}/files/batch';
+ url: '/api/v1/mcp-servers/{id}';
};
-export type DeleteApiV1KnowledgeBasesByIdFilesBatchResponses = {
+export type PatchApiV1McpServersByIdErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type PostApiV1KnowledgeBasesByIdFilesBatchData = {
- body: {
- fileIds: Array<string>;
+export type PatchApiV1McpServersByIdError = PatchApiV1McpServersByIdErrors[keyof PatchApiV1McpServersByIdErrors];
+
+export type PatchApiV1McpServersByIdResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: McpServer;
+ message?: string;
+ success: true;
+ timestamp: string;
};
+};
+
+export type PatchApiV1McpServersByIdResponse = PatchApiV1McpServersByIdResponses[keyof PatchApiV1McpServersByIdResponses];
+
+export type PostApiV1McpServersByIdSyncData = {
+ body?: never;
path: {
id: string;
};
query?: never;
- url: '/api/v1/knowledge-bases/{id}/files/batch';
+ url: '/api/v1/mcp-servers/{id}/sync';
};
-export type PostApiV1KnowledgeBasesByIdFilesBatchResponses = {
+export type PostApiV1McpServersByIdSyncErrors = {
/**
- * Successful response (schema pending)
+ * Invalid request
*/
- 200: unknown;
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type PostApiV1KnowledgeBasesByIdFilesMoveData = {
- body: {
- fileIds: Array<string>;
- targetKnowledgeBaseId: string;
- };
- path: {
- id: string;
- };
- query?: never;
- url: '/api/v1/knowledge-bases/{id}/files/move';
-};
+export type PostApiV1McpServersByIdSyncError = PostApiV1McpServersByIdSyncErrors[keyof PostApiV1McpServersByIdSyncErrors];
-export type PostApiV1KnowledgeBasesByIdFilesMoveResponses = {
+export type PostApiV1McpServersByIdSyncResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ id: string;
+ status: 'connected';
+ toolCount: number;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1McpServersByIdSyncResponse = PostApiV1McpServersByIdSyncResponses[keyof PostApiV1McpServersByIdSyncResponses];
+
export type DeleteApiV1MessageTranslationsByMessageIdData = {
body?: never;
path: {
@@ -706,13 +3403,55 @@ export type DeleteApiV1MessageTranslationsByMessageIdData = {
url: '/api/v1/message-translations/{messageId}';
};
+export type DeleteApiV1MessageTranslationsByMessageIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1MessageTranslationsByMessageIdError = DeleteApiV1MessageTranslationsByMessageIdErrors[keyof DeleteApiV1MessageTranslationsByMessageIdErrors];
+
export type DeleteApiV1MessageTranslationsByMessageIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1MessageTranslationsByMessageIdResponse = DeleteApiV1MessageTranslationsByMessageIdResponses[keyof DeleteApiV1MessageTranslationsByMessageIdResponses];
+
export type GetApiV1MessageTranslationsByMessageIdData = {
body?: never;
path: {
@@ -722,13 +3461,55 @@ export type GetApiV1MessageTranslationsByMessageIdData = {
url: '/api/v1/message-translations/{messageId}';
};
+export type GetApiV1MessageTranslationsByMessageIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1MessageTranslationsByMessageIdError = GetApiV1MessageTranslationsByMessageIdErrors[keyof GetApiV1MessageTranslationsByMessageIdErrors];
+
export type GetApiV1MessageTranslationsByMessageIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1MessageTranslationsByMessageIdResponse = GetApiV1MessageTranslationsByMessageIdResponses[keyof GetApiV1MessageTranslationsByMessageIdResponses];
+
export type PatchApiV1MessageTranslationsByMessageIdData = {
body: {
from?: string;
@@ -744,13 +3525,55 @@ export type PatchApiV1MessageTranslationsByMessageIdData = {
url: '/api/v1/message-translations/{messageId}';
};
+export type PatchApiV1MessageTranslationsByMessageIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1MessageTranslationsByMessageIdError = PatchApiV1MessageTranslationsByMessageIdErrors[keyof PatchApiV1MessageTranslationsByMessageIdErrors];
+
export type PatchApiV1MessageTranslationsByMessageIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PatchApiV1MessageTranslationsByMessageIdResponse = PatchApiV1MessageTranslationsByMessageIdResponses[keyof PatchApiV1MessageTranslationsByMessageIdResponses];
+
export type PostApiV1MessageTranslationsByMessageIdData = {
body: {
from?: string;
@@ -765,13 +3588,55 @@ export type PostApiV1MessageTranslationsByMessageIdData = {
url: '/api/v1/message-translations/{messageId}';
};
+export type PostApiV1MessageTranslationsByMessageIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1MessageTranslationsByMessageIdError = PostApiV1MessageTranslationsByMessageIdErrors[keyof PostApiV1MessageTranslationsByMessageIdErrors];
+
export type PostApiV1MessageTranslationsByMessageIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1MessageTranslationsByMessageIdResponse = PostApiV1MessageTranslationsByMessageIdResponses[keyof PostApiV1MessageTranslationsByMessageIdResponses];
+
export type GetApiV1MessagesCountData = {
body?: never;
path?: never;
@@ -782,13 +3647,55 @@ export type GetApiV1MessagesCountData = {
url: '/api/v1/messages/count';
};
+export type GetApiV1MessagesCountErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1MessagesCountError = GetApiV1MessagesCountErrors[keyof GetApiV1MessagesCountErrors];
+
export type GetApiV1MessagesCountResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ count: number;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1MessagesCountResponse = GetApiV1MessagesCountResponses[keyof GetApiV1MessagesCountResponses];
+
export type DeleteApiV1MessagesData = {
body: {
messageIds: Array<string>;
@@ -798,13 +3705,55 @@ export type DeleteApiV1MessagesData = {
url: '/api/v1/messages';
};
+export type DeleteApiV1MessagesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1MessagesError = DeleteApiV1MessagesErrors[keyof DeleteApiV1MessagesErrors];
+
export type DeleteApiV1MessagesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1MessagesResponse = DeleteApiV1MessagesResponses[keyof DeleteApiV1MessagesResponses];
+
export type GetApiV1MessagesData = {
body?: never;
path?: never;
@@ -819,13 +3768,57 @@ export type GetApiV1MessagesData = {
url: '/api/v1/messages';
};
+export type GetApiV1MessagesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1MessagesError = GetApiV1MessagesErrors[keyof GetApiV1MessagesErrors];
+
export type GetApiV1MessagesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ messages: Array<Message>;
+ total?: number;
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1MessagesResponse = GetApiV1MessagesResponses[keyof GetApiV1MessagesResponses];
+
export type PostApiV1MessagesData = {
body: {
content: string;
@@ -852,13 +3845,53 @@ export type PostApiV1MessagesData = {
url: '/api/v1/messages';
};
+export type PostApiV1MessagesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1MessagesError = PostApiV1MessagesErrors[keyof PostApiV1MessagesErrors];
+
export type PostApiV1MessagesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Message;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1MessagesResponse = PostApiV1MessagesResponses[keyof PostApiV1MessagesResponses];
+
export type DeleteApiV1MessagesByIdData = {
body?: never;
path: {
@@ -868,13 +3901,55 @@ export type DeleteApiV1MessagesByIdData = {
url: '/api/v1/messages/{id}';
};
+export type DeleteApiV1MessagesByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1MessagesByIdError = DeleteApiV1MessagesByIdErrors[keyof DeleteApiV1MessagesByIdErrors];
+
export type DeleteApiV1MessagesByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1MessagesByIdResponse = DeleteApiV1MessagesByIdResponses[keyof DeleteApiV1MessagesByIdResponses];
+
export type GetApiV1MessagesByIdData = {
body?: never;
path: {
@@ -884,13 +3959,53 @@ export type GetApiV1MessagesByIdData = {
url: '/api/v1/messages/{id}';
};
+export type GetApiV1MessagesByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1MessagesByIdError = GetApiV1MessagesByIdErrors[keyof GetApiV1MessagesByIdErrors];
+
export type GetApiV1MessagesByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Message;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1MessagesByIdResponse = GetApiV1MessagesByIdResponses[keyof GetApiV1MessagesByIdResponses];
+
export type PostApiV1MessagesRepliesData = {
body: {
content: string;
@@ -917,13 +4032,53 @@ export type PostApiV1MessagesRepliesData = {
url: '/api/v1/messages/replies';
};
+export type PostApiV1MessagesRepliesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1MessagesRepliesError = PostApiV1MessagesRepliesErrors[keyof PostApiV1MessagesRepliesErrors];
+
export type PostApiV1MessagesRepliesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Message | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1MessagesRepliesResponse = PostApiV1MessagesRepliesResponses[keyof PostApiV1MessagesRepliesResponses];
+
export type GetApiV1ModelsData = {
body?: never;
path?: never;
@@ -938,13 +4093,57 @@ export type GetApiV1ModelsData = {
url: '/api/v1/models';
};
+export type GetApiV1ModelsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1ModelsError = GetApiV1ModelsErrors[keyof GetApiV1ModelsErrors];
+
export type GetApiV1ModelsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ models: Array<Model>;
+ total?: number;
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1ModelsResponse = GetApiV1ModelsResponses[keyof GetApiV1ModelsResponses];
+
export type PostApiV1ModelsData = {
body: {
abilities?: {
@@ -976,13 +4175,53 @@ export type PostApiV1ModelsData = {
url: '/api/v1/models';
};
+export type PostApiV1ModelsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1ModelsError = PostApiV1ModelsErrors[keyof PostApiV1ModelsErrors];
+
export type PostApiV1ModelsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Model;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1ModelsResponse = PostApiV1ModelsResponses[keyof PostApiV1ModelsResponses];
+
export type GetApiV1ModelsByProviderIdByModelIdData = {
body?: never;
path: {
@@ -993,13 +4232,55 @@ export type GetApiV1ModelsByProviderIdByModelIdData = {
url: '/api/v1/models/{providerId}/{modelId}';
};
+export type GetApiV1ModelsByProviderIdByModelIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1ModelsByProviderIdByModelIdError = GetApiV1ModelsByProviderIdByModelIdErrors[keyof GetApiV1ModelsByProviderIdByModelIdErrors];
+
export type GetApiV1ModelsByProviderIdByModelIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1ModelsByProviderIdByModelIdResponse = GetApiV1ModelsByProviderIdByModelIdResponses[keyof GetApiV1ModelsByProviderIdByModelIdResponses];
+
export type PatchApiV1ModelsByProviderIdByModelIdData = {
body: {
abilities?: {
@@ -1032,13 +4313,55 @@ export type PatchApiV1ModelsByProviderIdByModelIdData = {
url: '/api/v1/models/{providerId}/{modelId}';
};
+export type PatchApiV1ModelsByProviderIdByModelIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1ModelsByProviderIdByModelIdError = PatchApiV1ModelsByProviderIdByModelIdErrors[keyof PatchApiV1ModelsByProviderIdByModelIdErrors];
+
export type PatchApiV1ModelsByProviderIdByModelIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PatchApiV1ModelsByProviderIdByModelIdResponse = PatchApiV1ModelsByProviderIdByModelIdResponses[keyof PatchApiV1ModelsByProviderIdByModelIdResponses];
+
export type GetApiV1PermissionsData = {
body?: never;
path?: never;
@@ -1052,13 +4375,57 @@ export type GetApiV1PermissionsData = {
url: '/api/v1/permissions';
};
+export type GetApiV1PermissionsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1PermissionsError = GetApiV1PermissionsErrors[keyof GetApiV1PermissionsErrors];
+
export type GetApiV1PermissionsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ permissions: Array<Permission>;
+ total?: number;
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1PermissionsResponse = GetApiV1PermissionsResponses[keyof GetApiV1PermissionsResponses];
+
export type PostApiV1PermissionsData = {
body: {
category: string;
@@ -1072,13 +4439,53 @@ export type PostApiV1PermissionsData = {
url: '/api/v1/permissions';
};
+export type PostApiV1PermissionsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1PermissionsError = PostApiV1PermissionsErrors[keyof PostApiV1PermissionsErrors];
+
export type PostApiV1PermissionsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Permission;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1PermissionsResponse = PostApiV1PermissionsResponses[keyof PostApiV1PermissionsResponses];
+
export type DeleteApiV1PermissionsByIdData = {
body?: never;
path: {
@@ -1088,13 +4495,55 @@ export type DeleteApiV1PermissionsByIdData = {
url: '/api/v1/permissions/{id}';
};
+export type DeleteApiV1PermissionsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1PermissionsByIdError = DeleteApiV1PermissionsByIdErrors[keyof DeleteApiV1PermissionsByIdErrors];
+
export type DeleteApiV1PermissionsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1PermissionsByIdResponse = DeleteApiV1PermissionsByIdResponses[keyof DeleteApiV1PermissionsByIdResponses];
+
export type GetApiV1PermissionsByIdData = {
body?: never;
path: {
@@ -1104,13 +4553,53 @@ export type GetApiV1PermissionsByIdData = {
url: '/api/v1/permissions/{id}';
};
+export type GetApiV1PermissionsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1PermissionsByIdError = GetApiV1PermissionsByIdErrors[keyof GetApiV1PermissionsByIdErrors];
+
export type GetApiV1PermissionsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Permission;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1PermissionsByIdResponse = GetApiV1PermissionsByIdResponses[keyof GetApiV1PermissionsByIdResponses];
+
export type PatchApiV1PermissionsByIdData = {
body: {
category?: string;
@@ -1126,13 +4615,53 @@ export type PatchApiV1PermissionsByIdData = {
url: '/api/v1/permissions/{id}';
};
+export type PatchApiV1PermissionsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1PermissionsByIdError = PatchApiV1PermissionsByIdErrors[keyof PatchApiV1PermissionsByIdErrors];
+
export type PatchApiV1PermissionsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Permission;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PatchApiV1PermissionsByIdResponse = PatchApiV1PermissionsByIdResponses[keyof PatchApiV1PermissionsByIdResponses];
+
export type GetApiV1ProvidersData = {
body?: never;
path?: never;
@@ -1145,13 +4674,57 @@ export type GetApiV1ProvidersData = {
url: '/api/v1/providers';
};
+export type GetApiV1ProvidersErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1ProvidersError = GetApiV1ProvidersErrors[keyof GetApiV1ProvidersErrors];
+
export type GetApiV1ProvidersResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ providers: Array<Provider>;
+ total?: number;
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1ProvidersResponse = GetApiV1ProvidersResponses[keyof GetApiV1ProvidersResponses];
+
export type PostApiV1ProvidersData = {
body: {
checkModel?: string | null;
@@ -1178,13 +4751,53 @@ export type PostApiV1ProvidersData = {
url: '/api/v1/providers';
};
+export type PostApiV1ProvidersErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1ProvidersError = PostApiV1ProvidersErrors[keyof PostApiV1ProvidersErrors];
+
export type PostApiV1ProvidersResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Provider;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1ProvidersResponse = PostApiV1ProvidersResponses[keyof PostApiV1ProvidersResponses];
+
export type DeleteApiV1ProvidersByIdData = {
body?: never;
path: {
@@ -1194,13 +4807,55 @@ export type DeleteApiV1ProvidersByIdData = {
url: '/api/v1/providers/{id}';
};
+export type DeleteApiV1ProvidersByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1ProvidersByIdError = DeleteApiV1ProvidersByIdErrors[keyof DeleteApiV1ProvidersByIdErrors];
+
export type DeleteApiV1ProvidersByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1ProvidersByIdResponse = DeleteApiV1ProvidersByIdResponses[keyof DeleteApiV1ProvidersByIdResponses];
+
export type GetApiV1ProvidersByIdData = {
body?: never;
path: {
@@ -1210,13 +4865,53 @@ export type GetApiV1ProvidersByIdData = {
url: '/api/v1/providers/{id}';
};
+export type GetApiV1ProvidersByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1ProvidersByIdError = GetApiV1ProvidersByIdErrors[keyof GetApiV1ProvidersByIdErrors];
+
export type GetApiV1ProvidersByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Provider;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1ProvidersByIdResponse = GetApiV1ProvidersByIdResponses[keyof GetApiV1ProvidersByIdResponses];
+
export type PatchApiV1ProvidersByIdData = {
body: {
checkModel?: string | null;
@@ -1244,13 +4939,53 @@ export type PatchApiV1ProvidersByIdData = {
url: '/api/v1/providers/{id}';
};
+export type PatchApiV1ProvidersByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1ProvidersByIdError = PatchApiV1ProvidersByIdErrors[keyof PatchApiV1ProvidersByIdErrors];
+
export type PatchApiV1ProvidersByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Provider;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PatchApiV1ProvidersByIdResponse = PatchApiV1ProvidersByIdResponses[keyof PatchApiV1ProvidersByIdResponses];
+
export type PostApiV1ResponsesData = {
body: {
input: string | Array<{
@@ -1331,13 +5066,59 @@ export type PostApiV1ResponsesData = {
url: '/api/v1/responses';
};
+export type PostApiV1ResponsesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1ResponsesError = PostApiV1ResponsesErrors[keyof PostApiV1ResponsesErrors];
+
export type PostApiV1ResponsesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ id: string;
+ object: 'response';
+ output: Array<{
+ [key: string]: unknown;
+ }>;
+ status: string;
+ usage?: {
+ [key: string]: unknown;
+ } | null;
+ [key: string]: unknown;
+ };
};
+export type PostApiV1ResponsesResponse = PostApiV1ResponsesResponses[keyof PostApiV1ResponsesResponses];
+
export type GetApiV1RolesData = {
body?: never;
path?: never;
@@ -1351,13 +5132,57 @@ export type GetApiV1RolesData = {
url: '/api/v1/roles';
};
+export type GetApiV1RolesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1RolesError = GetApiV1RolesErrors[keyof GetApiV1RolesErrors];
+
export type GetApiV1RolesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ roles: Array<Role>;
+ total?: number;
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1RolesResponse = GetApiV1RolesResponses[keyof GetApiV1RolesResponses];
+
export type PostApiV1RolesData = {
body: {
description?: string | null;
@@ -1371,13 +5196,53 @@ export type PostApiV1RolesData = {
url: '/api/v1/roles';
};
+export type PostApiV1RolesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1RolesError = PostApiV1RolesErrors[keyof PostApiV1RolesErrors];
+
export type PostApiV1RolesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Role;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1RolesResponse = PostApiV1RolesResponses[keyof PostApiV1RolesResponses];
+
export type DeleteApiV1RolesByIdData = {
body?: never;
path: {
@@ -1387,13 +5252,55 @@ export type DeleteApiV1RolesByIdData = {
url: '/api/v1/roles/{id}';
};
+export type DeleteApiV1RolesByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1RolesByIdError = DeleteApiV1RolesByIdErrors[keyof DeleteApiV1RolesByIdErrors];
+
export type DeleteApiV1RolesByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1RolesByIdResponse = DeleteApiV1RolesByIdResponses[keyof DeleteApiV1RolesByIdResponses];
+
export type GetApiV1RolesByIdData = {
body?: never;
path: {
@@ -1403,13 +5310,53 @@ export type GetApiV1RolesByIdData = {
url: '/api/v1/roles/{id}';
};
+export type GetApiV1RolesByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1RolesByIdError = GetApiV1RolesByIdErrors[keyof GetApiV1RolesByIdErrors];
+
export type GetApiV1RolesByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Role;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1RolesByIdResponse = GetApiV1RolesByIdResponses[keyof GetApiV1RolesByIdResponses];
+
export type PatchApiV1RolesByIdData = {
body: {
description?: string | null;
@@ -1425,13 +5372,53 @@ export type PatchApiV1RolesByIdData = {
url: '/api/v1/roles/{id}';
};
+export type PatchApiV1RolesByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1RolesByIdError = PatchApiV1RolesByIdErrors[keyof PatchApiV1RolesByIdErrors];
+
export type PatchApiV1RolesByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Role;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PatchApiV1RolesByIdResponse = PatchApiV1RolesByIdResponses[keyof PatchApiV1RolesByIdResponses];
+
export type DeleteApiV1RolesByIdPermissionsData = {
body?: never;
path: {
@@ -1441,13 +5428,55 @@ export type DeleteApiV1RolesByIdPermissionsData = {
url: '/api/v1/roles/{id}/permissions';
};
+export type DeleteApiV1RolesByIdPermissionsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1RolesByIdPermissionsError = DeleteApiV1RolesByIdPermissionsErrors[keyof DeleteApiV1RolesByIdPermissionsErrors];
+
export type DeleteApiV1RolesByIdPermissionsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1RolesByIdPermissionsResponse = DeleteApiV1RolesByIdPermissionsResponses[keyof DeleteApiV1RolesByIdPermissionsResponses];
+
export type GetApiV1RolesByIdPermissionsData = {
body?: never;
path: {
@@ -1461,13 +5490,55 @@ export type GetApiV1RolesByIdPermissionsData = {
url: '/api/v1/roles/{id}/permissions';
};
+export type GetApiV1RolesByIdPermissionsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1RolesByIdPermissionsError = GetApiV1RolesByIdPermissionsErrors[keyof GetApiV1RolesByIdPermissionsErrors];
+
export type GetApiV1RolesByIdPermissionsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1RolesByIdPermissionsResponse = GetApiV1RolesByIdPermissionsResponses[keyof GetApiV1RolesByIdPermissionsResponses];
+
export type PatchApiV1RolesByIdPermissionsData = {
body: {
grant?: Array<string> | null;
@@ -1480,13 +5551,55 @@ export type PatchApiV1RolesByIdPermissionsData = {
url: '/api/v1/roles/{id}/permissions';
};
+export type PatchApiV1RolesByIdPermissionsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1RolesByIdPermissionsError = PatchApiV1RolesByIdPermissionsErrors[keyof PatchApiV1RolesByIdPermissionsErrors];
+
export type PatchApiV1RolesByIdPermissionsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PatchApiV1RolesByIdPermissionsResponse = PatchApiV1RolesByIdPermissionsResponses[keyof PatchApiV1RolesByIdPermissionsResponses];
+
export type GetApiV1TopicsData = {
body?: never;
path?: never;
@@ -1503,13 +5616,57 @@ export type GetApiV1TopicsData = {
url: '/api/v1/topics';
};
+export type GetApiV1TopicsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1TopicsError = GetApiV1TopicsErrors[keyof GetApiV1TopicsErrors];
+
export type GetApiV1TopicsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ topics: Array<Topic>;
+ total?: number;
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1TopicsResponse = GetApiV1TopicsResponses[keyof GetApiV1TopicsResponses];
+
export type PostApiV1TopicsData = {
body: {
agentId?: string | null;
@@ -1523,13 +5680,53 @@ export type PostApiV1TopicsData = {
url: '/api/v1/topics';
};
+export type PostApiV1TopicsErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1TopicsError = PostApiV1TopicsErrors[keyof PostApiV1TopicsErrors];
+
export type PostApiV1TopicsResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Topic;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1TopicsResponse = PostApiV1TopicsResponses[keyof PostApiV1TopicsResponses];
+
export type DeleteApiV1TopicsByIdData = {
body?: never;
path: {
@@ -1539,29 +5736,111 @@ export type DeleteApiV1TopicsByIdData = {
url: '/api/v1/topics/{id}';
};
+export type DeleteApiV1TopicsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1TopicsByIdError = DeleteApiV1TopicsByIdErrors[keyof DeleteApiV1TopicsByIdErrors];
+
export type DeleteApiV1TopicsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
+ */
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type DeleteApiV1TopicsByIdResponse = DeleteApiV1TopicsByIdResponses[keyof DeleteApiV1TopicsByIdResponses];
+
+export type GetApiV1TopicsByIdData = {
+ body?: never;
+ path: {
+ id: string;
+ };
+ query?: never;
+ url: '/api/v1/topics/{id}';
+};
+
+export type GetApiV1TopicsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
*/
- 200: unknown;
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
};
-export type GetApiV1TopicsByIdData = {
- body?: never;
- path: {
- id: string;
- };
- query?: never;
- url: '/api/v1/topics/{id}';
-};
+export type GetApiV1TopicsByIdError = GetApiV1TopicsByIdErrors[keyof GetApiV1TopicsByIdErrors];
export type GetApiV1TopicsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Topic;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1TopicsByIdResponse = GetApiV1TopicsByIdResponses[keyof GetApiV1TopicsByIdResponses];
+
export type PatchApiV1TopicsByIdData = {
body: {
favorite?: boolean;
@@ -1581,13 +5860,53 @@ export type PatchApiV1TopicsByIdData = {
url: '/api/v1/topics/{id}';
};
+export type PatchApiV1TopicsByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1TopicsByIdError = PatchApiV1TopicsByIdErrors[keyof PatchApiV1TopicsByIdErrors];
+
export type PatchApiV1TopicsByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: Topic;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PatchApiV1TopicsByIdResponse = PatchApiV1TopicsByIdResponses[keyof PatchApiV1TopicsByIdResponses];
+
export type GetApiV1UsersMeData = {
body?: never;
path?: never;
@@ -1595,13 +5914,55 @@ export type GetApiV1UsersMeData = {
url: '/api/v1/users/me';
};
+export type GetApiV1UsersMeErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1UsersMeError = GetApiV1UsersMeErrors[keyof GetApiV1UsersMeErrors];
+
export type GetApiV1UsersMeResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: User | {
+ id: string;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1UsersMeResponse = GetApiV1UsersMeResponses[keyof GetApiV1UsersMeResponses];
+
export type GetApiV1UsersData = {
body?: never;
path?: never;
@@ -1613,13 +5974,57 @@ export type GetApiV1UsersData = {
url: '/api/v1/users';
};
+export type GetApiV1UsersErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1UsersError = GetApiV1UsersErrors[keyof GetApiV1UsersErrors];
+
export type GetApiV1UsersResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ users: Array<User>;
+ total?: number;
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1UsersResponse = GetApiV1UsersResponses[keyof GetApiV1UsersResponses];
+
export type PostApiV1UsersData = {
body: {
avatar?: string | null;
@@ -1637,13 +6042,53 @@ export type PostApiV1UsersData = {
url: '/api/v1/users';
};
+export type PostApiV1UsersErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PostApiV1UsersError = PostApiV1UsersErrors[keyof PostApiV1UsersErrors];
+
export type PostApiV1UsersResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: User;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PostApiV1UsersResponse = PostApiV1UsersResponses[keyof PostApiV1UsersResponses];
+
export type DeleteApiV1UsersByIdData = {
body?: never;
path: {
@@ -1653,13 +6098,55 @@ export type DeleteApiV1UsersByIdData = {
url: '/api/v1/users/{id}';
};
+export type DeleteApiV1UsersByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1UsersByIdError = DeleteApiV1UsersByIdErrors[keyof DeleteApiV1UsersByIdErrors];
+
export type DeleteApiV1UsersByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1UsersByIdResponse = DeleteApiV1UsersByIdResponses[keyof DeleteApiV1UsersByIdResponses];
+
export type GetApiV1UsersByIdData = {
body?: never;
path: {
@@ -1669,13 +6156,53 @@ export type GetApiV1UsersByIdData = {
url: '/api/v1/users/{id}';
};
+export type GetApiV1UsersByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1UsersByIdError = GetApiV1UsersByIdErrors[keyof GetApiV1UsersByIdErrors];
+
export type GetApiV1UsersByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: User;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1UsersByIdResponse = GetApiV1UsersByIdResponses[keyof GetApiV1UsersByIdResponses];
+
export type PatchApiV1UsersByIdData = {
body: {
avatar?: string | null;
@@ -1696,13 +6223,53 @@ export type PatchApiV1UsersByIdData = {
url: '/api/v1/users/{id}';
};
+export type PatchApiV1UsersByIdErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1UsersByIdError = PatchApiV1UsersByIdErrors[keyof PatchApiV1UsersByIdErrors];
+
export type PatchApiV1UsersByIdResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: User;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type PatchApiV1UsersByIdResponse = PatchApiV1UsersByIdResponses[keyof PatchApiV1UsersByIdResponses];
+
export type DeleteApiV1UsersByIdRolesData = {
body?: never;
path: {
@@ -1712,13 +6279,55 @@ export type DeleteApiV1UsersByIdRolesData = {
url: '/api/v1/users/{id}/roles';
};
+export type DeleteApiV1UsersByIdRolesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type DeleteApiV1UsersByIdRolesError = DeleteApiV1UsersByIdRolesErrors[keyof DeleteApiV1UsersByIdRolesErrors];
+
export type DeleteApiV1UsersByIdRolesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ } | null;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type DeleteApiV1UsersByIdRolesResponse = DeleteApiV1UsersByIdRolesResponses[keyof DeleteApiV1UsersByIdRolesResponses];
+
export type GetApiV1UsersByIdRolesData = {
body?: never;
path: {
@@ -1728,13 +6337,55 @@ export type GetApiV1UsersByIdRolesData = {
url: '/api/v1/users/{id}/roles';
};
+export type GetApiV1UsersByIdRolesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1UsersByIdRolesError = GetApiV1UsersByIdRolesErrors[keyof GetApiV1UsersByIdRolesErrors];
+
export type GetApiV1UsersByIdRolesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+export type GetApiV1UsersByIdRolesResponse = GetApiV1UsersByIdRolesResponses[keyof GetApiV1UsersByIdRolesResponses];
+
export type PatchApiV1UsersByIdRolesData = {
body: {
addRoles?: Array<{
@@ -1750,9 +6401,105 @@ export type PatchApiV1UsersByIdRolesData = {
url: '/api/v1/users/{id}/roles';
};
+export type PatchApiV1UsersByIdRolesErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type PatchApiV1UsersByIdRolesError = PatchApiV1UsersByIdRolesErrors[keyof PatchApiV1UsersByIdRolesErrors];
+
export type PatchApiV1UsersByIdRolesResponses = {
/**
- * Successful response (schema pending)
+ * Successful response
*/
- 200: unknown;
+ 200: {
+ data?: {
+ [key: string]: unknown;
+ };
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
+};
+
+export type PatchApiV1UsersByIdRolesResponse = PatchApiV1UsersByIdRolesResponses[keyof PatchApiV1UsersByIdRolesResponses];
+
+export type GetApiV1UsageData = {
+ body?: never;
+ path?: never;
+ query?: never;
+ url: '/api/v1/usage';
+};
+
+export type GetApiV1UsageErrors = {
+ /**
+ * Invalid request
+ */
+ 400: ApiError;
+ /**
+ * Authentication required
+ */
+ 401: ApiError;
+ /**
+ * Insufficient permission
+ */
+ 403: ApiError;
+ /**
+ * Resource not found
+ */
+ 404: ApiError;
+ /**
+ * Resource conflict
+ */
+ 409: ApiError;
+ /**
+ * Rate limit exceeded
+ */
+ 429: ApiError;
+ /**
+ * Internal server error
+ */
+ 500: ApiError;
+};
+
+export type GetApiV1UsageError = GetApiV1UsageErrors[keyof GetApiV1UsageErrors];
+
+export type GetApiV1UsageResponses = {
+ /**
+ * Successful response
+ */
+ 200: {
+ data?: Usage;
+ message?: string;
+ success: true;
+ timestamp: string;
+ };
};
+
+export type GetApiV1UsageResponse = GetApiV1UsageResponses[keyof GetApiV1UsageResponses];
diff --git a/src/features/Settings/apikey/features/ApiKey.test.tsx b/src/features/Settings/apikey/features/ApiKey.test.tsx
index 36da6dbe2f4..21dae62278d 100644
--- a/src/features/Settings/apikey/features/ApiKey.test.tsx
+++ b/src/features/Settings/apikey/features/ApiKey.test.tsx
@@ -8,6 +8,7 @@ import { type ApiKeyItem, type CreateApiKeyParams } from '@/types/apiKey';
import { WorkspaceApiKeyPolicyContext } from '../WorkspaceApiKeyPolicyContext';
import ApiKey from './ApiKey';
+import ScopeSelector from './ApiKeyModal/ScopeSelector';
const hoisted = vi.hoisted(() => ({
createApiKeyModal: vi.fn(),
@@ -184,6 +185,26 @@ const openDetail = async (name: string) => {
};
describe('ApiKey', () => {
+ it('offers MCP read/write and read-only usage scopes when access is restricted', () => {
+ const onSelectedChange = vi.fn();
+ render(
+ <ScopeSelector
+ fullAccess={false}
+ selected={[]}
+ onFullAccessChange={vi.fn()}
+ onSelectedChange={onSelectedChange}
+ />,
+ );
+
+ const mcpGroup = screen.getByText('apikey.scopes.groups.mcp').parentElement!;
+ const usageGroup = screen.getByText('apikey.scopes.groups.usage').parentElement!;
+ expect(within(mcpGroup).getAllByRole('checkbox')).toHaveLength(2);
+ expect(within(usageGroup).getAllByRole('checkbox')).toHaveLength(1);
+
+ fireEvent.click(within(mcpGroup).getByRole('checkbox', { name: 'apikey.scopes.write' }));
+ expect(onSelectedChange).toHaveBeenCalledWith(['mcp:write', 'mcp:read']);
+ });
+
it('shows loading, then empty state when the first fetch returns no keys', async () => {
let resolveList!: (items: ApiKeyItem[]) => void;
hoisted.trpc.getApiKeys.mockImplementation(
@@ -442,7 +463,9 @@ describe('ApiKey', () => {
it('opens the detail drawer on row click listing only the granted scopes', async () => {
hoisted.trpc.getApiKeys.mockResolvedValue([
- makeItem({ scopes: ['model:read', 'model:invoke', 'agent:read'] }),
+ makeItem({
+ scopes: ['model:read', 'model:invoke', 'agent:read', 'mcp:read', 'mcp:write', 'usage:read'],
+ }),
]);
renderPage();
await screen.findByText('My Key');
@@ -453,7 +476,9 @@ describe('ApiKey', () => {
expect(within(dialog).getByText('apikey.detail.title')).toBeInTheDocument();
// one row per granted domain, actions collapsed — ungranted domains absent
expect(within(dialog).getByText('apikey.scopes.groups.agent')).toBeInTheDocument();
+ expect(within(dialog).getByText('apikey.scopes.groups.mcp')).toBeInTheDocument();
expect(within(dialog).getByText('apikey.scopes.groups.model')).toBeInTheDocument();
+ expect(within(dialog).getByText('apikey.scopes.groups.usage')).toBeInTheDocument();
expect(within(dialog).queryByText('apikey.scopes.groups.chat')).toBeNull();
expect(within(dialog).queryByText('apikey.scopes.groups.file')).toBeNull();
// the model row collapses read + invoke onto one line (the `t` mock echoes
diff --git a/src/features/Settings/apikey/features/ApiKeyModal/ScopeSelector.tsx b/src/features/Settings/apikey/features/ApiKeyModal/ScopeSelector.tsx
index 39863b2e87c..ef68b5ec8e0 100644
--- a/src/features/Settings/apikey/features/ApiKeyModal/ScopeSelector.tsx
+++ b/src/features/Settings/apikey/features/ApiKeyModal/ScopeSelector.tsx
@@ -5,10 +5,10 @@ import { Switch } from '@lobehub/ui/base-ui';
import { Checkbox } from 'antd';
import { createStaticStyles } from 'antd-style';
import { Check } from 'lucide-react';
-import { type FC } from 'react';
+import type { FC } from 'react';
import { useTranslation } from 'react-i18next';
-import { type ApiKeyScope } from '@/const/apiKeyScope';
+import type { ApiKeyScope } from '@/const/apiKeyScope';
const styles = createStaticStyles(({ css, cssVar }) => ({
disabled: css`
@@ -80,11 +80,21 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
}));
/**
- * Scope groups shown to the user. Each group carries a read and a write
- * scope; the model group additionally carries the money-burning
- * `model:invoke` tier.
+ * Scope groups shown to the user. Most domains carry read and write scopes;
+ * usage is intentionally read-only, while the model group additionally
+ * carries the money-burning `model:invoke` tier.
*/
-const SCOPE_GROUPS = [
+type ScopeGroupKey =
+ 'agent' | 'chat' | 'file' | 'knowledge' | 'mcp' | 'model' | 'usage' | 'user' | 'workspace';
+
+interface ScopeGroup {
+ readonly key: ScopeGroupKey;
+ readonly label: `apikey.scopes.groups.${ScopeGroupKey}`;
+ readonly read: ApiKeyScope;
+ readonly write?: ApiKeyScope;
+}
+
+const SCOPE_GROUPS: readonly ScopeGroup[] = [
{ key: 'agent', label: 'apikey.scopes.groups.agent', read: 'agent:read', write: 'agent:write' },
{ key: 'chat', label: 'apikey.scopes.groups.chat', read: 'chat:read', write: 'chat:write' },
{ key: 'model', label: 'apikey.scopes.groups.model', read: 'model:read', write: 'model:write' },
@@ -95,6 +105,8 @@ const SCOPE_GROUPS = [
read: 'knowledge:read',
write: 'knowledge:write',
},
+ { key: 'mcp', label: 'apikey.scopes.groups.mcp', read: 'mcp:read', write: 'mcp:write' },
+ { key: 'usage', label: 'apikey.scopes.groups.usage', read: 'usage:read' },
{
key: 'workspace',
label: 'apikey.scopes.groups.workspace',
@@ -102,7 +114,7 @@ const SCOPE_GROUPS = [
write: 'workspace:write',
},
{ key: 'user', label: 'apikey.scopes.groups.user', read: 'user:read', write: 'user:write' },
-] as const satisfies { key: string; label: string; read: ApiKeyScope; write: ApiKeyScope }[];
+];
export interface ScopeOverviewProps {
scopes: string[];
@@ -125,7 +137,7 @@ export const ScopeOverview: FC<ScopeOverviewProps> = ({ scopes }) => {
const grants = SCOPE_GROUPS.flatMap((group) => {
const actions = [
scopeSet.has(group.read) && t('apikey.scopes.read'),
- scopeSet.has(group.write) && t('apikey.scopes.write'),
+ group.write && scopeSet.has(group.write) && t('apikey.scopes.write'),
group.key === 'model' && scopeSet.has('model:invoke') && t('apikey.scopes.invoke'),
].filter(Boolean) as string[];
@@ -209,13 +221,15 @@ const ScopeSelector: FC<ScopeSelectorProps> = ({
>
{t('apikey.scopes.read')}
</Checkbox>
- <Checkbox
- checked={selectedSet.has(group.write)}
- disabled={fullAccess}
- onChange={(e) => toggle(group.write, e.target.checked)}
- >
- {t('apikey.scopes.write')}
- </Checkbox>
+ {group.write && (
+ <Checkbox
+ checked={selectedSet.has(group.write)}
+ disabled={fullAccess}
+ onChange={(e) => group.write && toggle(group.write, e.target.checked)}
+ >
+ {t('apikey.scopes.write')}
+ </Checkbox>
+ )}
{group.key === 'model' && (
<Checkbox
checked={selectedSet.has('model:invoke')}