import { Paginator } from "@aws-sdk/types" ; import { ListRegistriesCommand , ListRegistriesCommandInput , ListRegistriesCommandOutput , } from "../commands/ListRegistriesCommand" ; import { Schemas } from "../Schemas" ; import { SchemasClient } from "../SchemasClient" ; import { SchemasPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListRegistriesCommandOutput > => { return await client . send ( new ListRegistriesCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListRegistriesCommandOutput > => { return await client . listRegistries ( input , ... args ) ; } ; export async function * paginateListRegistries ( 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 Schemas ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof SchemasClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected Schemas | SchemasClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }