Skip to content

Commit

Permalink
Merge pull request #270 from DougMidgley/develop
Browse files Browse the repository at this point in the history
Extended August 31 2023 release of SFMC-SDK
  • Loading branch information
DougMidgley authored Aug 31, 2023
2 parents 0f7e0b4 + 06d5624 commit e9b2f05
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default class Rest {
* @param {string} [iteratorField] attribute of the response to iterate over (only required if it's not 'items'|'definitions'|'entry')
* @returns {Promise.<object>} API response combined items
*/
async getBulk(url, pageSize, iteratorField) {
async getBulk(url, pageSize = 50, iteratorField) {
let page = 1;
const baseUrl = url.split('?')[0];
const isTransactionalMessageApi = this._isTransactionalMessageApi(baseUrl);
Expand All @@ -88,7 +88,7 @@ export default class Rest {
pageSize = 50;
}
}
queryParameters.set(pageSizeKey, Number(pageSize || 50).toString());
queryParameters.set(pageSizeKey, Number(pageSize).toString());
do {
queryParameters.set(pageKey, Number(page).toString());
const responseBatch = await this._apiRequest(
Expand Down Expand Up @@ -143,8 +143,7 @@ export default class Rest {
page++;
shouldPaginate = true;
if (this.options?.eventHandlers?.onLoop) {
// eslint-disable-next-line unicorn/no-null
this.options.eventHandlers.onLoop(null, collector?.[iteratorField]);
this.options.eventHandlers.onLoop(undefined, collector?.[iteratorField]);
}
}
} while (shouldPaginate);
Expand Down

0 comments on commit e9b2f05

Please sign in to comment.