Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot retrive all package versions owned by the authenticated use #2251

Closed
lpsm-dev opened this issue Jan 12, 2022 · 1 comment
Closed

Cannot retrive all package versions owned by the authenticated use #2251

lpsm-dev opened this issue Jan 12, 2022 · 1 comment
Labels
Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s).

Comments

@lpsm-dev
Copy link
Contributor

lpsm-dev commented Jan 12, 2022

Problem

In the current implementation we cannot retrieve all versions of a package for a user using the function PackageGetAllVersions present in the users_packages.go file.

The PackageGetAllVersions function has no parameters to allow pagination and retrieve all versions of a package, being limited to a return of 30 elements []*PackageVersion, which is the default value of the GitHub API.

Context

I'm creating a CLI tool to clean up my GitHub container packages and I find this limitation.

Code

// Getting all packages version
pkgVersions, _, err := client.Users.PackageGetAllVersions(ctx, name, "container", container)
if err != nil {
  log.Fatal(err)
}
size := len(pkgVersions)

log.Infof("Package: %s", utils.DecodeParam(container))
log.Infof("We have %v versions in this package", size)

Results

Screen Shot 2022-01-12 at 00 26 37

@gmlewis
Copy link
Collaborator

gmlewis commented Jan 12, 2022

Thank you, @lpmatos for the detailed report and PR!

@gmlewis gmlewis added the Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). label Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s).
Projects
None yet
Development

No branches or pull requests

2 participants