import { Paginator } from "@aws-sdk/types" ; import { ListFHIRExportJobsCommand , ListFHIRExportJobsCommandInput , ListFHIRExportJobsCommandOutput , } from "../commands/ListFHIRExportJobsCommand" ; import { HealthLake } from "../HealthLake" ; import { HealthLakeClient } from "../HealthLakeClient" ; import { HealthLakePaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListFHIRExportJobsCommandOutput > => { return await client . send ( new ListFHIRExportJobsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListFHIRExportJobsCommandOutput > => { return await client . listFHIRExportJobs ( input , ... args ) ; } ; export async function * paginateListFHIRExportJobs ( 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 HealthLake ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof HealthLakeClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected HealthLake | HealthLakeClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }