aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/xanzy/go-gitlab/merge_requests.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-02-17 04:47:24 +0100
committerGitHub <noreply@github.com>2021-02-16 22:47:24 -0500
commitfe628d8406632e6f5b3969ac86d817a035d4bae9 (patch)
treecf29502ba516dcceb6d36c818d6596bfc6715ffd /vendor/github.com/xanzy/go-gitlab/merge_requests.go
parentdc707aea090741acb48d370152e65aa37d89800b (diff)
downloadgitea-fe628d8406632e6f5b3969ac86d817a035d4bae9.tar.gz
gitea-fe628d8406632e6f5b3969ac86d817a035d4bae9.zip
Vendor Update (#14696)
* github.com/yuin/goldmark v1.3.1 -> v1.3.2 * github.com/xanzy/go-gitlab v0.42.0 -> v0.44.0 * github.com/prometheus/client_golang v1.8.0 -> v1.9.0 * github.com/minio/minio-go v7.0.7 -> v7.0.9 * github.com/lafriks/xormstore v1.3.2 -> v1.4.0 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/merge_requests.go')
-rw-r--r--vendor/github.com/xanzy/go-gitlab/merge_requests.go72
1 files changed, 47 insertions, 25 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/merge_requests.go b/vendor/github.com/xanzy/go-gitlab/merge_requests.go
index c8f70c99c2..0a1909ceb8 100644
--- a/vendor/github.com/xanzy/go-gitlab/merge_requests.go
+++ b/vendor/github.com/xanzy/go-gitlab/merge_requests.go
@@ -1,5 +1,5 @@
//
-// Copyright 2017, Sander van Harmelen
+// Copyright 2021, Sander van Harmelen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package gitlab
import (
"fmt"
+ "net/http"
"time"
)
@@ -48,6 +49,7 @@ type MergeRequest struct {
Author *BasicUser `json:"author"`
Assignee *BasicUser `json:"assignee"`
Assignees []*BasicUser `json:"assignees"`
+ Reviewers []*BasicUser `json:"reviewers"`
SourceProjectID int `json:"source_project_id"`
TargetProjectID int `json:"target_project_id"`
Labels Labels `json:"labels"`
@@ -69,6 +71,7 @@ type MergeRequest struct {
ChangesCount string `json:"changes_count"`
ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
+ AllowCollaboration bool `json:"allow_collaboration"`
WebURL string `json:"web_url"`
DiscussionLocked bool `json:"discussion_locked"`
Changes []struct {
@@ -101,7 +104,9 @@ type MergeRequest struct {
Count int `json:"count"`
CompletedCount int `json:"completed_count"`
} `json:"task_completion_status"`
- HasConflicts bool `json:"has_conflicts"`
+ HasConflicts bool `json:"has_conflicts"`
+ BlockingDiscussionsResolved bool `json:"blocking_discussions_resolved"`
+ Overflow bool `json:"overflow"`
}
func (m MergeRequest) String() string {
@@ -152,6 +157,8 @@ type ListMergeRequestsOptions struct {
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
+ ReviewerID *int `url:"reviewer_id,omitempty" json:"reviewer_id,omitempty"`
+ ReviewerUsername *string `url:"reviewer_username,omitempty" json:"reviewer_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
@@ -168,7 +175,7 @@ type ListMergeRequestsOptions struct {
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#list-merge-requests
func (s *MergeRequestsService) ListMergeRequests(opt *ListMergeRequestsOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) {
- req, err := s.client.NewRequest("GET", "merge_requests", opt, options)
+ req, err := s.client.NewRequest(http.MethodGet, "merge_requests", opt, options)
if err != nil {
return nil, nil, err
}
@@ -205,6 +212,8 @@ type ListGroupMergeRequestsOptions struct {
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
+ ReviewerID *int `url:"reviewer_id,omitempty" json:"reviewer_id,omitempty"`
+ ReviewerUsername *string `url:"reviewer_username,omitempty" json:"reviewer_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
@@ -222,7 +231,7 @@ func (s *MergeRequestsService) ListGroupMergeRequests(gid interface{}, opt *List
}
u := fmt.Sprintf("groups/%s/merge_requests", pathEscape(group))
- req, err := s.client.NewRequest("GET", u, opt, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -260,6 +269,8 @@ type ListProjectMergeRequestsOptions struct {
Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
+ ReviewerID *int `url:"reviewer_id,omitempty" json:"reviewer_id,omitempty"`
+ ReviewerUsername *string `url:"reviewer_username,omitempty" json:"reviewer_username,omitempty"`
MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
@@ -278,7 +289,7 @@ func (s *MergeRequestsService) ListProjectMergeRequests(pid interface{}, opt *Li
}
u := fmt.Sprintf("projects/%s/merge_requests", pathEscape(project))
- req, err := s.client.NewRequest("GET", u, opt, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -314,7 +325,7 @@ func (s *MergeRequestsService) GetMergeRequest(pid interface{}, mergeRequest int
}
u := fmt.Sprintf("projects/%s/merge_requests/%d", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("GET", u, opt, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -339,7 +350,7 @@ func (s *MergeRequestsService) GetMergeRequestApprovals(pid interface{}, mergeRe
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("GET", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -371,7 +382,7 @@ func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequ
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/commits", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("GET", u, opt, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -385,19 +396,28 @@ func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequ
return c, resp, err
}
+// GetMergeRequestChangesOptions represents the available GetMergeRequestChanges()
+// options.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-changes
+type GetMergeRequestChangesOptions struct {
+ AccessRawDiffs *bool `url:"access_raw_diffs,omitempty" json:"access_raw_diffs,omitempty"`
+}
+
// GetMergeRequestChanges shows information about the merge request including
// its files and changes.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-changes
-func (s *MergeRequestsService) GetMergeRequestChanges(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*MergeRequest, *Response, error) {
+func (s *MergeRequestsService) GetMergeRequestChanges(pid interface{}, mergeRequest int, opt *GetMergeRequestChangesOptions, options ...RequestOptionFunc) (*MergeRequest, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/changes", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("GET", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -422,7 +442,7 @@ func (s *MergeRequestsService) GetMergeRequestParticipants(pid interface{}, merg
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/participants", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("GET", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -447,7 +467,7 @@ func (s *MergeRequestsService) ListMergeRequestPipelines(pid interface{}, mergeR
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/pipelines", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("GET", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -472,7 +492,7 @@ func (s *MergeRequestsService) CreateMergeRequestPipeline(pid interface{}, merge
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/pipelines", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("POST", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -505,7 +525,7 @@ func (s *MergeRequestsService) GetIssuesClosedOnMerge(pid interface{}, mergeRequ
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/closes_issues", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("GET", u, opt, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -532,6 +552,7 @@ type CreateMergeRequestOptions struct {
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
+ ReviewerIDs []int `url:"reviewer_ids,omitempty" json:"reviewer_ids,omitempty"`
TargetProjectID *int `url:"target_project_id,omitempty" json:"target_project_id,omitempty"`
MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
RemoveSourceBranch *bool `url:"remove_source_branch,omitempty" json:"remove_source_branch,omitempty"`
@@ -550,7 +571,7 @@ func (s *MergeRequestsService) CreateMergeRequest(pid interface{}, opt *CreateMe
}
u := fmt.Sprintf("projects/%s/merge_requests", pathEscape(project))
- req, err := s.client.NewRequest("POST", u, opt, options)
+ req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -575,6 +596,7 @@ type UpdateMergeRequestOptions struct {
TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
+ ReviewerIDs []int `url:"reviewer_ids,omitempty" json:"reviewer_ids,omitempty"`
Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
AddLabels Labels `url:"add_labels,comma,omitempty" json:"add_labels,omitempty"`
RemoveLabels Labels `url:"remove_labels,comma,omitempty" json:"remove_labels,omitempty"`
@@ -597,7 +619,7 @@ func (s *MergeRequestsService) UpdateMergeRequest(pid interface{}, mergeRequest
}
u := fmt.Sprintf("projects/%s/merge_requests/%d", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("PUT", u, opt, options)
+ req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -622,7 +644,7 @@ func (s *MergeRequestsService) DeleteMergeRequest(pid interface{}, mergeRequest
}
u := fmt.Sprintf("projects/%s/merge_requests/%d", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("DELETE", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}
@@ -658,7 +680,7 @@ func (s *MergeRequestsService) AcceptMergeRequest(pid interface{}, mergeRequest
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/merge", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("PUT", u, opt, options)
+ req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -687,7 +709,7 @@ func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{},
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/cancel_merge_when_pipeline_succeeds", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("PUT", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodPut, u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -714,7 +736,7 @@ func (s *MergeRequestsService) RebaseMergeRequest(pid interface{}, mergeRequest
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/rebase", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("PUT", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodPut, u, nil, options)
if err != nil {
return nil, err
}
@@ -740,7 +762,7 @@ func (s *MergeRequestsService) GetMergeRequestDiffVersions(pid interface{}, merg
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/versions", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("GET", u, opt, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -765,7 +787,7 @@ func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{},
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/versions/%d", pathEscape(project), mergeRequest, version)
- req, err := s.client.NewRequest("GET", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -792,7 +814,7 @@ func (s *MergeRequestsService) SubscribeToMergeRequest(pid interface{}, mergeReq
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/subscribe", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("POST", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -820,7 +842,7 @@ func (s *MergeRequestsService) UnsubscribeFromMergeRequest(pid interface{}, merg
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/unsubscribe", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("POST", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -847,7 +869,7 @@ func (s *MergeRequestsService) CreateTodo(pid interface{}, mergeRequest int, opt
}
u := fmt.Sprintf("projects/%s/merge_requests/%d/todo", pathEscape(project), mergeRequest)
- req, err := s.client.NewRequest("POST", u, nil, options)
+ req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}