summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects.py
diff options
context:
space:
mode:
authorCharles <charles.fayal@uconn.edu>2020-01-29 19:26:52 +0200
committerCharles <charles.fayal@uconn.edu>2020-01-30 21:21:55 +0200
commite512cddd30f3047230e8eedb79d98dc06e93a77b (patch)
tree7241629f3722d576f45890b28e9472341f60a9a9 /gitlab/v4/objects.py
parent7843ace913589cf629f448a2541f290a4c7214cd (diff)
downloadgitlab-e512cddd30f3047230e8eedb79d98dc06e93a77b.tar.gz
fix(objects): update to new gitlab api for path, and args
Updated the gitlab path for set_approvers to approvers_rules, added default arg for rule type, and added arg for # of approvals required.
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r--gitlab/v4/objects.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index 1750a36..8dca355 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -2685,10 +2685,11 @@ class ProjectMergeRequestApprovalManager(GetWithoutIdMixin, UpdateMixin, RESTMan
_update_uses_post = True
@exc.on_http_error(exc.GitlabUpdateError)
- def set_approvers(self, approver_ids=None, approver_group_ids=None, **kwargs):
+ def set_approvers(self, approvals_required, approver_ids=None, approver_group_ids=None, **kwargs):
"""Change MR-level allowed approvers and approver groups.
Args:
+ approvals_required (integer): The number of required approvals for this rule
approver_ids (list): User IDs that can approve MRs
approver_group_ids (list): Group IDs whose members can approve MRs
@@ -2699,8 +2700,12 @@ class ProjectMergeRequestApprovalManager(GetWithoutIdMixin, UpdateMixin, RESTMan
approver_ids = approver_ids or []
approver_group_ids = approver_group_ids or []
- path = "%s/%s/approvers" % (self._parent.manager.path, self._parent.get_id())
- data = {"approver_ids": approver_ids, "approver_group_ids": approver_group_ids}
+ path = "%s/%s/approval_rules" % (self._parent.manager.path, self._parent.get_id())
+ data = {
+ "approvals_required": approvals_required,
+ "rule_type": "regular",
+ "user_ids": approver_ids,
+ "group_ids": approver_group_ids}
self.gitlab.http_put(path, post_data=data, **kwargs)