From 6aff7b6843b57f65e5a68c3026ba73d8a53374cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=99=93=E4=BC=9F?= Date: Thu, 5 Oct 2023 03:49:16 +0800 Subject: [PATCH] :sparkles: delete artifacts eligible for deletion in a project https://docs.gitlab.com/ee/api/job_artifacts.html#delete-project-artifacts --- jobs.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/jobs.go b/jobs.go index 0feaee989..9ad006658 100644 --- a/jobs.go +++ b/jobs.go @@ -564,3 +564,22 @@ func (s *JobsService) DeleteArtifacts(pid interface{}, jobID int, options ...Req return s.client.Do(req, nil) } + +// DeleteProjectArtifacts delete artifacts eligible for deletion in a project +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/job_artifacts.html#delete-project-artifacts +func (s *JobsService) DeleteProjectArtifacts(pid interface{}, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/artifacts", PathEscape(project)) + + req, err := s.client.NewRequest(http.MethodDelete, u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +}