Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Add pagination to custom profile steps #30

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to

## [Unreleased]

## 1.4.1 - 2024-08-16

### Added

- Pagination to custom profile step

## 1.4.0 - 2024-07-12

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jupiterone/graph-kandji",
"version": "1.4.0",
"version": "1.4.1",
"description": "A JupiterOne Integration for ingesting data of Kandji",
"repository": {
"type": "git",
Expand Down
21 changes: 12 additions & 9 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,19 @@ export class APIClient {
public async iterateCustomProfiles(
iteratee: ResourceIteratee<CustomProfiles>,
) {
const endpoint = this.withBaseUri('library/custom-profiles', {
page: '1',
});

const body = await this.request<CustomProfiles[]>(endpoint);
const results = (body as any).results;
let page = '1';
do {
const endpoint = this.withBaseUri('library/custom-profiles', {
page: page,
});

for (const result of results) {
await iteratee(result);
}
const body = await this.request<CustomProfiles[]>(endpoint);
const results = (body as any).results;
page = (body as any).next;
for (const result of results) {
await iteratee(result);
}
} while (page != null);
}
public async iterateDevices(iteratee: ResourceIteratee<Device>) {
let offset = 0;
Expand Down
Loading