import { APIResource } from "../../core/resource.js"; import * as KnowledgeBasesAPI from "./knowledge-bases.js"; import * as FilesAPI from "../files.js"; import * as KnowledgeBasesFilesAPI from "./files.js"; import { FileBatchAddParams, FileBatchRemoveParams, FileListParams, FileMoveParams, Files, KBAPIResponseFileOperation, KBAPIResponseMoveFiles } from "./files.js"; import * as UsersAPI from "../users/users.js"; import { APIPromise } from "../../core/api-promise.js"; import { RequestOptions } from "../../internal/request-options.js"; export declare class KnowledgeBases extends APIResource { files: KnowledgeBasesFilesAPI.Files; /** * Create a new knowledge base with specified properties. * * - Requires KNOWLEDGE_BASE_CREATE permission * - Returns the created knowledge base with complete metadata */ create(body: KnowledgeBaseCreateParams, options?: RequestOptions): APIPromise; /** * Retrieve detailed information about a specific knowledge base. * * - Requires KNOWLEDGE_BASE_READ permission * - Checks access permissions and enabled status * - Returns complete knowledge base metadata */ retrieve(id: string, options?: RequestOptions): APIPromise; /** * Update knowledge base properties. * * - Requires KNOWLEDGE_BASE_UPDATE permission * - Only the owner can update the knowledge base * - All fields are optional */ update(id: string, body: KnowledgeBaseUpdateParams, options?: RequestOptions): APIPromise; /** * Get paginated list of knowledge bases with optional filtering and search. * * - Requires KNOWLEDGE_BASE_READ permission * - Returns knowledge bases accessible by the current user * - Supports filtering by type (personal/shared) and enabled status */ list(query?: KnowledgeBaseListParams | null | undefined, options?: RequestOptions): APIPromise; /** * Permanently delete a knowledge base. * * - Requires KNOWLEDGE_BASE_DELETE permission * - Only the owner can delete the knowledge base * - Cascades delete to related files and grants * - Cannot be undone */ delete(id: string, options?: RequestOptions): APIPromise; } export interface APIResponseKnowledgeBase extends UsersAPI.APIResponseBase { data?: APIResponseKnowledgeBase.Data; } export declare namespace APIResponseKnowledgeBase { interface Data { knowledgeBase: KnowledgeBasesAPI.KnowledgeBase; } } export interface APIResponseKnowledgeBaseDelete extends UsersAPI.APIResponseBase { data?: APIResponseKnowledgeBaseDelete.Data; } export declare namespace APIResponseKnowledgeBaseDelete { interface Data { success: boolean; message?: string | null; } } export interface APIResponseKnowledgeBaseFileOperation extends UsersAPI.APIResponseBase { data: KnowledgeBaseFileOperationResult; } export interface APIResponseKnowledgeBaseList extends UsersAPI.APIResponseBase { data?: APIResponseKnowledgeBaseList.Data; } export declare namespace APIResponseKnowledgeBaseList { interface Data { knowledgeBases: Array; total: number; } } export interface APIResponseMoveKnowledgeBaseFiles extends UsersAPI.APIResponseBase { data: MoveKnowledgeBaseFilesResult; } export interface CreateKnowledgeBaseRequest { name: string; avatar?: string | null; description?: string | null; isPublic?: boolean | null; settings?: { [key: string]: unknown; } | null; type?: 'personal' | 'shared' | null; } export interface KBAPIResponseFileList extends UsersAPI.APIResponseBase { data?: KBAPIResponseFileList.Data; } export declare namespace KBAPIResponseFileList { interface Data { files: Array; total: number; /** * Total size in bytes of all matched files */ totalSize?: string; } } export interface KBFile { id?: string; chunking?: KBFile.Chunking | null; createdAt?: string | null; embedding?: KBFile.Embedding | null; fileHash?: string | null; fileType?: string | null; knowledgeBaseId?: string | null; knowledgeBases?: Array | null; metadata?: { [key: string]: unknown; } | null; name?: string | null; size?: number | null; updatedAt?: string | null; url?: string | null; userId?: string | null; } export declare namespace KBFile { interface Chunking { id?: string | null; /** * Chunk count for the related file (only for chunking tasks) */ count?: number | null; error?: Chunking.Error | null; status?: 'pending' | 'processing' | 'success' | 'error' | null; type?: 'chunk' | 'embedding' | 'image_generation' | null; } namespace Chunking { interface Error { body: Error.Body; name: string; } namespace Error { interface Body { detail: string; } } } interface Embedding { id?: string | null; /** * Chunk count for the related file (only for chunking tasks) */ count?: number | null; error?: Embedding.Error | null; status?: 'pending' | 'processing' | 'success' | 'error' | null; type?: 'chunk' | 'embedding' | 'image_generation' | null; } namespace Embedding { interface Error { body: Error.Body; name: string; } namespace Error { interface Body { detail: string; } } } interface KnowledgeBase { id: string; name: string; avatar?: string | null; description?: string | null; } } export interface KnowledgeBase { id: string; accessedAt: string; createdAt: string; enabled: boolean; name: string; updatedAt: string; userId: string; avatar?: string | null; clientId?: string | null; description?: string | null; isPublic?: boolean | null; settings?: { [key: string]: unknown; } | null; type?: 'personal' | 'shared' | null; } export interface KnowledgeBaseFileOperationResult { failed: Array; successed: Array; } export declare namespace KnowledgeBaseFileOperationResult { interface Failed { fileId: string; reason: string; } } export interface KnowledgeBaseListItem extends KnowledgeBase { /** * Access type/source of the current user for this knowledge base */ accessType?: 'owner' | 'userGrant' | 'roleGrant' | 'public'; } export interface MoveKnowledgeBaseFilesResult { failed: Array; successed: Array; } export declare namespace MoveKnowledgeBaseFilesResult { interface Failed { fileId: string; reason: string; } } export interface UpdateKnowledgeBaseRequest { avatar?: string | null; description?: string | null; enabled?: boolean | null; isPublic?: boolean | null; name?: string | null; settings?: { [key: string]: unknown; } | null; type?: 'personal' | 'shared' | null; } export interface KnowledgeBaseCreateParams { /** * Knowledge base name (required) */ name: string; /** * Knowledge base avatar URL */ avatar?: string | null; /** * Knowledge base description */ description?: string | null; /** * Whether the knowledge base is public (default false) */ isPublic?: boolean | null; /** * Knowledge base settings */ settings?: { [key: string]: unknown; } | null; /** * Knowledge base type (default personal) */ type?: 'personal' | 'shared' | null; } export interface KnowledgeBaseUpdateParams { /** * Knowledge base avatar URL */ avatar?: string | null; /** * Knowledge base description */ description?: string | null; /** * Whether the knowledge base is enabled */ enabled?: boolean | null; /** * Whether the knowledge base is public */ isPublic?: boolean | null; /** * Knowledge base name */ name?: string | null; /** * Knowledge base settings */ settings?: { [key: string]: unknown; } | null; /** * Knowledge base type */ type?: 'personal' | 'shared' | null; } export interface KnowledgeBaseListParams { /** * Filter by enabled status */ enabled?: boolean; /** * Search keyword for name or description (case-insensitive) */ keyword?: string; /** * Page number (default 1) */ page?: number; /** * Items per page (default 20, max 100) */ pageSize?: number; /** * Filter by knowledge base type */ type?: 'personal' | 'shared'; } export declare namespace KnowledgeBases { export { type APIResponseKnowledgeBase as APIResponseKnowledgeBase, type APIResponseKnowledgeBaseDelete as APIResponseKnowledgeBaseDelete, type APIResponseKnowledgeBaseFileOperation as APIResponseKnowledgeBaseFileOperation, type APIResponseKnowledgeBaseList as APIResponseKnowledgeBaseList, type APIResponseMoveKnowledgeBaseFiles as APIResponseMoveKnowledgeBaseFiles, type CreateKnowledgeBaseRequest as CreateKnowledgeBaseRequest, type KBAPIResponseFileList as KBAPIResponseFileList, type KBFile as KBFile, type KnowledgeBase as KnowledgeBase, type KnowledgeBaseFileOperationResult as KnowledgeBaseFileOperationResult, type KnowledgeBaseListItem as KnowledgeBaseListItem, type MoveKnowledgeBaseFilesResult as MoveKnowledgeBaseFilesResult, type UpdateKnowledgeBaseRequest as UpdateKnowledgeBaseRequest, type KnowledgeBaseCreateParams as KnowledgeBaseCreateParams, type KnowledgeBaseUpdateParams as KnowledgeBaseUpdateParams, type KnowledgeBaseListParams as KnowledgeBaseListParams, }; export { Files as Files, type KBAPIResponseFileOperation as KBAPIResponseFileOperation, type KBAPIResponseMoveFiles as KBAPIResponseMoveFiles, type FileListParams as FileListParams, type FileBatchAddParams as FileBatchAddParams, type FileBatchRemoveParams as FileBatchRemoveParams, type FileMoveParams as FileMoveParams, }; } //# sourceMappingURL=knowledge-bases.d.ts.map