import { Paginator } from "@aws-sdk/types" ; import { DescribeModelVersionsCommand , DescribeModelVersionsCommandInput , DescribeModelVersionsCommandOutput , } from "../commands/DescribeModelVersionsCommand" ; import { FraudDetector } from "../FraudDetector" ; import { FraudDetectorClient } from "../FraudDetectorClient" ; import { FraudDetectorPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < DescribeModelVersionsCommandOutput > => { return await client . send ( new DescribeModelVersionsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < DescribeModelVersionsCommandOutput > => { return await client . describeModelVersions ( input , ... args ) ; } ; export async function * paginateDescribeModelVersions ( 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 FraudDetector ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof FraudDetectorClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected FraudDetector | FraudDetectorClient" ) ; } yield page ; token = page . nextToken ; hasNext = ! ! token ; } return undefined ; }