Navigate paginated API results
masterIf an endpoint supports pagination, the SDK provides .next(), .previous(), .last(), and .first() methods to access subsequent or previous pages. You pass the current response object into these methods. If no page is available, the promise resolves to null.
amadeus.referenceData.locations.get({
keyword: 'LON',
subType: 'AIRPORT,CITY'
}).then(function(response){
console.log(response.data); // first page
return amadeus.next(response);
}).then(function(nextResponse){
if (nextResponse) {
console.log(nextResponse.data); // second page
}
});