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

Commit

Permalink
Merge pull request #223 from JupiterOne/INT-9845-fix-6
Browse files Browse the repository at this point in the history
INT-9845: fix pagination
  • Loading branch information
gastonyelmini authored Dec 14, 2023
2 parents 85a3d5e + b5ce6ba commit 538c865
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/gsuite/clients/GSuiteInstalledAppsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ export class GSuiteInstalledAppsClient extends GSuiteChromeManagementClient {
): Promise<void> {
const client = await this.getAuthenticatedServiceClient();

const oneMonth = new Date();
oneMonth.setMonth(oneMonth.getMonth() - 1);
const oneMonthFormatted = oneMonth.toISOString().split('T')[0]; // Format date to YYYY-MM-DD
const sixMonths = new Date();
sixMonths.setMonth(sixMonths.getMonth() - 1);
const sixMonthsFormatted = sixMonths.toISOString().split('T')[0]; // Format date to YYYY-MM-DD

await this.iterateApi(
async () => {
async (nextPageToken) => {
return client.customers.reports.countInstalledApps({
pageToken: nextPageToken,
customer: `customers/${this.accountId}`,
filter: `app_type=${appType} AND latest_profile_active_date>=${oneMonthFormatted} AND total_install_count>0`,
filter: `app_type=${appType} AND latest_profile_active_date>=${sixMonthsFormatted} AND total_install_count>0`,
pageSize: 1000,
});
},
Expand Down

0 comments on commit 538c865

Please sign in to comment.