fastify-xhubspot
deals.list
Page through all HubSpot deals with optional limit and cursor-based pagination.
deals.list
Retrieve a paginated list of HubSpot deals.
Signature
fastify.deals.list(options?: {
limit?: number;
after?: string;
}): Promise<{
deals: Array<{ id: string; properties: Record<string, string> }>;
paging?: { next?: { after: string } };
}>
Params
| Name | Type | Required | Description |
|---|---|---|---|
options.limit | number | No | Max deals per page. Default: 100. |
options.after | string | No | Cursor from paging.next.after for the next page. |
Returns
{ deals, paging }.
Throws
Re-throws HubSpot API errors.
Examples
Basic
const { deals } = await fastify.deals.list({ limit: 50 });
Paginate all deals
async function getAllDeals(fastify) {
const all = [];
let after;
do {
const result = await fastify.deals.list({ limit: 100, after });
all.push(...result.deals);
after = result.paging?.next?.after;
} while (after);
return all;
}
See also
- deals.search — filter by stage or amount
AI Context
package: "@xenterprises/fastify-xhubspot"
method: fastify.deals.list(options?)
use-when: Page through all HubSpot deals
returns: { results, paging }
