Improved Paginator Functionality #40
Open
animesh-tarodia-sp wants to merge 2 commits intosailpoint-oss:mainfrom
Open
Improved Paginator Functionality #40animesh-tarodia-sp wants to merge 2 commits intosailpoint-oss:mainfrom
animesh-tarodia-sp wants to merge 2 commits intosailpoint-oss:mainfrom
Conversation
Introduced paginateEach and paginateEachSearchApi: These generator functions allow you to iterate over each page individually, improving memory efficiency.
Added for AsyncGenerator support in Paginator
Author
|
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(); |
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added the
paginateEachandpaginateEachSearchApimethod 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.