import { Paginator } from "@aws-sdk/types" ; import { GetAttributeValuesCommand , GetAttributeValuesCommandInput , GetAttributeValuesCommandOutput , } from "../commands/GetAttributeValuesCommand" ; import { Pricing } from "../Pricing" ; import { PricingClient } from "../PricingClient" ; import { PricingPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < GetAttributeValuesCommandOutput > => { return await client . send ( new GetAttributeValuesCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < GetAttributeValuesCommandOutput > => { return await client . getAttributeValues ( input , ... args ) ; } ; export async function * paginateGetAttributeValues ( 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 Pricing ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof PricingClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected Pricing | PricingClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }