import { Paginator } from "@aws-sdk/types" ; import { ListAccountSettingsCommand , ListAccountSettingsCommandInput , ListAccountSettingsCommandOutput , } from "../commands/ListAccountSettingsCommand" ; import { ECS } from "../ECS" ; import { ECSClient } from "../ECSClient" ; import { ECSPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListAccountSettingsCommandOutput > => { return await client . send ( new ListAccountSettingsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListAccountSettingsCommandOutput > => { return await client . listAccountSettings ( input , ... args ) ; } ; export async function * paginateListAccountSettings ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . nextToken = token ; input [ "maxResults" ] = config . pageSize ; if ( config . client instanceof ECS ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof ECSClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected ECS | ECSClient" ) ; } yield page ; token = page . nextToken ; hasNext = ! ! token ; } return undefined ; }