Created
March 6, 2019 12:42
-
-
Save pizzacat83/6a4f1cc10bcfaf149a0f8ceed3a49188 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchAllDriveActivities = ( | |
root_folder_id: string, | |
since?: Date | string | |
): DriveActivityAPI.DriveActivity[] => { | |
let activities: DriveActivityAPI.DriveActivity[] = []; | |
let response: DriveActivityAPI.DriveActivityAPIResponse; | |
if (since instanceof Date) { | |
since = since.getTime().toString(); | |
} | |
do { | |
response = DriveActivity.Activity.query({ | |
ancestorName: 'items/' + root_folder_id, | |
filter: since ? `time > ${since}` : '', | |
pageToken: response ? response.nextPageToken || null : null, | |
consolidationStrategy: { legacy: {} } | |
}); | |
activities = activities.concat(response.activities); | |
} while (response.nextPageToken); | |
return activities; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment