import { Paginator } from "@aws-sdk/types" ; import { ApplicationDiscoveryService } from "../ApplicationDiscoveryService" ; import { ApplicationDiscoveryServiceClient } from "../ApplicationDiscoveryServiceClient" ; import { DescribeContinuousExportsCommand , DescribeContinuousExportsCommandInput , DescribeContinuousExportsCommandOutput , } from "../commands/DescribeContinuousExportsCommand" ; import { ApplicationDiscoveryServicePaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < DescribeContinuousExportsCommandOutput > => { return await client . send ( new DescribeContinuousExportsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < DescribeContinuousExportsCommandOutput > => { return await client . describeContinuousExports ( input , ... args ) ; } ; export async function * paginateDescribeContinuousExports ( 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 ApplicationDiscoveryService ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof ApplicationDiscoveryServiceClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected ApplicationDiscoveryService | ApplicationDiscoveryServiceClient" ) ; } yield page ; token = page . nextToken ; hasNext = ! ! token ; } return undefined ; }