import { Paginator } from "@aws-sdk/types" ; import { ListExperimentTemplatesCommand , ListExperimentTemplatesCommandInput , ListExperimentTemplatesCommandOutput , } from "../commands/ListExperimentTemplatesCommand" ; import { Fis } from "../Fis" ; import { FisClient } from "../FisClient" ; import { FisPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListExperimentTemplatesCommandOutput > => { return await client . send ( new ListExperimentTemplatesCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListExperimentTemplatesCommandOutput > => { return await client . listExperimentTemplates ( input , ... args ) ; } ; export async function * paginateListExperimentTemplates ( 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 Fis ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof FisClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected Fis | FisClient" ) ; } yield page ; token = page . nextToken ; hasNext = ! ! token ; } return undefined ; }