Doc

@julep/sdk / Modules / managers/doc / DocsManager

Class: DocsManager

managers/doc.DocsManager

BaseManager serves as the base class for all manager classes that interact with the Julep API. It provides common functionality needed for API interactions.

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DocsManager(apiClient): DocsManager

Constructs a new instance of BaseManager.

Parameters

NameTypeDescription

apiClient

The JulepApiClient instance used for API interactions.

Returns

DocsManager

Inherited from

BaseManager.constructor

Defined in

src/managers/base.ts:12

Properties

apiClient

apiClient: JulepApiClient

The JulepApiClient instance used for API interactions.

Inherited from

BaseManager.apiClient

Defined in

src/managers/base.ts:12

Methods

create

create(params): Promise<Doc>

Creates a document based on the provided agentId or userId. Ensures that only one of agentId or userId is provided using xor function. Validates the provided agentId or userId using isValidUuid4.

Parameters

NameTypeDescription

params

Object

The parameters for creating a document.

params.agentId?

string

The agent's unique identifier, if creating for an agent.

params.doc

The document to be created.

params.userId?

string

The user's unique identifier, if creating for a user.

Returns

Promise<Doc>

The created document.

Throws

If neither agentId nor userId is provided.

Defined in

src/managers/doc.ts:133


delete

delete(params): Promise<void>

Deletes a document based on the provided agentId or userId and the specific docId. Ensures that only one of agentId or userId is provided using xor function. Validates the provided agentId or userId using isValidUuid4.

Parameters

NameTypeDescription

params

Object

The parameters for deleting a document.

params.agentId?

string

The agent's unique identifier, if deleting for an agent.

params.docId

string

The unique identifier of the document to be deleted.

params.userId?

string

The user's unique identifier, if deleting for a user.

Returns

Promise<void>

A promise that resolves when the document is successfully deleted.

Throws

If neither agentId nor userId is provided.

Defined in

src/managers/doc.ts:186


get

get(params): Promise<{ items?: Doc[] }>

Retrieves documents based on the provided agentId or userId. Ensures that only one of agentId or userId is provided using xor function. Validates the provided agentId or userId using isValidUuid4.

Parameters

NameTypeDefault valueDescription

params

Object

undefined

The parameters for retrieving documents.

params.agentId?

string

undefined

The agent's unique identifier.

params.limit?

number

100

The maximum number of documents to return.

params.offset?

number

0

The offset from which to start the document retrieval.

params.userId?

string

undefined

The user's unique identifier.

Returns

Promise<{ items?: Doc[] }>

The retrieved documents.

Throws

If neither agentId nor userId is provided.

Defined in

src/managers/doc.ts:22


list

list(params?): Promise<Doc[]>

Lists documents based on the provided agentId or userId, with optional metadata filtering. Ensures that only one of agentId or userId is provided using xor function. Validates the provided agentId or userId using isValidUuid4. Allows for filtering based on metadata.

Parameters

NameTypeDefault valueDescription

params

Object

{}

The parameters for listing documents, including filtering options.

params.agentId?

string

undefined

The agent's unique identifier, if filtering by agent.

params.limit?

number

100

The maximum number of documents to return.

params.metadataFilter?

Object

{}

Optional metadata to filter the documents.

params.offset?

number

0

The offset from which to start the document listing.

params.userId?

string

undefined

The user's unique identifier, if filtering by user.

Returns

Promise<Doc[]>

The list of filtered documents.

Throws

If neither agentId nor userId is provided.

Defined in

src/managers/doc.ts:74

Last updated