import { Paginator } from "@aws-sdk/types" ; import { GetDevicePositionHistoryCommand , GetDevicePositionHistoryCommandInput , GetDevicePositionHistoryCommandOutput , } from "../commands/GetDevicePositionHistoryCommand" ; import { Location } from "../Location" ; import { LocationClient } from "../LocationClient" ; import { LocationPaginationConfiguration } from "./Interfaces" ; private const makePagedClientRequest = async ( client , input , ... args ) : Promise < GetDevicePositionHistoryCommandOutput > => { return await client . send ( new GetDevicePositionHistoryCommand ( input ) , ... args ) ; } ; private const makePagedRequest = async ( client , input , ... args ) : Promise < GetDevicePositionHistoryCommandOutput > => { return await client . getDevicePositionHistory ( input , ... args ) ; } ; export async function * paginateGetDevicePositionHistory ( config , input , ... additionalArguments ) { let token = config . startingToken || undefined ; let hasNext = true ; let page ; while ( hasNext ) { input . NextToken = token ; if ( config . client instanceof Location ) { page = await makePagedRequest ( config . client , input , ... additionalArguments ) ; } else if ( config . client instanceof LocationClient ) { page = await makePagedClientRequest ( config . client , input , ... additionalArguments ) ; } else { throw new Error ( "Invalid client, expected Location | LocationClient" ) ; } yield page ; token = page . NextToken ; hasNext = ! ! token ; } return undefined ; }