[Vendor] Update gitea go-sdk to 2020-01-03 (#81)

update sdk to v0.0.0-20200103062250-c7686bd633c6

Co-authored-by: 6543 <6543@obermui.de>
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: sapk <sapk@noreply.gitea.io>
Reviewed-by: mrsdizzie <info@mrsdizzie.com>
This commit is contained in:
6543
2020-01-04 01:44:33 +00:00
committed by Lunny Xiao
parent 6e85b47f7c
commit 3c66a7af24
8 changed files with 86 additions and 13 deletions

View File

@ -1,4 +1,5 @@
// Copyright 2016 The Gogs Authors. All rights reserved.
// Copyright 2019 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
@ -124,10 +125,28 @@ func (c *Client) EditPullRequest(owner, repo string, index int64, opt EditPullRe
jsonHeader, bytes.NewReader(body), pr)
}
// MergePullRequestOption options when merging a pull request
type MergePullRequestOption struct {
// required: true
// enum: merge,rebase,rebase-merge,squash
Do string `json:"Do" binding:"Required;In(merge,rebase,rebase-merge,squash)"`
MergeTitleField string `json:"MergeTitleField"`
MergeMessageField string `json:"MergeMessageField"`
}
// MergePullRequestResponse response when merging a pull request
type MergePullRequestResponse struct {
}
// MergePullRequest merge a PR to repository by PR id
func (c *Client) MergePullRequest(owner, repo string, index int64) error {
_, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/pulls/%d/merge", owner, repo, index), nil, nil)
return err
func (c *Client) MergePullRequest(owner, repo string, index int64, opt MergePullRequestOption) (*MergePullRequestResponse, error) {
body, err := json.Marshal(&opt)
if err != nil {
return nil, err
}
response := new(MergePullRequestResponse)
return response, c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/pulls/%d/merge", owner, repo, index),
jsonHeader, bytes.NewReader(body), response)
}
// IsPullRequestMerged test if one PR is merged to one repository