ThreadsApi
Class: ThreadsApi
Defined in: CodeBolt/packages/clientsdk/src/api/threads.api.ts:28
Manages thread operations within the CodeBolt platform.
Threads represent execution units that can be created, monitored, and controlled through various states and lifecycle events. This API provides comprehensive functionality for thread management including CRUD operations, search, bulk operations, and execution control.
Constructors
Constructor
new ThreadsApi(http: HttpClient): ThreadsApi;
Defined in: CodeBolt/packages/clientsdk/src/api/threads.api.ts:29
Parameters
| Parameter | Type |
|---|---|
http | HttpClient |
Returns
ThreadsApi
Methods
advancedSearch()
advancedSearch(data: ThreadSearchRequest): Promise<Thread[]>;
Defined in: CodeBolt/packages/clientsdk/src/api/threads.api.ts:144
Performs an advanced search for threads based on multiple criteria.
Allows complex queries with filtering, sorting, and pagination to find threads matching specific conditions. Use this for flexible thread discovery and management operations.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | ThreadSearchRequest | The search request containing filter and query parameters |
Returns
Promise<Thread[]>
A promise that resolves to an array of matching Thread objects
Example
const results = await client.threads.advancedSearch({
status: 'active',
limit: 10
});
autoUpdateName()
autoUpdateName(data: AutoUpdateNameRequest): Promise<void>;
Defined in: CodeBolt/packages/clientsdk/src/api/threads.api.ts:206
Automatically updates a thread's name based on its content.
Analyzes the thread's execution history, messages, and context to generate an appropriate name that reflects its purpose and activity. This is useful for maintaining descriptive thread labels without manual intervention.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | AutoUpdateNameRequest | The request containing the thread ID to rename |
Returns
Promise<void>
A promise that resolves when the thread name has been updated
Example
await client.threads.autoUpdateName({ threadId: 'thread-123' });
bulkDelete()
bulkDelete(data: ThreadBulkDeleteRequest): Promise<void>;
Defined in: CodeBolt/packages/clientsdk/src/api/threads.api.ts:187
Deletes multiple threads in a single operation.
Removes the specified threads from the system in a bulk operation. This is more efficient than deleting threads individually and ensures atomic deletion of multiple threads.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | ThreadBulkDeleteRequest | The bulk delete request containing thread IDs to delete |
Returns
Promise<void>
A promise that resolves when all threads have been deleted
Example
await client.threads.bulkDelete({
threadIds: ['thread-1', 'thread-2', 'thread-3']
});
bulkUpdate()
bulkUpdate(data: ThreadBulkUpdateRequest): Promise<void>;
Defined in: CodeBolt/packages/clientsdk/src/api/threads.api.ts:166
Updates multiple threads in a single operation.
Performs bulk modifications across multiple threads simultaneously. This is more efficient than updating threads individually when you need to apply the same changes to many threads.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | ThreadBulkUpdateRequest | The bulk update request containing thread IDs and updates |
Returns
Promise<void>
A promise that resolves when all threads have been updated
Example
await client.threads.bulkUpdate({
threadIds: ['thread-1', 'thread-2'],
updates: { status: 'completed' }
});
cancel()
cancel(threadId: string): Promise<void>;
Defined in: CodeBolt/packages/clientsdk/src/api/threads.api.ts:415
Cancels the execution of a thread.
Terminates the thread's operations and places it in a cancelled state. Unlike pausing, this action cannot be reversed and the thread will not continue execution. Use this to stop threads that are no longer needed.
Parameters
| Parameter | Type | Description |
|---|---|---|
threadId | string | The unique identifier of the thread to cancel |
Returns
Promise<void>
A promise that resolves when the thread has been cancelled
Example
await client.threads.cancel('thread-123');
complete()
complete(threadId: string): Promise<void>;
Defined in: CodeBolt/packages/clientsdk/src/api/threads.api.ts:434
Marks a thread as completed.
Sets the thread's status to completed, indicating that its execution has finished successfully. This is typically done automatically by the thread, but can be called manually when needed.
Parameters
| Parameter | Type | Description |
|---|---|---|
threadId | string | The unique identifier of the thread to complete |
Returns
Promise<void>
A promise that resolves when the thread has been marked complete
Example
await client.threads.complete('thread-123');