import { Paginator } from "@aws-sdk/types" ; import { ListDeliverabilityTestReportsCommand , ListDeliverabilityTestReportsCommandInput , ListDeliverabilityTestReportsCommandOutput , } from "../commands/ListDeliverabilityTestReportsCommand" ; import { SESv2 } from "../SESv2" ; import { SESv2Client } from "../SESv2Client" ; import { SESv2PaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < ListDeliverabilityTestReportsCommandOutput > => { return await client . send ( new ListDeliverabilityTestReportsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < ListDeliverabilityTestReportsCommandOutput > => { return await client . listDeliverabilityTestReports ( input , ... args ) ; } ; export async function * paginateListDeliverabilityTestReports ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . NextToken = token ; input [ "PageSize" ] = config . pageSize ; if ( config . client instanceof SESv2 ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof SESv2Client ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected SESv2 | SESv2Client" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }