Skip to main content

Class: PersonalStorageClient

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.

Methods

extractDataFromDocument

extractDataFromDocument(documentId, identifier): Promise<DocumentTextDataResponse>

Extracts text data from a document.

Parameters

NameTypeDescription
documentIdstringThe ID of the document to extract text data from.
identifierstringA user-provided identifier (usually a user ID) that is associated with the document.

Returns

Promise<DocumentTextDataResponse>

A promise that resolves with the extracted text data.


getAccessToken

getAccessToken(identifier): Promise<PsGetAccessTokenResponse>

Retrieves an access token for the personal storage service.

Parameters

NameTypeDescription
identifierstringA user-provided identifier (usually a user ID) that is associated with the token.

Returns

Promise<PsGetAccessTokenResponse>

A promise that resolves with the access token and expiration time.


indexDocumentOrFolder

indexDocumentOrFolder(documentOrFolderId, identifier, aiIntegrationId, aiProfileId, metadata?): Promise<void>

Indexes a document or folder for AI processing.

Parameters

NameTypeDescription
documentOrFolderIdstringThe ID of the document or folder to be indexed.
identifierstringA user-provided identifier (usually a user ID) that will be associated with the document.
aiIntegrationIdstringThe integration ID for the AI processing configuration.
aiProfileIdstringThe profile ID for the AI processing configuration.
metadata?AiContextMetadataMetadata to include with the index

Returns

Promise<void>

A promise that resolves when the document or folder is successfully indexed.


saveAuthCode

saveAuthCode(authCode, identifier): Promise<PsGetAccessTokenResponse>

Saves an authentication token for the personal storage service.

Parameters

NameTypeDescription
authCodestringThe authorization code obtained from the OAuth flow for the personal storage service.
identifierstringA user-provided identifier (usually a user ID) that will be associated with the token.

Returns

Promise<PsGetAccessTokenResponse>

A promise that resolves with the access token and expiration time.


unindexDocument

unindexDocument(documentId, identifier, aiProfileId, aiIntegrationId): Promise<void>

Unindexes a previously indexed document, removing it from AI processing.

Parameters

NameTypeDescription
documentIdstringThe ID of the document to be unindexed.
identifierstringA user-provided identifier (usually a user ID) that was associated with the document.
aiProfileIdstringThe profile ID for the AI processing configuration.
aiIntegrationIdstringThe integration ID for the AI processing configuration.

Returns

Promise<void>

A promise that resolves when the document is successfully unindexed.