@whitebox-co/walmart-marketplace-api
Version:
A fully typed TypeScript, Javascript, and Node.js API library for the Walmart Marketplace API
21 lines (20 loc) • 1.06 kB
TypeScript
/**
* Request helper to help with pagination for endpoints that implement the `nextCursor` functionality.
*
* Will recursively request the endpoint until the nextCursor is null and will then return a concatenated array of
* requested data.
*
* @param {T} api The INSTANCE of an api (ex. ordersApi, inventoryApi, etc)
* @param {string} methodName The name of the instanced method to use for request (ex. ordersApi.getAllOrders.name)
* @param {object} requestParams The request parameters for the type of API.
* @param {string} nextCursor Data returned from previous response to handle requesting next pagination records - Optional and should be null for first call.
*
* Note: Please use with caution. It is possible for this to be long running and quickly consume your request
* rate limits!
*
* @returns {Promise<T[]>} Array of data based on the endpoint requested
*/
declare const getAllRecursively: <T>(api: T, methodName: string, requestParams?: {
limit: string;
}, nextCursor?: string) => Promise<T[]>;
export { getAllRecursively };