BatchBuilder
Executes multiple API requests in a single HTTP call.
Example
const results = await api.batch(
api.workspaceUsers.getUserById(123, 456, { batch: true }),
api.workspaceUsers.getUserById(123, 789, { batch: true })
)
Constructors
Constructor
new BatchBuilder(apiToken: string, baseUrl?: string): BatchBuilder;
Parameters
Parameter | Type |
---|---|
apiToken | string |
baseUrl? | string |
Returns
BatchBuilder
Methods
execute()
execute<T>(requests: T): Promise<BatchResponseArray<T>>;
Executes an array of batch request descriptors in a single API call.
Type Parameters
Type Parameter |
---|
T extends readonly BatchRequestDescriptor <unknown >[] |
Parameters
Parameter | Type | Description |
---|---|---|
requests | T | Array of batch request descriptors |
Returns
Promise
<BatchResponseArray
<T
>>
Array of BatchResponse objects with processed data
Throws
If the batch request fails