Skip to content

Commit

Permalink
Merge pull request #20 from integration-os/feat/pagination-helper
Browse files Browse the repository at this point in the history
chore: remove required pagination helper initialization
  • Loading branch information
paulkr authored Oct 17, 2024
2 parents 581b8bd + 0031850 commit adc0627
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 114 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@integrationos/node",
"version": "4.1.10",
"version": "4.1.11",
"description": "Node SDK for the IntegrationOS Unified API",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
8 changes: 5 additions & 3 deletions src/paginate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ export class PaginationHelper<T> {

constructor(
private fetchFunction: PaginationHelperFetch<T>,
private listParams: ListFilter = {
limit: 25
}
private listParams: ListFilter = {}
) { }

async initialize(): Promise<void> {
Expand Down Expand Up @@ -60,6 +58,10 @@ export class PaginationHelper<T> {
}

hasMoreData(): boolean {
if (!this.isInitialized) {
return true;
}

return this.currentBatch.length > 0 || (this.nextBatch !== null && this.nextBatch.length > 0);
}
}
Loading

0 comments on commit adc0627

Please sign in to comment.