PowerShellForGitHub icon indicating copy to clipboard operation
PowerShellForGitHub copied to clipboard

Retrieve more items from the REST API per call

Open variableresistor opened this issue 1 year ago • 1 comments

Feature Idea Summary

Add support for varying page sizes using the per_page parameter.

Feature Idea Additional Details

We have a large number of repos, and it's far faster to retrieve as many as possible in a single request. GitHub's REST API supports the per_page parameter that allows us to retrieve up to 100 items (for the endpoints I checked), defaulting to 30 items.

Requested Assignment

I can do it, but it seems a bit complex, based on Invoke-GHRestMethodMultipleResult. So I might have to have guidance as far as the standards I need to follow in this function.

Operating System

All

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.4.6
PSEdition                      Core
GitCommitId                    7.4.6
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module Version

Running: 0.17.0 Installed: 0.17.0

variableresistor avatar Jan 07 '25 23:01 variableresistor

Maybe add a setting "perPage" and default it to 0. Then implement the parameter on a case-by-case basis:

$perPage = Get-GitHubConfiguration -Name 'PerPage'
if ($perPage -gt 0) { $getParams += "per_page=$perPage" }

In GitHubRepositories.ps1.

variableresistor avatar Jan 08 '25 00:01 variableresistor