aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
diff options
context:
space:
mode:
authoramine <hilalyamine@gmail.com>2019-10-24 20:45:02 +0200
committeramine <hilalyamine@gmail.com>2019-10-24 20:45:02 +0200
commita3a431edac978e20ab1887b902ee7240683f7d95 (patch)
tree79cc256c3e7cb2349174e77a33a6eb74c235b9f9 /vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
parent683040dd7a26878a05902a98378c2ed0d5bf23ee (diff)
downloadgit-bug-a3a431edac978e20ab1887b902ee7240683f7d95.tar.gz
vendors: upgrade github.com/xanzy/go-gitlab dependencies to 0.21.0
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go')
-rw-r--r--vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go87
1 files changed, 75 insertions, 12 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go b/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
index 43b96520..e4057c1a 100644
--- a/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
+++ b/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
@@ -33,6 +33,11 @@ type MergeRequestApprovals struct {
ApprovedBy []*MergeRequestApproverUser `json:"approved_by"`
Approvers []*MergeRequestApproverUser `json:"approvers"`
ApproverGroups []*MergeRequestApproverGroup `json:"approver_groups"`
+ SuggestedApprovers []*BasicUser `json:"suggested_approvers"`
+}
+
+func (m MergeRequestApprovals) String() string {
+ return Stringify(m)
}
// MergeRequestApproverGroup represents GitLab project level merge request approver group.
@@ -60,18 +65,7 @@ type MergeRequestApproverGroup struct {
// GitLab API docs:
// https://docs.gitlab.com/ee/api/merge_request_approvals.html#project-level-mr-approvals
type MergeRequestApproverUser struct {
- User struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Username string `json:"username"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- }
-}
-
-func (m MergeRequestApprovals) String() string {
- return Stringify(m)
+ User *BasicUser
}
// ApproveMergeRequestOptions represents the available ApproveMergeRequest() options.
@@ -126,3 +120,72 @@ func (s *MergeRequestApprovalsService) UnapproveMergeRequest(pid interface{}, mr
return s.client.Do(req, nil)
}
+
+// ChangeMergeRequestApprovalConfigurationOptions represents the available
+// ChangeMergeRequestApprovalConfiguration() options.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-approval-configuration
+type ChangeMergeRequestApprovalConfigurationOptions struct {
+ ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"`
+}
+
+// ChangeApprovalConfiguration updates the approval configuration of a merge request.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-approval-configuration
+func (s *MergeRequestApprovalsService) ChangeApprovalConfiguration(pid interface{}, mergeRequestIID int, opt *ChangeMergeRequestApprovalConfigurationOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
+ project, err := parseID(pid)
+ if err != nil {
+ return nil, nil, err
+ }
+ u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", pathEscape(project), mergeRequestIID)
+
+ req, err := s.client.NewRequest("POST", u, opt, options)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ m := new(MergeRequest)
+ resp, err := s.client.Do(req, m)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return m, resp, err
+}
+
+// ChangeMergeRequestAllowedApproversOptions represents the available
+// ChangeMergeRequestAllowedApprovers() options.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-allowed-approvers-for-merge-request
+type ChangeMergeRequestAllowedApproversOptions struct {
+ ApproverIDs []int `url:"approver_ids,omitempty" json:"approver_ids,omitempty"`
+ ApproverGroupIDs []int `url:"approver_group_ids,omitempty" json:"approver_group_ids,omitempty"`
+}
+
+// ChangeAllowedApprovers updates the approvers for a merge request.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-allowed-approvers-for-merge-request
+func (s *MergeRequestApprovalsService) ChangeAllowedApprovers(pid interface{}, mergeRequestIID int, opt *ChangeMergeRequestAllowedApproversOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
+ project, err := parseID(pid)
+ if err != nil {
+ return nil, nil, err
+ }
+ u := fmt.Sprintf("projects/%s/merge_requests/%d/approvers", pathEscape(project), mergeRequestIID)
+
+ req, err := s.client.NewRequest("PUT", u, opt, options)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ m := new(MergeRequest)
+ resp, err := s.client.Do(req, m)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return m, resp, err
+}