From c01c034169789e1d20fd27a0f39f4c3c3628a2bb Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Thu, 10 Feb 2022 01:38:14 +0100 Subject: feat(artifacts): add support for project artifacts delete API --- gitlab/v4/objects/artifacts.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gitlab/v4/objects') diff --git a/gitlab/v4/objects/artifacts.py b/gitlab/v4/objects/artifacts.py index 55d762b..541e5e2 100644 --- a/gitlab/v4/objects/artifacts.py +++ b/gitlab/v4/objects/artifacts.py @@ -45,6 +45,23 @@ class ProjectArtifactManager(RESTManager): **kwargs, ) + @exc.on_http_error(exc.GitlabDeleteError) + def delete(self, **kwargs: Any) -> None: + """Delete the project's artifacts on the server. + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabDeleteError: If the server cannot perform the request + """ + path = self._compute_path("/projects/{project_id}/artifacts") + + if TYPE_CHECKING: + assert path is not None + self.gitlab.http_delete(path, **kwargs) + @cli.register_custom_action( "ProjectArtifactManager", ("ref_name", "job"), ("job_token",) ) -- cgit v1.2.1