import { Paginator } from "@aws-sdk/types" ; import { ListResiliencyPoliciesCommand , ListResiliencyPoliciesCommandInput , ListResiliencyPoliciesCommandOutput , } from "../commands/ListResiliencyPoliciesCommand" ; import { Resiliencehub } from "../Resiliencehub" ; import { ResiliencehubClient } from "../ResiliencehubClient" ; import { ResiliencehubPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListResiliencyPoliciesCommandOutput > => { return await client . send ( new ListResiliencyPoliciesCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListResiliencyPoliciesCommandOutput > => { return await client . listResiliencyPolicies ( input , ... args ) ; } ; export async function * paginateListResiliencyPolicies ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . nextToken = token ; if ( config . client instanceof Resiliencehub ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof ResiliencehubClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected Resiliencehub | ResiliencehubClient" ) ; } yield page ; token = page . nextToken ; hasNext = ! ! token ; } return undefined ; }