Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Rebase and tweak the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
svanharmelen committed Feb 10, 2022
1 parent 7a5b4df commit c78bb03
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
22 changes: 14 additions & 8 deletions packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type PackagesService struct {
client *Client
}

// Package represents a GitLab single package.
// Package represents a GitLab package.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/packages.html
type Package struct {
Expand All @@ -44,7 +44,11 @@ type Package struct {
Tags []string `json:"tags"`
}

// GroupPackage represents a GitLab single package with project reference.
func (s Package) String() string {
return Stringify(s)
}

// GroupPackage represents a GitLab group package.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/packages.html
type GroupPackage struct {
Expand All @@ -53,7 +57,7 @@ type GroupPackage struct {
ProjectPath string `json:"project_path"`
}

func (s Package) String() string {
func (s GroupPackage) String() string {
return Stringify(s)
}

Expand Down Expand Up @@ -85,7 +89,8 @@ func (s PackageFile) String() string {
return Stringify(s)
}

// ListProjectPackagesOptions are the parameters available in a ListProjectPackages() Operation.
// ListProjectPackagesOptions represents the available ListProjectPackages()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/packages.html#within-a-project
Expand Down Expand Up @@ -124,7 +129,8 @@ func (s *PackagesService) ListProjectPackages(pid interface{}, opt *ListProjectP
return ps, resp, err
}

// ListGroupPackagesOptions are the parameters available in a ListGroupPackages() Operation.
// ListGroupPackagesOptions represents the available ListGroupPackages()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/packages.html#within-a-group
Expand All @@ -148,7 +154,7 @@ func (s *PackagesService) ListGroupPackages(gid interface{}, opt *ListGroupPacka
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("groups/%s/packages", pathEscape(group))
u := fmt.Sprintf("groups/%s/packages", PathEscape(group))

req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
Expand All @@ -164,8 +170,8 @@ func (s *PackagesService) ListGroupPackages(gid interface{}, opt *ListGroupPacka
return ps, resp, err
}

// ListPackageFilesOptions represents the available
// ListPackageFiles() options.
// ListPackageFilesOptions represents the available ListPackageFiles()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/packages.html#list-package-files
Expand Down
1 change: 1 addition & 0 deletions packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func TestPackagesService_ListProjectPackages(t *testing.T) {
WebPath: "/foo/bar/-/packages/3",
DeleteAPIPath: "https://gitlab.example.com/api/v4/projects/1/packages/3",
},
Tags: []string{},
}}

ps, resp, err := client.Packages.ListProjectPackages(3, nil)
Expand Down

0 comments on commit c78bb03

Please sign in to comment.