import { Paginator } from "@aws-sdk/types" ; import { Appflow } from "../Appflow" ; import { AppflowClient } from "../AppflowClient" ; import { DescribeConnectorsCommand , DescribeConnectorsCommandInput , DescribeConnectorsCommandOutput , } from "../commands/DescribeConnectorsCommand" ; import { AppflowPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < DescribeConnectorsCommandOutput > => { return await client . send ( new DescribeConnectorsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < DescribeConnectorsCommandOutput > => { return await client . describeConnectors ( input , ... args ) ; } ; export async function * paginateDescribeConnectors ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . nextToken = token ; if ( config . client instanceof Appflow ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof AppflowClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected Appflow | AppflowClient" ) ; } yield page ; token = page . nextToken ; hasNext = ! ! token ; } return undefined ; }