Skip to content

Commit

Permalink
Merge pull request #1898 from castlesofplacebo/add-reset-approvals-of…
Browse files Browse the repository at this point in the history
…-a-merge-request

feat: add Reset approvals of a merge request method
  • Loading branch information
svanharmelen authored Mar 12, 2024
2 parents 0968e9e + 0c85713 commit 8f2dbc2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions merge_request_approvals.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,26 @@ func (s *MergeRequestApprovalsService) UnapproveMergeRequest(pid interface{}, mr
return s.client.Do(req, nil)
}

// ResetApprovalsOfMergeRequest clear all approvals of merge request on GitLab.
// Available only for bot users based on project or group tokens.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/merge_request_approvals.html#reset-approvals-of-a-merge-request
func (s *MergeRequestApprovalsService) ResetApprovalsOfMergeRequest(pid interface{}, mr int, options ...RequestOptionFunc) (*Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/reset_approvals", PathEscape(project), mr)

req, err := s.client.NewRequest(http.MethodPut, u, nil, options)
if err != nil {
return nil, err
}

return s.client.Do(req, nil)
}

// ChangeMergeRequestApprovalConfigurationOptions represents the available
// ChangeMergeRequestApprovalConfiguration() options.
//
Expand Down

0 comments on commit 8f2dbc2

Please sign in to comment.