ReactionsClient
Client for interacting with Twist reaction endpoints.
Extends
BaseClient
Constructors
Constructor
new ReactionsClient(config: ClientConfig): ReactionsClient;
Parameters
| Parameter | Type |
|---|---|
config | ClientConfig |
Returns
ReactionsClient
Inherited from
BaseClient.constructor
Properties
| Property | Modifier | Type |
|---|---|---|
apiToken | readonly | string |
baseUrl? | readonly | string |
customFetch? | readonly | CustomFetch |
defaultVersion | readonly | ApiVersion |
Methods
add()
Call Signature
add(args: AddReactionArgs, options: {
batch: true;
}): BatchRequestDescriptor<void>;
Adds an emoji reaction to a thread, comment, or conversation message.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | AddReactionArgs | The arguments for adding a reaction. |
options | { batch: true; } | Optional configuration. Set batch: true to return a descriptor for batch requests. |
options.batch | true | - |
Returns
BatchRequestDescriptor<void>
Example
await api.reactions.add({ threadId: 789, reaction: '👍' })
// Batch usage
const batch = api.createBatch()
batch.add(() => api.reactions.add({ threadId: 789, reaction: '👍' }, { batch: true }))
Call Signature
add(args: AddReactionArgs, options?: {
batch?: false;
}): Promise<void>;
Adds an emoji reaction to a thread, comment, or conversation message.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | AddReactionArgs | The arguments for adding a reaction. |
options? | { batch?: false; } | Optional configuration. Set batch: true to return a descriptor for batch requests. |
options.batch? | false | - |
Returns
Promise<void>
Example
await api.reactions.add({ threadId: 789, reaction: '👍' })
// Batch usage
const batch = api.createBatch()
batch.add(() => api.reactions.add({ threadId: 789, reaction: '👍' }, { batch: true }))
get()
Call Signature
get(args: GetReactionsArgs, options: {
batch: true;
}): BatchRequestDescriptor<ReactionObject>;
Gets reactions for a thread, comment, or conversation message.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetReactionsArgs | The arguments for getting reactions. |
options | { batch: true; } | Optional configuration. Set batch: true to return a descriptor for batch requests. |
options.batch | true | - |
Returns
BatchRequestDescriptor<ReactionObject>
A reaction object with emoji reactions as keys and arrays of user IDs as values, or null if no reactions.
Example
const reactions = await api.reactions.get({ threadId: 789 })
// Returns: { "👍": [1, 2, 3], "❤️": [4, 5] }
Call Signature
get(args: GetReactionsArgs, options?: {
batch?: false;
}): Promise<ReactionObject>;
Gets reactions for a thread, comment, or conversation message.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | GetReactionsArgs | The arguments for getting reactions. |
options? | { batch?: false; } | Optional configuration. Set batch: true to return a descriptor for batch requests. |
options.batch? | false | - |
Returns
Promise<ReactionObject>
A reaction object with emoji reactions as keys and arrays of user IDs as values, or null if no reactions.
Example
const reactions = await api.reactions.get({ threadId: 789 })
// Returns: { "👍": [1, 2, 3], "❤️": [4, 5] }
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
| Parameter | Type | Description |
|---|---|---|
version? | ApiVersion | Optional 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
remove()
Call Signature
remove(args: RemoveReactionArgs, options: {
batch: true;
}): BatchRequestDescriptor<void>;
Removes an emoji reaction from a thread, comment, or conversation message.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | RemoveReactionArgs | The arguments for removing a reaction. |
options | { batch: true; } | Optional configuration. Set batch: true to return a descriptor for batch requests. |
options.batch | true | - |
Returns
BatchRequestDescriptor<void>
Example
await api.reactions.remove({ threadId: 789, reaction: '👍' })
Call Signature
remove(args: RemoveReactionArgs, options?: {
batch?: false;
}): Promise<void>;
Removes an emoji reaction from a thread, comment, or conversation message.
Parameters
| Parameter | Type | Description |
|---|---|---|
args | RemoveReactionArgs | The arguments for removing a reaction. |
options? | { batch?: false; } | Optional configuration. Set batch: true to return a descriptor for batch requests. |
options.batch? | false | - |
Returns
Promise<void>
Example
await api.reactions.remove({ threadId: 789, reaction: '👍' })