From 4794ecc45d7aa08785c622918d08bb046e7359ae Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Sat, 23 Jul 2022 18:16:24 +0200 Subject: feat(projects): add support for project restore API --- gitlab/v4/objects/projects.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gitlab/v4/objects') diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py index 96d802b..a90bffb 100644 --- a/gitlab/v4/objects/projects.py +++ b/gitlab/v4/objects/projects.py @@ -477,6 +477,21 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO assert isinstance(data, dict) return {"alt": data["alt"], "url": data["url"], "markdown": data["markdown"]} + @cli.register_custom_action("Project") + @exc.on_http_error(exc.GitlabRestoreError) + def restore(self, **kwargs: Any) -> None: + """Restore a project marked for deletion. + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabRestoreError: If the server failed to perform the request + """ + path = f"/projects/{self.encoded_id}/restore" + self.manager.gitlab.http_post(path, **kwargs) + @cli.register_custom_action("Project", optional=("wiki",)) @exc.on_http_error(exc.GitlabGetError) def snapshot( -- cgit v1.2.1