import { Paginator } from "@aws-sdk/types" ; import { ChimeSDKMeetings } from "../ChimeSDKMeetings" ; import { ChimeSDKMeetingsClient } from "../ChimeSDKMeetingsClient" ; import { ListAttendeesCommand , ListAttendeesCommandInput , ListAttendeesCommandOutput , } from "../commands/ListAttendeesCommand" ; import { ChimeSDKMeetingsPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListAttendeesCommandOutput > => { return await client . send ( new ListAttendeesCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListAttendeesCommandOutput > => { return await client . listAttendees ( input , ... args ) ; } ; export async function * paginateListAttendees ( 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 ChimeSDKMeetings ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof ChimeSDKMeetingsClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected ChimeSDKMeetings | ChimeSDKMeetingsClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }