Pagination Logic for Multi-Division Queue Fetch via Genesys Cloud JavaScript SDK

Trying to understand the correct recursive pattern for retrieving all queues across multiple divisions using the Genesys Cloud Platform SDK for JavaScript. I have been orchestrating data syncs between MuleSoft and Genesys Cloud for several years, primarily leveraging REST endpoints directly. However, I am now tasked with implementing a client-side dashboard component that requires fetching queue metadata. The challenge arises because our environment spans multiple divisions, and the standard getQueues method does not accept a division ID parameter in a way that simplifies iteration. I need to iterate through every division ID returned by the getDivisions endpoint and then fetch queues for each. My current implementation uses async/await with a simple for-loop, but I am concerned about rate limiting and the efficiency of the pagination logic within the SDK. Specifically, the SDK handles pagination automatically when pageSize is set, but I am unsure if the internal state resets correctly when switching division contexts. Here is the snippet I am testing:

const platformClient = require('@genesyscloud/purecloud-platform-client');

async function getAllQueues() {
 const divisions = await platformClient.DivisionsApi.getDivisions({ pageSize: 250 });
 const allQueues = [];
 
 for (const division of divisions.entities) {
 const queueResult = await platformClient.QueueApi.getQueues({ 
 divisionId: division.id,
 pageSize: 250
 });
 // How does the SDK handle subsequent pages for this specific division?
 allQueues.push(...queueResult.entities);
 }
 return allQueues;
}

When I inspect the response, I see nextPageLink, but I am not calling it explicitly. Does the SDK’s getQueues method automatically follow these links until completion for a single division, or do I need to manually implement the loop for nextPageLink before moving to the next division? I want to avoid hitting 429 Too Many Requests errors by making too many sequential calls. Any insights on the internal behavior of the JavaScript SDK regarding pagination state would be appreciated.

Thanks for the help.