@clickup/rest-client / Exports
- RestClient
- RestRequest
- RestResponse
- RestStream
- RestContentSizeOverLimitError
- RestError
- RestRateLimitError
- RestResponseError
- RestRetriableError
- RestTimeoutError
- RestTokenInvalidError
▸ depaginate<TItem
, TCursor
>(readFunc
): AsyncGenerator
<TItem
, void
, undefined
>
Keeps calling a function with an updating cursor, and depaginates all the results until the cursor returned is null or undefined.
On each call, the inner function needs to return an array with two elements:
- Array or results, which could be empty, but not null or undefined.
- A new cursor.
Name | Type |
---|---|
TItem |
TItem |
TCursor |
string |
Name | Type |
---|---|
readFunc |
(cursor : undefined | TCursor ) => Promise <readonly [TItem [], undefined | null | TCursor ]> |
AsyncGenerator
<TItem
, void
, undefined
>
▸ paceRequests(pacer
, delayMetric?
): Middleware
Rest Client middleware that adds some delay between requests using one of Pacer implementations.
Name | Type |
---|---|
pacer |
null | Pacer | (req : RestRequest <any >) => Promise <null | Pacer > |
delayMetric? |
(delay : number , reason : string ) => void |