Commit d99758a9 authored by Sander van Harmelen's avatar Sander van Harmelen Committed by GitHub

Fixup PR #82 (#104)

* Support for AcceptMergeRequest parameters

* Fixup PR #82
parent 5cf34379
......@@ -277,6 +277,18 @@ func (s *MergeRequestsService) UpdateMergeRequest(
return m, resp, err
}
// AcceptMergeRequestOptions represents the available AcceptMergeRequest()
// options.
//
// GitLab API docs:
// http://doc.gitlab.com/ce/api/merge_requests.html#accept-mr
type AcceptMergeRequestOptions struct {
MergeCommitMessage *string `url:"merge_commit_message,omitempty" json:"merge_commit_message,omitempty"`
ShouldRemoveSourceBranch *bool `url:"should_remove_source_branch,omitempty" json:"should_remove_source_branch,omitempty"`
MergeWhenBuildSucceeds *bool `url:"merge_when_build_succeeds,omitempty" json:"merge_when_build_succeeds,omitempty"`
Sha *string `url:"sha,omitempty" json:"sha,omitempty"`
}
// AcceptMergeRequest merges changes submitted with MR using this API. If merge
// success you get 200 OK. If it has some conflicts and can not be merged - you
// get 405 and error message 'Branch cannot be merged'. If merge request is
......@@ -286,14 +298,15 @@ func (s *MergeRequestsService) UpdateMergeRequest(
// http://doc.gitlab.com/ce/api/merge_requests.html#accept-mr
func (s *MergeRequestsService) AcceptMergeRequest(
pid interface{},
mergeRequest int) (*MergeRequest, *Response, error) {
mergeRequest int,
opt *AcceptMergeRequestOptions) (*MergeRequest, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/merge_request/%d/merge", url.QueryEscape(project), mergeRequest)
req, err := s.client.NewRequest("PUT", u, nil)
req, err := s.client.NewRequest("PUT", u, opt)
if err != nil {
return nil, nil, err
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment