import { Paginator } from "@aws-sdk/types" ; import { GetConformancePackComplianceSummaryCommand , GetConformancePackComplianceSummaryCommandInput , GetConformancePackComplianceSummaryCommandOutput , } from "../commands/GetConformancePackComplianceSummaryCommand" ; import { ConfigService } from "../ConfigService" ; import { ConfigServiceClient } from "../ConfigServiceClient" ; import { ConfigServicePaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < GetConformancePackComplianceSummaryCommandOutput > => { return await client . send ( new GetConformancePackComplianceSummaryCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < GetConformancePackComplianceSummaryCommandOutput > => { return await client . getConformancePackComplianceSummary ( input , ... args ) ; } ; export async function * paginateGetConformancePackComplianceSummary ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . NextToken = token ; input [ "Limit" ] = config . pageSize ; if ( config . client instanceof ConfigService ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof ConfigServiceClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected ConfigService | ConfigServiceClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }