Skip to content

Conversation

@anitarodia
Copy link

Added the paginateEach and paginateEachSearchApi method to the Paginator class.

This method returns an async iterable, allowing users to iterate over pages of results using the for await...of syntax.This provides an efficient way to process large datasets page by page, reducing memory usage by handling each page individually.

Introduced paginateEach and paginateEachSearchApi: These generator functions allow you to iterate over each page individually, improving memory efficiency.
Added for AsyncGenerator support in Paginator
@anitarodia
Copy link
Author

anitarodia commented Aug 27, 2024

Example:

import { Configuration, AccountsApi, Paginator } from 'sailpoint-api-client';

const processAccountsPageByPage = async () => {
  let apiConfig = new Configuration();
  let api = new AccountsApi(apiConfig);

  // Using paginateEach to process each page individually
  for await (const page of Paginator.paginateEach(
    api,
    api.listAccounts,
    { limit: 1000 }, // Request a total of 1000 accounts
    250              // Page size of 250 accounts
  )) {
    console.log(page.forEach(account => console.log(account)));
    // Process each page of results here
  }
};

processAccountsPageByPage();

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants