Pagination

Both TypeScript and Python SDKs handle pagination automatically. The SDKs return paginated responses that you can iterate through to access all data.

Basic Pagination

import { Fathom } from 'fathom-typescript';

const fathom = new Fathom({
  security: {
    apiKeyAuth: "YOUR_API_KEY"
  }
});

const result = await fathom.listMeetings({});

for await (const page of result) {
  console.log(page);
}

Processing All Data

Here’s how to collect all data from paginated responses:
import { Fathom } from 'fathom-typescript';

async function getAllMeetings() {
  const fathom = new Fathom({
    security: {
      apiKeyAuth: "YOUR_API_KEY"
    }
  });

  const result = await fathom.listMeetings({});
  const allMeetings: any[] = [];
  
  for await (const page of result) {
    if (page.items) {
      allMeetings.push(...page.items);
    }
  }
  
  console.log(`Total meetings: ${allMeetings.length}`);
  return allMeetings;
}

Pagination Best Practices

  1. Use async iteration (TypeScript): The for await...of syntax is the recommended way to handle pagination
  2. Use while loops (Python): The while res is not None pattern is the standard approach
  3. Process incrementally: For large datasets, consider processing each page as it comes rather than collecting all data in memory
  4. Handle errors: Wrap pagination in try-catch blocks for robust error handling (see Error Handling)
  5. Respect rate limits: The SDK handles rate limiting automatically, but be mindful of API usage