import { Paginator } from "@aws-sdk/types" ; import { ListAssociatedResourcesCommand , ListAssociatedResourcesCommandInput , ListAssociatedResourcesCommandOutput , } from "../commands/ListAssociatedResourcesCommand" ; import { ServiceCatalogAppRegistry } from "../ServiceCatalogAppRegistry" ; import { ServiceCatalogAppRegistryClient } from "../ServiceCatalogAppRegistryClient" ; import { ServiceCatalogAppRegistryPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListAssociatedResourcesCommandOutput > => { return await client . send ( new ListAssociatedResourcesCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListAssociatedResourcesCommandOutput > => { return await client . listAssociatedResources ( input , ... args ) ; } ; export async function * paginateListAssociatedResources ( 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 ServiceCatalogAppRegistry ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof ServiceCatalogAppRegistryClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected ServiceCatalogAppRegistry | ServiceCatalogAppRegistryClient" ) ; } yield page ; token = page . nextToken ; hasNext = ! ! token ; } return undefined ; }