TheJumpCloud / jcapi-powershell

MIT License
10 stars 3 forks source link

support for token based pagination #60

Closed jworkmanjc closed 1 year ago

jworkmanjc commented 1 year ago

Issues

What does this solve?

Previously generated functions, Get-JCSdkGSuiteUsersToImport, Get-JCSdkGSuiteUsersToImportFormatted and Get-JCSdkOffice365UsersToImport had been generated with skip and limit type pagination, these endpoints use a tokenized method for fetching the next pages. This release creates a definition map for endpoints that return users with tokenized pages. Both of these functions should paginate automatically when run.

Is there anything particularly tricky?

The BuildCustomFunctions.ps1 script is the primary change in this release. The map for the two functions and the logic for custom pagination is built into the that file. It's a little tricky to read but at a high level, when the script encounters those functions, the new pagination for token pages should be written to the Get-JCSdkGSuiteUsersToImport, Get-JCSdkGSuiteUsersToImportFormatted and Get-JCSdkOffice365UsersToImport custom functions.

How should this be tested?

In an org with a Google Workspace / Office365 Directory, run the functions: Get-JCSdkGSuiteUsersToImport, Get-JCSdkGSuiteUsersToImportFormatted and Get-JCSdkOffice365UsersToImport

Both should return the max number of users in the directory without having to paginate manually.

Screenshots