INNER CODE UNIT · TypeScript
getAWSPagedResults
amplify-education/serverless-domain-manager · src/utils.ts:51
async function getAWSPagedResults<ClientOutput, ClientInputCommand extends object, ClientOutputCommand extends MetadataBearer> (
client: Client<any, any, any, any>,
resultsKey: keyof ClientOutputCommand,
nextTokenKey: keyof ClientInputCommand,
nextRequestTokenKey: keyof ClientOutputCommand,
params: Command<any, any, any>
): Promise<ClientOutput[]> {
let results = [];
let response = await client.send(params);
results = results.concat(response[resultsKey] || results);
while ((nextRequestTokenKey in response) && response[nextRequestTokenKey]) {
params.input[nextTokenKey] = response[nextRequestTokenKey];
response = await client.send(params);
results = results.concat(response[resultsKey]);
}
return results;
}