cronofy / cronofy-node

Node wrapper for the Cronofy API
https://docs.cronofy.com/developers
MIT License
49 stars 23 forks source link

freeBusy with options: {next_page} fails #58

Closed cyrep closed 6 years ago

cyrep commented 6 years ago

If you set the 'next_page' option, the request is made to . -->'https://api-de.cronofy.comhttps://api-de.cronofy.com/v1/free_busy/pages/pageId'

The exact same code (but with readEvents()) works fine.

Code: let freeBusy = [];

const options = { from: moment().toISOString(), to: moment().add(1, 'day').toISOString(), tzid: this.tzid };

while(true) { const freeBusyList = await this.cronofyClient.freeBusy(options); freeBusy = freeBusy.concat(freeBusyList.free_busy);

/ Fails at 2nd run with error: { url: 'https://api-de.cronofy.comhttps://api-de.cronofy.com/v1/free_busy/pages/pageId', entity: undefined } } /

options['next_page'] = freeBusyList.pages.next_page || null; if (!freeBusyList.pages.next_page) { break; } }