Skip to main content

SearchClient

Client for interacting with Twist search endpoints.

Extends

  • BaseClient

Constructors

Constructor

new SearchClient(config: ClientConfig): SearchClient;

Parameters

ParameterType
configClientConfig

Returns

SearchClient

Inherited from

BaseClient.constructor

Properties

PropertyModifierType
apiTokenreadonlystring
baseUrl?readonlystring
customFetch?readonlyCustomFetch
defaultVersionreadonlyApiVersion

Methods

getBaseUri()

protected getBaseUri(version?: ApiVersion): string;

Gets the base URI for API requests with proper trailing slash handling. This method fixes the trailing slash bug that occurred when using custom baseUrl.

Parameters

ParameterTypeDescription
version?ApiVersionOptional API version override. Defaults to the configured version or 'v3'

Returns

string

Base URI with guaranteed trailing slash for proper URL resolution

Inherited from

BaseClient.getBaseUri

Call Signature

search(args: SearchArgs, options: {
batch: true;
}): BatchRequestDescriptor<SearchResponse>;

Searches across all threads and conversations in a workspace.

Parameters
ParameterTypeDescription
argsSearchArgsThe arguments for searching.
options{ batch: true; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batchtrue-
Returns

BatchRequestDescriptor<SearchResponse>

Search results with pagination.

Example
const results = await api.search.search({
query: 'important meeting',
import { BaseClient, type ClientConfig } from './base-client'
workspaceId: 123
})

Call Signature

search(args: SearchArgs, options?: {
batch?: false;
}): Promise<SearchResponse>;

Searches across all threads and conversations in a workspace.

Parameters
ParameterTypeDescription
argsSearchArgsThe arguments for searching.
options?{ batch?: false; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batch?false-
Returns

Promise<SearchResponse>

Search results with pagination.

Example
const results = await api.search.search({
query: 'important meeting',
import { BaseClient, type ClientConfig } from './base-client'
workspaceId: 123
})

searchConversation()

Call Signature

searchConversation(args: SearchConversationArgs, options: {
batch: true;
}): BatchRequestDescriptor<SearchConversationResponse>;

Searches within messages of a specific conversation.

Parameters
ParameterTypeDescription
argsSearchConversationArgsThe arguments for searching within a conversation.
options{ batch: true; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batchtrue-
Returns

BatchRequestDescriptor<SearchConversationResponse>

Message IDs that match the search query.

Example
const results = await api.search.searchConversation({
query: 'budget',
conversationId: 456
})

Call Signature

searchConversation(args: SearchConversationArgs, options?: {
batch?: false;
}): Promise<SearchConversationResponse>;

Searches within messages of a specific conversation.

Parameters
ParameterTypeDescription
argsSearchConversationArgsThe arguments for searching within a conversation.
options?{ batch?: false; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batch?false-
Returns

Promise<SearchConversationResponse>

Message IDs that match the search query.

Example
const results = await api.search.searchConversation({
query: 'budget',
conversationId: 456
})

searchThread()

Call Signature

searchThread(args: SearchThreadArgs, options: {
batch: true;
}): BatchRequestDescriptor<SearchThreadResponse>;

Searches within comments of a specific thread.

Parameters
ParameterTypeDescription
argsSearchThreadArgsThe arguments for searching within a thread.
options{ batch: true; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batchtrue-
Returns

BatchRequestDescriptor<SearchThreadResponse>

Comment IDs that match the search query.

Example
const results = await api.search.searchThread({
query: 'deadline',
threadId: 789
})

Call Signature

searchThread(args: SearchThreadArgs, options?: {
batch?: false;
}): Promise<SearchThreadResponse>;

Searches within comments of a specific thread.

Parameters
ParameterTypeDescription
argsSearchThreadArgsThe arguments for searching within a thread.
options?{ batch?: false; }Optional configuration. Set batch: true to return a descriptor for batch requests.
options.batch?false-
Returns

Promise<SearchThreadResponse>

Comment IDs that match the search query.

Example
const results = await api.search.searchThread({
query: 'deadline',
threadId: 789
})