ReactionsClient
Client for interacting with Twist reaction endpoints.
Constructors
Constructor
new ReactionsClient(apiToken: string, baseUrl?: string): ReactionsClient;
Parameters
Parameter | Type |
---|---|
apiToken | string |
baseUrl? | string |
Returns
ReactionsClient
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] }
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: '👍' })