SearchClient
Client for interacting with Twist search endpoints.
Constructors
Constructor
new SearchClient(apiToken: string, baseUrl?: string): SearchClient;
Parameters
Parameter | Type |
---|---|
apiToken | string |
baseUrl? | string |
Returns
SearchClient
Methods
search()
Call Signature
search(args: SearchArgs, options: {
batch: true;
}): BatchRequestDescriptor<SearchResponse>;
Searches across all threads and conversations in a workspace.
Parameters
Parameter | Type | Description |
---|---|---|
args | SearchArgs | The arguments for searching. |
options | { batch : true ; } | Optional configuration. Set batch: true to return a descriptor for batch requests. |
options.batch | true | - |
Returns
BatchRequestDescriptor
<SearchResponse
>
Search results with pagination.
Example
const results = await api.search.search({
query: 'important meeting',
workspaceId: 123
})
Call Signature
search(args: SearchArgs, options?: {
batch?: false;
}): Promise<SearchResponse>;
Searches across all threads and conversations in a workspace.
Parameters
Parameter | Type | Description |
---|---|---|
args | SearchArgs | The 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',
workspaceId: 123
})
searchConversation()
Call Signature
searchConversation(args: SearchConversationArgs, options: {
batch: true;
}): BatchRequestDescriptor<SearchConversationResponse>;
Searches within messages of a specific conversation.
Parameters
Parameter | Type | Description |
---|---|---|
args | SearchConversationArgs | The arguments for searching within a conversation. |
options | { batch : true ; } | Optional configuration. Set batch: true to return a descriptor for batch requests. |
options.batch | true | - |
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
Parameter | Type | Description |
---|---|---|
args | SearchConversationArgs | The 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
Parameter | Type | Description |
---|---|---|
args | SearchThreadArgs | The arguments for searching within a thread. |
options | { batch : true ; } | Optional configuration. Set batch: true to return a descriptor for batch requests. |
options.batch | true | - |
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
Parameter | Type | Description |
---|---|---|
args | SearchThreadArgs | The 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
})