Skip to content

Commit

Permalink
Merge pull request #1522 from cyd01/master
Browse files Browse the repository at this point in the history
Add DeletePackageFile in PackagesService
  • Loading branch information
svanharmelen committed Aug 10, 2022
2 parents 1ced135 + dbc0011 commit bcb4540
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages.go
Expand Up @@ -224,3 +224,22 @@ func (s *PackagesService) DeleteProjectPackage(pid interface{}, pkg int, options

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

// DeletePackageFile deletes a file in project package
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/packages.html#delete-a-package-file
func (s *PackagesService) DeletePackageFile(pid interface{}, pkg, file int, options ...RequestOptionFunc) (*Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/packages/%d/package_files/%d", PathEscape(project), pkg, file)

req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}

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

0 comments on commit bcb4540

Please sign in to comment.