import { Paginator } from "@aws-sdk/types" ; import { ListInvitationsCommand , ListInvitationsCommandInput , ListInvitationsCommandOutput , } from "../commands/ListInvitationsCommand" ; import { ManagedBlockchain } from "../ManagedBlockchain" ; import { ManagedBlockchainClient } from "../ManagedBlockchainClient" ; import { ManagedBlockchainPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListInvitationsCommandOutput > => { return await client . send ( new ListInvitationsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListInvitationsCommandOutput > => { return await client . listInvitations ( input , ... args ) ; } ; export async function * paginateListInvitations ( 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 ManagedBlockchain ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof ManagedBlockchainClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected ManagedBlockchain | ManagedBlockchainClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }