import { Paginator } from "@aws-sdk/types" ; import { DescribeFolderContentsCommand , DescribeFolderContentsCommandInput , DescribeFolderContentsCommandOutput , } from "../commands/DescribeFolderContentsCommand" ; import { WorkDocs } from "../WorkDocs" ; import { WorkDocsClient } from "../WorkDocsClient" ; import { WorkDocsPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < DescribeFolderContentsCommandOutput > => { return await client . send ( new DescribeFolderContentsCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < DescribeFolderContentsCommandOutput > => { return await client . describeFolderContents ( input , ... args ) ; } ; export async function * paginateDescribeFolderContents ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . Marker = token ; input [ "Limit" ] = config . pageSize ; if ( config . client instanceof WorkDocs ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof WorkDocsClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected WorkDocs | WorkDocsClient" ) ; } yield page ; token = page . Marker ; hasNext = ! ! token ; } return undefined ; }