import { Paginator } from "@aws-sdk/types" ; import { ListSignalingChannelsCommand , ListSignalingChannelsCommandInput , ListSignalingChannelsCommandOutput , } from "../commands/ListSignalingChannelsCommand" ; import { KinesisVideo } from "../KinesisVideo" ; import { KinesisVideoClient } from "../KinesisVideoClient" ; import { KinesisVideoPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListSignalingChannelsCommandOutput > => { return await client . send ( new ListSignalingChannelsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListSignalingChannelsCommandOutput > => { return await client . listSignalingChannels ( input , ... args ) ; } ; export async function * paginateListSignalingChannels ( 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 KinesisVideo ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof KinesisVideoClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected KinesisVideo | KinesisVideoClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }