UNPKG

@squidcloud/client

Version:

A typescript implementation of the Squid client

86 lines (85 loc) 4.11 kB
import { AiContextMetadata } from '../../internal-common/src/public-types/ai-agent.public-types'; /** * Response to a request to get the access token for a personal storage service. * @category Personal Storage */ export interface PsGetAccessTokenResponse { /** The access token for the personal storage service. */ accessToken: string; /** The expiration time of the access token. */ expirationTime: Date; } /** * The type of a document in personal storage. * @category Personal Storage */ export type PsDocumentType = 'file' | 'folder'; /** * A document indexed for AI processing (as part of the personal storage connector). * @category Personal Storage */ export interface PsIndexedDocument { /** The ID of the document. */ id: string; /** The name of the document. */ name: string; /** The type of the document (file or folder). */ type: PsDocumentType; /** Metadata stored about the document */ metadata: AiContextMetadata; /** The ID of the parent folder of the document. */ folderDocumentId?: string; } /** * Client to handle personal storage integrations such as Google Drive or Microsoft OneDrive. * Provides methods for saving authentication tokens, indexing documents or folders for AI processing, * and unindexing documents from AI processing. * @category Personal Storage */ export declare class PersonalStorageClient { private readonly integrationId; private readonly rpcManager; /** * Saves an authentication token for the personal storage service. * * @param authCode - The authorization code obtained from the OAuth flow for the personal storage service. * @param identifier - A user-provided identifier (usually a user ID) that will be associated with the token. * @returns A promise that resolves with the access token and expiration time. */ saveAuthCode(authCode: string, identifier: string): Promise<PsGetAccessTokenResponse>; /** * Retrieves an access token for the personal storage service. * * @param identifier - A user-provided identifier (usually a user ID) that is associated with the token. * @returns A promise that resolves with the access token and expiration time. */ getAccessToken(identifier: string): Promise<PsGetAccessTokenResponse>; /** * Indexes a document or folder for AI processing. * * @param documentOrFolderId - The ID of the document or folder to be indexed. * @param identifier - A user-provided identifier (usually a user ID) that will be associated with the document. * @param agentId - The agent ID for the AI processing configuration. * @param metadata - Metadata to include with the index * @returns A promise that resolves when the document or folder is successfully indexed. */ indexDocumentOrFolder(documentOrFolderId: string, identifier: string, agentId: string, metadata?: AiContextMetadata): Promise<void>; /** * Lists all documents or folders that have been indexed for AI processing. * * @param identifier - A user-provided identifier (usually a user ID) associated with the indexed documents. * @param agentId - The AI agent ID used when indexing the documents. * @param type - (Optional) The type of items to list: `'file'` or `'folder'`. If omitted, returns both. * @returns A promise that resolves with an array of indexed documents or folders. */ listIndexedDocuments(identifier: string, agentId: string, type?: PsDocumentType): Promise<Array<PsIndexedDocument>>; /** * Unindexes a previously indexed document, removing it from AI processing. * * @param documentId - The ID of the document to be unindexed. * @param identifier - A user-provided identifier (usually a user ID) that was associated with the document. * @param agentId - The agent ID for the AI processing configuration. * @returns A promise that resolves when the document is successfully unindexed. */ unindexDocument(documentId: string, identifier: string, agentId: string): Promise<void>; }