Repository: google/go-github
File: github/users_packages.go (Go)

Code before:
// restore the package for the authenticated user.
//
// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-a-user
//
// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-the-authenticated-user
//
//meta:operation POST /user/packages/{package_type}/{package_name}/restore
//meta:operation POST /users/{username}/packages/{package_type}/{package_name}/restore
func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, packageName string) (*Response, error) {
	var u string
	if user != "" {
		u = fmt.Sprintf("users/%v/packages/%v/%v/restore", user, packageType, packageName)
	} else {
		u = fmt.Sprintf("user/packages/%v/%v/restore", packageType, packageName)
	}

	req, err := s.client.NewRequest("POST", u, nil)
	if err != nil {
		return nil, err
	}

	return s.client.Do(ctx, req, nil)
}

// PackageVersionListOptions specifies the optional parameters to the UsersService.ListPackageVersions.
type PackageVersionListOptions struct {
	// State of package either "active" or "deleted".
	State string `url:"state,omitempty"`

	ListOptions
}

// ListPackageVersions gets all versions of a package for the authenticated user.
//
// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-the-authenticated-user
//
//meta:operation GET /user/packages/{package_type}/{package_name}/versions
func (s *UsersService) ListPackageVersions(ctx context.Context, packageType, packageName string, opts *PackageVersionListOptions) ([]*PackageVersion, *Response, error) {
	u := fmt.Sprintf("user/packages/%v/%v/versions", packageType, packageName)
	u, err := addOptions(u, opts)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	var versions []*PackageVersion
	resp, err := s.client.Do(ctx, req, &versions)

Review comment (suggestion):
List prefix is required:

```suggestion
type ListPackageVersionOptions struct {
```


Code after:
// restore the package for the authenticated user.
//
// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-a-user
//
// GitHub API docs: https://docs.github.com/rest/packages/packages#restore-a-package-for-the-authenticated-user
//
//meta:operation POST /user/packages/{package_type}/{package_name}/restore
//meta:operation POST /users/{username}/packages/{package_type}/{package_name}/restore
func (s *UsersService) RestorePackage(ctx context.Context, user, packageType, packageName string) (*Response, error) {
	var u string
	if user != "" {
		u = fmt.Sprintf("users/%v/packages/%v/%v/restore", user, packageType, packageName)
	} else {
		u = fmt.Sprintf("user/packages/%v/%v/restore", packageType, packageName)
	}

	req, err := s.client.NewRequest("POST", u, nil)
	if err != nil {
		return nil, err
	}

	return s.client.Do(ctx, req, nil)
}

// ListPackageVersionsOptions specifies the optional parameters to the UsersService.ListPackageVersions.
type ListPackageVersionsOptions struct {
	// State of package either "active" or "deleted".
	State string `url:"state,omitempty"`

	ListOptions
}

// ListPackageVersions gets all versions of a package for the authenticated user.
//
// GitHub API docs: https://docs.github.com/rest/packages/packages#list-package-versions-for-a-package-owned-by-the-authenticated-user
//
//meta:operation GET /user/packages/{package_type}/{package_name}/versions
func (s *UsersService) ListPackageVersions(ctx context.Context, packageType, packageName string, opts *ListPackageVersionsOptions) ([]*PackageVersion, *Response, error) {
	u := fmt.Sprintf("user/packages/%v/%v/versions", packageType, packageName)
	u, err := addOptions(u, opts)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	var versions []*PackageVersion
	resp, err := s.client.Do(ctx, req, &versions)