pagination.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from "./core.js";
  2. export interface PageResponse<Item> {
  3. data: Array<Item>;
  4. object: string;
  5. }
  6. /**
  7. * Note: no pagination actually occurs yet, this is for forwards-compatibility.
  8. */
  9. export declare class Page<Item> extends AbstractPage<Item> implements PageResponse<Item> {
  10. data: Array<Item>;
  11. object: string;
  12. constructor(client: APIClient, response: Response, body: PageResponse<Item>, options: FinalRequestOptions);
  13. getPaginatedItems(): Item[];
  14. /**
  15. * This page represents a response that isn't actually paginated at the API level
  16. * so there will never be any next page params.
  17. */
  18. nextPageParams(): null;
  19. nextPageInfo(): null;
  20. }
  21. export interface CursorPageResponse<Item> {
  22. data: Array<Item>;
  23. has_more: boolean;
  24. }
  25. export interface CursorPageParams {
  26. after?: string;
  27. limit?: number;
  28. }
  29. export declare class CursorPage<Item extends {
  30. id: string;
  31. }> extends AbstractPage<Item> implements CursorPageResponse<Item> {
  32. data: Array<Item>;
  33. has_more: boolean;
  34. constructor(client: APIClient, response: Response, body: CursorPageResponse<Item>, options: FinalRequestOptions);
  35. getPaginatedItems(): Item[];
  36. hasNextPage(): boolean;
  37. nextPageParams(): Partial<CursorPageParams> | null;
  38. nextPageInfo(): PageInfo | null;
  39. }
  40. //# sourceMappingURL=pagination.d.ts.map