import { Paginator } from "@aws-sdk/types" ; import { ListIdentityProvidersCommand , ListIdentityProvidersCommandInput , ListIdentityProvidersCommandOutput , } from "../commands/ListIdentityProvidersCommand" ; import { WorkSpacesWeb } from "../WorkSpacesWeb" ; import { WorkSpacesWebClient } from "../WorkSpacesWebClient" ; import { WorkSpacesWebPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListIdentityProvidersCommandOutput > => { return await client . send ( new ListIdentityProvidersCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListIdentityProvidersCommandOutput > => { return await client . listIdentityProviders ( input , ... args ) ; } ; export async function * paginateListIdentityProviders ( 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 WorkSpacesWeb ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof WorkSpacesWebClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected WorkSpacesWeb | WorkSpacesWebClient" ) ; } yield page ; token = page . nextToken ; hasNext = ! ! token ; } return undefined ; }