import { Paginator } from "@aws-sdk/types" ; import { ListSigningJobsCommand , ListSigningJobsCommandInput , ListSigningJobsCommandOutput , } from "../commands/ListSigningJobsCommand" ; import { Signer } from "../Signer" ; import { SignerClient } from "../SignerClient" ; import { SignerPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListSigningJobsCommandOutput > => { return await client . send ( new ListSigningJobsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListSigningJobsCommandOutput > => { return await client . listSigningJobs ( input , ... args ) ; } ; export async function * paginateListSigningJobs ( 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 Signer ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof SignerClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected Signer | SignerClient" ) ; } yield page ; token = page . nextToken ; hasNext = ! ! token ; } return undefined ; }