import { Paginator } from "@aws-sdk/types" ; import { ListPricesCommand , ListPricesCommandInput , ListPricesCommandOutput } from "../commands/ListPricesCommand" ; import { Route53Domains } from "../Route53Domains" ; import { Route53DomainsClient } from "../Route53DomainsClient" ; import { Route53DomainsPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListPricesCommandOutput > => { return await client . send ( new ListPricesCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListPricesCommandOutput > => { return await client . listPrices ( input , ... args ) ; } ; export async function * paginateListPrices ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . Marker = token ; input [ "MaxItems" ] = config . pageSize ; if ( config . client instanceof Route53Domains ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof Route53DomainsClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected Route53Domains | Route53DomainsClient" ) ; } yield page ; token = page . NextPageMarker ; hasNext = ! ! token ; } return undefined ; }