summaryrefslogtreecommitdiff
path: root/gitlab/v4
diff options
context:
space:
mode:
authorSrikanth Chelluri <srikanth.chelluri@appian.com>2019-10-23 16:51:10 -0400
committerSrikanth Chelluri <srikanth.chelluri@appian.com>2019-10-27 14:15:49 -0400
commit2cef2bb40b1f37b97bb2ee9894ab3b9970cef231 (patch)
tree1ad1b8335dbf947dbf29b13c32a1e2645765cd28 /gitlab/v4
parent6048175ef2c21fda298754e9b07515b0a56d66bd (diff)
downloadgitlab-2cef2bb40b1f37b97bb2ee9894ab3b9970cef231.tar.gz
fix(projects): support `approval_rules` endpoint for projects
The `approvers` API endpoint is deprecated [1]. GitLab instead uses the `approval_rules` API endpoint to modify approval settings for merge requests. This adds the functionality for project-level merge request approval settings. Note that there does not exist an endpoint to 'get' a single approval rule at this moment - only 'list'. [1] https://docs.gitlab.com/ee/api/merge_request_approvals.html
Diffstat (limited to 'gitlab/v4')
-rw-r--r--gitlab/v4/objects.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index fcac301..7b9c8f3 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -3777,6 +3777,19 @@ class ProjectApprovalManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
self.gitlab.http_put(path, post_data=data, **kwargs)
+class ProjectApprovalRule(SaveMixin, ObjectDeleteMixin, RESTObject):
+ _id_attr = "id"
+
+
+class ProjectApprovalRuleManager(
+ ListMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTManager
+):
+ _path = "/projects/%(project_id)s/approval_rules"
+ _obj_cls = ProjectApprovalRule
+ _from_parent_attrs = {"project_id": "id"}
+ _create_attrs = (("name", "approvals_required"), ("user_ids", "group_ids"))
+
+
class ProjectDeployment(RESTObject, SaveMixin):
pass
@@ -3888,6 +3901,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
_managers = (
("accessrequests", "ProjectAccessRequestManager"),
("approvals", "ProjectApprovalManager"),
+ ("approvalrules", "ProjectApprovalRuleManager"),
("badges", "ProjectBadgeManager"),
("boards", "ProjectBoardManager"),
("branches", "ProjectBranchManager"),