diff options
author | 6543 <6543@obermui.de> | 2020-04-19 22:23:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-19 21:23:05 +0100 |
commit | 82dbb34c9c2d0efa8eeb8df845ee3e283024b1d6 (patch) | |
tree | 45f81306d304a30be114187b72bdfd3e1be18e6e /vendor/github.com/xanzy | |
parent | 5c092eb0ef9347e88db59618902781e099880196 (diff) | |
download | gitea-82dbb34c9c2d0efa8eeb8df845ee3e283024b1d6.tar.gz gitea-82dbb34c9c2d0efa8eeb8df845ee3e283024b1d6.zip |
Vendor Update: go-gitlab v0.22.1 -> v0.31.0 (#11136)
* vendor update: go-gitlab to v0.31.0
* migrate client init to v0.31.0
* refactor
Diffstat (limited to 'vendor/github.com/xanzy')
83 files changed, 3123 insertions, 1146 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/.travis.yml b/vendor/github.com/xanzy/go-gitlab/.travis.yml index ee77c02ba7..f389447c39 100644 --- a/vendor/github.com/xanzy/go-gitlab/.travis.yml +++ b/vendor/github.com/xanzy/go-gitlab/.travis.yml @@ -1,10 +1,8 @@ language: go go: - - 1.10.x - - 1.11.x - - 1.12.x - 1.13.x + - 1.14.x - master stages: diff --git a/vendor/github.com/xanzy/go-gitlab/LICENSE b/vendor/github.com/xanzy/go-gitlab/LICENSE index e06d208186..261eeb9e9f 100644 --- a/vendor/github.com/xanzy/go-gitlab/LICENSE +++ b/vendor/github.com/xanzy/go-gitlab/LICENSE @@ -1,4 +1,4 @@ -Apache License + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -178,7 +178,7 @@ Apache License APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" + boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a @@ -186,7 +186,7 @@ Apache License same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright {yyyy} {name of copyright owner} + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -199,4 +199,3 @@ Apache License WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - diff --git a/vendor/github.com/xanzy/go-gitlab/README.md b/vendor/github.com/xanzy/go-gitlab/README.md index 48fb4882b4..0b1f5bfc2a 100644 --- a/vendor/github.com/xanzy/go-gitlab/README.md +++ b/vendor/github.com/xanzy/go-gitlab/README.md @@ -20,6 +20,7 @@ incompatible changes that were needed to fully support the V4 Gitlab API. This API client package covers most of the existing Gitlab API calls and is updated regularly to add new and/or missing endpoints. Currently the following services are supported: +- [x] Applications - [x] Award Emojis - [x] Branches - [x] Broadcast Messages @@ -96,8 +97,21 @@ access different parts of the GitLab API. For example, to list all users: ```go -git := gitlab.NewClient(nil, "yourtokengoeshere") -//git.SetBaseURL("https://git.mydomain.com/api/v4") +git, err := gitlab.NewClient("yourtokengoeshere") +if err != nil { + log.Fatalf("Failed to create client: %v", err) +} +users, _, err := git.Users.ListUsers(&gitlab.ListUsersOptions{}) +``` + +There are a few `With...` option functions that can be used to customize +the API client. For example, to set a custom base URL: + +```go +git, err := gitlab.NewClient("yourtokengoeshere", WithBaseURL("https://git.mydomain.com/api/v4")) +if err != nil { + log.Fatalf("Failed to create client: %v", err) +} users, _, err := git.Users.ListUsers(&gitlab.ListUsersOptions{}) ``` @@ -105,7 +119,7 @@ Some API methods have optional parameters that can be passed. For example, to list all projects for user "svanharmelen": ```go -git := gitlab.NewClient(nil) +git := gitlab.NewClient("yourtokengoeshere") opt := &ListProjectsOptions{Search: gitlab.String("svanharmelen")} projects, _, err := git.Projects.ListProjects(opt) ``` @@ -125,7 +139,10 @@ import ( ) func main() { - git := gitlab.NewClient(nil, "yourtokengoeshere") + git, err := gitlab.NewClient("yourtokengoeshere") + if err != nil { + log.Fatalf("Failed to create client: %v", err) + } // Create new project p := &gitlab.CreateProjectOptions{ @@ -166,7 +183,7 @@ For complete usage of go-gitlab, see the full [package docs](https://godoc.org/g ## Author -Sander van Harmelen (<sander@xanzy.io>) +Sander van Harmelen (<sander@vanharmelen.nl>) ## License diff --git a/vendor/github.com/xanzy/go-gitlab/access_requests.go b/vendor/github.com/xanzy/go-gitlab/access_requests.go index 3fa406bca3..fa00d75db4 100644 --- a/vendor/github.com/xanzy/go-gitlab/access_requests.go +++ b/vendor/github.com/xanzy/go-gitlab/access_requests.go @@ -39,7 +39,7 @@ type ListAccessRequestsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/access_requests.html#list-access-requests-for-a-group-or-project -func (s *AccessRequestsService) ListProjectAccessRequests(pid interface{}, opt *ListAccessRequestsOptions, options ...OptionFunc) ([]*AccessRequest, *Response, error) { +func (s *AccessRequestsService) ListProjectAccessRequests(pid interface{}, opt *ListAccessRequestsOptions, options ...RequestOptionFunc) ([]*AccessRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -65,7 +65,7 @@ func (s *AccessRequestsService) ListProjectAccessRequests(pid interface{}, opt * // // GitLab API docs: // https://docs.gitlab.com/ce/api/access_requests.html#list-access-requests-for-a-group-or-project -func (s *AccessRequestsService) ListGroupAccessRequests(gid interface{}, opt *ListAccessRequestsOptions, options ...OptionFunc) ([]*AccessRequest, *Response, error) { +func (s *AccessRequestsService) ListGroupAccessRequests(gid interface{}, opt *ListAccessRequestsOptions, options ...RequestOptionFunc) ([]*AccessRequest, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -91,7 +91,7 @@ func (s *AccessRequestsService) ListGroupAccessRequests(gid interface{}, opt *Li // // GitLab API docs: // https://docs.gitlab.com/ce/api/access_requests.html#request-access-to-a-group-or-project -func (s *AccessRequestsService) RequestProjectAccess(pid interface{}, options ...OptionFunc) (*AccessRequest, *Response, error) { +func (s *AccessRequestsService) RequestProjectAccess(pid interface{}, options ...RequestOptionFunc) (*AccessRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -117,7 +117,7 @@ func (s *AccessRequestsService) RequestProjectAccess(pid interface{}, options .. // // GitLab API docs: // https://docs.gitlab.com/ce/api/access_requests.html#request-access-to-a-group-or-project -func (s *AccessRequestsService) RequestGroupAccess(gid interface{}, options ...OptionFunc) (*AccessRequest, *Response, error) { +func (s *AccessRequestsService) RequestGroupAccess(gid interface{}, options ...RequestOptionFunc) (*AccessRequest, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -151,7 +151,7 @@ type ApproveAccessRequestOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/access_requests.html#approve-an-access-request -func (s *AccessRequestsService) ApproveProjectAccessRequest(pid interface{}, user int, opt *ApproveAccessRequestOptions, options ...OptionFunc) (*AccessRequest, *Response, error) { +func (s *AccessRequestsService) ApproveProjectAccessRequest(pid interface{}, user int, opt *ApproveAccessRequestOptions, options ...RequestOptionFunc) (*AccessRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -176,7 +176,7 @@ func (s *AccessRequestsService) ApproveProjectAccessRequest(pid interface{}, use // // GitLab API docs: // https://docs.gitlab.com/ce/api/access_requests.html#approve-an-access-request -func (s *AccessRequestsService) ApproveGroupAccessRequest(gid interface{}, user int, opt *ApproveAccessRequestOptions, options ...OptionFunc) (*AccessRequest, *Response, error) { +func (s *AccessRequestsService) ApproveGroupAccessRequest(gid interface{}, user int, opt *ApproveAccessRequestOptions, options ...RequestOptionFunc) (*AccessRequest, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -201,7 +201,7 @@ func (s *AccessRequestsService) ApproveGroupAccessRequest(gid interface{}, user // // GitLab API docs: // https://docs.gitlab.com/ce/api/access_requests.html#deny-an-access-request -func (s *AccessRequestsService) DenyProjectAccessRequest(pid interface{}, user int, options ...OptionFunc) (*Response, error) { +func (s *AccessRequestsService) DenyProjectAccessRequest(pid interface{}, user int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -220,7 +220,7 @@ func (s *AccessRequestsService) DenyProjectAccessRequest(pid interface{}, user i // // GitLab API docs: // https://docs.gitlab.com/ce/api/access_requests.html#deny-an-access-request -func (s *AccessRequestsService) DenyGroupAccessRequest(gid interface{}, user int, options ...OptionFunc) (*Response, error) { +func (s *AccessRequestsService) DenyGroupAccessRequest(gid interface{}, user int, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/applications.go b/vendor/github.com/xanzy/go-gitlab/applications.go new file mode 100644 index 0000000000..1436ed011c --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/applications.go @@ -0,0 +1,100 @@ +// +// Copyright 2017, 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. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package gitlab + +import "fmt" + +// ApplicationsService handles communication with administrables applications +// of the Gitlab API. +// +// Gitlab API docs : https://docs.gitlab.com/ee/api/applications.html +type ApplicationsService struct { + client *Client +} + +type Application struct { + ID int `json:"id"` + ApplicationID string `json:"application_id"` + ApplicationName string `json:"application_name"` + Secret string `json:"secret"` + CallbackURL string `json:"callback_url"` + Confidential bool `json:"confidential"` +} + +// CreateApplicationOptions represents the available CreateApplication() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/applications.html#create-an-application +type CreateApplicationOptions struct { + Name *string `url:"name,omitempty" json:"name,omitempty"` + RedirectURI *string `url:"redirect_uri,omitempty" json:"redirect_uri,omitempty"` + Scopes *string `url:"scopes,omitempty" json:"scopes,omitempty"` + Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"` +} + +// CreateApplication creates a new application owned by the authenticated user. +// +// Gitlab API docs : https://docs.gitlab.com/ce/api/applications.html#create-an-application +func (s *ApplicationsService) CreateApplication(opt *CreateApplicationOptions, options ...RequestOptionFunc) (*Application, *Response, error) { + req, err := s.client.NewRequest("POST", "applications", opt, options) + if err != nil { + return nil, nil, err + } + + a := new(Application) + resp, err := s.client.Do(req, a) + if err != nil { + return nil, resp, err + } + + return a, resp, err +} + +type ListApplicationsOptions ListOptions + +// ListApplications get a list of administrables applications by the authenticated user +// +// Gitlab API docs : https://docs.gitlab.com/ce/api/applications.html#list-all-applications +func (s *ApplicationsService) ListApplications(opt *ListApplicationsOptions, options ...RequestOptionFunc) ([]*Application, *Response, error) { + req, err := s.client.NewRequest("GET", "applications", opt, options) + if err != nil { + return nil, nil, err + } + + var as []*Application + resp, err := s.client.Do(req, &as) + if err != nil { + return nil, resp, err + } + + return as, resp, err +} + +// DeleteApplication removes a specific application. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/applications.html#delete-an-application +func (s *ApplicationsService) DeleteApplication(application int, options ...RequestOptionFunc) (*Response, error) { + u := fmt.Sprintf("applications/%d", application) + + req, err := s.client.NewRequest("DELETE", u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/xanzy/go-gitlab/award_emojis.go b/vendor/github.com/xanzy/go-gitlab/award_emojis.go index 4c054f9661..d365472767 100644 --- a/vendor/github.com/xanzy/go-gitlab/award_emojis.go +++ b/vendor/github.com/xanzy/go-gitlab/award_emojis.go @@ -66,7 +66,7 @@ type ListAwardEmojiOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji -func (s *AwardEmojiService) ListMergeRequestAwardEmoji(pid interface{}, mergeRequestIID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) ListMergeRequestAwardEmoji(pid interface{}, mergeRequestIID int, opt *ListAwardEmojiOptions, options ...RequestOptionFunc) ([]*AwardEmoji, *Response, error) { return s.listAwardEmoji(pid, awardMergeRequest, mergeRequestIID, opt, options...) } @@ -74,7 +74,7 @@ func (s *AwardEmojiService) ListMergeRequestAwardEmoji(pid interface{}, mergeReq // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji -func (s *AwardEmojiService) ListIssueAwardEmoji(pid interface{}, issueIID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) ListIssueAwardEmoji(pid interface{}, issueIID int, opt *ListAwardEmojiOptions, options ...RequestOptionFunc) ([]*AwardEmoji, *Response, error) { return s.listAwardEmoji(pid, awardIssue, issueIID, opt, options...) } @@ -82,11 +82,11 @@ func (s *AwardEmojiService) ListIssueAwardEmoji(pid interface{}, issueIID int, o // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji -func (s *AwardEmojiService) ListSnippetAwardEmoji(pid interface{}, snippetID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) ListSnippetAwardEmoji(pid interface{}, snippetID int, opt *ListAwardEmojiOptions, options ...RequestOptionFunc) ([]*AwardEmoji, *Response, error) { return s.listAwardEmoji(pid, awardSnippets, snippetID, opt, options...) } -func (s *AwardEmojiService) listAwardEmoji(pid interface{}, resource string, resourceID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) listAwardEmoji(pid interface{}, resource string, resourceID int, opt *ListAwardEmojiOptions, options ...RequestOptionFunc) ([]*AwardEmoji, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -115,7 +115,7 @@ func (s *AwardEmojiService) listAwardEmoji(pid interface{}, resource string, res // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji -func (s *AwardEmojiService) GetMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) GetMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.getAwardEmoji(pid, awardMergeRequest, mergeRequestIID, awardID, options...) } @@ -123,7 +123,7 @@ func (s *AwardEmojiService) GetMergeRequestAwardEmoji(pid interface{}, mergeRequ // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji -func (s *AwardEmojiService) GetIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) GetIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.getAwardEmoji(pid, awardIssue, issueIID, awardID, options...) } @@ -131,11 +131,11 @@ func (s *AwardEmojiService) GetIssueAwardEmoji(pid interface{}, issueIID, awardI // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji -func (s *AwardEmojiService) GetSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) GetSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.getAwardEmoji(pid, awardSnippets, snippetID, awardID, options...) } -func (s *AwardEmojiService) getAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) getAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -174,7 +174,7 @@ type CreateAwardEmojiOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji -func (s *AwardEmojiService) CreateMergeRequestAwardEmoji(pid interface{}, mergeRequestIID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) CreateMergeRequestAwardEmoji(pid interface{}, mergeRequestIID int, opt *CreateAwardEmojiOptions, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.createAwardEmoji(pid, awardMergeRequest, mergeRequestIID, opt, options...) } @@ -182,7 +182,7 @@ func (s *AwardEmojiService) CreateMergeRequestAwardEmoji(pid interface{}, mergeR // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji -func (s *AwardEmojiService) CreateIssueAwardEmoji(pid interface{}, issueIID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) CreateIssueAwardEmoji(pid interface{}, issueIID int, opt *CreateAwardEmojiOptions, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.createAwardEmoji(pid, awardIssue, issueIID, opt, options...) } @@ -190,11 +190,11 @@ func (s *AwardEmojiService) CreateIssueAwardEmoji(pid interface{}, issueIID int, // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji -func (s *AwardEmojiService) CreateSnippetAwardEmoji(pid interface{}, snippetID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) CreateSnippetAwardEmoji(pid interface{}, snippetID int, opt *CreateAwardEmojiOptions, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.createAwardEmoji(pid, awardSnippets, snippetID, opt, options...) } -func (s *AwardEmojiService) createAwardEmoji(pid interface{}, resource string, resourceID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) createAwardEmoji(pid interface{}, resource string, resourceID int, opt *CreateAwardEmojiOptions, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -223,7 +223,7 @@ func (s *AwardEmojiService) createAwardEmoji(pid interface{}, resource string, r // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note -func (s *AwardEmojiService) DeleteIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...OptionFunc) (*Response, error) { +func (s *AwardEmojiService) DeleteIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...RequestOptionFunc) (*Response, error) { return s.deleteAwardEmoji(pid, awardMergeRequest, issueIID, awardID, options...) } @@ -231,7 +231,7 @@ func (s *AwardEmojiService) DeleteIssueAwardEmoji(pid interface{}, issueIID, awa // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note -func (s *AwardEmojiService) DeleteMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...OptionFunc) (*Response, error) { +func (s *AwardEmojiService) DeleteMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...RequestOptionFunc) (*Response, error) { return s.deleteAwardEmoji(pid, awardMergeRequest, mergeRequestIID, awardID, options...) } @@ -239,7 +239,7 @@ func (s *AwardEmojiService) DeleteMergeRequestAwardEmoji(pid interface{}, mergeR // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note -func (s *AwardEmojiService) DeleteSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...OptionFunc) (*Response, error) { +func (s *AwardEmojiService) DeleteSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...RequestOptionFunc) (*Response, error) { return s.deleteAwardEmoji(pid, awardMergeRequest, snippetID, awardID, options...) } @@ -247,7 +247,7 @@ func (s *AwardEmojiService) DeleteSnippetAwardEmoji(pid interface{}, snippetID, // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#delete-an-award-emoji -func (s *AwardEmojiService) deleteAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...OptionFunc) (*Response, error) { +func (s *AwardEmojiService) deleteAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -267,7 +267,7 @@ func (s *AwardEmojiService) deleteAwardEmoji(pid interface{}, resource string, r // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) ListIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) ListIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID int, opt *ListAwardEmojiOptions, options ...RequestOptionFunc) ([]*AwardEmoji, *Response, error) { return s.listAwardEmojiOnNote(pid, awardIssue, issueID, noteID, opt, options...) } @@ -276,7 +276,7 @@ func (s *AwardEmojiService) ListIssuesAwardEmojiOnNote(pid interface{}, issueID, // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) ListMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) ListMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID int, opt *ListAwardEmojiOptions, options ...RequestOptionFunc) ([]*AwardEmoji, *Response, error) { return s.listAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, opt, options...) } @@ -285,11 +285,11 @@ func (s *AwardEmojiService) ListMergeRequestAwardEmojiOnNote(pid interface{}, me // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) ListSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) ListSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID int, opt *ListAwardEmojiOptions, options ...RequestOptionFunc) ([]*AwardEmoji, *Response, error) { return s.listAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, opt, options...) } -func (s *AwardEmojiService) listAwardEmojiOnNote(pid interface{}, resources string, ressourceID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) listAwardEmojiOnNote(pid interface{}, resources string, ressourceID, noteID int, opt *ListAwardEmojiOptions, options ...RequestOptionFunc) ([]*AwardEmoji, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -315,7 +315,7 @@ func (s *AwardEmojiService) listAwardEmojiOnNote(pid interface{}, resources stri // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) GetIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) GetIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID, awardID int, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.getSingleNoteAwardEmoji(pid, awardIssue, issueID, noteID, awardID, options...) } @@ -324,7 +324,7 @@ func (s *AwardEmojiService) GetIssuesAwardEmojiOnNote(pid interface{}, issueID, // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) GetMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) GetMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID, awardID int, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.getSingleNoteAwardEmoji(pid, awardMergeRequest, mergeRequestIID, noteID, awardID, options...) } @@ -333,11 +333,11 @@ func (s *AwardEmojiService) GetMergeRequestAwardEmojiOnNote(pid interface{}, mer // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) GetSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) GetSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID, awardID int, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.getSingleNoteAwardEmoji(pid, awardSnippets, snippetIID, noteID, awardID, options...) } -func (s *AwardEmojiService) getSingleNoteAwardEmoji(pid interface{}, ressource string, resourceID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) getSingleNoteAwardEmoji(pid interface{}, ressource string, resourceID, noteID, awardID int, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -368,7 +368,7 @@ func (s *AwardEmojiService) getSingleNoteAwardEmoji(pid interface{}, ressource s // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) CreateIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) CreateIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID int, opt *CreateAwardEmojiOptions, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.createAwardEmojiOnNote(pid, awardIssue, issueID, noteID, opt, options...) } @@ -377,7 +377,7 @@ func (s *AwardEmojiService) CreateIssuesAwardEmojiOnNote(pid interface{}, issueI // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) CreateMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) CreateMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID int, opt *CreateAwardEmojiOptions, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.createAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, opt, options...) } @@ -385,7 +385,7 @@ func (s *AwardEmojiService) CreateMergeRequestAwardEmojiOnNote(pid interface{}, // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) CreateSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) CreateSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID int, opt *CreateAwardEmojiOptions, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { return s.createAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, opt, options...) } @@ -393,7 +393,7 @@ func (s *AwardEmojiService) CreateSnippetAwardEmojiOnNote(pid interface{}, snipp // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note -func (s *AwardEmojiService) createAwardEmojiOnNote(pid interface{}, resource string, resourceID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) { +func (s *AwardEmojiService) createAwardEmojiOnNote(pid interface{}, resource string, resourceID, noteID int, opt *CreateAwardEmojiOptions, options ...RequestOptionFunc) (*AwardEmoji, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -423,7 +423,7 @@ func (s *AwardEmojiService) createAwardEmojiOnNote(pid interface{}, resource str // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) DeleteIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID, awardID int, options ...OptionFunc) (*Response, error) { +func (s *AwardEmojiService) DeleteIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID, awardID int, options ...RequestOptionFunc) (*Response, error) { return s.deleteAwardEmojiOnNote(pid, awardIssue, issueID, noteID, awardID, options...) } @@ -432,7 +432,7 @@ func (s *AwardEmojiService) DeleteIssuesAwardEmojiOnNote(pid interface{}, issueI // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) DeleteMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID, awardID int, options ...OptionFunc) (*Response, error) { +func (s *AwardEmojiService) DeleteMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID, awardID int, options ...RequestOptionFunc) (*Response, error) { return s.deleteAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, awardID, options...) } @@ -441,11 +441,11 @@ func (s *AwardEmojiService) DeleteMergeRequestAwardEmojiOnNote(pid interface{}, // // GitLab API docs: // https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes -func (s *AwardEmojiService) DeleteSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID, awardID int, options ...OptionFunc) (*Response, error) { +func (s *AwardEmojiService) DeleteSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID, awardID int, options ...RequestOptionFunc) (*Response, error) { return s.deleteAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, awardID, options...) } -func (s *AwardEmojiService) deleteAwardEmojiOnNote(pid interface{}, resource string, resourceID, noteID, awardID int, options ...OptionFunc) (*Response, error) { +func (s *AwardEmojiService) deleteAwardEmojiOnNote(pid interface{}, resource string, resourceID, noteID, awardID int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/boards.go b/vendor/github.com/xanzy/go-gitlab/boards.go index fd5e280f63..eed377c8dd 100644 --- a/vendor/github.com/xanzy/go-gitlab/boards.go +++ b/vendor/github.com/xanzy/go-gitlab/boards.go @@ -66,7 +66,7 @@ type CreateIssueBoardOptions struct { // CreateIssueBoard creates a new issue board. // // GitLab API docs: https://docs.gitlab.com/ee/api/boards.html#create-a-board-starter -func (s *IssueBoardsService) CreateIssueBoard(pid interface{}, opt *CreateIssueBoardOptions, options ...OptionFunc) (*IssueBoard, *Response, error) { +func (s *IssueBoardsService) CreateIssueBoard(pid interface{}, opt *CreateIssueBoardOptions, options ...RequestOptionFunc) (*IssueBoard, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -101,7 +101,7 @@ type UpdateIssueBoardOptions struct { // UpdateIssueBoard update an issue board. // // GitLab API docs: https://docs.gitlab.com/ee/api/boards.html#create-a-board-starter -func (s *IssueBoardsService) UpdateIssueBoard(pid interface{}, board int, opt *UpdateIssueBoardOptions, options ...OptionFunc) (*IssueBoard, *Response, error) { +func (s *IssueBoardsService) UpdateIssueBoard(pid interface{}, board int, opt *UpdateIssueBoardOptions, options ...RequestOptionFunc) (*IssueBoard, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -125,7 +125,7 @@ func (s *IssueBoardsService) UpdateIssueBoard(pid interface{}, board int, opt *U // DeleteIssueBoard deletes an issue board. // // GitLab API docs: https://docs.gitlab.com/ee/api/boards.html#delete-a-board-starter -func (s *IssueBoardsService) DeleteIssueBoard(pid interface{}, board int, options ...OptionFunc) (*Response, error) { +func (s *IssueBoardsService) DeleteIssueBoard(pid interface{}, board int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -148,7 +148,7 @@ type ListIssueBoardsOptions ListOptions // ListIssueBoards gets a list of all issue boards in a project. // // GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#project-board -func (s *IssueBoardsService) ListIssueBoards(pid interface{}, opt *ListIssueBoardsOptions, options ...OptionFunc) ([]*IssueBoard, *Response, error) { +func (s *IssueBoardsService) ListIssueBoards(pid interface{}, opt *ListIssueBoardsOptions, options ...RequestOptionFunc) ([]*IssueBoard, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -172,7 +172,7 @@ func (s *IssueBoardsService) ListIssueBoards(pid interface{}, opt *ListIssueBoar // GetIssueBoard gets a single issue board of a project. // // GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#single-board -func (s *IssueBoardsService) GetIssueBoard(pid interface{}, board int, options ...OptionFunc) (*IssueBoard, *Response, error) { +func (s *IssueBoardsService) GetIssueBoard(pid interface{}, board int, options ...RequestOptionFunc) (*IssueBoard, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -202,7 +202,7 @@ type GetIssueBoardListsOptions ListOptions // backlog and closed lists. // // GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#list-board-lists -func (s *IssueBoardsService) GetIssueBoardLists(pid interface{}, board int, opt *GetIssueBoardListsOptions, options ...OptionFunc) ([]*BoardList, *Response, error) { +func (s *IssueBoardsService) GetIssueBoardLists(pid interface{}, board int, opt *GetIssueBoardListsOptions, options ...RequestOptionFunc) ([]*BoardList, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -226,7 +226,7 @@ func (s *IssueBoardsService) GetIssueBoardLists(pid interface{}, board int, opt // GetIssueBoardList gets a single issue board list. // // GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#single-board-list -func (s *IssueBoardsService) GetIssueBoardList(pid interface{}, board, list int, options ...OptionFunc) (*BoardList, *Response, error) { +func (s *IssueBoardsService) GetIssueBoardList(pid interface{}, board, list int, options ...RequestOptionFunc) (*BoardList, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -262,7 +262,7 @@ type CreateIssueBoardListOptions struct { // CreateIssueBoardList creates a new issue board list. // // GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#new-board-list -func (s *IssueBoardsService) CreateIssueBoardList(pid interface{}, board int, opt *CreateIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) { +func (s *IssueBoardsService) CreateIssueBoardList(pid interface{}, board int, opt *CreateIssueBoardListOptions, options ...RequestOptionFunc) (*BoardList, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -294,7 +294,7 @@ type UpdateIssueBoardListOptions struct { // UpdateIssueBoardList updates the position of an existing issue board list. // // GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#edit-board-list -func (s *IssueBoardsService) UpdateIssueBoardList(pid interface{}, board, list int, opt *UpdateIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) { +func (s *IssueBoardsService) UpdateIssueBoardList(pid interface{}, board, list int, opt *UpdateIssueBoardListOptions, options ...RequestOptionFunc) (*BoardList, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -324,7 +324,7 @@ func (s *IssueBoardsService) UpdateIssueBoardList(pid interface{}, board, list i // // GitLab API docs: // https://docs.gitlab.com/ce/api/boards.html#delete-a-board-list -func (s *IssueBoardsService) DeleteIssueBoardList(pid interface{}, board, list int, options ...OptionFunc) (*Response, error) { +func (s *IssueBoardsService) DeleteIssueBoardList(pid interface{}, board, list int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/branches.go b/vendor/github.com/xanzy/go-gitlab/branches.go index e61ddfe742..fd473f545f 100644 --- a/vendor/github.com/xanzy/go-gitlab/branches.go +++ b/vendor/github.com/xanzy/go-gitlab/branches.go @@ -60,7 +60,7 @@ type ListBranchesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/branches.html#list-repository-branches -func (s *BranchesService) ListBranches(pid interface{}, opts *ListBranchesOptions, options ...OptionFunc) ([]*Branch, *Response, error) { +func (s *BranchesService) ListBranches(pid interface{}, opts *ListBranchesOptions, options ...RequestOptionFunc) ([]*Branch, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -85,7 +85,7 @@ func (s *BranchesService) ListBranches(pid interface{}, opts *ListBranchesOption // // GitLab API docs: // https://docs.gitlab.com/ce/api/branches.html#get-single-repository-branch -func (s *BranchesService) GetBranch(pid interface{}, branch string, options ...OptionFunc) (*Branch, *Response, error) { +func (s *BranchesService) GetBranch(pid interface{}, branch string, options ...RequestOptionFunc) (*Branch, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -121,7 +121,7 @@ type ProtectBranchOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/branches.html#protect-repository-branch -func (s *BranchesService) ProtectBranch(pid interface{}, branch string, opts *ProtectBranchOptions, options ...OptionFunc) (*Branch, *Response, error) { +func (s *BranchesService) ProtectBranch(pid interface{}, branch string, opts *ProtectBranchOptions, options ...RequestOptionFunc) (*Branch, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -148,7 +148,7 @@ func (s *BranchesService) ProtectBranch(pid interface{}, branch string, opts *Pr // // GitLab API docs: // https://docs.gitlab.com/ce/api/branches.html#unprotect-repository-branch -func (s *BranchesService) UnprotectBranch(pid interface{}, branch string, options ...OptionFunc) (*Branch, *Response, error) { +func (s *BranchesService) UnprotectBranch(pid interface{}, branch string, options ...RequestOptionFunc) (*Branch, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -182,7 +182,7 @@ type CreateBranchOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/branches.html#create-repository-branch -func (s *BranchesService) CreateBranch(pid interface{}, opt *CreateBranchOptions, options ...OptionFunc) (*Branch, *Response, error) { +func (s *BranchesService) CreateBranch(pid interface{}, opt *CreateBranchOptions, options ...RequestOptionFunc) (*Branch, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -207,7 +207,7 @@ func (s *BranchesService) CreateBranch(pid interface{}, opt *CreateBranchOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/branches.html#delete-repository-branch -func (s *BranchesService) DeleteBranch(pid interface{}, branch string, options ...OptionFunc) (*Response, error) { +func (s *BranchesService) DeleteBranch(pid interface{}, branch string, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -226,7 +226,7 @@ func (s *BranchesService) DeleteBranch(pid interface{}, branch string, options . // // GitLab API docs: // https://docs.gitlab.com/ce/api/branches.html#delete-merged-branches -func (s *BranchesService) DeleteMergedBranches(pid interface{}, options ...OptionFunc) (*Response, error) { +func (s *BranchesService) DeleteMergedBranches(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/broadcast_messages.go b/vendor/github.com/xanzy/go-gitlab/broadcast_messages.go index aee852d464..08247103fb 100644 --- a/vendor/github.com/xanzy/go-gitlab/broadcast_messages.go +++ b/vendor/github.com/xanzy/go-gitlab/broadcast_messages.go @@ -54,7 +54,7 @@ type ListBroadcastMessagesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages -func (s *BroadcastMessagesService) ListBroadcastMessages(opt *ListBroadcastMessagesOptions, options ...OptionFunc) ([]*BroadcastMessage, *Response, error) { +func (s *BroadcastMessagesService) ListBroadcastMessages(opt *ListBroadcastMessagesOptions, options ...RequestOptionFunc) ([]*BroadcastMessage, *Response, error) { req, err := s.client.NewRequest("GET", "broadcast_messages", opt, options) if err != nil { return nil, nil, err @@ -73,7 +73,7 @@ func (s *BroadcastMessagesService) ListBroadcastMessages(opt *ListBroadcastMessa // // GitLab API docs: // https://docs.gitlab.com/ce/api/broadcast_messages.html#get-a-specific-broadcast-message -func (s *BroadcastMessagesService) GetBroadcastMessage(broadcast int, options ...OptionFunc) (*BroadcastMessage, *Response, error) { +func (s *BroadcastMessagesService) GetBroadcastMessage(broadcast int, options ...RequestOptionFunc) (*BroadcastMessage, *Response, error) { u := fmt.Sprintf("broadcast_messages/%d", broadcast) req, err := s.client.NewRequest("GET", u, nil, options) @@ -107,7 +107,7 @@ type CreateBroadcastMessageOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/broadcast_messages.html#create-a-broadcast-message -func (s *BroadcastMessagesService) CreateBroadcastMessage(opt *CreateBroadcastMessageOptions, options ...OptionFunc) (*BroadcastMessage, *Response, error) { +func (s *BroadcastMessagesService) CreateBroadcastMessage(opt *CreateBroadcastMessageOptions, options ...RequestOptionFunc) (*BroadcastMessage, *Response, error) { req, err := s.client.NewRequest("POST", "broadcast_messages", opt, options) if err != nil { return nil, nil, err @@ -139,7 +139,7 @@ type UpdateBroadcastMessageOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/broadcast_messages.html#update-a-broadcast-message -func (s *BroadcastMessagesService) UpdateBroadcastMessage(broadcast int, opt *UpdateBroadcastMessageOptions, options ...OptionFunc) (*BroadcastMessage, *Response, error) { +func (s *BroadcastMessagesService) UpdateBroadcastMessage(broadcast int, opt *UpdateBroadcastMessageOptions, options ...RequestOptionFunc) (*BroadcastMessage, *Response, error) { u := fmt.Sprintf("broadcast_messages/%d", broadcast) req, err := s.client.NewRequest("PUT", u, opt, options) @@ -160,7 +160,7 @@ func (s *BroadcastMessagesService) UpdateBroadcastMessage(broadcast int, opt *Up // // GitLab API docs: // https://docs.gitlab.com/ce/api/broadcast_messages.html#delete-a-broadcast-message -func (s *BroadcastMessagesService) DeleteBroadcastMessage(broadcast int, options ...OptionFunc) (*Response, error) { +func (s *BroadcastMessagesService) DeleteBroadcastMessage(broadcast int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("broadcast_messages/%d", broadcast) req, err := s.client.NewRequest("DELETE", u, nil, options) diff --git a/vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go b/vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go index 7a185af62f..1f5ca5ccc5 100644 --- a/vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go +++ b/vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go @@ -32,7 +32,7 @@ type ListCIYMLTemplatesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html#list-gitlab-ci-yml-templates -func (s *CIYMLTemplatesService) ListAllTemplates(opt *ListCIYMLTemplatesOptions, options ...OptionFunc) ([]*CIYMLTemplate, *Response, error) { +func (s *CIYMLTemplatesService) ListAllTemplates(opt *ListCIYMLTemplatesOptions, options ...RequestOptionFunc) ([]*CIYMLTemplate, *Response, error) { req, err := s.client.NewRequest("GET", "templates/gitlab_ci_ymls", opt, options) if err != nil { return nil, nil, err @@ -51,7 +51,7 @@ func (s *CIYMLTemplatesService) ListAllTemplates(opt *ListCIYMLTemplatesOptions, // // GitLab API docs: // https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html#single-gitlab-ci-yml-template -func (s *CIYMLTemplatesService) GetTemplate(key string, options ...OptionFunc) (*CIYMLTemplate, *Response, error) { +func (s *CIYMLTemplatesService) GetTemplate(key string, options ...RequestOptionFunc) (*CIYMLTemplate, *Response, error) { u := fmt.Sprintf("templates/gitlab_ci_ymls/%s", pathEscape(key)) req, err := s.client.NewRequest("GET", u, nil, options) diff --git a/vendor/github.com/xanzy/go-gitlab/client_options.go b/vendor/github.com/xanzy/go-gitlab/client_options.go new file mode 100644 index 0000000000..dfc4089797 --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/client_options.go @@ -0,0 +1,49 @@ +package gitlab + +import ( + "net/http" + + retryablehttp "github.com/hashicorp/go-retryablehttp" +) + +// ClientOptionFunc can be used customize a new GitLab API client. +type ClientOptionFunc func(*Client) error + +// WithBaseURL sets the base URL for API requests to a custom endpoint. +func WithBaseURL(urlStr string) ClientOptionFunc { + return func(c *Client) error { + return c.setBaseURL(urlStr) + } +} + +// WithCustomBackoff can be used to configure a custom backoff policy. +func WithCustomBackoff(backoff retryablehttp.Backoff) ClientOptionFunc { + return func(c *Client) error { + c.client.Backoff = backoff + return nil + } +} + +// WithCustomRetry can be used to configure a custom retry policy. +func WithCustomRetry(checkRetry retryablehttp.CheckRetry) ClientOptionFunc { + return func(c *Client) error { + c.client.CheckRetry = checkRetry + return nil + } +} + +// WithHTTPClient can be used to configure a custom HTTP client. +func WithHTTPClient(httpClient *http.Client) ClientOptionFunc { + return func(c *Client) error { + c.client.HTTPClient = httpClient + return nil + } +} + +// WithoutRetries disables the default retry logic. +func WithoutRetries() ClientOptionFunc { + return func(c *Client) error { + c.disableRetries = true + return nil + } +} diff --git a/vendor/github.com/xanzy/go-gitlab/commits.go b/vendor/github.com/xanzy/go-gitlab/commits.go index 27dd564596..3ebeda2e30 100644 --- a/vendor/github.com/xanzy/go-gitlab/commits.go +++ b/vendor/github.com/xanzy/go-gitlab/commits.go @@ -70,18 +70,19 @@ func (c Commit) String() string { // GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-repository-commits type ListCommitsOptions struct { ListOptions - RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"` - Since *time.Time `url:"since,omitempty" json:"since,omitempty"` - Until *time.Time `url:"until,omitempty" json:"until,omitempty"` - Path *string `url:"path,omitempty" json:"path,omitempty"` - All *bool `url:"all,omitempty" json:"all,omitempty"` - WithStats *bool `url:"with_stats,omitempty" json:"with_stats,omitempty"` + RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"` + Since *time.Time `url:"since,omitempty" json:"since,omitempty"` + Until *time.Time `url:"until,omitempty" json:"until,omitempty"` + Path *string `url:"path,omitempty" json:"path,omitempty"` + All *bool `url:"all,omitempty" json:"all,omitempty"` + WithStats *bool `url:"with_stats,omitempty" json:"with_stats,omitempty"` + FirstParent *bool `url:"first_parent,omitempty" json:"first_parent,omitempty"` } // ListCommits gets a list of repository commits in a project. // // GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-commits -func (s *CommitsService) ListCommits(pid interface{}, opt *ListCommitsOptions, options ...OptionFunc) ([]*Commit, *Response, error) { +func (s *CommitsService) ListCommits(pid interface{}, opt *ListCommitsOptions, options ...RequestOptionFunc) ([]*Commit, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -146,7 +147,7 @@ type GetCommitRefsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to -func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetCommitRefsOptions, options ...OptionFunc) ([]*CommitRef, *Response, error) { +func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetCommitRefsOptions, options ...RequestOptionFunc) ([]*CommitRef, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -171,7 +172,7 @@ func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetComm // branch or tag. // // GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-a-single-commit -func (s *CommitsService) GetCommit(pid interface{}, sha string, options ...OptionFunc) (*Commit, *Response, error) { +func (s *CommitsService) GetCommit(pid interface{}, sha string, options ...RequestOptionFunc) (*Commit, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -214,7 +215,7 @@ type CreateCommitOptions struct { // CreateCommit creates a commit with multiple files and actions. // // GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions -func (s *CommitsService) CreateCommit(pid interface{}, opt *CreateCommitOptions, options ...OptionFunc) (*Commit, *Response, error) { +func (s *CommitsService) CreateCommit(pid interface{}, opt *CreateCommitOptions, options ...RequestOptionFunc) (*Commit, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -263,7 +264,7 @@ type GetCommitDiffOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/commits.html#get-the-diff-of-a-commit -func (s *CommitsService) GetCommitDiff(pid interface{}, sha string, opt *GetCommitDiffOptions, options ...OptionFunc) ([]*Diff, *Response, error) { +func (s *CommitsService) GetCommitDiff(pid interface{}, sha string, opt *GetCommitDiffOptions, options ...RequestOptionFunc) ([]*Diff, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -320,7 +321,7 @@ type GetCommitCommentsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/commits.html#get-the-comments-of-a-commit -func (s *CommitsService) GetCommitComments(pid interface{}, sha string, opt *GetCommitCommentsOptions, options ...OptionFunc) ([]*CommitComment, *Response, error) { +func (s *CommitsService) GetCommitComments(pid interface{}, sha string, opt *GetCommitCommentsOptions, options ...RequestOptionFunc) ([]*CommitComment, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -359,7 +360,7 @@ type PostCommitCommentOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/commits.html#post-comment-to-commit -func (s *CommitsService) PostCommitComment(pid interface{}, sha string, opt *PostCommitCommentOptions, options ...OptionFunc) (*CommitComment, *Response, error) { +func (s *CommitsService) PostCommitComment(pid interface{}, sha string, opt *PostCommitCommentOptions, options ...RequestOptionFunc) (*CommitComment, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -411,7 +412,7 @@ type CommitStatus struct { // GetCommitStatuses gets the statuses of a commit in a project. // // GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit -func (s *CommitsService) GetCommitStatuses(pid interface{}, sha string, opt *GetCommitStatusesOptions, options ...OptionFunc) ([]*CommitStatus, *Response, error) { +func (s *CommitsService) GetCommitStatuses(pid interface{}, sha string, opt *GetCommitStatusesOptions, options ...RequestOptionFunc) ([]*CommitStatus, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -447,7 +448,7 @@ type SetCommitStatusOptions struct { // SetCommitStatus sets the status of a commit in a project. // // GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#post-the-status-to-commit -func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCommitStatusOptions, options ...OptionFunc) (*CommitStatus, *Response, error) { +func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCommitStatusOptions, options ...RequestOptionFunc) (*CommitStatus, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -472,7 +473,7 @@ func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCo // // GitLab API docs: // https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit -func (s *CommitsService) GetMergeRequestsByCommit(pid interface{}, sha string, options ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *CommitsService) GetMergeRequestsByCommit(pid interface{}, sha string, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -503,7 +504,7 @@ type CherryPickCommitOptions struct { // CherryPickCommit cherry picks a commit to a given branch. // // GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#cherry-pick-a-commit -func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *CherryPickCommitOptions, options ...OptionFunc) (*Commit, *Response, error) { +func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *CherryPickCommitOptions, options ...RequestOptionFunc) (*Commit, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -534,7 +535,7 @@ type RevertCommitOptions struct { // RevertCommit reverts a commit in a given branch. // // GitLab API docs: https://docs.gitlab.com/ee/api/commits.html#revert-a-commit -func (s *CommitsService) RevertCommit(pid interface{}, sha string, opt *RevertCommitOptions, options ...OptionFunc) (*Commit, *Response, error) { +func (s *CommitsService) RevertCommit(pid interface{}, sha string, opt *RevertCommitOptions, options ...RequestOptionFunc) (*Commit, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -571,7 +572,7 @@ type GPGSignature struct { // GetGPGSiganature gets a GPG signature of a commit. // // GitLab API docs: https://docs.gitlab.com/ee/api/commits.html#get-gpg-signature-of-a-commit -func (s *CommitsService) GetGPGSiganature(pid interface{}, sha string, options ...OptionFunc) (*GPGSignature, *Response, error) { +func (s *CommitsService) GetGPGSiganature(pid interface{}, sha string, options ...RequestOptionFunc) (*GPGSignature, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/custom_attributes.go b/vendor/github.com/xanzy/go-gitlab/custom_attributes.go index ce165c808d..02e9e5ca08 100644 --- a/vendor/github.com/xanzy/go-gitlab/custom_attributes.go +++ b/vendor/github.com/xanzy/go-gitlab/custom_attributes.go @@ -24,7 +24,7 @@ type CustomAttribute struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#list-custom-attributes -func (s *CustomAttributesService) ListCustomUserAttributes(user int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) ListCustomUserAttributes(user int, options ...RequestOptionFunc) ([]*CustomAttribute, *Response, error) { return s.listCustomAttributes("users", user, options...) } @@ -32,7 +32,7 @@ func (s *CustomAttributesService) ListCustomUserAttributes(user int, options ... // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#list-custom-attributes -func (s *CustomAttributesService) ListCustomGroupAttributes(group int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) ListCustomGroupAttributes(group int, options ...RequestOptionFunc) ([]*CustomAttribute, *Response, error) { return s.listCustomAttributes("groups", group, options...) } @@ -40,11 +40,11 @@ func (s *CustomAttributesService) ListCustomGroupAttributes(group int, options . // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#list-custom-attributes -func (s *CustomAttributesService) ListCustomProjectAttributes(project int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) ListCustomProjectAttributes(project int, options ...RequestOptionFunc) ([]*CustomAttribute, *Response, error) { return s.listCustomAttributes("projects", project, options...) } -func (s *CustomAttributesService) listCustomAttributes(resource string, id int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) listCustomAttributes(resource string, id int, options ...RequestOptionFunc) ([]*CustomAttribute, *Response, error) { u := fmt.Sprintf("%s/%d/custom_attributes", resource, id) req, err := s.client.NewRequest("GET", u, nil, options) if err != nil { @@ -63,7 +63,7 @@ func (s *CustomAttributesService) listCustomAttributes(resource string, id int, // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#single-custom-attribute -func (s *CustomAttributesService) GetCustomUserAttribute(user int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) GetCustomUserAttribute(user int, key string, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) { return s.getCustomAttribute("users", user, key, options...) } @@ -71,7 +71,7 @@ func (s *CustomAttributesService) GetCustomUserAttribute(user int, key string, o // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#single-custom-attribute -func (s *CustomAttributesService) GetCustomGroupAttribute(group int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) GetCustomGroupAttribute(group int, key string, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) { return s.getCustomAttribute("groups", group, key, options...) } @@ -79,11 +79,11 @@ func (s *CustomAttributesService) GetCustomGroupAttribute(group int, key string, // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#single-custom-attribute -func (s *CustomAttributesService) GetCustomProjectAttribute(project int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) GetCustomProjectAttribute(project int, key string, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) { return s.getCustomAttribute("projects", project, key, options...) } -func (s *CustomAttributesService) getCustomAttribute(resource string, id int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) getCustomAttribute(resource string, id int, key string, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) { u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, key) req, err := s.client.NewRequest("GET", u, nil, options) if err != nil { @@ -102,7 +102,7 @@ func (s *CustomAttributesService) getCustomAttribute(resource string, id int, ke // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute -func (s *CustomAttributesService) SetCustomUserAttribute(user int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) SetCustomUserAttribute(user int, c CustomAttribute, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) { return s.setCustomAttribute("users", user, c, options...) } @@ -110,7 +110,7 @@ func (s *CustomAttributesService) SetCustomUserAttribute(user int, c CustomAttri // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute -func (s *CustomAttributesService) SetCustomGroupAttribute(group int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) SetCustomGroupAttribute(group int, c CustomAttribute, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) { return s.setCustomAttribute("groups", group, c, options...) } @@ -118,11 +118,11 @@ func (s *CustomAttributesService) SetCustomGroupAttribute(group int, c CustomAtt // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute -func (s *CustomAttributesService) SetCustomProjectAttribute(project int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) SetCustomProjectAttribute(project int, c CustomAttribute, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) { return s.setCustomAttribute("projects", project, c, options...) } -func (s *CustomAttributesService) setCustomAttribute(resource string, id int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) { +func (s *CustomAttributesService) setCustomAttribute(resource string, id int, c CustomAttribute, options ...RequestOptionFunc) (*CustomAttribute, *Response, error) { u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, c.Key) req, err := s.client.NewRequest("PUT", u, c, options) if err != nil { @@ -141,7 +141,7 @@ func (s *CustomAttributesService) setCustomAttribute(resource string, id int, c // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#delete-custom-attribute -func (s *CustomAttributesService) DeleteCustomUserAttribute(user int, key string, options ...OptionFunc) (*Response, error) { +func (s *CustomAttributesService) DeleteCustomUserAttribute(user int, key string, options ...RequestOptionFunc) (*Response, error) { return s.deleteCustomAttribute("users", user, key, options...) } @@ -149,7 +149,7 @@ func (s *CustomAttributesService) DeleteCustomUserAttribute(user int, key string // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#delete-custom-attribute -func (s *CustomAttributesService) DeleteCustomGroupAttribute(group int, key string, options ...OptionFunc) (*Response, error) { +func (s *CustomAttributesService) DeleteCustomGroupAttribute(group int, key string, options ...RequestOptionFunc) (*Response, error) { return s.deleteCustomAttribute("groups", group, key, options...) } @@ -157,11 +157,11 @@ func (s *CustomAttributesService) DeleteCustomGroupAttribute(group int, key stri // // GitLab API docs: // https://docs.gitlab.com/ce/api/custom_attributes.html#delete-custom-attribute -func (s *CustomAttributesService) DeleteCustomProjectAttribute(project int, key string, options ...OptionFunc) (*Response, error) { +func (s *CustomAttributesService) DeleteCustomProjectAttribute(project int, key string, options ...RequestOptionFunc) (*Response, error) { return s.deleteCustomAttribute("projects", project, key, options...) } -func (s *CustomAttributesService) deleteCustomAttribute(resource string, id int, key string, options ...OptionFunc) (*Response, error) { +func (s *CustomAttributesService) deleteCustomAttribute(resource string, id int, key string, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, key) req, err := s.client.NewRequest("DELETE", u, nil, options) if err != nil { diff --git a/vendor/github.com/xanzy/go-gitlab/deploy_keys.go b/vendor/github.com/xanzy/go-gitlab/deploy_keys.go index 8c184184a5..adb50bdbff 100644 --- a/vendor/github.com/xanzy/go-gitlab/deploy_keys.go +++ b/vendor/github.com/xanzy/go-gitlab/deploy_keys.go @@ -46,7 +46,7 @@ func (k DeployKey) String() string { // // GitLab API docs: // https://docs.gitlab.com/ce/api/deploy_keys.html#list-all-deploy-keys -func (s *DeployKeysService) ListAllDeployKeys(options ...OptionFunc) ([]*DeployKey, *Response, error) { +func (s *DeployKeysService) ListAllDeployKeys(options ...RequestOptionFunc) ([]*DeployKey, *Response, error) { req, err := s.client.NewRequest("GET", "deploy_keys", nil, options) if err != nil { return nil, nil, err @@ -72,7 +72,7 @@ type ListProjectDeployKeysOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/deploy_keys.html#list-project-deploy-keys -func (s *DeployKeysService) ListProjectDeployKeys(pid interface{}, opt *ListProjectDeployKeysOptions, options ...OptionFunc) ([]*DeployKey, *Response, error) { +func (s *DeployKeysService) ListProjectDeployKeys(pid interface{}, opt *ListProjectDeployKeysOptions, options ...RequestOptionFunc) ([]*DeployKey, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -97,7 +97,7 @@ func (s *DeployKeysService) ListProjectDeployKeys(pid interface{}, opt *ListProj // // GitLab API docs: // https://docs.gitlab.com/ce/api/deploy_keys.html#single-deploy-key -func (s *DeployKeysService) GetDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*DeployKey, *Response, error) { +func (s *DeployKeysService) GetDeployKey(pid interface{}, deployKey int, options ...RequestOptionFunc) (*DeployKey, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -134,7 +134,7 @@ type AddDeployKeyOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/deploy_keys.html#add-deploy-key -func (s *DeployKeysService) AddDeployKey(pid interface{}, opt *AddDeployKeyOptions, options ...OptionFunc) (*DeployKey, *Response, error) { +func (s *DeployKeysService) AddDeployKey(pid interface{}, opt *AddDeployKeyOptions, options ...RequestOptionFunc) (*DeployKey, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -159,7 +159,7 @@ func (s *DeployKeysService) AddDeployKey(pid interface{}, opt *AddDeployKeyOptio // // GitLab API docs: // https://docs.gitlab.com/ce/api/deploy_keys.html#delete-deploy-key -func (s *DeployKeysService) DeleteDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*Response, error) { +func (s *DeployKeysService) DeleteDeployKey(pid interface{}, deployKey int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -178,7 +178,7 @@ func (s *DeployKeysService) DeleteDeployKey(pid interface{}, deployKey int, opti // // GitLab API docs: // https://docs.gitlab.com/ce/api/deploy_keys.html#enable-deploy-key -func (s *DeployKeysService) EnableDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*DeployKey, *Response, error) { +func (s *DeployKeysService) EnableDeployKey(pid interface{}, deployKey int, options ...RequestOptionFunc) (*DeployKey, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/deploy_tokens.go b/vendor/github.com/xanzy/go-gitlab/deploy_tokens.go new file mode 100644 index 0000000000..6d6ece3967 --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/deploy_tokens.go @@ -0,0 +1,221 @@ +package gitlab + +import ( + "fmt" + "time" +) + +// DeployTokensService handles communication with the deploy tokens related methods +// of the GitLab API. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/deploy_tokens.html +type DeployTokensService struct { + client *Client +} + +// DeployToken represents a GitLab deploy token. +type DeployToken struct { + ID int `json:"id"` + Name string `json:"name"` + Username string `json:"username"` + ExpiresAt *time.Time `json:"expires_at"` + Token string `json:"token,omitempty"` + Scopes []string `json:"scopes"` +} + +func (k DeployToken) String() string { + return Stringify(k) +} + +// ListAllDeployTokens gets a list of all deploy tokens. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#list-all-deploy-tokens +func (s *DeployTokensService) ListAllDeployTokens(options ...RequestOptionFunc) ([]*DeployToken, *Response, error) { + req, err := s.client.NewRequest("GET", "deploy_tokens", nil, options) + if err != nil { + return nil, nil, err + } + + var ts []*DeployToken + resp, err := s.client.Do(req, &ts) + if err != nil { + return nil, resp, err + } + + return ts, resp, err +} + +// ListProjectDeployTokensOptions represents the available ListProjectDeployTokens() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#list-project-deploy-tokens +type ListProjectDeployTokensOptions ListOptions + +// ListProjectDeployTokens gets a list of a project's deploy tokens. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#list-project-deploy-tokens +func (s *DeployTokensService) ListProjectDeployTokens(pid interface{}, opt *ListProjectDeployTokensOptions, options ...RequestOptionFunc) ([]*DeployToken, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/deploy_tokens", pathEscape(project)) + + req, err := s.client.NewRequest("GET", u, opt, options) + if err != nil { + return nil, nil, err + } + + var ts []*DeployToken + resp, err := s.client.Do(req, &ts) + if err != nil { + return nil, resp, err + } + + return ts, resp, err +} + +// CreateProjectDeployTokenOptions represents the available CreateProjectDeployToken() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#create-a-project-deploy-token +type CreateProjectDeployTokenOptions struct { + Name *string `url:"name,omitempty" json:"name,omitempty"` + ExpiresAt *time.Time `url:"expires_at,omitempty" json:"expires_at,omitempty"` + Username *string `url:"username,omitempty" json:"username,omitempty"` + Scopes []string `url:"scopes,omitempty" json:"scopes,omitempty"` +} + +// CreateProjectDeployToken creates a new deploy token for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#create-a-project-deploy-token +func (s *DeployTokensService) CreateProjectDeployToken(pid interface{}, opt *CreateProjectDeployTokenOptions, options ...RequestOptionFunc) (*DeployToken, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/deploy_tokens", pathEscape(project)) + + req, err := s.client.NewRequest("POST", u, opt, options) + if err != nil { + return nil, nil, err + } + + t := new(DeployToken) + resp, err := s.client.Do(req, t) + if err != nil { + return nil, resp, err + } + + return t, resp, err +} + +// DeleteProjectDeployToken removes a deploy token from the project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#delete-a-project-deploy-token +func (s *DeployTokensService) DeleteProjectDeployToken(pid interface{}, deployToken int, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/deploy_tokens/%d", pathEscape(project), deployToken) + + req, err := s.client.NewRequest("DELETE", u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ListGroupDeployTokensOptions represents the available ListGroupDeployTokens() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#list-group-deploy-deploy-tokens +type ListGroupDeployTokensOptions ListOptions + +// ListGroupDeployTokens gets a list of a group’s deploy tokens. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#list-project-deploy-tokens +func (s *DeployTokensService) ListGroupDeployTokens(gid interface{}, opt *ListGroupDeployTokensOptions, options ...RequestOptionFunc) ([]*DeployToken, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/deploy_tokens", pathEscape(group)) + + req, err := s.client.NewRequest("GET", u, opt, options) + if err != nil { + return nil, nil, err + } + + var ts []*DeployToken + resp, err := s.client.Do(req, &ts) + if err != nil { + return nil, resp, err + } + + return ts, resp, err +} + +// CreateGroupDeployTokenOptions represents the available CreateGroupDeployToken() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#create-a-group-deploy-token +type CreateGroupDeployTokenOptions struct { + Name *string `url:"name,omitempty" json:"name,omitempty"` + ExpiresAt *time.Time `url:"expires_at,omitempty" json:"expires_at,omitempty"` + Username *string `url:"username,omitempty" json:"username,omitempty"` + Scopes []string `url:"scopes,omitempty" json:"scopes,omitempty"` +} + +// CreateGroupDeployToken creates a new deploy token for a group. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#create-a-group-deploy-token +func (s *DeployTokensService) CreateGroupDeployToken(gid interface{}, opt *CreateGroupDeployTokenOptions, options ...RequestOptionFunc) (*DeployToken, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/deploy_tokens", pathEscape(group)) + + req, err := s.client.NewRequest("POST", u, opt, options) + if err != nil { + return nil, nil, err + } + + t := new(DeployToken) + resp, err := s.client.Do(req, t) + if err != nil { + return nil, resp, err + } + + return t, resp, err +} + +// DeleteGroupDeployToken removes a deploy token from the group. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/deploy_tokens.html#delete-a-group-deploy-token +func (s *DeployTokensService) DeleteGroupDeployToken(gid interface{}, deployToken int, options ...RequestOptionFunc) (*Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("groups/%s/deploy_tokens/%d", pathEscape(group), deployToken) + + req, err := s.client.NewRequest("DELETE", u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/xanzy/go-gitlab/deployments.go b/vendor/github.com/xanzy/go-gitlab/deployments.go index 8041ce9211..251cded825 100644 --- a/vendor/github.com/xanzy/go-gitlab/deployments.go +++ b/vendor/github.com/xanzy/go-gitlab/deployments.go @@ -67,14 +67,18 @@ type Deployment struct { // https://docs.gitlab.com/ce/api/deployments.html#list-project-deployments type ListProjectDeploymentsOptions struct { ListOptions - OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` - Sort *string `url:"sort,omitempty" json:"sort,omitempty"` + OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` + Sort *string `url:"sort,omitempty" json:"sort,omitempty"` + UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` + UpdatedBefore *time.Time `url:"update_before,omitempty" json:"updated_before,omitempty"` + Environment *string `url:"environment,omitempty" json:"environment,omitempty"` + Status *string `url:"status,omitempty" json:"status,omitempty"` } // ListProjectDeployments gets a list of deployments in a project. // // GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html#list-project-deployments -func (s *DeploymentsService) ListProjectDeployments(pid interface{}, opts *ListProjectDeploymentsOptions, options ...OptionFunc) ([]*Deployment, *Response, error) { +func (s *DeploymentsService) ListProjectDeployments(pid interface{}, opts *ListProjectDeploymentsOptions, options ...RequestOptionFunc) ([]*Deployment, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -98,7 +102,7 @@ func (s *DeploymentsService) ListProjectDeployments(pid interface{}, opts *ListP // GetProjectDeployment get a deployment for a project. // // GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html#get-a-specific-deployment -func (s *DeploymentsService) GetProjectDeployment(pid interface{}, deployment int, options ...OptionFunc) (*Deployment, *Response, error) { +func (s *DeploymentsService) GetProjectDeployment(pid interface{}, deployment int, options ...RequestOptionFunc) (*Deployment, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -118,3 +122,71 @@ func (s *DeploymentsService) GetProjectDeployment(pid interface{}, deployment in return d, resp, err } + +// CreateProjectDeploymentOptions represents the available +// CreateProjectDeployment() options. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/deployments.html#create-a-deployment +type CreateProjectDeploymentOptions struct { + Environment *string `url:"environment,omitempty" json:"environment,omitempty"` + Ref *string `url:"ref,omitempty" json:"ref,omitempty"` + SHA *string `url:"sha,omitempty" json:"sha,omitempty"` + Tag *bool `url:"tag,omitempty" json:"tag,omitempty"` + Status *DeploymentStatusValue `url:"status,omitempty" json:"status,omitempty"` +} + +// CreateProjectDeployment creates a project deployment. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/deployments.html#create-a-deployment +func (s *DeploymentsService) CreateProjectDeployment(pid interface{}, opt *CreateProjectDeploymentOptions, options ...RequestOptionFunc) (*Deployment, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/deployments", pathEscape(project)) + + req, err := s.client.NewRequest("POST", u, opt, options) + if err != nil { + return nil, nil, err + } + + d := new(Deployment) + resp, err := s.client.Do(req, &d) + if err != nil { + return nil, resp, err + } + + return d, resp, err +} + +// UpdateProjectDeploymentOptions represents the available +// UpdateProjectDeployment() options. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/deployments.html#updating-a-deployment +type UpdateProjectDeploymentOptions struct { + Status *DeploymentStatusValue `url:"status,omitempty" json:"status,omitempty"` +} + +// UpdateProjectDeployment updates a project deployment. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/deployments.html#updating-a-deployment +func (s *DeploymentsService) UpdateProjectDeployment(pid interface{}, deployment int, opt *UpdateProjectDeploymentOptions, options ...RequestOptionFunc) (*Deployment, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/deployments/%d", pathEscape(project), deployment) + + req, err := s.client.NewRequest("PUT", u, opt, options) + if err != nil { + return nil, nil, err + } + + d := new(Deployment) + resp, err := s.client.Do(req, &d) + if err != nil { + return nil, resp, err + } + + return d, resp, err +} diff --git a/vendor/github.com/xanzy/go-gitlab/discussions.go b/vendor/github.com/xanzy/go-gitlab/discussions.go index 17ed1c7d58..14a5401dd7 100644 --- a/vendor/github.com/xanzy/go-gitlab/discussions.go +++ b/vendor/github.com/xanzy/go-gitlab/discussions.go @@ -54,7 +54,7 @@ type ListIssueDiscussionsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#list-project-issue-discussion-items -func (s *DiscussionsService) ListIssueDiscussions(pid interface{}, issue int, opt *ListIssueDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) { +func (s *DiscussionsService) ListIssueDiscussions(pid interface{}, issue int, opt *ListIssueDiscussionsOptions, options ...RequestOptionFunc) ([]*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -79,7 +79,7 @@ func (s *DiscussionsService) ListIssueDiscussions(pid interface{}, issue int, op // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#get-single-issue-discussion-item -func (s *DiscussionsService) GetIssueDiscussion(pid interface{}, issue int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) GetIssueDiscussion(pid interface{}, issue int, discussion string, options ...RequestOptionFunc) (*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -118,7 +118,7 @@ type CreateIssueDiscussionOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#create-new-issue-thread -func (s *DiscussionsService) CreateIssueDiscussion(pid interface{}, issue int, opt *CreateIssueDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) CreateIssueDiscussion(pid interface{}, issue int, opt *CreateIssueDiscussionOptions, options ...RequestOptionFunc) (*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -153,7 +153,7 @@ type AddIssueDiscussionNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-issue-thread -func (s *DiscussionsService) AddIssueDiscussionNote(pid interface{}, issue int, discussion string, opt *AddIssueDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *DiscussionsService) AddIssueDiscussionNote(pid interface{}, issue int, discussion string, opt *AddIssueDiscussionNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -192,7 +192,7 @@ type UpdateIssueDiscussionNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#modify-existing-issue-thread-note -func (s *DiscussionsService) UpdateIssueDiscussionNote(pid interface{}, issue int, discussion string, note int, opt *UpdateIssueDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *DiscussionsService) UpdateIssueDiscussionNote(pid interface{}, issue int, discussion string, note int, opt *UpdateIssueDiscussionNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -222,7 +222,7 @@ func (s *DiscussionsService) UpdateIssueDiscussionNote(pid interface{}, issue in // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#delete-an-issue-thread-note -func (s *DiscussionsService) DeleteIssueDiscussionNote(pid interface{}, issue int, discussion string, note int, options ...OptionFunc) (*Response, error) { +func (s *DiscussionsService) DeleteIssueDiscussionNote(pid interface{}, issue int, discussion string, note int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -254,7 +254,7 @@ type ListSnippetDiscussionsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#list-project-snippet-discussion-items -func (s *DiscussionsService) ListSnippetDiscussions(pid interface{}, snippet int, opt *ListSnippetDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) { +func (s *DiscussionsService) ListSnippetDiscussions(pid interface{}, snippet int, opt *ListSnippetDiscussionsOptions, options ...RequestOptionFunc) ([]*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -279,7 +279,7 @@ func (s *DiscussionsService) ListSnippetDiscussions(pid interface{}, snippet int // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#get-single-snippet-discussion-item -func (s *DiscussionsService) GetSnippetDiscussion(pid interface{}, snippet int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) GetSnippetDiscussion(pid interface{}, snippet int, discussion string, options ...RequestOptionFunc) (*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -319,7 +319,7 @@ type CreateSnippetDiscussionOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#create-new-snippet-thread -func (s *DiscussionsService) CreateSnippetDiscussion(pid interface{}, snippet int, opt *CreateSnippetDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) CreateSnippetDiscussion(pid interface{}, snippet int, opt *CreateSnippetDiscussionOptions, options ...RequestOptionFunc) (*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -355,7 +355,7 @@ type AddSnippetDiscussionNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-snippet-thread -func (s *DiscussionsService) AddSnippetDiscussionNote(pid interface{}, snippet int, discussion string, opt *AddSnippetDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *DiscussionsService) AddSnippetDiscussionNote(pid interface{}, snippet int, discussion string, opt *AddSnippetDiscussionNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -394,7 +394,7 @@ type UpdateSnippetDiscussionNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#modify-existing-snippet-thread-note -func (s *DiscussionsService) UpdateSnippetDiscussionNote(pid interface{}, snippet int, discussion string, note int, opt *UpdateSnippetDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *DiscussionsService) UpdateSnippetDiscussionNote(pid interface{}, snippet int, discussion string, note int, opt *UpdateSnippetDiscussionNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -424,7 +424,7 @@ func (s *DiscussionsService) UpdateSnippetDiscussionNote(pid interface{}, snippe // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#delete-a-snippet-thread-note -func (s *DiscussionsService) DeleteSnippetDiscussionNote(pid interface{}, snippet int, discussion string, note int, options ...OptionFunc) (*Response, error) { +func (s *DiscussionsService) DeleteSnippetDiscussionNote(pid interface{}, snippet int, discussion string, note int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -456,7 +456,7 @@ type ListGroupEpicDiscussionsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#list-group-epic-discussion-items -func (s *DiscussionsService) ListGroupEpicDiscussions(gid interface{}, epic int, opt *ListGroupEpicDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) { +func (s *DiscussionsService) ListGroupEpicDiscussions(gid interface{}, epic int, opt *ListGroupEpicDiscussionsOptions, options ...RequestOptionFunc) ([]*Discussion, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -484,7 +484,7 @@ func (s *DiscussionsService) ListGroupEpicDiscussions(gid interface{}, epic int, // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#get-single-epic-discussion-item -func (s *DiscussionsService) GetEpicDiscussion(gid interface{}, epic int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) GetEpicDiscussion(gid interface{}, epic int, discussion string, options ...RequestOptionFunc) (*Discussion, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -524,7 +524,7 @@ type CreateEpicDiscussionOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-epic-thread -func (s *DiscussionsService) CreateEpicDiscussion(gid interface{}, epic int, opt *CreateEpicDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) CreateEpicDiscussion(gid interface{}, epic int, opt *CreateEpicDiscussionOptions, options ...RequestOptionFunc) (*Discussion, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -562,7 +562,7 @@ type AddEpicDiscussionNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-epic-thread -func (s *DiscussionsService) AddEpicDiscussionNote(gid interface{}, epic int, discussion string, opt *AddEpicDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *DiscussionsService) AddEpicDiscussionNote(gid interface{}, epic int, discussion string, opt *AddEpicDiscussionNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -601,7 +601,7 @@ type UpdateEpicDiscussionNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#modify-existing-epic-thread-note -func (s *DiscussionsService) UpdateEpicDiscussionNote(gid interface{}, epic int, discussion string, note int, opt *UpdateEpicDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *DiscussionsService) UpdateEpicDiscussionNote(gid interface{}, epic int, discussion string, note int, opt *UpdateEpicDiscussionNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -631,7 +631,7 @@ func (s *DiscussionsService) UpdateEpicDiscussionNote(gid interface{}, epic int, // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#delete-an-epic-thread-note -func (s *DiscussionsService) DeleteEpicDiscussionNote(gid interface{}, epic int, discussion string, note int, options ...OptionFunc) (*Response, error) { +func (s *DiscussionsService) DeleteEpicDiscussionNote(gid interface{}, epic int, discussion string, note int, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err @@ -663,7 +663,7 @@ type ListMergeRequestDiscussionsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#list-project-merge-request-discussion-items -func (s *DiscussionsService) ListMergeRequestDiscussions(pid interface{}, mergeRequest int, opt *ListMergeRequestDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) { +func (s *DiscussionsService) ListMergeRequestDiscussions(pid interface{}, mergeRequest int, opt *ListMergeRequestDiscussionsOptions, options ...RequestOptionFunc) ([]*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -692,7 +692,7 @@ func (s *DiscussionsService) ListMergeRequestDiscussions(pid interface{}, mergeR // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#get-single-merge-request-discussion-item -func (s *DiscussionsService) GetMergeRequestDiscussion(pid interface{}, mergeRequest int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) GetMergeRequestDiscussion(pid interface{}, mergeRequest int, discussion string, options ...RequestOptionFunc) (*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -733,7 +733,7 @@ type CreateMergeRequestDiscussionOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#create-new-merge-request-thread -func (s *DiscussionsService) CreateMergeRequestDiscussion(pid interface{}, mergeRequest int, opt *CreateMergeRequestDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) CreateMergeRequestDiscussion(pid interface{}, mergeRequest int, opt *CreateMergeRequestDiscussionOptions, options ...RequestOptionFunc) (*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -771,7 +771,7 @@ type ResolveMergeRequestDiscussionOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#resolve-a-merge-request-thread -func (s *DiscussionsService) ResolveMergeRequestDiscussion(pid interface{}, mergeRequest int, discussion string, opt *ResolveMergeRequestDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) ResolveMergeRequestDiscussion(pid interface{}, mergeRequest int, discussion string, opt *ResolveMergeRequestDiscussionOptions, options ...RequestOptionFunc) (*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -811,7 +811,7 @@ type AddMergeRequestDiscussionNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-merge-request-discussion -func (s *DiscussionsService) AddMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, opt *AddMergeRequestDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *DiscussionsService) AddMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, opt *AddMergeRequestDiscussionNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -852,7 +852,7 @@ type UpdateMergeRequestDiscussionNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#modify-existing-merge-request-discussion-note -func (s *DiscussionsService) UpdateMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, note int, opt *UpdateMergeRequestDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *DiscussionsService) UpdateMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, note int, opt *UpdateMergeRequestDiscussionNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -883,7 +883,7 @@ func (s *DiscussionsService) UpdateMergeRequestDiscussionNote(pid interface{}, m // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#delete-a-merge-request-discussion-note -func (s *DiscussionsService) DeleteMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, note int, options ...OptionFunc) (*Response, error) { +func (s *DiscussionsService) DeleteMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, note int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -915,7 +915,7 @@ type ListCommitDiscussionsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#list-project-commit-discussion-items -func (s *DiscussionsService) ListCommitDiscussions(pid interface{}, commit string, opt *ListCommitDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) { +func (s *DiscussionsService) ListCommitDiscussions(pid interface{}, commit string, opt *ListCommitDiscussionsOptions, options ...RequestOptionFunc) ([]*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -944,7 +944,7 @@ func (s *DiscussionsService) ListCommitDiscussions(pid interface{}, commit strin // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#get-single-commit-discussion-item -func (s *DiscussionsService) GetCommitDiscussion(pid interface{}, commit string, discussion string, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) GetCommitDiscussion(pid interface{}, commit string, discussion string, options ...RequestOptionFunc) (*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -984,7 +984,7 @@ type CreateCommitDiscussionOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#create-new-commit-thread -func (s *DiscussionsService) CreateCommitDiscussion(pid interface{}, commit string, opt *CreateCommitDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) { +func (s *DiscussionsService) CreateCommitDiscussion(pid interface{}, commit string, opt *CreateCommitDiscussionOptions, options ...RequestOptionFunc) (*Discussion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1022,7 +1022,7 @@ type AddCommitDiscussionNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-commit-thread -func (s *DiscussionsService) AddCommitDiscussionNote(pid interface{}, commit string, discussion string, opt *AddCommitDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *DiscussionsService) AddCommitDiscussionNote(pid interface{}, commit string, discussion string, opt *AddCommitDiscussionNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1061,7 +1061,7 @@ type UpdateCommitDiscussionNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#modify-an-existing-commit-thread-note -func (s *DiscussionsService) UpdateCommitDiscussionNote(pid interface{}, commit string, discussion string, note int, opt *UpdateCommitDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *DiscussionsService) UpdateCommitDiscussionNote(pid interface{}, commit string, discussion string, note int, opt *UpdateCommitDiscussionNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1091,7 +1091,7 @@ func (s *DiscussionsService) UpdateCommitDiscussionNote(pid interface{}, commit // // GitLab API docs: // https://docs.gitlab.com/ce/api/discussions.html#delete-a-commit-thread-note -func (s *DiscussionsService) DeleteCommitDiscussionNote(pid interface{}, commit string, discussion string, note int, options ...OptionFunc) (*Response, error) { +func (s *DiscussionsService) DeleteCommitDiscussionNote(pid interface{}, commit string, discussion string, note int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/environments.go b/vendor/github.com/xanzy/go-gitlab/environments.go index 397c2d280e..f666cde899 100644 --- a/vendor/github.com/xanzy/go-gitlab/environments.go +++ b/vendor/github.com/xanzy/go-gitlab/environments.go @@ -56,7 +56,7 @@ type ListEnvironmentsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ee/api/environments.html#list-environments -func (s *EnvironmentsService) ListEnvironments(pid interface{}, opts *ListEnvironmentsOptions, options ...OptionFunc) ([]*Environment, *Response, error) { +func (s *EnvironmentsService) ListEnvironments(pid interface{}, opts *ListEnvironmentsOptions, options ...RequestOptionFunc) ([]*Environment, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -81,7 +81,7 @@ func (s *EnvironmentsService) ListEnvironments(pid interface{}, opts *ListEnviro // // GitLab API docs: // https://docs.gitlab.com/ee/api/environments.html#get-a-specific-environment -func (s *EnvironmentsService) GetEnvironment(pid interface{}, environment int, options ...OptionFunc) (*Environment, *Response, error) { +func (s *EnvironmentsService) GetEnvironment(pid interface{}, environment int, options ...RequestOptionFunc) (*Environment, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -118,7 +118,7 @@ type CreateEnvironmentOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/environments.html#create-a-new-environment -func (s *EnvironmentsService) CreateEnvironment(pid interface{}, opt *CreateEnvironmentOptions, options ...OptionFunc) (*Environment, *Response, error) { +func (s *EnvironmentsService) CreateEnvironment(pid interface{}, opt *CreateEnvironmentOptions, options ...RequestOptionFunc) (*Environment, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -152,7 +152,7 @@ type EditEnvironmentOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/environments.html#edit-an-existing-environment -func (s *EnvironmentsService) EditEnvironment(pid interface{}, environment int, opt *EditEnvironmentOptions, options ...OptionFunc) (*Environment, *Response, error) { +func (s *EnvironmentsService) EditEnvironment(pid interface{}, environment int, opt *EditEnvironmentOptions, options ...RequestOptionFunc) (*Environment, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -177,7 +177,7 @@ func (s *EnvironmentsService) EditEnvironment(pid interface{}, environment int, // // GitLab API docs: // https://docs.gitlab.com/ce/api/environments.html#remove-a-environment-from-a-group-or-project -func (s *EnvironmentsService) DeleteEnvironment(pid interface{}, environment int, options ...OptionFunc) (*Response, error) { +func (s *EnvironmentsService) DeleteEnvironment(pid interface{}, environment int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -196,7 +196,7 @@ func (s *EnvironmentsService) DeleteEnvironment(pid interface{}, environment int // // GitLab API docs: // https://docs.gitlab.com/ce/api/environments.html#stop-an-environment -func (s *EnvironmentsService) StopEnvironment(pid interface{}, environmentID int, options ...OptionFunc) (*Response, error) { +func (s *EnvironmentsService) StopEnvironment(pid interface{}, environmentID int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/epics.go b/vendor/github.com/xanzy/go-gitlab/epics.go index 1e93c8ec16..87dbe200cd 100644 --- a/vendor/github.com/xanzy/go-gitlab/epics.go +++ b/vendor/github.com/xanzy/go-gitlab/epics.go @@ -71,7 +71,7 @@ type ListGroupEpicsOptions struct { // parameters page and per_page to return the list of group epics. // // GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#list-epics-for-a-group -func (s *EpicsService) ListGroupEpics(gid interface{}, opt *ListGroupEpicsOptions, options ...OptionFunc) ([]*Epic, *Response, error) { +func (s *EpicsService) ListGroupEpics(gid interface{}, opt *ListGroupEpicsOptions, options ...RequestOptionFunc) ([]*Epic, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -95,7 +95,7 @@ func (s *EpicsService) ListGroupEpics(gid interface{}, opt *ListGroupEpicsOption // GetEpic gets a single group epic. // // GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#single-epic -func (s *EpicsService) GetEpic(gid interface{}, epic int, options ...OptionFunc) (*Epic, *Response, error) { +func (s *EpicsService) GetEpic(gid interface{}, epic int, options ...RequestOptionFunc) (*Epic, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -132,7 +132,7 @@ type CreateEpicOptions struct { // CreateEpic creates a new group epic. // // GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#new-epic -func (s *EpicsService) CreateEpic(gid interface{}, opt *CreateEpicOptions, options ...OptionFunc) (*Epic, *Response, error) { +func (s *EpicsService) CreateEpic(gid interface{}, opt *CreateEpicOptions, options ...RequestOptionFunc) (*Epic, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -171,7 +171,7 @@ type UpdateEpicOptions struct { // to mark an epic as closed. // // GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#update-epic -func (s *EpicsService) UpdateEpic(gid interface{}, epic int, opt *UpdateEpicOptions, options ...OptionFunc) (*Epic, *Response, error) { +func (s *EpicsService) UpdateEpic(gid interface{}, epic int, opt *UpdateEpicOptions, options ...RequestOptionFunc) (*Epic, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -195,7 +195,7 @@ func (s *EpicsService) UpdateEpic(gid interface{}, epic int, opt *UpdateEpicOpti // DeleteEpic deletes a single group epic. // // GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#delete-epic -func (s *EpicsService) DeleteEpic(gid interface{}, epic int, options ...OptionFunc) (*Response, error) { +func (s *EpicsService) DeleteEpic(gid interface{}, epic int, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/event_parsing.go b/vendor/github.com/xanzy/go-gitlab/event_parsing.go index 7ac042ae89..a09b356c11 100644 --- a/vendor/github.com/xanzy/go-gitlab/event_parsing.go +++ b/vendor/github.com/xanzy/go-gitlab/event_parsing.go @@ -11,15 +11,18 @@ type EventType string // List of available event types. const ( - EventTypeBuild EventType = "Build Hook" - EventTypeIssue EventType = "Issue Hook" - EventTypeJob EventType = "Job Hook" - EventTypeMergeRequest EventType = "Merge Request Hook" - EventTypeNote EventType = "Note Hook" - EventTypePipeline EventType = "Pipeline Hook" - EventTypePush EventType = "Push Hook" - EventTypeTagPush EventType = "Tag Push Hook" - EventTypeWikiPage EventType = "Wiki Page Hook" + EventTypeBuild EventType = "Build Hook" + EventTypeIssue EventType = "Issue Hook" + EventConfidentialIssue EventType = "Confidential Issue Hook" + EventTypeJob EventType = "Job Hook" + EventTypeMergeRequest EventType = "Merge Request Hook" + EventTypeNote EventType = "Note Hook" + EventConfidentialNote EventType = "Confidential Note Hook" + EventTypePipeline EventType = "Pipeline Hook" + EventTypePush EventType = "Push Hook" + EventTypeSystemHook EventType = "System Hook" + EventTypeTagPush EventType = "Tag Push Hook" + EventTypeWikiPage EventType = "Wiki Page Hook" ) const ( @@ -38,6 +41,119 @@ type noteEvent struct { const eventTypeHeader = "X-Gitlab-Event" +// HookEventType returns the event type for the given request. +func HookEventType(r *http.Request) EventType { + return EventType(r.Header.Get(eventTypeHeader)) +} + +// ParseHook tries to parse both web- and system hooks. +// +// Example usage: +// +// func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { +// payload, err := ioutil.ReadAll(r.Body) +// if err != nil { ... } +// event, err := gitlab.ParseHook(gitlab.HookEventType(r), payload) +// if err != nil { ... } +// switch event := event.(type) { +// case *gitlab.PushEvent: +// processPushEvent(event) +// case *gitlab.MergeEvent: +// processMergeEvent(event) +// ... +// } +// } +// +func ParseHook(eventType EventType, payload []byte) (event interface{}, err error) { + switch eventType { + case EventTypeSystemHook: + return ParseSystemhook(payload) + default: + return ParseWebhook(eventType, payload) + } +} + +// ParseSystemhook parses the event payload. For recognized event types, a +// value of the corresponding struct type will be returned. An error will be +// returned for unrecognized event types. +// +// Example usage: +// +// func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { +// payload, err := ioutil.ReadAll(r.Body) +// if err != nil { ... } +// event, err := gitlab.ParseSystemhook(payload) +// if err != nil { ... } +// switch event := event.(type) { +// case *gitlab.PushSystemEvent: +// processPushSystemEvent(event) +// case *gitlab.MergeSystemEvent: +// processMergeSystemEvent(event) +// ... +// } +// } +// +func ParseSystemhook(payload []byte) (event interface{}, err error) { + e := &systemHookEvent{} + err = json.Unmarshal(payload, e) + if err != nil { + return nil, err + } + + switch e.EventName { + case "push": + event = &PushSystemEvent{} + case "tag_push": + event = &TagPushSystemEvent{} + case "repository_update": + event = &RepositoryUpdateSystemEvent{} + case + "project_create", + "project_update", + "project_destroy", + "project_transfer", + "project_rename": + event = &ProjectSystemEvent{} + case + "group_create", + "group_destroy", + "group_rename": + event = &GroupSystemEvent{} + case + "key_create", + "key_destroy": + event = &KeySystemEvent{} + case + "user_create", + "user_destroy", + "user_rename": + event = &UserSystemEvent{} + case + "user_add_to_group", + "user_remove_from_group", + "user_update_for_group": + event = &UserGroupSystemEvent{} + case + "user_add_to_team", + "user_remove_from_team", + "user_update_for_team": + event = &UserTeamSystemEvent{} + default: + switch e.ObjectKind { + case "merge_request": + event = &MergeEvent{} + default: + return nil, fmt.Errorf("unexpected system hook type %s", e.EventName) + } + } + + if err := json.Unmarshal(payload, event); err != nil { + return nil, err + } + + return event, nil +} + // WebhookEventType returns the event type for the given request. func WebhookEventType(r *http.Request) EventType { return EventType(r.Header.Get(eventTypeHeader)) @@ -52,7 +168,7 @@ func WebhookEventType(r *http.Request) EventType { // func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // payload, err := ioutil.ReadAll(r.Body) // if err != nil { ... } -// event, err := gitlab.ParseWebhook(gitlab.WebhookEventType(r), payload) +// event, err := gitlab.ParseWebhook(gitlab.HookEventType(r), payload) // if err != nil { ... } // switch event := event.(type) { // case *gitlab.PushEvent: @@ -67,7 +183,7 @@ func ParseWebhook(eventType EventType, payload []byte) (event interface{}, err e switch eventType { case EventTypeBuild: event = &BuildEvent{} - case EventTypeIssue: + case EventTypeIssue, EventConfidentialIssue: event = &IssueEvent{} case EventTypeJob: event = &JobEvent{} @@ -81,7 +197,7 @@ func ParseWebhook(eventType EventType, payload []byte) (event interface{}, err e event = &TagEvent{} case EventTypeWikiPage: event = &WikiPageEvent{} - case EventTypeNote: + case EventTypeNote, EventConfidentialNote: note := ¬eEvent{} err := json.Unmarshal(payload, note) if err != nil { diff --git a/vendor/github.com/xanzy/go-gitlab/event_systemhook_types.go b/vendor/github.com/xanzy/go-gitlab/event_systemhook_types.go new file mode 100644 index 0000000000..4f3d527b52 --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/event_systemhook_types.go @@ -0,0 +1,133 @@ +package gitlab + +// systemHookEvent is used to pre-process events to determine the +// system hook event type. +type systemHookEvent struct { + BaseSystemEvent + ObjectKind string `json:"object_kind"` +} + +// BaseSystemEvent contains system hook's common properties. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/system_hooks/system_hooks.html +type BaseSystemEvent struct { + EventName string `json:"event_name"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` +} + +// ProjectSystemEvent represents a project system event. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/system_hooks/system_hooks.html +type ProjectSystemEvent struct { + BaseSystemEvent + Name string `json:"name"` + Path string `json:"path"` + PathWithNamespace string `json:"path_with_namespace"` + ProjectID int `json:"project_id"` + OwnerName string `json:"owner_name"` + OwnerEmail string `json:"owner_email"` + ProjectVisibility string `json:"project_visibility"` + OldPathWithNamespace string `json:"old_path_with_namespace,omitempty"` +} + +// GroupSystemEvent represents a group system event. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/system_hooks/system_hooks.html +type GroupSystemEvent struct { + BaseSystemEvent + Name string `json:"name"` + Path string `json:"path"` + PathWithNamespace string `json:"full_path"` + GroupID int `json:"group_id"` + OwnerName string `json:"owner_name"` + OwnerEmail string `json:"owner_email"` + ProjectVisibility string `json:"project_visibility"` + OldPath string `json:"old_path,omitempty"` + OldPathWithNamespace string `json:"old_full_path,omitempty"` +} + +// KeySystemEvent represents a key system event. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/system_hooks/system_hooks.html +type KeySystemEvent struct { + BaseSystemEvent + ID int `json:"id"` + Username string `json:"username"` + Key string `json:"key"` +} + +// UserSystemEvent represents a user system event. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/system_hooks/system_hooks.html +type UserSystemEvent struct { + BaseSystemEvent + ID int `json:"user_id"` + Name string `json:"name"` + Username string `json:"username"` + OldUsername string `json:"old_username,omitempty"` + Email string `json:"email"` +} + +// UserGroupSystemEvent represents a user group system event. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/system_hooks/system_hooks.html +type UserGroupSystemEvent struct { + BaseSystemEvent + ID int `json:"user_id"` + Name string `json:"user_name"` + Username string `json:"user_username"` + Email string `json:"user_email"` + GroupID int `json:"group_id"` + GroupName string `json:"group_name"` + GroupPath string `json:"group_path"` + GroupAccess string `json:"group_access"` +} + +// UserTeamSystemEvent represents a user team system event. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/system_hooks/system_hooks.html +type UserTeamSystemEvent struct { + BaseSystemEvent + ID int `json:"user_id"` + Name string `json:"user_name"` + Username string `json:"user_username"` + Email string `json:"user_email"` + ProjectID int `json:"project_id"` + ProjectName string `json:"project_name"` + ProjectPath string `json:"project_path"` + ProjectPathWithNamespace string `json:"project_path_with_namespace"` + ProjectVisibility string `json:"project_visibility"` + AccessLevel string `json:"access_level"` +} + +// PushSystemEvent represents a push system event. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/system_hooks/system_hooks.html +type PushSystemEvent struct { + BaseSystemEvent +} + +// TagPushSystemEvent represents a tag push system event. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/system_hooks/system_hooks.html +type TagPushSystemEvent struct { + BaseSystemEvent +} + +// RepositoryUpdateSystemEvent represents a repository updated system event. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/system_hooks/system_hooks.html +type RepositoryUpdateSystemEvent struct { + BaseSystemEvent +} diff --git a/vendor/github.com/xanzy/go-gitlab/event_types.go b/vendor/github.com/xanzy/go-gitlab/event_webhook_types.go index ae04a049da..108c191b83 100644 --- a/vendor/github.com/xanzy/go-gitlab/event_types.go +++ b/vendor/github.com/xanzy/go-gitlab/event_webhook_types.go @@ -128,6 +128,7 @@ type IssueEvent struct { ObjectKind string `json:"object_kind"` User *User `json:"user"` Project struct { + ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` AvatarURL string `json:"avatar_url"` @@ -203,6 +204,7 @@ type JobEvent struct { BuildFinishedAt string `json:"build_finished_at"` BuildDuration float64 `json:"build_duration"` BuildAllowFailure bool `json:"build_allow_failure"` + PipelineID int `json:"pipeline_id"` ProjectID int `json:"project_id"` ProjectName string `json:"project_name"` User struct { @@ -329,42 +331,41 @@ type MergeCommentEvent struct { } `json:"object_attributes"` Repository *Repository `json:"repository"` MergeRequest struct { - ID int `json:"id"` - TargetBranch string `json:"target_branch"` - SourceBranch string `json:"source_branch"` - SourceProjectID int `json:"source_project_id"` - AuthorID int `json:"author_id"` - AssigneeID int `json:"assignee_id"` - Title string `json:"title"` - CreatedAt string `json:"created_at"` - UpdatedAt string `json:"updated_at"` - MilestoneID int `json:"milestone_id"` - State string `json:"state"` - MergeStatus string `json:"merge_status"` - TargetProjectID int `json:"target_project_id"` - IID int `json:"iid"` - Description string `json:"description"` - Position int `json:"position"` - LockedAt string `json:"locked_at"` - UpdatedByID int `json:"updated_by_id"` - MergeError string `json:"merge_error"` - MergeParams struct { - ForceRemoveSourceBranch string `json:"force_remove_source_branch"` - } `json:"merge_params"` - MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"` - MergeUserID int `json:"merge_user_id"` - MergeCommitSHA string `json:"merge_commit_sha"` - DeletedAt string `json:"deleted_at"` - InProgressMergeCommitSHA string `json:"in_progress_merge_commit_sha"` - LockVersion int `json:"lock_version"` - ApprovalsBeforeMerge string `json:"approvals_before_merge"` - RebaseCommitSHA string `json:"rebase_commit_sha"` - TimeEstimate int `json:"time_estimate"` - Squash bool `json:"squash"` - LastEditedAt string `json:"last_edited_at"` - LastEditedByID int `json:"last_edited_by_id"` - Source *Repository `json:"source"` - Target *Repository `json:"target"` + ID int `json:"id"` + TargetBranch string `json:"target_branch"` + SourceBranch string `json:"source_branch"` + SourceProjectID int `json:"source_project_id"` + AuthorID int `json:"author_id"` + AssigneeID int `json:"assignee_id"` + AssigneeIDs []int `json:"assignee_ids"` + Title string `json:"title"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + MilestoneID int `json:"milestone_id"` + State string `json:"state"` + MergeStatus string `json:"merge_status"` + TargetProjectID int `json:"target_project_id"` + IID int `json:"iid"` + Description string `json:"description"` + Position int `json:"position"` + LockedAt string `json:"locked_at"` + UpdatedByID int `json:"updated_by_id"` + MergeError string `json:"merge_error"` + MergeParams *MergeParams `json:"merge_params"` + MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"` + MergeUserID int `json:"merge_user_id"` + MergeCommitSHA string `json:"merge_commit_sha"` + DeletedAt string `json:"deleted_at"` + InProgressMergeCommitSHA string `json:"in_progress_merge_commit_sha"` + LockVersion int `json:"lock_version"` + ApprovalsBeforeMerge string `json:"approvals_before_merge"` + RebaseCommitSHA string `json:"rebase_commit_sha"` + TimeEstimate int `json:"time_estimate"` + Squash bool `json:"squash"` + LastEditedAt string `json:"last_edited_at"` + LastEditedByID int `json:"last_edited_by_id"` + Source *Repository `json:"source"` + Target *Repository `json:"target"` LastCommit struct { ID string `json:"id"` Message string `json:"message"` @@ -524,6 +525,7 @@ type MergeEvent struct { SourceProjectID int `json:"source_project_id"` AuthorID int `json:"author_id"` AssigneeID int `json:"assignee_id"` + AssigneeIDs []int `json:"assignee_ids"` Title string `json:"title"` CreatedAt string `json:"created_at"` // Should be *time.Time (see Gitlab issue #21468) UpdatedAt string `json:"updated_at"` // Should be *time.Time (see Gitlab issue #21468) @@ -715,6 +717,18 @@ type PipelineEvent struct { FinishedAt string `json:"finished_at"` Duration int `json:"duration"` } `json:"object_attributes"` + MergeRequest struct { + ID int `json:"id"` + IID int `json:"iid"` + Title string `json:"title"` + SourceBranch string `json:"source_branch"` + SourceProjectID int `json:"source_project_id"` + TargetBranch string `json:"target_branch"` + TargetProjectID int `json:"target_project_id"` + State string `json:"state"` + MergeRequestStatus string `json:"merge_status"` + URL string `json:"url"` + } `json:"merge_request"` User struct { Name string `json:"name"` Username string `json:"username"` diff --git a/vendor/github.com/xanzy/go-gitlab/events.go b/vendor/github.com/xanzy/go-gitlab/events.go index 821b19d073..ed11609385 100644 --- a/vendor/github.com/xanzy/go-gitlab/events.go +++ b/vendor/github.com/xanzy/go-gitlab/events.go @@ -82,7 +82,7 @@ type ListContributionEventsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/events.html#get-user-contribution-events -func (s *UsersService) ListUserContributionEvents(uid interface{}, opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) { +func (s *UsersService) ListUserContributionEvents(uid interface{}, opt *ListContributionEventsOptions, options ...RequestOptionFunc) ([]*ContributionEvent, *Response, error) { user, err := parseID(uid) if err != nil { return nil, nil, err @@ -106,7 +106,7 @@ func (s *UsersService) ListUserContributionEvents(uid interface{}, opt *ListCont // ListCurrentUserContributionEvents gets a list currently authenticated user's events // // GitLab API docs: https://docs.gitlab.com/ce/api/events.html#list-currently-authenticated-user-39-s-events -func (s *EventsService) ListCurrentUserContributionEvents(opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) { +func (s *EventsService) ListCurrentUserContributionEvents(opt *ListContributionEventsOptions, options ...RequestOptionFunc) ([]*ContributionEvent, *Response, error) { req, err := s.client.NewRequest("GET", "events", opt, options) if err != nil { return nil, nil, err @@ -124,7 +124,7 @@ func (s *EventsService) ListCurrentUserContributionEvents(opt *ListContributionE // ListProjectVisibleEvents gets a list of visible events for a particular project // // GitLab API docs: https://docs.gitlab.com/ee/api/events.html#list-a-project-s-visible-events -func (s *EventsService) ListProjectVisibleEvents(pid interface{}, opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) { +func (s *EventsService) ListProjectVisibleEvents(pid interface{}, opt *ListContributionEventsOptions, options ...RequestOptionFunc) ([]*ContributionEvent, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/feature_flags.go b/vendor/github.com/xanzy/go-gitlab/feature_flags.go index 1b5df5fa8a..f5926c283e 100644 --- a/vendor/github.com/xanzy/go-gitlab/feature_flags.go +++ b/vendor/github.com/xanzy/go-gitlab/feature_flags.go @@ -38,7 +38,7 @@ func (f Feature) String() string { // // GitLab API docs: // https://docs.gitlab.com/ce/api/features.html#list-all-features -func (s *FeaturesService) ListFeatures(options ...OptionFunc) ([]*Feature, *Response, error) { +func (s *FeaturesService) ListFeatures(options ...RequestOptionFunc) ([]*Feature, *Response, error) { req, err := s.client.NewRequest("GET", "features", nil, options) if err != nil { return nil, nil, err @@ -56,7 +56,7 @@ func (s *FeaturesService) ListFeatures(options ...OptionFunc) ([]*Feature, *Resp // // GitLab API docs: // https://docs.gitlab.com/ce/api/features.html#set-or-create-a-feature -func (s *FeaturesService) SetFeatureFlag(name string, value interface{}, options ...OptionFunc) (*Feature, *Response, error) { +func (s *FeaturesService) SetFeatureFlag(name string, value interface{}, options ...RequestOptionFunc) (*Feature, *Response, error) { u := fmt.Sprintf("features/%s", url.PathEscape(name)) opt := struct { diff --git a/vendor/github.com/xanzy/go-gitlab/gitignore_templates.go b/vendor/github.com/xanzy/go-gitlab/gitignore_templates.go index 1f5e83aff0..e2dea83647 100644 --- a/vendor/github.com/xanzy/go-gitlab/gitignore_templates.go +++ b/vendor/github.com/xanzy/go-gitlab/gitignore_templates.go @@ -47,7 +47,7 @@ type ListTemplatesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates -func (s *GitIgnoreTemplatesService) ListTemplates(opt *ListTemplatesOptions, options ...OptionFunc) ([]*GitIgnoreTemplate, *Response, error) { +func (s *GitIgnoreTemplatesService) ListTemplates(opt *ListTemplatesOptions, options ...RequestOptionFunc) ([]*GitIgnoreTemplate, *Response, error) { req, err := s.client.NewRequest("GET", "templates/gitignores", opt, options) if err != nil { return nil, nil, err @@ -66,7 +66,7 @@ func (s *GitIgnoreTemplatesService) ListTemplates(opt *ListTemplatesOptions, opt // // GitLab API docs: // https://docs.gitlab.com/ce/api/templates/gitignores.html#single-gitignore-template -func (s *GitIgnoreTemplatesService) GetTemplate(key string, options ...OptionFunc) (*GitIgnoreTemplate, *Response, error) { +func (s *GitIgnoreTemplatesService) GetTemplate(key string, options ...RequestOptionFunc) (*GitIgnoreTemplate, *Response, error) { u := fmt.Sprintf("templates/gitignores/%s", url.PathEscape(key)) req, err := s.client.NewRequest("GET", u, nil, options) diff --git a/vendor/github.com/xanzy/go-gitlab/gitlab.go b/vendor/github.com/xanzy/go-gitlab/gitlab.go index b8c951c5dc..4fdca56351 100644 --- a/vendor/github.com/xanzy/go-gitlab/gitlab.go +++ b/vendor/github.com/xanzy/go-gitlab/gitlab.go @@ -18,28 +18,35 @@ package gitlab import ( - "bytes" "context" "encoding/json" "errors" "fmt" "io" "io/ioutil" + "math/rand" "net/http" "net/url" "sort" "strconv" "strings" + "sync" "time" "github.com/google/go-querystring/query" + "github.com/hashicorp/go-cleanhttp" + retryablehttp "github.com/hashicorp/go-retryablehttp" "golang.org/x/oauth2" + "golang.org/x/time/rate" ) const ( defaultBaseURL = "https://gitlab.com/" apiVersionPath = "api/v4/" userAgent = "go-gitlab" + + headerRateLimit = "RateLimit-Limit" + headerRateReset = "RateLimit-Reset" ) // authType represents an authentication type within GitLab. @@ -83,6 +90,7 @@ type BuildStateValue string // These constants represent all valid build states. const ( Pending BuildStateValue = "pending" + Created BuildStateValue = "created" Running BuildStateValue = "running" Success BuildStateValue = "success" Failed BuildStateValue = "failed" @@ -91,6 +99,18 @@ const ( Manual BuildStateValue = "manual" ) +// DeploymentStatusValue represents a Gitlab deployment status. +type DeploymentStatusValue string + +// These constants represent all valid deployment statuses. +const ( + DeploymentStatusCreated DeploymentStatusValue = "created" + DeploymentStatusRunning DeploymentStatusValue = "running" + DeploymentStatusSuccess DeploymentStatusValue = "success" + DeploymentStatusFailed DeploymentStatusValue = "failed" + DeploymentStatusCanceled DeploymentStatusValue = "canceled" +) + // ISOTime represents an ISO 8601 formatted date type ISOTime time.Time @@ -215,6 +235,33 @@ const ( PublicVisibility VisibilityValue = "public" ) +// ProjectCreationLevelValue represents a project creation level within GitLab. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/ +type ProjectCreationLevelValue string + +// List of available project creation levels. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/ +const ( + NoOneProjectCreation ProjectCreationLevelValue = "noone" + MaintainerProjectCreation ProjectCreationLevelValue = "maintainer" + DeveloperProjectCreation ProjectCreationLevelValue = "developer" +) + +// SubGroupCreationLevelValue represents a sub group creation level within GitLab. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/ +type SubGroupCreationLevelValue string + +// List of available sub group creation levels. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/ +const ( + OwnerSubGroupCreationLevelValue SubGroupCreationLevelValue = "owner" + MaintainerSubGroupCreationLevelValue SubGroupCreationLevelValue = "maintainer" +) + // VariableTypeValue represents a variable type within GitLab. // // GitLab API docs: https://docs.gitlab.com/ce/api/ @@ -281,13 +328,23 @@ const ( // A Client manages communication with the GitLab API. type Client struct { // HTTP client used to communicate with the API. - client *http.Client + client *retryablehttp.Client // Base URL for API requests. Defaults to the public GitLab API, but can be // set to a domain endpoint to use with a self hosted GitLab server. baseURL // should always be specified with a trailing slash. baseURL *url.URL + // disableRetries is used to disable the default retry logic. + disableRetries bool + + // configLimiter is used to make sure the limiter is configured exactly + // once and block all other calls until the initial (one) call is done. + configureLimiterOnce sync.Once + + // Limiter is used to limit API calls and prevent 429 responses. + limiter *rate.Limiter + // Token type used to make authenticated API calls. authType authType @@ -302,6 +359,7 @@ type Client struct { // Services used for talking to different parts of the GitLab API. AccessRequests *AccessRequestsService + Applications *ApplicationsService AwardEmoji *AwardEmojiService Boards *IssueBoardsService Branches *BranchesService @@ -311,6 +369,7 @@ type Client struct { ContainerRegistry *ContainerRegistryService CustomAttribute *CustomAttributesService DeployKeys *DeployKeysService + DeployTokens *DeployTokensService Deployments *DeploymentsService Discussions *DiscussionsService Environments *EnvironmentsService @@ -382,27 +441,31 @@ type ListOptions struct { PerPage int `url:"per_page,omitempty" json:"per_page,omitempty"` } -// NewClient returns a new GitLab API client. If a nil httpClient is -// provided, http.DefaultClient will be used. To use API methods which require +// NewClient returns a new GitLab API client. To use API methods which require // authentication, provide a valid private or personal token. -func NewClient(httpClient *http.Client, token string) *Client { - client := newClient(httpClient) +func NewClient(token string, options ...ClientOptionFunc) (*Client, error) { + client, err := newClient(options...) + if err != nil { + return nil, err + } client.authType = privateToken client.token = token - return client + return client, nil } -// NewBasicAuthClient returns a new GitLab API client. If a nil httpClient is -// provided, http.DefaultClient will be used. To use API methods which require -// authentication, provide a valid username and password. -func NewBasicAuthClient(httpClient *http.Client, endpoint, username, password string) (*Client, error) { - client := newClient(httpClient) +// NewBasicAuthClient returns a new GitLab API client. To use API methods which +// require authentication, provide a valid username and password. +func NewBasicAuthClient(username, password string, options ...ClientOptionFunc) (*Client, error) { + client, err := newClient(options...) + if err != nil { + return nil, err + } + client.authType = basicAuth client.username = username client.password = password - client.SetBaseURL(endpoint) - err := client.requestOAuthToken(context.TODO()) + err = client.requestOAuthToken(context.Background()) if err != nil { return nil, err } @@ -410,6 +473,18 @@ func NewBasicAuthClient(httpClient *http.Client, endpoint, username, password st return client, nil } +// NewOAuthClient returns a new GitLab API client. To use API methods which +// require authentication, provide a valid oauth token. +func NewOAuthClient(token string, options ...ClientOptionFunc) (*Client, error) { + client, err := newClient(options...) + if err != nil { + return nil, err + } + client.authType = oAuthToken + client.token = token + return client, nil +} + func (c *Client) requestOAuthToken(ctx context.Context) error { config := &oauth2.Config{ Endpoint: oauth2.Endpoint{ @@ -426,25 +501,31 @@ func (c *Client) requestOAuthToken(ctx context.Context) error { return nil } -// NewOAuthClient returns a new GitLab API client. If a nil httpClient is -// provided, http.DefaultClient will be used. To use API methods which require -// authentication, provide a valid oauth token. -func NewOAuthClient(httpClient *http.Client, token string) *Client { - client := newClient(httpClient) - client.authType = oAuthToken - client.token = token - return client -} - -func newClient(httpClient *http.Client) *Client { - if httpClient == nil { - httpClient = http.DefaultClient +func newClient(options ...ClientOptionFunc) (*Client, error) { + c := &Client{UserAgent: userAgent} + + // Configure the HTTP client. + c.client = &retryablehttp.Client{ + Backoff: c.retryHTTPBackoff, + CheckRetry: c.retryHTTPCheck, + ErrorHandler: retryablehttp.PassthroughErrorHandler, + HTTPClient: cleanhttp.DefaultPooledClient(), + RetryWaitMin: 100 * time.Millisecond, + RetryWaitMax: 400 * time.Millisecond, + RetryMax: 5, } - c := &Client{client: httpClient, UserAgent: userAgent} - if err := c.SetBaseURL(defaultBaseURL); err != nil { - // Should never happen since defaultBaseURL is our constant. - panic(err) + // Set the default base URL. + c.setBaseURL(defaultBaseURL) + + // Apply any given client options. + for _, fn := range options { + if fn == nil { + continue + } + if err := fn(c); err != nil { + return nil, err + } } // Create the internal timeStats service. @@ -452,6 +533,7 @@ func newClient(httpClient *http.Client) *Client { // Create all the public services. c.AccessRequests = &AccessRequestsService{client: c} + c.Applications = &ApplicationsService{client: c} c.AwardEmoji = &AwardEmojiService{client: c} c.Boards = &IssueBoardsService{client: c} c.Branches = &BranchesService{client: c} @@ -461,6 +543,7 @@ func newClient(httpClient *http.Client) *Client { c.ContainerRegistry = &ContainerRegistryService{client: c} c.CustomAttribute = &CustomAttributesService{client: c} c.DeployKeys = &DeployKeysService{client: c} + c.DeployTokens = &DeployTokensService{client: c} c.Deployments = &DeploymentsService{client: c} c.Discussions = &DiscussionsService{client: c} c.Environments = &EnvironmentsService{client: c} @@ -521,7 +604,107 @@ func newClient(httpClient *http.Client) *Client { c.Version = &VersionService{client: c} c.Wikis = &WikisService{client: c} - return c + return c, nil +} + +// retryHTTPCheck provides a callback for Client.CheckRetry which +// will retry both rate limit (429) and server (>= 500) errors. +func (c *Client) retryHTTPCheck(ctx context.Context, resp *http.Response, err error) (bool, error) { + if ctx.Err() != nil { + return false, ctx.Err() + } + if err != nil { + return false, err + } + if !c.disableRetries && (resp.StatusCode == 429 || resp.StatusCode >= 500) { + return true, nil + } + return false, nil +} + +// retryHTTPBackoff provides a generic callback for Client.Backoff which +// will pass through all calls based on the status code of the response. +func (c *Client) retryHTTPBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration { + // Use the rate limit backoff function when we are rate limited. + if resp != nil && resp.StatusCode == 429 { + return rateLimitBackoff(min, max, attemptNum, resp) + } + + // Set custom duration's when we experience a service interruption. + min = 700 * time.Millisecond + max = 900 * time.Millisecond + + return retryablehttp.LinearJitterBackoff(min, max, attemptNum, resp) +} + +// rateLimitBackoff provides a callback for Client.Backoff which will use the +// RateLimit-Reset header to determine the time to wait. We add some jitter +// to prevent a thundering herd. +// +// min and max are mainly used for bounding the jitter that will be added to +// the reset time retrieved from the headers. But if the final wait time is +// less then min, min will be used instead. +func rateLimitBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration { + // rnd is used to generate pseudo-random numbers. + rnd := rand.New(rand.NewSource(time.Now().UnixNano())) + + // First create some jitter bounded by the min and max durations. + jitter := time.Duration(rnd.Float64() * float64(max-min)) + + if resp != nil { + if v := resp.Header.Get(headerRateReset); v != "" { + if reset, _ := strconv.ParseInt(v, 10, 64); reset > 0 { + // Only update min if the given time to wait is longer. + if wait := time.Until(time.Unix(reset, 0)); wait > min { + min = wait + } + } + } + } + + return min + jitter +} + +// configureLimiter configures the rate limiter. +func (c *Client) configureLimiter() error { + // Set default values for when rate limiting is disabled. + limit := rate.Inf + burst := 0 + + defer func() { + // Create a new limiter using the calculated values. + c.limiter = rate.NewLimiter(limit, burst) + }() + + // Create a new request. + req, err := http.NewRequest("GET", c.baseURL.String(), nil) + if err != nil { + return err + } + + // Make a single request to retrieve the rate limit headers. + resp, err := c.client.HTTPClient.Do(req) + if err != nil { + return err + } + resp.Body.Close() + + if v := resp.Header.Get(headerRateLimit); v != "" { + if rateLimit, _ := strconv.ParseFloat(v, 64); rateLimit > 0 { + // The rate limit is based on requests per minute, so for our limiter to + // work correctly we devide the limit by 60 to get the limit per second. + rateLimit /= 60 + // Configure the limit and burst using a split of 2/3 for the limit and + // 1/3 for the burst. This enables clients to burst 1/3 of the allowed + // calls before the limiter kicks in. The remaining calls will then be + // spread out evenly using intervals of time.Second / limit which should + // prevent hitting the rate limit. + limit = rate.Limit(rateLimit * 0.66) + burst = int(rateLimit * 0.33) + } + } + + return nil } // BaseURL return a copy of the baseURL. @@ -530,9 +713,8 @@ func (c *Client) BaseURL() *url.URL { return &u } -// SetBaseURL sets the base URL for API requests to a custom endpoint. urlStr -// should always be specified with a trailing slash. -func (c *Client) SetBaseURL(urlStr string) error { +// setBaseURL sets the base URL for API requests to a custom endpoint. +func (c *Client) setBaseURL(urlStr string) error { // Make sure the given URL end with a slash if !strings.HasSuffix(urlStr, "/") { urlStr += "/" @@ -554,11 +736,11 @@ func (c *Client) SetBaseURL(urlStr string) error { } // NewRequest creates an API request. A relative URL path can be provided in -// urlStr, in which case it is resolved relative to the base URL of the Client. +// path, in which case it is resolved relative to the base URL of the Client. // Relative URL paths should always be specified without a preceding slash. If // specified, the value pointed to by body is JSON encoded and included as the // request body. -func (c *Client) NewRequest(method, path string, opt interface{}, options []OptionFunc) (*http.Request, error) { +func (c *Client) NewRequest(method, path string, opt interface{}, options []RequestOptionFunc) (*retryablehttp.Request, error) { u := *c.baseURL unescaped, err := url.PathUnescape(path) if err != nil { @@ -569,7 +751,33 @@ func (c *Client) NewRequest(method, path string, opt interface{}, options []Opti u.RawPath = c.baseURL.Path + path u.Path = c.baseURL.Path + unescaped - if opt != nil { + // Create a request specific headers map. + reqHeaders := make(http.Header) + reqHeaders.Set("Accept", "application/json") + + switch c.authType { + case basicAuth, oAuthToken: + reqHeaders.Set("Authorization", "Bearer "+c.token) + case privateToken: + reqHeaders.Set("PRIVATE-TOKEN", c.token) + } + + if c.UserAgent != "" { + reqHeaders.Set("User-Agent", c.UserAgent) + } + + var body interface{} + switch { + case method == "POST" || method == "PUT": + reqHeaders.Set("Content-Type", "application/json") + + if opt != nil { + body, err = json.Marshal(opt) + if err != nil { + return nil, err + } + } + case opt != nil: q, err := query.Values(opt) if err != nil { return nil, err @@ -577,53 +785,23 @@ func (c *Client) NewRequest(method, path string, opt interface{}, options []Opti u.RawQuery = q.Encode() } - req := &http.Request{ - Method: method, - URL: &u, - Proto: "HTTP/1.1", - ProtoMajor: 1, - ProtoMinor: 1, - Header: make(http.Header), - Host: u.Host, + req, err := retryablehttp.NewRequest(method, u.String(), body) + if err != nil { + return nil, err } for _, fn := range options { if fn == nil { continue } - if err := fn(req); err != nil { return nil, err } } - if method == "POST" || method == "PUT" { - bodyBytes, err := json.Marshal(opt) - if err != nil { - return nil, err - } - bodyReader := bytes.NewReader(bodyBytes) - - u.RawQuery = "" - req.Body = ioutil.NopCloser(bodyReader) - req.GetBody = func() (io.ReadCloser, error) { - return ioutil.NopCloser(bodyReader), nil - } - req.ContentLength = int64(bodyReader.Len()) - req.Header.Set("Content-Type", "application/json") - } - - req.Header.Set("Accept", "application/json") - - switch c.authType { - case basicAuth, oAuthToken: - req.Header.Set("Authorization", "Bearer "+c.token) - case privateToken: - req.Header.Set("PRIVATE-TOKEN", c.token) - } - - if c.UserAgent != "" { - req.Header.Set("User-Agent", c.UserAgent) + // Set the request specific headers. + for k, v := range reqHeaders { + req.Header[k] = v } return req, nil @@ -691,7 +869,16 @@ func (r *Response) populatePageValues() { // error if an API error has occurred. If v implements the io.Writer // interface, the raw response body will be written to v, without attempting to // first decode it. -func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) { +func (c *Client) Do(req *retryablehttp.Request, v interface{}) (*Response, error) { + // If not yet configured, try to configure the rate limiter. Fail + // silently as the limiter will be disabled in case of an error. + c.configureLimiterOnce.Do(func() { c.configureLimiter() }) + + // Wait will block until the limiter can obtain a new token. + if err := c.limiter.Wait(req.Context()); err != nil { + return nil, err + } + resp, err := c.client.Do(req) if err != nil { return nil, err @@ -710,8 +897,8 @@ func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) { err = CheckResponse(resp) if err != nil { - // even though there was an error, we still return the response - // in case the caller wants to inspect it further + // Even though there was an error, we still return the response + // in case the caller wants to inspect it further. return response, err } @@ -826,32 +1013,6 @@ func parseError(raw interface{}) string { } } -// OptionFunc can be passed to all API requests to make the API call as if you were -// another user, provided your private token is from an administrator account. -// -// GitLab docs: https://docs.gitlab.com/ce/api/README.html#sudo -type OptionFunc func(*http.Request) error - -// WithSudo takes either a username or user ID and sets the SUDO request header -func WithSudo(uid interface{}) OptionFunc { - return func(req *http.Request) error { - user, err := parseID(uid) - if err != nil { - return err - } - req.Header.Set("SUDO", user) - return nil - } -} - -// WithContext runs the request with the provided context -func WithContext(ctx context.Context) OptionFunc { - return func(req *http.Request) error { - *req = *req.WithContext(ctx) - return nil - } -} - // Bool is a helper routine that allocates a new bool value // to store v and returns a pointer to it. func Bool(v bool) *bool { @@ -901,6 +1062,14 @@ func BuildState(v BuildStateValue) *BuildStateValue { return p } +// DeploymentStatus is a helper routine that allocates a new +// DeploymentStatusValue to store v and returns a pointer to it. +func DeploymentStatus(v DeploymentStatusValue) *DeploymentStatusValue { + p := new(DeploymentStatusValue) + *p = v + return p +} + // NotificationLevel is a helper routine that allocates a new NotificationLevelValue // to store v and returns a pointer to it. func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue { @@ -925,6 +1094,22 @@ func Visibility(v VisibilityValue) *VisibilityValue { return p } +// ProjectCreationLevel is a helper routine that allocates a new ProjectCreationLevelValue +// to store v and returns a pointer to it. +func ProjectCreationLevel(v ProjectCreationLevelValue) *ProjectCreationLevelValue { + p := new(ProjectCreationLevelValue) + *p = v + return p +} + +// SubGroupCreationLevel is a helper routine that allocates a new SubGroupCreationLevelValue +// to store v and returns a pointer to it. +func SubGroupCreationLevel(v SubGroupCreationLevelValue) *SubGroupCreationLevelValue { + p := new(SubGroupCreationLevelValue) + *p = v + return p +} + // MergeMethod is a helper routine that allocates a new MergeMethod // to sotre v and returns a pointer to it. func MergeMethod(v MergeMethodValue) *MergeMethodValue { diff --git a/vendor/github.com/xanzy/go-gitlab/go.mod b/vendor/github.com/xanzy/go-gitlab/go.mod index 0632997b6a..e947c98809 100644 --- a/vendor/github.com/xanzy/go-gitlab/go.mod +++ b/vendor/github.com/xanzy/go-gitlab/go.mod @@ -2,10 +2,13 @@ module github.com/xanzy/go-gitlab require ( github.com/google/go-querystring v1.0.0 + github.com/hashicorp/go-cleanhttp v0.5.1 + github.com/hashicorp/go-retryablehttp v0.6.4 github.com/stretchr/testify v1.4.0 golang.org/x/net v0.0.0-20181108082009-03003ca0c849 // indirect golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect + golang.org/x/time v0.0.0-20191024005414-555d28b269f0 google.golang.org/appengine v1.3.0 // indirect ) diff --git a/vendor/github.com/xanzy/go-gitlab/go.sum b/vendor/github.com/xanzy/go-gitlab/go.sum index d78b9d5f6d..c10598c5b1 100644 --- a/vendor/github.com/xanzy/go-gitlab/go.sum +++ b/vendor/github.com/xanzy/go-gitlab/go.sum @@ -1,12 +1,21 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-retryablehttp v0.6.4 h1:BbgctKO892xEyOXnGiaAwIoSq1QZ/SS4AhjoAh9DnfY= +github.com/hashicorp/go-retryablehttp v0.6.4/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -17,6 +26,8 @@ golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAG golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= google.golang.org/appengine v1.3.0 h1:FBSsiFRMz3LBeXIomRnVzrQwSDj4ibvcRexLG0LZGQk= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/vendor/github.com/xanzy/go-gitlab/group_badges.go b/vendor/github.com/xanzy/go-gitlab/group_badges.go index 9be27bd2ad..8f284c897c 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_badges.go +++ b/vendor/github.com/xanzy/go-gitlab/group_badges.go @@ -44,7 +44,7 @@ type ListGroupBadgesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_badges.html#list-all-badges-of-a-group -func (s *GroupBadgesService) ListGroupBadges(gid interface{}, opt *ListGroupBadgesOptions, options ...OptionFunc) ([]*GroupBadge, *Response, error) { +func (s *GroupBadgesService) ListGroupBadges(gid interface{}, opt *ListGroupBadgesOptions, options ...RequestOptionFunc) ([]*GroupBadge, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -69,7 +69,7 @@ func (s *GroupBadgesService) ListGroupBadges(gid interface{}, opt *ListGroupBadg // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_badges.html#get-a-badge-of-a-group -func (s *GroupBadgesService) GetGroupBadge(gid interface{}, badge int, options ...OptionFunc) (*GroupBadge, *Response, error) { +func (s *GroupBadgesService) GetGroupBadge(gid interface{}, badge int, options ...RequestOptionFunc) (*GroupBadge, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -103,7 +103,7 @@ type AddGroupBadgeOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_badges.html#add-a-badge-to-a-group -func (s *GroupBadgesService) AddGroupBadge(gid interface{}, opt *AddGroupBadgeOptions, options ...OptionFunc) (*GroupBadge, *Response, error) { +func (s *GroupBadgesService) AddGroupBadge(gid interface{}, opt *AddGroupBadgeOptions, options ...RequestOptionFunc) (*GroupBadge, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -137,7 +137,7 @@ type EditGroupBadgeOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_badges.html#edit-a-badge-of-a-group -func (s *GroupBadgesService) EditGroupBadge(gid interface{}, badge int, opt *EditGroupBadgeOptions, options ...OptionFunc) (*GroupBadge, *Response, error) { +func (s *GroupBadgesService) EditGroupBadge(gid interface{}, badge int, opt *EditGroupBadgeOptions, options ...RequestOptionFunc) (*GroupBadge, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -162,7 +162,7 @@ func (s *GroupBadgesService) EditGroupBadge(gid interface{}, badge int, opt *Edi // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_badges.html#remove-a-badge-from-a-group -func (s *GroupBadgesService) DeleteGroupBadge(gid interface{}, badge int, options ...OptionFunc) (*Response, error) { +func (s *GroupBadgesService) DeleteGroupBadge(gid interface{}, badge int, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err @@ -191,7 +191,7 @@ type GroupBadgePreviewOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_badges.html#preview-a-badge-from-a-group -func (s *GroupBadgesService) PreviewGroupBadge(gid interface{}, opt *GroupBadgePreviewOptions, options ...OptionFunc) (*GroupBadge, *Response, error) { +func (s *GroupBadgesService) PreviewGroupBadge(gid interface{}, opt *GroupBadgePreviewOptions, options ...RequestOptionFunc) (*GroupBadge, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/group_boards.go b/vendor/github.com/xanzy/go-gitlab/group_boards.go index 1e814c57f7..d9d2ee6d41 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_boards.go +++ b/vendor/github.com/xanzy/go-gitlab/group_boards.go @@ -56,7 +56,7 @@ type ListGroupIssueBoardsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_boards.html#group-board -func (s *GroupIssueBoardsService) ListGroupIssueBoards(gid interface{}, opt *ListGroupIssueBoardsOptions, options ...OptionFunc) ([]*GroupIssueBoard, *Response, error) { +func (s *GroupIssueBoardsService) ListGroupIssueBoards(gid interface{}, opt *ListGroupIssueBoardsOptions, options ...RequestOptionFunc) ([]*GroupIssueBoard, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -77,11 +77,45 @@ func (s *GroupIssueBoardsService) ListGroupIssueBoards(gid interface{}, opt *Lis return gs, resp, err } +// CreateGroupIssueBoardOptions represents the available +// CreateGroupIssueBoard() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/group_boards.html#create-a-group-issue-board-premium +type CreateGroupIssueBoardOptions struct { + Name *string `url:"name" json:"name"` +} + +// CreateGroupIssueBoard creates a new issue board. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/group_boards.html#create-a-group-issue-board-premium +func (s *GroupIssueBoardsService) CreateGroupIssueBoard(gid interface{}, opt *CreateGroupIssueBoardOptions, options ...RequestOptionFunc) (*GroupIssueBoard, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/boards", pathEscape(group)) + + req, err := s.client.NewRequest("POST", u, opt, options) + if err != nil { + return nil, nil, err + } + + gib := new(GroupIssueBoard) + resp, err := s.client.Do(req, gib) + if err != nil { + return nil, resp, err + } + + return gib, resp, err +} + // GetGroupIssueBoard gets a single issue board of a group. // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_boards.html#single-board -func (s *GroupIssueBoardsService) GetGroupIssueBoard(gid interface{}, board int, options ...OptionFunc) (*GroupIssueBoard, *Response, error) { +func (s *GroupIssueBoardsService) GetGroupIssueBoard(gid interface{}, board int, options ...RequestOptionFunc) (*GroupIssueBoard, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -102,6 +136,62 @@ func (s *GroupIssueBoardsService) GetGroupIssueBoard(gid interface{}, board int, return gib, resp, err } +// UpdateGroupIssueBoardOptions represents a group issue board. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/group_boards.html#update-a-group-issue-board-premium +type UpdateGroupIssueBoardOptions struct { + Name *string `url:"name,omitempty" json:"name,omitempty"` + AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"` + MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"` + Labels *Labels `url:"labels,omitempty" json:"labels,omitempty"` + Weight *int `url:"weight,omitempty" json:"weight,omitempty"` +} + +// UpdateIssueBoard updates a single issue board of a group. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/group_boards.html#update-a-group-issue-board-premium +func (s *GroupIssueBoardsService) UpdateIssueBoard(gid interface{}, board int, opt *UpdateGroupIssueBoardOptions, options ...RequestOptionFunc) (*GroupIssueBoard, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/boards/%d", pathEscape(group), board) + + req, err := s.client.NewRequest("PUT", u, opt, options) + if err != nil { + return nil, nil, err + } + + gib := new(GroupIssueBoard) + resp, err := s.client.Do(req, gib) + if err != nil { + return nil, resp, err + } + + return gib, resp, err +} + +// DeleteIssueBoard delete a single issue board of a group. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/group_boards.html#delete-a-group-issue-board-premium +func (s *GroupIssueBoardsService) DeleteIssueBoard(gid interface{}, board int, options ...RequestOptionFunc) (*Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("groups/%s/boards/%d", pathEscape(group), board) + + req, err := s.client.NewRequest("DELETE", u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + // ListGroupIssueBoardListsOptions represents the available // ListGroupIssueBoardLists() options. // @@ -113,7 +203,7 @@ type ListGroupIssueBoardListsOptions ListOptions // backlog and closed lists. // // GitLab API docs: https://docs.gitlab.com/ce/api/group_boards.html#list-board-lists -func (s *GroupIssueBoardsService) ListGroupIssueBoardLists(gid interface{}, board int, opt *ListGroupIssueBoardListsOptions, options ...OptionFunc) ([]*BoardList, *Response, error) { +func (s *GroupIssueBoardsService) ListGroupIssueBoardLists(gid interface{}, board int, opt *ListGroupIssueBoardListsOptions, options ...RequestOptionFunc) ([]*BoardList, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -138,7 +228,7 @@ func (s *GroupIssueBoardsService) ListGroupIssueBoardLists(gid interface{}, boar // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_boards.html#single-board-list -func (s *GroupIssueBoardsService) GetGroupIssueBoardList(gid interface{}, board, list int, options ...OptionFunc) (*BoardList, *Response, error) { +func (s *GroupIssueBoardsService) GetGroupIssueBoardList(gid interface{}, board, list int, options ...RequestOptionFunc) (*BoardList, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -176,7 +266,7 @@ type CreateGroupIssueBoardListOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_boards.html#new-board-list -func (s *GroupIssueBoardsService) CreateGroupIssueBoardList(gid interface{}, board int, opt *CreateGroupIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) { +func (s *GroupIssueBoardsService) CreateGroupIssueBoardList(gid interface{}, board int, opt *CreateGroupIssueBoardListOptions, options ...RequestOptionFunc) (*BoardList, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -211,7 +301,7 @@ type UpdateGroupIssueBoardListOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_boards.html#edit-board-list -func (s *GroupIssueBoardsService) UpdateIssueBoardList(gid interface{}, board, list int, opt *UpdateGroupIssueBoardListOptions, options ...OptionFunc) ([]*BoardList, *Response, error) { +func (s *GroupIssueBoardsService) UpdateIssueBoardList(gid interface{}, board, list int, opt *UpdateGroupIssueBoardListOptions, options ...RequestOptionFunc) ([]*BoardList, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -241,7 +331,7 @@ func (s *GroupIssueBoardsService) UpdateIssueBoardList(gid interface{}, board, l // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_boards.html#delete-a-board-list -func (s *GroupIssueBoardsService) DeleteGroupIssueBoardList(gid interface{}, board, list int, options ...OptionFunc) (*Response, error) { +func (s *GroupIssueBoardsService) DeleteGroupIssueBoardList(gid interface{}, board, list int, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/group_clusters.go b/vendor/github.com/xanzy/go-gitlab/group_clusters.go index 9f38bc0b07..6e893ea467 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_clusters.go +++ b/vendor/github.com/xanzy/go-gitlab/group_clusters.go @@ -44,6 +44,7 @@ type GroupCluster struct { ClusterType string `json:"cluster_type"` User *User `json:"user"` PlatformKubernetes *PlatformKubernetes `json:"platform_kubernetes"` + ManagementProject *ManagementProject `json:"management_project"` Group *Group `json:"group"` } @@ -55,7 +56,7 @@ func (v GroupCluster) String() string { // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_clusters.html#list-group-clusters -func (s *GroupClustersService) ListClusters(pid interface{}, options ...OptionFunc) ([]*GroupCluster, *Response, error) { +func (s *GroupClustersService) ListClusters(pid interface{}, options ...RequestOptionFunc) ([]*GroupCluster, *Response, error) { group, err := parseID(pid) if err != nil { return nil, nil, err @@ -80,7 +81,7 @@ func (s *GroupClustersService) ListClusters(pid interface{}, options ...OptionFu // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_clusters.html#get-a-single-group-cluster -func (s *GroupClustersService) GetCluster(pid interface{}, cluster int, options ...OptionFunc) (*GroupCluster, *Response, error) { +func (s *GroupClustersService) GetCluster(pid interface{}, cluster int, options ...RequestOptionFunc) (*GroupCluster, *Response, error) { group, err := parseID(pid) if err != nil { return nil, nil, err @@ -106,12 +107,13 @@ func (s *GroupClustersService) GetCluster(pid interface{}, cluster int, options // GitLab API docs: // https://docs.gitlab.com/ee/api/group_clusters.html#add-existing-cluster-to-group type AddGroupClusterOptions struct { - Name *string `url:"name,omitempty" json:"name,omitempty"` - Domain *string `url:"domain,omitempty" json:"domain,omitempty"` - Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` - Managed *bool `url:"managed,omitempty" json:"managed,omitempty"` - EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` - PlatformKubernetes *AddGroupPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + Domain *string `url:"domain,omitempty" json:"domain,omitempty"` + ManagementProjectID *string `url:"management_project_id,omitempty" json:"management_project_id,omitempty"` + Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` + Managed *bool `url:"managed,omitempty" json:"managed,omitempty"` + EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` + PlatformKubernetes *AddGroupPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"` } // AddGroupPlatformKubernetesOptions represents the available PlatformKubernetes options for adding. @@ -127,7 +129,7 @@ type AddGroupPlatformKubernetesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_clusters.html#add-existing-cluster-to-group -func (s *GroupClustersService) AddCluster(pid interface{}, opt *AddGroupClusterOptions, options ...OptionFunc) (*GroupCluster, *Response, error) { +func (s *GroupClustersService) AddCluster(pid interface{}, opt *AddGroupClusterOptions, options ...RequestOptionFunc) (*GroupCluster, *Response, error) { group, err := parseID(pid) if err != nil { return nil, nil, err @@ -153,10 +155,11 @@ func (s *GroupClustersService) AddCluster(pid interface{}, opt *AddGroupClusterO // GitLab API docs: // https://docs.gitlab.com/ee/api/group_clusters.html#edit-group-cluster type EditGroupClusterOptions struct { - Name *string `url:"name,omitempty" json:"name,omitempty"` - Domain *string `url:"domain,omitempty" json:"domain,omitempty"` - EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` - PlatformKubernetes *EditGroupPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + Domain *string `url:"domain,omitempty" json:"domain,omitempty"` + EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` + PlatformKubernetes *EditGroupPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"` + ManagementProjectID *string `url:"management_project_id,omitempty" json:"management_project_id,omitempty"` } // EditGroupPlatformKubernetesOptions represents the available PlatformKubernetes options for editing. @@ -170,7 +173,7 @@ type EditGroupPlatformKubernetesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_clusters.html#edit-group-cluster -func (s *GroupClustersService) EditCluster(pid interface{}, cluster int, opt *EditGroupClusterOptions, options ...OptionFunc) (*GroupCluster, *Response, error) { +func (s *GroupClustersService) EditCluster(pid interface{}, cluster int, opt *EditGroupClusterOptions, options ...RequestOptionFunc) (*GroupCluster, *Response, error) { group, err := parseID(pid) if err != nil { return nil, nil, err @@ -195,7 +198,7 @@ func (s *GroupClustersService) EditCluster(pid interface{}, cluster int, opt *Ed // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_clusters.html#delete-group-cluster -func (s *GroupClustersService) DeleteCluster(pid interface{}, cluster int, options ...OptionFunc) (*Response, error) { +func (s *GroupClustersService) DeleteCluster(pid interface{}, cluster int, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/group_hooks.go b/vendor/github.com/xanzy/go-gitlab/group_hooks.go new file mode 100644 index 0000000000..704232b90b --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/group_hooks.go @@ -0,0 +1,199 @@ +// +// Copyright 2020, Eric Stevens +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +package gitlab + +import ( + "fmt" + "time" +) + +// GroupHook represents a GitLab group hook. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#list-group-hooks +type GroupHook struct { + ID int `json:"id"` + URL string `json:"url"` + GroupID int `json:"group_id"` + PushEvents bool `json:"push_events"` + IssuesEvents bool `json:"issues_events"` + ConfidentialIssuesEvents bool `json:"confidential_issues_events"` + ConfidentialNoteEvents bool `json:"confidential_note_events"` + MergeRequestsEvents bool `json:"merge_requests_events"` + TagPushEvents bool `json:"tag_push_events"` + NoteEvents bool `json:"note_events"` + JobEvents bool `json:"job_events"` + PipelineEvents bool `json:"pipeline_events"` + WikiPageEvents bool `json:"wiki_page_events"` + EnableSSLVerification bool `json:"enable_ssl_verification"` + CreatedAt *time.Time `json:"created_at"` +} + +// ListGroupHooks gets a list of group hooks. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#list-group-hooks +func (s *GroupsService) ListGroupHooks(gid interface{}) ([]*GroupHook, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/hooks", pathEscape(group)) + + req, err := s.client.NewRequest("GET", u, nil, nil) + if err != nil { + return nil, nil, err + } + var gh []*GroupHook + resp, err := s.client.Do(req, &gh) + if err != nil { + return nil, resp, err + } + + return gh, resp, err +} + +// GetGroupHook gets a specific hook for a group. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/groups.html#get-group-hook +func (s *GroupsService) GetGroupHook(pid interface{}, hook int, options ...RequestOptionFunc) (*GroupHook, *Response, error) { + group, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/hooks/%d", pathEscape(group), hook) + + req, err := s.client.NewRequest("GET", u, nil, options) + if err != nil { + return nil, nil, err + } + + gh := new(GroupHook) + resp, err := s.client.Do(req, gh) + if err != nil { + return nil, resp, err + } + + return gh, resp, err +} + +// AddGroupHookOptions represents the available AddGroupHook() options. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/groups.html#add-group-hook +type AddGroupHookOptions struct { + URL *string `url:"url,omitempty" json:"url,omitempty"` + PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` + IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` + ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` + ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` + MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` + TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"` + NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"` + JobEvents *bool `url:"job_events,omitempty" json:"job_events,omitempty"` + PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` + WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` + EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"` + Token *string `url:"token,omitempty" json:"token,omitempty"` +} + +// AddGroupHook create a new group scoped webhook. +// +// GitLab API docs: https://docs.gitlab.com/ee/api/groups.html#add-group-hook +func (s *GroupsService) AddGroupHook(gid interface{}, opt *AddGroupHookOptions, options ...RequestOptionFunc) (*GroupHook, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/hooks", pathEscape(group)) + + req, err := s.client.NewRequest("POST", u, opt, options) + if err != nil { + return nil, nil, err + } + + gh := new(GroupHook) + resp, err := s.client.Do(req, gh) + if err != nil { + return nil, resp, err + } + + return gh, resp, err +} + +// EditGroupHookOptions represents the available EditGroupHook() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/groups.html#edit-group-hook +type EditGroupHookOptions struct { + URL *string `url:"url,omitempty" json:"url,omitempty"` + PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` + IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` + ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` + ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` + MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` + TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"` + NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"` + JobEvents *bool `url:"job_events,omitempty" json:"job_events,omitempty"` + PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` + WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` + EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"` + Token *string `url:"token,omitempty" json:"token,omitempty"` +} + +// EditGroupHook edits a hook for a specified group. +// +// Gitlab API docs: +// https://docs.gitlab.com/ce/api/groups.html#edit-group-hook +func (s *GroupsService) EditGroupHook(pid interface{}, hook int, opt *EditGroupHookOptions, options ...RequestOptionFunc) (*GroupHook, *Response, error) { + group, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/hooks/%d", pathEscape(group), hook) + + req, err := s.client.NewRequest("PUT", u, opt, options) + if err != nil { + return nil, nil, err + } + + gh := new(GroupHook) + resp, err := s.client.Do(req, gh) + if err != nil { + return nil, resp, err + } + + return gh, resp, err +} + +// DeleteGroupHook removes a hook from a group. This is an idempotent +// method and can be called multiple times. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/groups.html#delete-group-hook +func (s *GroupsService) DeleteGroupHook(pid interface{}, hook int, options ...RequestOptionFunc) (*Response, error) { + group, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("groups/%s/hooks/%d", pathEscape(group), hook) + + req, err := s.client.NewRequest("DELETE", u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/xanzy/go-gitlab/group_labels.go b/vendor/github.com/xanzy/go-gitlab/group_labels.go index 4e7332811f..bff4496a8f 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_labels.go +++ b/vendor/github.com/xanzy/go-gitlab/group_labels.go @@ -30,7 +30,7 @@ type ListGroupLabelsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_labels.html#list-group-labels -func (s *GroupLabelsService) ListGroupLabels(gid interface{}, opt *ListGroupLabelsOptions, options ...OptionFunc) ([]*GroupLabel, *Response, error) { +func (s *GroupLabelsService) ListGroupLabels(gid interface{}, opt *ListGroupLabelsOptions, options ...RequestOptionFunc) ([]*GroupLabel, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -62,7 +62,7 @@ type CreateGroupLabelOptions CreateLabelOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_labels.html#create-a-new-group-label -func (s *GroupLabelsService) CreateGroupLabel(gid interface{}, opt *CreateGroupLabelOptions, options ...OptionFunc) (*GroupLabel, *Response, error) { +func (s *GroupLabelsService) CreateGroupLabel(gid interface{}, opt *CreateGroupLabelOptions, options ...RequestOptionFunc) (*GroupLabel, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -92,7 +92,7 @@ type DeleteGroupLabelOptions DeleteLabelOptions // DeleteGroupLabel deletes a group label given by its name. // // GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label -func (s *GroupLabelsService) DeleteGroupLabel(gid interface{}, opt *DeleteGroupLabelOptions, options ...OptionFunc) (*Response, error) { +func (s *GroupLabelsService) DeleteGroupLabel(gid interface{}, opt *DeleteGroupLabelOptions, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err @@ -118,7 +118,7 @@ type UpdateGroupLabelOptions UpdateLabelOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_labels.html#update-a-group-label -func (s *GroupLabelsService) UpdateGroupLabel(gid interface{}, opt *UpdateGroupLabelOptions, options ...OptionFunc) (*GroupLabel, *Response, error) { +func (s *GroupLabelsService) UpdateGroupLabel(gid interface{}, opt *UpdateGroupLabelOptions, options ...RequestOptionFunc) (*GroupLabel, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -145,7 +145,7 @@ func (s *GroupLabelsService) UpdateGroupLabel(gid interface{}, opt *UpdateGroupL // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_labels.html#subscribe-to-a-group-label -func (s *GroupLabelsService) SubscribeToGroupLabel(gid interface{}, labelID interface{}, options ...OptionFunc) (*GroupLabel, *Response, error) { +func (s *GroupLabelsService) SubscribeToGroupLabel(gid interface{}, labelID interface{}, options ...RequestOptionFunc) (*GroupLabel, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -176,7 +176,7 @@ func (s *GroupLabelsService) SubscribeToGroupLabel(gid interface{}, labelID inte // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_labels.html#unsubscribe-from-a-group-label -func (s *GroupLabelsService) UnsubscribeFromGroupLabel(gid interface{}, labelID interface{}, options ...OptionFunc) (*Response, error) { +func (s *GroupLabelsService) UnsubscribeFromGroupLabel(gid interface{}, labelID interface{}, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/group_members.go b/vendor/github.com/xanzy/go-gitlab/group_members.go index 5d6f5e6034..08b1d51b06 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_members.go +++ b/vendor/github.com/xanzy/go-gitlab/group_members.go @@ -28,18 +28,30 @@ type GroupMembersService struct { client *Client } +// GroupMemberSAMLIdentity represents the SAML Identity link for the group member. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project +// Gitlab MR for API change: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/20357 +// Gitlab MR for API Doc change: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/25652 +type GroupMemberSAMLIdentity struct { + ExternUID string `json:"extern_uid"` + Provider string `json:"provider"` + SAMLProviderID int `json:"saml_provider_id"` +} + // GroupMember represents a GitLab group member. // // GitLab API docs: https://docs.gitlab.com/ce/api/members.html type GroupMember struct { - ID int `json:"id"` - Username string `json:"username"` - Name string `json:"name"` - State string `json:"state"` - AvatarURL string `json:"avatar_url"` - WebURL string `json:"web_url"` - ExpiresAt *ISOTime `json:"expires_at"` - AccessLevel AccessLevelValue `json:"access_level"` + ID int `json:"id"` + Username string `json:"username"` + Name string `json:"name"` + State string `json:"state"` + AvatarURL string `json:"avatar_url"` + WebURL string `json:"web_url"` + ExpiresAt *ISOTime `json:"expires_at"` + AccessLevel AccessLevelValue `json:"access_level"` + GroupSAMLIdentity *GroupMemberSAMLIdentity `json:"group_saml_identity"` } // ListGroupMembersOptions represents the available ListGroupMembers() and @@ -57,7 +69,7 @@ type ListGroupMembersOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project -func (s *GroupsService) ListGroupMembers(gid interface{}, opt *ListGroupMembersOptions, options ...OptionFunc) ([]*GroupMember, *Response, error) { +func (s *GroupsService) ListGroupMembers(gid interface{}, opt *ListGroupMembersOptions, options ...RequestOptionFunc) ([]*GroupMember, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -83,7 +95,7 @@ func (s *GroupsService) ListGroupMembers(gid interface{}, opt *ListGroupMembersO // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project-including-inherited-members -func (s *GroupsService) ListAllGroupMembers(gid interface{}, opt *ListGroupMembersOptions, options ...OptionFunc) ([]*GroupMember, *Response, error) { +func (s *GroupsService) ListAllGroupMembers(gid interface{}, opt *ListGroupMembersOptions, options ...RequestOptionFunc) ([]*GroupMember, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -118,7 +130,7 @@ type AddGroupMemberOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project -func (s *GroupMembersService) GetGroupMember(gid interface{}, user int, options ...OptionFunc) (*GroupMember, *Response, error) { +func (s *GroupMembersService) GetGroupMember(gid interface{}, user int, options ...RequestOptionFunc) (*GroupMember, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -143,7 +155,7 @@ func (s *GroupMembersService) GetGroupMember(gid interface{}, user int, options // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project -func (s *GroupMembersService) AddGroupMember(gid interface{}, opt *AddGroupMemberOptions, options ...OptionFunc) (*GroupMember, *Response, error) { +func (s *GroupMembersService) AddGroupMember(gid interface{}, opt *AddGroupMemberOptions, options ...RequestOptionFunc) (*GroupMember, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -178,7 +190,7 @@ type EditGroupMemberOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project -func (s *GroupMembersService) EditGroupMember(gid interface{}, user int, opt *EditGroupMemberOptions, options ...OptionFunc) (*GroupMember, *Response, error) { +func (s *GroupMembersService) EditGroupMember(gid interface{}, user int, opt *EditGroupMemberOptions, options ...RequestOptionFunc) (*GroupMember, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -203,7 +215,7 @@ func (s *GroupMembersService) EditGroupMember(gid interface{}, user int, opt *Ed // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project -func (s *GroupMembersService) RemoveGroupMember(gid interface{}, user int, options ...OptionFunc) (*Response, error) { +func (s *GroupMembersService) RemoveGroupMember(gid interface{}, user int, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/group_milestones.go b/vendor/github.com/xanzy/go-gitlab/group_milestones.go index d9436c65b2..21a4d2edfe 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_milestones.go +++ b/vendor/github.com/xanzy/go-gitlab/group_milestones.go @@ -65,7 +65,7 @@ type ListGroupMilestonesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_milestones.html#list-group-milestones -func (s *GroupMilestonesService) ListGroupMilestones(gid interface{}, opt *ListGroupMilestonesOptions, options ...OptionFunc) ([]*GroupMilestone, *Response, error) { +func (s *GroupMilestonesService) ListGroupMilestones(gid interface{}, opt *ListGroupMilestonesOptions, options ...RequestOptionFunc) ([]*GroupMilestone, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -90,7 +90,7 @@ func (s *GroupMilestonesService) ListGroupMilestones(gid interface{}, opt *ListG // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_milestones.html#get-single-milestone -func (s *GroupMilestonesService) GetGroupMilestone(gid interface{}, milestone int, options ...OptionFunc) (*GroupMilestone, *Response, error) { +func (s *GroupMilestonesService) GetGroupMilestone(gid interface{}, milestone int, options ...RequestOptionFunc) (*GroupMilestone, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -126,7 +126,7 @@ type CreateGroupMilestoneOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_milestones.html#create-new-milestone -func (s *GroupMilestonesService) CreateGroupMilestone(gid interface{}, opt *CreateGroupMilestoneOptions, options ...OptionFunc) (*GroupMilestone, *Response, error) { +func (s *GroupMilestonesService) CreateGroupMilestone(gid interface{}, opt *CreateGroupMilestoneOptions, options ...RequestOptionFunc) (*GroupMilestone, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -163,7 +163,7 @@ type UpdateGroupMilestoneOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_milestones.html#edit-milestone -func (s *GroupMilestonesService) UpdateGroupMilestone(gid interface{}, milestone int, opt *UpdateGroupMilestoneOptions, options ...OptionFunc) (*GroupMilestone, *Response, error) { +func (s *GroupMilestonesService) UpdateGroupMilestone(gid interface{}, milestone int, opt *UpdateGroupMilestoneOptions, options ...RequestOptionFunc) (*GroupMilestone, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -194,7 +194,7 @@ type GetGroupMilestoneIssuesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_milestones.html#get-all-issues-assigned-to-a-single-milestone -func (s *GroupMilestonesService) GetGroupMilestoneIssues(gid interface{}, milestone int, opt *GetGroupMilestoneIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) { +func (s *GroupMilestonesService) GetGroupMilestoneIssues(gid interface{}, milestone int, opt *GetGroupMilestoneIssuesOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -227,7 +227,7 @@ type GetGroupMilestoneMergeRequestsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/group_milestones.html#get-all-merge-requests-assigned-to-a-single-milestone -func (s *GroupMilestonesService) GetGroupMilestoneMergeRequests(gid interface{}, milestone int, opt *GetGroupMilestoneMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *GroupMilestonesService) GetGroupMilestoneMergeRequests(gid interface{}, milestone int, opt *GetGroupMilestoneMergeRequestsOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/group_variables.go b/vendor/github.com/xanzy/go-gitlab/group_variables.go index 694b20199a..fea12a20a4 100644 --- a/vendor/github.com/xanzy/go-gitlab/group_variables.go +++ b/vendor/github.com/xanzy/go-gitlab/group_variables.go @@ -39,6 +39,7 @@ type GroupVariable struct { Value string `json:"value"` VariableType VariableTypeValue `json:"variable_type"` Protected bool `json:"protected"` + Masked bool `json:"masked"` } func (v GroupVariable) String() string { @@ -56,7 +57,7 @@ type ListGroupVariablesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_level_variables.html#list-group-variables -func (s *GroupVariablesService) ListVariables(gid interface{}, opt *ListGroupVariablesOptions, options ...OptionFunc) ([]*GroupVariable, *Response, error) { +func (s *GroupVariablesService) ListVariables(gid interface{}, opt *ListGroupVariablesOptions, options ...RequestOptionFunc) ([]*GroupVariable, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -81,7 +82,7 @@ func (s *GroupVariablesService) ListVariables(gid interface{}, opt *ListGroupVar // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_level_variables.html#show-variable-details -func (s *GroupVariablesService) GetVariable(gid interface{}, key string, options ...OptionFunc) (*GroupVariable, *Response, error) { +func (s *GroupVariablesService) GetVariable(gid interface{}, key string, options ...RequestOptionFunc) (*GroupVariable, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -112,13 +113,14 @@ type CreateGroupVariableOptions struct { Value *string `url:"value,omitempty" json:"value,omitempty"` VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"` Protected *bool `url:"protected,omitempty" json:"protected,omitempty"` + Masked *bool `url:"masked,omitempty" json:"masked,omitempty"` } // CreateVariable creates a new group variable. // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_level_variables.html#create-variable -func (s *GroupVariablesService) CreateVariable(gid interface{}, opt *CreateGroupVariableOptions, options ...OptionFunc) (*GroupVariable, *Response, error) { +func (s *GroupVariablesService) CreateVariable(gid interface{}, opt *CreateGroupVariableOptions, options ...RequestOptionFunc) (*GroupVariable, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -148,6 +150,7 @@ type UpdateGroupVariableOptions struct { Value *string `url:"value,omitempty" json:"value,omitempty"` VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"` Protected *bool `url:"protected,omitempty" json:"protected,omitempty"` + Masked *bool `url:"masked,omitempty" json:"masked,omitempty"` } // UpdateVariable updates the position of an existing @@ -155,7 +158,7 @@ type UpdateGroupVariableOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_level_variables.html#update-variable -func (s *GroupVariablesService) UpdateVariable(gid interface{}, key string, opt *UpdateGroupVariableOptions, options ...OptionFunc) (*GroupVariable, *Response, error) { +func (s *GroupVariablesService) UpdateVariable(gid interface{}, key string, opt *UpdateGroupVariableOptions, options ...RequestOptionFunc) (*GroupVariable, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -180,7 +183,7 @@ func (s *GroupVariablesService) UpdateVariable(gid interface{}, key string, opt // // GitLab API docs: // https://docs.gitlab.com/ee/api/group_level_variables.html#remove-variable -func (s *GroupVariablesService) RemoveVariable(gid interface{}, key string, options ...OptionFunc) (*Response, error) { +func (s *GroupVariablesService) RemoveVariable(gid interface{}, key string, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/groups.go b/vendor/github.com/xanzy/go-gitlab/groups.go index b2e7dd3262..3a1d872d57 100644 --- a/vendor/github.com/xanzy/go-gitlab/groups.go +++ b/vendor/github.com/xanzy/go-gitlab/groups.go @@ -32,34 +32,44 @@ type GroupsService struct { // // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html type Group struct { - ID int `json:"id"` - Name string `json:"name"` - Path string `json:"path"` - Description string `json:"description"` - Visibility *VisibilityValue `json:"visibility"` - LFSEnabled bool `json:"lfs_enabled"` - AvatarURL string `json:"avatar_url"` - WebURL string `json:"web_url"` - RequestAccessEnabled bool `json:"request_access_enabled"` - FullName string `json:"full_name"` - FullPath string `json:"full_path"` - ParentID int `json:"parent_id"` - Projects []*Project `json:"projects"` - Statistics *StorageStatistics `json:"statistics"` - CustomAttributes []*CustomAttribute `json:"custom_attributes"` - ShareWithGroupLock bool `json:"share_with_group_lock"` - RequireTwoFactorAuth bool `json:"require_two_factor_authentication"` - TwoFactorGracePeriod int `json:"two_factor_grace_period"` - ProjectCreationLevel string `json:"project_creation_level"` - AutoDevopsEnabled bool `json:"auto_devops_enabled"` - SubGroupCreationLevel string `json:"subgroup_creation_level"` - EmailsDisabled bool `json:"emails_disabled"` - RunnersToken string `json:"runners_token"` - SharedProjects []*Project `json:"shared_projects"` - LDAPCN string `json:"ldap_cn"` - LDAPAccess bool `json:"ldap_access"` - SharedRunnersMinutesLimit int `json:"shared_runners_minutes_limit"` - ExtraSharedRunnersMinutesLimit int `json:"extra_shared_runners_minutes_limit"` + ID int `json:"id"` + Name string `json:"name"` + Path string `json:"path"` + Description string `json:"description"` + MembershipLock bool `json:"membership_lock"` + Visibility VisibilityValue `json:"visibility"` + LFSEnabled bool `json:"lfs_enabled"` + AvatarURL string `json:"avatar_url"` + WebURL string `json:"web_url"` + RequestAccessEnabled bool `json:"request_access_enabled"` + FullName string `json:"full_name"` + FullPath string `json:"full_path"` + ParentID int `json:"parent_id"` + Projects []*Project `json:"projects"` + Statistics *StorageStatistics `json:"statistics"` + CustomAttributes []*CustomAttribute `json:"custom_attributes"` + ShareWithGroupLock bool `json:"share_with_group_lock"` + RequireTwoFactorAuth bool `json:"require_two_factor_authentication"` + TwoFactorGracePeriod int `json:"two_factor_grace_period"` + ProjectCreationLevel ProjectCreationLevelValue `json:"project_creation_level"` + AutoDevopsEnabled bool `json:"auto_devops_enabled"` + SubGroupCreationLevel SubGroupCreationLevelValue `json:"subgroup_creation_level"` + EmailsDisabled bool `json:"emails_disabled"` + MentionsDisabled bool `json:"mentions_disabled"` + RunnersToken string `json:"runners_token"` + SharedProjects []*Project `json:"shared_projects"` + LDAPCN string `json:"ldap_cn"` + LDAPAccess AccessLevelValue `json:"ldap_access"` + LDAPGroupLinks []*LDAPGroupLink `json:"ldap_group_links"` + SharedRunnersMinutesLimit int `json:"shared_runners_minutes_limit"` + ExtraSharedRunnersMinutesLimit int `json:"extra_shared_runners_minutes_limit"` + MarkedForDeletionOn *ISOTime `json:"marked_for_deletion_on"` +} + +type LDAPGroupLink struct { + CN string `json:"cn"` + GroupAccess AccessLevelValue `json:"group_access"` + Provider string `json:"provider"` } // ListGroupsOptions represents the available ListGroups() options. @@ -82,7 +92,7 @@ type ListGroupsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/groups.html#list-project-groups -func (s *GroupsService) ListGroups(opt *ListGroupsOptions, options ...OptionFunc) ([]*Group, *Response, error) { +func (s *GroupsService) ListGroups(opt *ListGroupsOptions, options ...RequestOptionFunc) ([]*Group, *Response, error) { req, err := s.client.NewRequest("GET", "groups", opt, options) if err != nil { return nil, nil, err @@ -100,7 +110,7 @@ func (s *GroupsService) ListGroups(opt *ListGroupsOptions, options ...OptionFunc // GetGroup gets all details of a group. // // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#details-of-a-group -func (s *GroupsService) GetGroup(gid interface{}, options ...OptionFunc) (*Group, *Response, error) { +func (s *GroupsService) GetGroup(gid interface{}, options ...RequestOptionFunc) (*Group, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -125,20 +135,31 @@ func (s *GroupsService) GetGroup(gid interface{}, options ...OptionFunc) (*Group // // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group type CreateGroupOptions struct { - Name *string `url:"name,omitempty" json:"name,omitempty"` - Path *string `url:"path,omitempty" json:"path,omitempty"` - Description *string `url:"description,omitempty" json:"description,omitempty"` - Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"` - LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"` - RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"` - ParentID *int `url:"parent_id,omitempty" json:"parent_id,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + Path *string `url:"path,omitempty" json:"path,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` + MembershipLock *bool `url:"membership_lock,omitempty" json:"membership_lock,omitempty"` + Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"` + ShareWithGroupLock *bool `url:"share_with_group_lock,omitempty" json:"share_with_group_lock,omitempty"` + RequireTwoFactorAuth *bool `url:"require_two_factor_authentication,omitempty" json:"require_two_factor_authentication,omitempty"` + TwoFactorGracePeriod *int `url:"two_factor_grace_period,omitempty" json:"two_factor_grace_period,omitempty"` + ProjectCreationLevel *ProjectCreationLevelValue `url:"project_creation_level,omitempty" json:"project_creation_level,omitempty"` + AutoDevopsEnabled *bool `url:"auto_devops_enabled,omitempty" json:"auto_devops_enabled,omitempty"` + SubGroupCreationLevel *SubGroupCreationLevelValue `url:"subgroup_creation_level,omitempty" json:"subgroup_creation_level,omitempty"` + EmailsDisabled *bool `url:"emails_disabled,omitempty" json:"emails_disabled,omitempty"` + MentionsDisabled *bool `url:"mentions_disabled,omitempty" json:"mentions_disabled,omitempty"` + LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"` + RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"` + ParentID *int `url:"parent_id,omitempty" json:"parent_id,omitempty"` + SharedRunnersMinutesLimit *int `url:"shared_runners_minutes_limit,omitempty" json:"shared_runners_minutes_limit,omitempty"` + ExtraSharedRunnersMinutesLimit *int `url:"extra_shared_runners_minutes_limit,omitempty" json:"extra_shared_runners_minutes_limit,omitempty"` } // CreateGroup creates a new project group. Available only for users who can // create groups. // // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group -func (s *GroupsService) CreateGroup(opt *CreateGroupOptions, options ...OptionFunc) (*Group, *Response, error) { +func (s *GroupsService) CreateGroup(opt *CreateGroupOptions, options ...RequestOptionFunc) (*Group, *Response, error) { req, err := s.client.NewRequest("POST", "groups", opt, options) if err != nil { return nil, nil, err @@ -158,7 +179,7 @@ func (s *GroupsService) CreateGroup(opt *CreateGroupOptions, options ...OptionFu // // GitLab API docs: // https://docs.gitlab.com/ce/api/groups.html#transfer-project-to-group -func (s *GroupsService) TransferGroup(gid interface{}, pid interface{}, options ...OptionFunc) (*Group, *Response, error) { +func (s *GroupsService) TransferGroup(gid interface{}, pid interface{}, options ...RequestOptionFunc) (*Group, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -193,7 +214,7 @@ type UpdateGroupOptions CreateGroupOptions // administrators. // // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#update-group -func (s *GroupsService) UpdateGroup(gid interface{}, opt *UpdateGroupOptions, options ...OptionFunc) (*Group, *Response, error) { +func (s *GroupsService) UpdateGroup(gid interface{}, opt *UpdateGroupOptions, options ...RequestOptionFunc) (*Group, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -217,7 +238,7 @@ func (s *GroupsService) UpdateGroup(gid interface{}, opt *UpdateGroupOptions, op // DeleteGroup removes group with all projects inside. // // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#remove-group -func (s *GroupsService) DeleteGroup(gid interface{}, options ...OptionFunc) (*Response, error) { +func (s *GroupsService) DeleteGroup(gid interface{}, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err @@ -235,7 +256,7 @@ func (s *GroupsService) DeleteGroup(gid interface{}, options ...OptionFunc) (*Re // SearchGroup get all groups that match your string in their name or path. // // GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#search-for-group -func (s *GroupsService) SearchGroup(query string, options ...OptionFunc) ([]*Group, *Response, error) { +func (s *GroupsService) SearchGroup(query string, options ...RequestOptionFunc) ([]*Group, *Response, error) { var q struct { Search string `url:"search,omitempty" json:"search,omitempty"` } @@ -281,7 +302,7 @@ type ListGroupProjectsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/groups.html#list-a-group-39-s-projects -func (s *GroupsService) ListGroupProjects(gid interface{}, opt *ListGroupProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) { +func (s *GroupsService) ListGroupProjects(gid interface{}, opt *ListGroupProjectsOptions, options ...RequestOptionFunc) ([]*Project, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -313,7 +334,7 @@ type ListSubgroupsOptions ListGroupsOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/groups.html#list-a-groups-s-subgroups -func (s *GroupsService) ListSubgroups(gid interface{}, opt *ListSubgroupsOptions, options ...OptionFunc) ([]*Group, *Response, error) { +func (s *GroupsService) ListSubgroups(gid interface{}, opt *ListSubgroupsOptions, options ...RequestOptionFunc) ([]*Group, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -333,3 +354,110 @@ func (s *GroupsService) ListSubgroups(gid interface{}, opt *ListSubgroupsOptions return g, resp, err } + +// ListGroupLDAPLinks lists the group's LDAP links. Available only for users who +// can edit groups. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#list-ldap-group-links-starter +func (s *GroupsService) ListGroupLDAPLinks(gid interface{}, options ...RequestOptionFunc) ([]*LDAPGroupLink, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/ldap_group_links", pathEscape(group)) + + req, err := s.client.NewRequest("GET", u, nil, options) + if err != nil { + return nil, nil, err + } + + var gl []*LDAPGroupLink + resp, err := s.client.Do(req, &gl) + if err != nil { + return nil, resp, err + } + + return gl, resp, nil +} + +// AddGroupLDAPLinkOptions represents the available AddGroupLDAPLink() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#add-ldap-group-link-starter +type AddGroupLDAPLinkOptions struct { + CN *string `url:"cn,omitempty" json:"cn,omitempty"` + GroupAccess *int `url:"group_access,omitempty" json:"group_access,omitempty"` + Provider *string `url:"provider,omitempty" json:"provider,ommitempty"` +} + +// AddGroupLDAPLink creates a new group LDAP link. Available only for users who +// can edit groups. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#add-ldap-group-link-starter +func (s *GroupsService) AddGroupLDAPLink(gid interface{}, opt *AddGroupLDAPLinkOptions, options ...RequestOptionFunc) (*LDAPGroupLink, *Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("groups/%s/ldap_group_links", pathEscape(group)) + + req, err := s.client.NewRequest("POST", u, opt, options) + if err != nil { + return nil, nil, err + } + + gl := new(LDAPGroupLink) + resp, err := s.client.Do(req, gl) + if err != nil { + return nil, resp, err + } + + return gl, resp, err +} + +// DeleteGroupLDAPLink deletes a group LDAP link. Available only for users who +// can edit groups. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#delete-ldap-group-link-starter +func (s *GroupsService) DeleteGroupLDAPLink(gid interface{}, cn string, options ...RequestOptionFunc) (*Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("groups/%s/ldap_group_links/%s", pathEscape(group), pathEscape(cn)) + + req, err := s.client.NewRequest("DELETE", u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteGroupLDAPLinkForProvider deletes a group LDAP link from a specific +// provider. Available only for users who can edit groups. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/groups.html#delete-ldap-group-link-starter +func (s *GroupsService) DeleteGroupLDAPLinkForProvider(gid interface{}, provider, cn string, options ...RequestOptionFunc) (*Response, error) { + group, err := parseID(gid) + if err != nil { + return nil, err + } + u := fmt.Sprintf( + "groups/%s/ldap_group_links/%s/%s", + pathEscape(group), + pathEscape(provider), + pathEscape(cn), + ) + + req, err := s.client.NewRequest("DELETE", u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/xanzy/go-gitlab/issue_links.go b/vendor/github.com/xanzy/go-gitlab/issue_links.go index f310d7915d..495793764a 100644 --- a/vendor/github.com/xanzy/go-gitlab/issue_links.go +++ b/vendor/github.com/xanzy/go-gitlab/issue_links.go @@ -43,7 +43,7 @@ type IssueLink struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/issue_links.html#list-issue-relations -func (s *IssueLinksService) ListIssueRelations(pid interface{}, issueIID int, options ...OptionFunc) ([]*Issue, *Response, error) { +func (s *IssueLinksService) ListIssueRelations(pid interface{}, issueIID int, options ...RequestOptionFunc) ([]*Issue, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -77,7 +77,7 @@ type CreateIssueLinkOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/issue_links.html#create-an-issue-link -func (s *IssueLinksService) CreateIssueLink(pid interface{}, issueIID int, opt *CreateIssueLinkOptions, options ...OptionFunc) (*IssueLink, *Response, error) { +func (s *IssueLinksService) CreateIssueLink(pid interface{}, issueIID int, opt *CreateIssueLinkOptions, options ...RequestOptionFunc) (*IssueLink, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -102,7 +102,7 @@ func (s *IssueLinksService) CreateIssueLink(pid interface{}, issueIID int, opt * // // GitLab API docs: // https://docs.gitlab.com/ee/api/issue_links.html#delete-an-issue-link -func (s *IssueLinksService) DeleteIssueLink(pid interface{}, issueIID, issueLinkID int, options ...OptionFunc) (*IssueLink, *Response, error) { +func (s *IssueLinksService) DeleteIssueLink(pid interface{}, issueIID, issueLinkID int, options ...RequestOptionFunc) (*IssueLink, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/issues.go b/vendor/github.com/xanzy/go-gitlab/issues.go index 70a1255d8d..7b7a583ed2 100644 --- a/vendor/github.com/xanzy/go-gitlab/issues.go +++ b/vendor/github.com/xanzy/go-gitlab/issues.go @@ -19,6 +19,7 @@ package gitlab import ( "encoding/json" "fmt" + "net/url" "strings" "time" ) @@ -52,6 +53,13 @@ type IssueAssignee struct { Username string `json:"username"` } +// IssueReferences represents references of the issue. +type IssueReferences struct { + Short string `json:"short"` + Relative string `json:"relative"` + Full string `json:"full"` +} + // IssueLinks represents links of the issue. type IssueLinks struct { Self string `json:"self"` @@ -64,33 +72,38 @@ type IssueLinks struct { // // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html type Issue struct { - ID int `json:"id"` - IID int `json:"iid"` - ProjectID int `json:"project_id"` - Milestone *Milestone `json:"milestone"` - Author *IssueAuthor `json:"author"` - Description string `json:"description"` - State string `json:"state"` - Assignees []*IssueAssignee `json:"assignees"` - Assignee *IssueAssignee `json:"assignee"` - Upvotes int `json:"upvotes"` - Downvotes int `json:"downvotes"` - Labels Labels `json:"labels"` - Title string `json:"title"` - UpdatedAt *time.Time `json:"updated_at"` - CreatedAt *time.Time `json:"created_at"` - ClosedAt *time.Time `json:"closed_at"` - Subscribed bool `json:"subscribed"` - UserNotesCount int `json:"user_notes_count"` - DueDate *ISOTime `json:"due_date"` - WebURL string `json:"web_url"` - TimeStats *TimeStats `json:"time_stats"` - Confidential bool `json:"confidential"` - Weight int `json:"weight"` - DiscussionLocked bool `json:"discussion_locked"` - Links *IssueLinks `json:"_links"` - IssueLinkID int `json:"issue_link_id"` - MergeRequestCount int `json:"merge_requests_count"` + ID int `json:"id"` + IID int `json:"iid"` + State string `json:"state"` + Description string `json:"description"` + Author *IssueAuthor `json:"author"` + Milestone *Milestone `json:"milestone"` + ProjectID int `json:"project_id"` + Assignees []*IssueAssignee `json:"assignees"` + Assignee *IssueAssignee `json:"assignee"` + UpdatedAt *time.Time `json:"updated_at"` + ClosedAt *time.Time `json:"closed_at"` + Title string `json:"title"` + CreatedAt *time.Time `json:"created_at"` + Labels Labels `json:"labels"` + Upvotes int `json:"upvotes"` + Downvotes int `json:"downvotes"` + DueDate *ISOTime `json:"due_date"` + WebURL string `json:"web_url"` + References *IssueReferences `json:"references"` + TimeStats *TimeStats `json:"time_stats"` + Confidential bool `json:"confidential"` + Weight int `json:"weight"` + DiscussionLocked bool `json:"discussion_locked"` + Subscribed bool `json:"subscribed"` + UserNotesCount int `json:"user_notes_count"` + Links *IssueLinks `json:"_links"` + IssueLinkID int `json:"issue_link_id"` + MergeRequestCount int `json:"merge_requests_count"` + TaskCompletionStatus struct { + Count int `json:"count"` + CompletedCount int `json:"completed_count"` + } `json:"task_completion_status"` } func (i Issue) String() string { @@ -105,6 +118,12 @@ func (l *Labels) MarshalJSON() ([]byte, error) { return json.Marshal(strings.Join(*l, ",")) } +// EncodeValues implements the query.EncodeValues interface +func (l *Labels) EncodeValues(key string, v *url.Values) error { + v.Set(key, strings.Join(*l, ",")) + return nil +} + // ListIssuesOptions represents the available ListIssues() options. // // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues @@ -133,7 +152,7 @@ type ListIssuesOptions struct { // takes pagination parameters page and per_page to restrict the list of issues. // // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues -func (s *IssuesService) ListIssues(opt *ListIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) { +func (s *IssuesService) ListIssues(opt *ListIssuesOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { req, err := s.client.NewRequest("GET", "issues", opt, options) if err != nil { return nil, nil, err @@ -175,7 +194,7 @@ type ListGroupIssuesOptions struct { // pagination parameters page and per_page to return the list of group issues. // // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-group-issues -func (s *IssuesService) ListGroupIssues(pid interface{}, opt *ListGroupIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) { +func (s *IssuesService) ListGroupIssues(pid interface{}, opt *ListGroupIssuesOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { group, err := parseID(pid) if err != nil { return nil, nil, err @@ -225,7 +244,7 @@ type ListProjectIssuesOptions struct { // pagination parameters page and per_page to return the list of project issues. // // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-project-issues -func (s *IssuesService) ListProjectIssues(pid interface{}, opt *ListProjectIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) { +func (s *IssuesService) ListProjectIssues(pid interface{}, opt *ListProjectIssuesOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -249,7 +268,7 @@ func (s *IssuesService) ListProjectIssues(pid interface{}, opt *ListProjectIssue // GetIssue gets a single project issue. // // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#single-issues -func (s *IssuesService) GetIssue(pid interface{}, issue int, options ...OptionFunc) (*Issue, *Response, error) { +func (s *IssuesService) GetIssue(pid interface{}, issue int, options ...RequestOptionFunc) (*Issue, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -291,7 +310,7 @@ type CreateIssueOptions struct { // CreateIssue creates a new project issue. // // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#new-issues -func (s *IssuesService) CreateIssue(pid interface{}, opt *CreateIssueOptions, options ...OptionFunc) (*Issue, *Response, error) { +func (s *IssuesService) CreateIssue(pid interface{}, opt *CreateIssueOptions, options ...RequestOptionFunc) (*Issue, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -333,7 +352,7 @@ type UpdateIssueOptions struct { // to mark an issue as closed. // // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#edit-issues -func (s *IssuesService) UpdateIssue(pid interface{}, issue int, opt *UpdateIssueOptions, options ...OptionFunc) (*Issue, *Response, error) { +func (s *IssuesService) UpdateIssue(pid interface{}, issue int, opt *UpdateIssueOptions, options ...RequestOptionFunc) (*Issue, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -357,7 +376,7 @@ func (s *IssuesService) UpdateIssue(pid interface{}, issue int, opt *UpdateIssue // DeleteIssue deletes a single project issue. // // GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#delete-an-issue -func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...OptionFunc) (*Response, error) { +func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -383,7 +402,7 @@ type MoveIssueOptions struct { // to mark an issue as closed. // // GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#move-an-issue -func (s *IssuesService) MoveIssue(pid interface{}, issue int, opt *MoveIssueOptions, options ...OptionFunc) (*Issue, *Response, error) { +func (s *IssuesService) MoveIssue(pid interface{}, issue int, opt *MoveIssueOptions, options ...RequestOptionFunc) (*Issue, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -410,7 +429,7 @@ func (s *IssuesService) MoveIssue(pid interface{}, issue int, opt *MoveIssueOpti // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#subscribe-to-a-merge-request -func (s *IssuesService) SubscribeToIssue(pid interface{}, issue int, options ...OptionFunc) (*Issue, *Response, error) { +func (s *IssuesService) SubscribeToIssue(pid interface{}, issue int, options ...RequestOptionFunc) (*Issue, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -437,7 +456,7 @@ func (s *IssuesService) SubscribeToIssue(pid interface{}, issue int, options ... // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#unsubscribe-from-a-merge-request -func (s *IssuesService) UnsubscribeFromIssue(pid interface{}, issue int, options ...OptionFunc) (*Issue, *Response, error) { +func (s *IssuesService) UnsubscribeFromIssue(pid interface{}, issue int, options ...RequestOptionFunc) (*Issue, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -470,7 +489,7 @@ type ListMergeRequestsClosingIssueOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/issues.html#list-merge-requests-that-will-close-issue-on-merge -func (s *IssuesService) ListMergeRequestsClosingIssue(pid interface{}, issue int, opt *ListMergeRequestsClosingIssueOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *IssuesService) ListMergeRequestsClosingIssue(pid interface{}, issue int, opt *ListMergeRequestsClosingIssueOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -503,7 +522,7 @@ type ListMergeRequestsRelatedToIssueOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/issues.html#list-merge-requests-related-to-issue -func (s *IssuesService) ListMergeRequestsRelatedToIssue(pid interface{}, issue int, opt *ListMergeRequestsRelatedToIssueOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *IssuesService) ListMergeRequestsRelatedToIssue(pid interface{}, issue int, opt *ListMergeRequestsRelatedToIssueOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -531,7 +550,7 @@ func (s *IssuesService) ListMergeRequestsRelatedToIssue(pid interface{}, issue i // // GitLab API docs: // https://docs.gitlab.com/ce/api/issues.html#set-a-time-estimate-for-an-issue -func (s *IssuesService) SetTimeEstimate(pid interface{}, issue int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *IssuesService) SetTimeEstimate(pid interface{}, issue int, opt *SetTimeEstimateOptions, options ...RequestOptionFunc) (*TimeStats, *Response, error) { return s.timeStats.setTimeEstimate(pid, "issues", issue, opt, options...) } @@ -539,7 +558,7 @@ func (s *IssuesService) SetTimeEstimate(pid interface{}, issue int, opt *SetTime // // GitLab API docs: // https://docs.gitlab.com/ce/api/issues.html#reset-the-time-estimate-for-an-issue -func (s *IssuesService) ResetTimeEstimate(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *IssuesService) ResetTimeEstimate(pid interface{}, issue int, options ...RequestOptionFunc) (*TimeStats, *Response, error) { return s.timeStats.resetTimeEstimate(pid, "issues", issue, options...) } @@ -547,7 +566,7 @@ func (s *IssuesService) ResetTimeEstimate(pid interface{}, issue int, options .. // // GitLab API docs: // https://docs.gitlab.com/ce/api/issues.html#add-spent-time-for-an-issue -func (s *IssuesService) AddSpentTime(pid interface{}, issue int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *IssuesService) AddSpentTime(pid interface{}, issue int, opt *AddSpentTimeOptions, options ...RequestOptionFunc) (*TimeStats, *Response, error) { return s.timeStats.addSpentTime(pid, "issues", issue, opt, options...) } @@ -555,7 +574,7 @@ func (s *IssuesService) AddSpentTime(pid interface{}, issue int, opt *AddSpentTi // // GitLab API docs: // https://docs.gitlab.com/ce/api/issues.html#reset-spent-time-for-an-issue -func (s *IssuesService) ResetSpentTime(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *IssuesService) ResetSpentTime(pid interface{}, issue int, options ...RequestOptionFunc) (*TimeStats, *Response, error) { return s.timeStats.resetSpentTime(pid, "issues", issue, options...) } @@ -563,6 +582,6 @@ func (s *IssuesService) ResetSpentTime(pid interface{}, issue int, options ...Op // // GitLab API docs: // https://docs.gitlab.com/ce/api/issues.html#get-time-tracking-stats -func (s *IssuesService) GetTimeSpent(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *IssuesService) GetTimeSpent(pid interface{}, issue int, options ...RequestOptionFunc) (*TimeStats, *Response, error) { return s.timeStats.getTimeSpent(pid, "issues", issue, options...) } diff --git a/vendor/github.com/xanzy/go-gitlab/jobs.go b/vendor/github.com/xanzy/go-gitlab/jobs.go index f0c1e2c46b..c6e4ec1eac 100644 --- a/vendor/github.com/xanzy/go-gitlab/jobs.go +++ b/vendor/github.com/xanzy/go-gitlab/jobs.go @@ -89,7 +89,7 @@ type ListJobsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#list-project-jobs -func (s *JobsService) ListProjectJobs(pid interface{}, opts *ListJobsOptions, options ...OptionFunc) ([]Job, *Response, error) { +func (s *JobsService) ListProjectJobs(pid interface{}, opts *ListJobsOptions, options ...RequestOptionFunc) ([]Job, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -115,7 +115,7 @@ func (s *JobsService) ListProjectJobs(pid interface{}, opts *ListJobsOptions, op // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#list-pipeline-jobs -func (s *JobsService) ListPipelineJobs(pid interface{}, pipelineID int, opts *ListJobsOptions, options ...OptionFunc) ([]*Job, *Response, error) { +func (s *JobsService) ListPipelineJobs(pid interface{}, pipelineID int, opts *ListJobsOptions, options ...RequestOptionFunc) ([]*Job, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -140,7 +140,7 @@ func (s *JobsService) ListPipelineJobs(pid interface{}, pipelineID int, opts *Li // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#get-a-single-job -func (s *JobsService) GetJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) { +func (s *JobsService) GetJob(pid interface{}, jobID int, options ...RequestOptionFunc) (*Job, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -165,7 +165,7 @@ func (s *JobsService) GetJob(pid interface{}, jobID int, options ...OptionFunc) // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#get-job-artifacts -func (s *JobsService) GetJobArtifacts(pid interface{}, jobID int, options ...OptionFunc) (io.Reader, *Response, error) { +func (s *JobsService) GetJobArtifacts(pid interface{}, jobID int, options ...RequestOptionFunc) (io.Reader, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -200,7 +200,7 @@ type DownloadArtifactsFileOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#download-the-artifacts-file -func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, opt *DownloadArtifactsFileOptions, options ...OptionFunc) (io.Reader, *Response, error) { +func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, opt *DownloadArtifactsFileOptions, options ...RequestOptionFunc) (io.Reader, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -228,7 +228,7 @@ func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, opt // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#download-a-single-artifact-file -func (s *JobsService) DownloadSingleArtifactsFile(pid interface{}, jobID int, artifactPath string, options ...OptionFunc) (io.Reader, *Response, error) { +func (s *JobsService) DownloadSingleArtifactsFile(pid interface{}, jobID int, artifactPath string, options ...RequestOptionFunc) (io.Reader, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -259,7 +259,7 @@ func (s *JobsService) DownloadSingleArtifactsFile(pid interface{}, jobID int, ar // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#get-a-trace-file -func (s *JobsService) GetTraceFile(pid interface{}, jobID int, options ...OptionFunc) (io.Reader, *Response, error) { +func (s *JobsService) GetTraceFile(pid interface{}, jobID int, options ...RequestOptionFunc) (io.Reader, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -284,7 +284,7 @@ func (s *JobsService) GetTraceFile(pid interface{}, jobID int, options ...Option // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#cancel-a-job -func (s *JobsService) CancelJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) { +func (s *JobsService) CancelJob(pid interface{}, jobID int, options ...RequestOptionFunc) (*Job, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -309,7 +309,7 @@ func (s *JobsService) CancelJob(pid interface{}, jobID int, options ...OptionFun // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#retry-a-job -func (s *JobsService) RetryJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) { +func (s *JobsService) RetryJob(pid interface{}, jobID int, options ...RequestOptionFunc) (*Job, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -335,7 +335,7 @@ func (s *JobsService) RetryJob(pid interface{}, jobID int, options ...OptionFunc // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#erase-a-job -func (s *JobsService) EraseJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) { +func (s *JobsService) EraseJob(pid interface{}, jobID int, options ...RequestOptionFunc) (*Job, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -361,7 +361,7 @@ func (s *JobsService) EraseJob(pid interface{}, jobID int, options ...OptionFunc // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#keep-artifacts -func (s *JobsService) KeepArtifacts(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) { +func (s *JobsService) KeepArtifacts(pid interface{}, jobID int, options ...RequestOptionFunc) (*Job, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -386,7 +386,7 @@ func (s *JobsService) KeepArtifacts(pid interface{}, jobID int, options ...Optio // // GitLab API docs: // https://docs.gitlab.com/ce/api/jobs.html#play-a-job -func (s *JobsService) PlayJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) { +func (s *JobsService) PlayJob(pid interface{}, jobID int, options ...RequestOptionFunc) (*Job, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/keys.go b/vendor/github.com/xanzy/go-gitlab/keys.go index 9657e862a9..c520377131 100644 --- a/vendor/github.com/xanzy/go-gitlab/keys.go +++ b/vendor/github.com/xanzy/go-gitlab/keys.go @@ -47,7 +47,7 @@ type Key struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/keys.html#get-ssh-key-with-user-by-id-of-an-ssh-key -func (s *KeysService) GetKeyWithUser(key int, options ...OptionFunc) (*Key, *Response, error) { +func (s *KeysService) GetKeyWithUser(key int, options ...RequestOptionFunc) (*Key, *Response, error) { u := fmt.Sprintf("keys/%d", key) req, err := s.client.NewRequest("GET", u, nil, options) diff --git a/vendor/github.com/xanzy/go-gitlab/labels.go b/vendor/github.com/xanzy/go-gitlab/labels.go index 7baf66634f..37e7277622 100644 --- a/vendor/github.com/xanzy/go-gitlab/labels.go +++ b/vendor/github.com/xanzy/go-gitlab/labels.go @@ -78,7 +78,7 @@ type ListLabelsOptions ListOptions // ListLabels gets all labels for given project. // // GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels -func (s *LabelsService) ListLabels(pid interface{}, opt *ListLabelsOptions, options ...OptionFunc) ([]*Label, *Response, error) { +func (s *LabelsService) ListLabels(pid interface{}, opt *ListLabelsOptions, options ...RequestOptionFunc) ([]*Label, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -112,7 +112,7 @@ type CreateLabelOptions struct { // color. // // GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#create-a-new-label -func (s *LabelsService) CreateLabel(pid interface{}, opt *CreateLabelOptions, options ...OptionFunc) (*Label, *Response, error) { +func (s *LabelsService) CreateLabel(pid interface{}, opt *CreateLabelOptions, options ...RequestOptionFunc) (*Label, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -143,7 +143,7 @@ type DeleteLabelOptions struct { // DeleteLabel deletes a label given by its name. // // GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label -func (s *LabelsService) DeleteLabel(pid interface{}, opt *DeleteLabelOptions, options ...OptionFunc) (*Response, error) { +func (s *LabelsService) DeleteLabel(pid interface{}, opt *DeleteLabelOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -172,7 +172,7 @@ type UpdateLabelOptions struct { // one parameter is required, to update the label. // // GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#edit-an-existing-label -func (s *LabelsService) UpdateLabel(pid interface{}, opt *UpdateLabelOptions, options ...OptionFunc) (*Label, *Response, error) { +func (s *LabelsService) UpdateLabel(pid interface{}, opt *UpdateLabelOptions, options ...RequestOptionFunc) (*Label, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -199,7 +199,7 @@ func (s *LabelsService) UpdateLabel(pid interface{}, opt *UpdateLabelOptions, op // // GitLab API docs: // https://docs.gitlab.com/ce/api/labels.html#subscribe-to-a-label -func (s *LabelsService) SubscribeToLabel(pid interface{}, labelID interface{}, options ...OptionFunc) (*Label, *Response, error) { +func (s *LabelsService) SubscribeToLabel(pid interface{}, labelID interface{}, options ...RequestOptionFunc) (*Label, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -230,7 +230,7 @@ func (s *LabelsService) SubscribeToLabel(pid interface{}, labelID interface{}, o // // GitLab API docs: // https://docs.gitlab.com/ce/api/labels.html#unsubscribe-from-a-label -func (s *LabelsService) UnsubscribeFromLabel(pid interface{}, labelID interface{}, options ...OptionFunc) (*Response, error) { +func (s *LabelsService) UnsubscribeFromLabel(pid interface{}, labelID interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/license.go b/vendor/github.com/xanzy/go-gitlab/license.go index 746e99ae94..f14aef6093 100644 --- a/vendor/github.com/xanzy/go-gitlab/license.go +++ b/vendor/github.com/xanzy/go-gitlab/license.go @@ -78,7 +78,7 @@ type AddLicenseOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/license.html#add-a-new-license -func (s *LicenseService) AddLicense(opt *AddLicenseOptions, options ...OptionFunc) (*License, *Response, error) { +func (s *LicenseService) AddLicense(opt *AddLicenseOptions, options ...RequestOptionFunc) (*License, *Response, error) { req, err := s.client.NewRequest("POST", "license", opt, options) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/license_templates.go b/vendor/github.com/xanzy/go-gitlab/license_templates.go index 83f8259b7f..41dcdc3b40 100644 --- a/vendor/github.com/xanzy/go-gitlab/license_templates.go +++ b/vendor/github.com/xanzy/go-gitlab/license_templates.go @@ -44,7 +44,7 @@ type ListLicenseTemplatesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/templates/licenses.html#list-license-templates -func (s *LicenseTemplatesService) ListLicenseTemplates(opt *ListLicenseTemplatesOptions, options ...OptionFunc) ([]*LicenseTemplate, *Response, error) { +func (s *LicenseTemplatesService) ListLicenseTemplates(opt *ListLicenseTemplatesOptions, options ...RequestOptionFunc) ([]*LicenseTemplate, *Response, error) { req, err := s.client.NewRequest("GET", "templates/licenses", opt, options) if err != nil { return nil, nil, err @@ -74,7 +74,7 @@ type GetLicenseTemplateOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/templates/licenses.html#single-license-template -func (s *LicenseTemplatesService) GetLicenseTemplate(template string, opt *GetLicenseTemplateOptions, options ...OptionFunc) (*LicenseTemplate, *Response, error) { +func (s *LicenseTemplatesService) GetLicenseTemplate(template string, opt *GetLicenseTemplateOptions, options ...RequestOptionFunc) (*LicenseTemplate, *Response, error) { u := fmt.Sprintf("templates/licenses/%s", template) req, err := s.client.NewRequest("GET", u, opt, options) 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 c11fe35736..9ef8a7e585 100644 --- a/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go +++ b/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go @@ -60,6 +60,38 @@ type MergeRequestApproverGroup struct { } } +// MergeRequestApprovalRule represents a GitLab merge request approval rule. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-merge-request-level-rules +type MergeRequestApprovalRule struct { + ID int `json:"id"` + Name string `json:"name"` + RuleType string `json:"rule_type"` + EligibleApprovers []*BasicUser `json:"eligible_approvers"` + ApprovalsRequired int `json:"approvals_required"` + SourceRule *ProjectApprovalRule `json:"source_rule"` + Users []*BasicUser `json:"users"` + Groups []*Group `json:"groups"` + ContainsHiddenGroups bool `json:"contains_hidden_groups"` + ApprovedBy []*BasicUser `json:"approved_by"` + Approved bool `json:"approved"` +} + +// MergeRequestApprovalState represents a GitLab merge request approval state. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-the-approval-state-of-merge-requests +type MergeRequestApprovalState struct { + ApprovalRulesOverwritten bool `json:"approval_rules_overwritten"` + Rules []*MergeRequestApprovalRule `json:"rules"` +} + +// String is a stringify for MergeRequestApprovalRule +func (s MergeRequestApprovalRule) String() string { + return Stringify(s) +} + // MergeRequestApproverUser represents GitLab project level merge request approver user. // // GitLab API docs: @@ -81,7 +113,7 @@ type ApproveMergeRequestOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#approve-merge-request -func (s *MergeRequestApprovalsService) ApproveMergeRequest(pid interface{}, mr int, opt *ApproveMergeRequestOptions, options ...OptionFunc) (*MergeRequestApprovals, *Response, error) { +func (s *MergeRequestApprovalsService) ApproveMergeRequest(pid interface{}, mr int, opt *ApproveMergeRequestOptions, options ...RequestOptionFunc) (*MergeRequestApprovals, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -106,7 +138,7 @@ func (s *MergeRequestApprovalsService) ApproveMergeRequest(pid interface{}, mr i // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#unapprove-merge-request -func (s *MergeRequestApprovalsService) UnapproveMergeRequest(pid interface{}, mr int, options ...OptionFunc) (*Response, error) { +func (s *MergeRequestApprovalsService) UnapproveMergeRequest(pid interface{}, mr int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -130,16 +162,41 @@ type ChangeMergeRequestApprovalConfigurationOptions struct { ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"` } +// GetConfiguration shows information about single merge request approvals +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-configuration-1 +func (s *MergeRequestApprovalsService) GetConfiguration(pid interface{}, mr int, options ...RequestOptionFunc) (*MergeRequestApprovals, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", pathEscape(project), mr) + + req, err := s.client.NewRequest("GET", u, nil, options) + if err != nil { + return nil, nil, err + } + + m := new(MergeRequestApprovals) + resp, err := s.client.Do(req, m) + if err != nil { + return nil, resp, err + } + + return m, resp, err +} + // 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) { +func (s *MergeRequestApprovalsService) ChangeApprovalConfiguration(pid interface{}, mergeRequest int, opt *ChangeMergeRequestApprovalConfigurationOptions, options ...RequestOptionFunc) (*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) + u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", pathEscape(project), mergeRequest) req, err := s.client.NewRequest("POST", u, opt, options) if err != nil { @@ -169,12 +226,12 @@ type ChangeMergeRequestAllowedApproversOptions struct { // // 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) { +func (s *MergeRequestApprovalsService) ChangeAllowedApprovers(pid interface{}, mergeRequest int, opt *ChangeMergeRequestAllowedApproversOptions, options ...RequestOptionFunc) (*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) + u := fmt.Sprintf("projects/%s/merge_requests/%d/approvers", pathEscape(project), mergeRequest) req, err := s.client.NewRequest("PUT", u, opt, options) if err != nil { @@ -189,3 +246,147 @@ func (s *MergeRequestApprovalsService) ChangeAllowedApprovers(pid interface{}, m return m, resp, err } + +// GetApprovalRules requests information about a merge request’s approval rules +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-merge-request-level-rules +func (s *MergeRequestApprovalsService) GetApprovalRules(pid interface{}, mergeRequest int, options ...RequestOptionFunc) ([]*MergeRequestApprovalRule, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/merge_requests/%d/approval_rules", pathEscape(project), mergeRequest) + + req, err := s.client.NewRequest("GET", u, nil, options) + if err != nil { + return nil, nil, err + } + + var par []*MergeRequestApprovalRule + resp, err := s.client.Do(req, &par) + if err != nil { + return nil, resp, err + } + + return par, resp, err +} + +// GetApprovalState requests information about a merge request’s approval state +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-the-approval-state-of-merge-requests +func (s *MergeRequestApprovalsService) GetApprovalState(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*MergeRequestApprovalState, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/merge_requests/%d/approval_state", pathEscape(project), mergeRequest) + + req, err := s.client.NewRequest("GET", u, nil, options) + if err != nil { + return nil, nil, err + } + + var pas *MergeRequestApprovalState + resp, err := s.client.Do(req, &pas) + if err != nil { + return nil, resp, err + } + + return pas, resp, err +} + +// CreateMergeRequestApprovalRuleOptions represents the available CreateApprovalRule() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_request_approvals.html#create-merge-request-level-rule +type CreateMergeRequestApprovalRuleOptions struct { + Name *string `url:"name,omitempty" json:"name,omitempty"` + ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"` + ApprovalProjectRuleID *int `url:"approval_project_rule_id,omitempty" json:"approval_project_rule_id,omitempty"` + UserIDs []int `url:"user_ids,omitempty" json:"user_ids,omitempty"` + GroupIDs []int `url:"group_ids,omitempty" json:"group_ids,omitempty"` +} + +// CreateApprovalRule creates a new MR level approval rule. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_request_approvals.html#create-merge-request-level-rule +func (s *MergeRequestApprovalsService) CreateApprovalRule(pid interface{}, mergeRequest int, opt *CreateMergeRequestApprovalRuleOptions, options ...RequestOptionFunc) (*MergeRequestApprovalRule, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/merge_requests/%d/approval_rules", pathEscape(project), mergeRequest) + + req, err := s.client.NewRequest("POST", u, opt, options) + if err != nil { + return nil, nil, err + } + + par := new(MergeRequestApprovalRule) + resp, err := s.client.Do(req, &par) + if err != nil { + return nil, resp, err + } + + return par, resp, err +} + +// UpdateMergeRequestApprovalRuleOptions represents the available UpdateApprovalRule() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_request_approvals.html#update-merge-request-level-rule +type UpdateMergeRequestApprovalRuleOptions struct { + Name *string `url:"name,omitempty" json:"name,omitempty"` + ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"` + UserIDs []int `url:"user_ids,omitempty" json:"user_ids,omitempty"` + GroupIDs []int `url:"group_ids,omitempty" json:"group_ids,omitempty"` +} + +// UpdateApprovalRule updates an existing approval rule with new options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_request_approvals.html#update-merge-request-level-rule +func (s *MergeRequestApprovalsService) UpdateApprovalRule(pid interface{}, mergeRequest int, approvalRule int, opt *UpdateMergeRequestApprovalRuleOptions, options ...RequestOptionFunc) (*MergeRequestApprovalRule, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/merge_requests/%d/approval_rules/%d", pathEscape(project), mergeRequest, approvalRule) + + req, err := s.client.NewRequest("PUT", u, opt, options) + if err != nil { + return nil, nil, err + } + + par := new(MergeRequestApprovalRule) + resp, err := s.client.Do(req, &par) + if err != nil { + return nil, resp, err + } + + return par, resp, err +} + +// DeleteApprovalRule deletes a mr level approval rule. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/merge_request_approvals.html#delete-merge-request-level-rule +func (s *MergeRequestApprovalsService) DeleteApprovalRule(pid interface{}, mergeRequest int, approvalRule int, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/merge_requests/%d/approval_rules/%d", pathEscape(project), mergeRequest, approvalRule) + + req, err := s.client.NewRequest("DELETE", u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/xanzy/go-gitlab/merge_requests.go b/vendor/github.com/xanzy/go-gitlab/merge_requests.go index 4e10cb8ff7..044a1c5848 100644 --- a/vendor/github.com/xanzy/go-gitlab/merge_requests.go +++ b/vendor/github.com/xanzy/go-gitlab/merge_requests.go @@ -64,6 +64,7 @@ type MergeRequest struct { Subscribed bool `json:"subscribed"` SHA string `json:"sha"` MergeCommitSHA string `json:"merge_commit_sha"` + SquashCommitSHA string `json:"squash_commit_sha"` UserNotesCount int `json:"user_notes_count"` ChangesCount string `json:"changes_count"` ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"` @@ -97,6 +98,7 @@ type MergeRequest struct { Count int `json:"count"` CompletedCount int `json:"completed_count"` } `json:"task_completion_status"` + HasConflicts bool `json:"has_conflicts"` } func (m MergeRequest) String() string { @@ -159,7 +161,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 ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *MergeRequestsService) ListMergeRequests(opt *ListMergeRequestsOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { req, err := s.client.NewRequest("GET", "merge_requests", opt, options) if err != nil { return nil, nil, err @@ -204,7 +206,7 @@ type ListGroupMergeRequestsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#list-group-merge-requests -func (s *MergeRequestsService) ListGroupMergeRequests(gid interface{}, opt *ListGroupMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *MergeRequestsService) ListGroupMergeRequests(gid interface{}, opt *ListGroupMergeRequestsOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -257,7 +259,7 @@ type ListProjectMergeRequestsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#list-project-merge-requests -func (s *MergeRequestsService) ListProjectMergeRequests(pid interface{}, opt *ListProjectMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *MergeRequestsService) ListProjectMergeRequests(pid interface{}, opt *ListProjectMergeRequestsOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -293,7 +295,7 @@ type GetMergeRequestsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr -func (s *MergeRequestsService) GetMergeRequest(pid interface{}, mergeRequest int, opt *GetMergeRequestsOptions, options ...OptionFunc) (*MergeRequest, *Response, error) { +func (s *MergeRequestsService) GetMergeRequest(pid interface{}, mergeRequest int, opt *GetMergeRequestsOptions, options ...RequestOptionFunc) (*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -318,7 +320,7 @@ func (s *MergeRequestsService) GetMergeRequest(pid interface{}, mergeRequest int // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#merge-request-level-mr-approvals -func (s *MergeRequestsService) GetMergeRequestApprovals(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequestApprovals, *Response, error) { +func (s *MergeRequestsService) GetMergeRequestApprovals(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*MergeRequestApprovals, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -350,7 +352,7 @@ type GetMergeRequestCommitsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-commits -func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequest int, opt *GetMergeRequestCommitsOptions, options ...OptionFunc) ([]*Commit, *Response, error) { +func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequest int, opt *GetMergeRequestCommitsOptions, options ...RequestOptionFunc) ([]*Commit, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -376,7 +378,7 @@ func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequ // // 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 ...OptionFunc) (*MergeRequest, *Response, error) { +func (s *MergeRequestsService) GetMergeRequestChanges(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -401,7 +403,7 @@ func (s *MergeRequestsService) GetMergeRequestChanges(pid interface{}, mergeRequ // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#list-mr-pipelines -func (s *MergeRequestsService) ListMergeRequestPipelines(pid interface{}, mergeRequest int, options ...OptionFunc) ([]*PipelineInfo, *Response, error) { +func (s *MergeRequestsService) ListMergeRequestPipelines(pid interface{}, mergeRequest int, options ...RequestOptionFunc) ([]*PipelineInfo, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -434,7 +436,7 @@ type GetIssuesClosedOnMergeOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#list-issues-that-will-close-on-merge -func (s *MergeRequestsService) GetIssuesClosedOnMerge(pid interface{}, mergeRequest int, opt *GetIssuesClosedOnMergeOptions, options ...OptionFunc) ([]*Issue, *Response, error) { +func (s *MergeRequestsService) GetIssuesClosedOnMerge(pid interface{}, mergeRequest int, opt *GetIssuesClosedOnMergeOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -479,7 +481,7 @@ type CreateMergeRequestOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#create-mr -func (s *MergeRequestsService) CreateMergeRequest(pid interface{}, opt *CreateMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) { +func (s *MergeRequestsService) CreateMergeRequest(pid interface{}, opt *CreateMergeRequestOptions, options ...RequestOptionFunc) (*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -524,7 +526,7 @@ type UpdateMergeRequestOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#update-mr -func (s *MergeRequestsService) UpdateMergeRequest(pid interface{}, mergeRequest int, opt *UpdateMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) { +func (s *MergeRequestsService) UpdateMergeRequest(pid interface{}, mergeRequest int, opt *UpdateMergeRequestOptions, options ...RequestOptionFunc) (*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -549,7 +551,7 @@ func (s *MergeRequestsService) UpdateMergeRequest(pid interface{}, mergeRequest // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#delete-a-merge-request -func (s *MergeRequestsService) DeleteMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*Response, error) { +func (s *MergeRequestsService) DeleteMergeRequest(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -585,7 +587,7 @@ type AcceptMergeRequestOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#accept-mr -func (s *MergeRequestsService) AcceptMergeRequest(pid interface{}, mergeRequest int, opt *AcceptMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) { +func (s *MergeRequestsService) AcceptMergeRequest(pid interface{}, mergeRequest int, opt *AcceptMergeRequestOptions, options ...RequestOptionFunc) (*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -614,7 +616,7 @@ func (s *MergeRequestsService) AcceptMergeRequest(pid interface{}, mergeRequest // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#cancel-merge-when-pipeline-succeeds -func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) { +func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -641,7 +643,7 @@ func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{}, // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#rebase-a-merge-request -func (s *MergeRequestsService) RebaseMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*Response, error) { +func (s *MergeRequestsService) RebaseMergeRequest(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -667,7 +669,7 @@ type GetMergeRequestDiffVersionsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#get-mr-diff-versions -func (s *MergeRequestsService) GetMergeRequestDiffVersions(pid interface{}, mergeRequest int, opt *GetMergeRequestDiffVersionsOptions, options ...OptionFunc) ([]*MergeRequestDiffVersion, *Response, error) { +func (s *MergeRequestsService) GetMergeRequestDiffVersions(pid interface{}, mergeRequest int, opt *GetMergeRequestDiffVersionsOptions, options ...RequestOptionFunc) ([]*MergeRequestDiffVersion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -692,7 +694,7 @@ func (s *MergeRequestsService) GetMergeRequestDiffVersions(pid interface{}, merg // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#get-a-single-mr-diff-version -func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{}, mergeRequest, version int, options ...OptionFunc) (*MergeRequestDiffVersion, *Response, error) { +func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{}, mergeRequest, version int, options ...RequestOptionFunc) (*MergeRequestDiffVersion, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -719,7 +721,7 @@ func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{}, // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#subscribe-to-a-merge-request -func (s *MergeRequestsService) SubscribeToMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) { +func (s *MergeRequestsService) SubscribeToMergeRequest(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -747,7 +749,7 @@ func (s *MergeRequestsService) SubscribeToMergeRequest(pid interface{}, mergeReq // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#unsubscribe-from-a-merge-request -func (s *MergeRequestsService) UnsubscribeFromMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) { +func (s *MergeRequestsService) UnsubscribeFromMergeRequest(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -774,7 +776,7 @@ func (s *MergeRequestsService) UnsubscribeFromMergeRequest(pid interface{}, merg // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#create-a-todo -func (s *MergeRequestsService) CreateTodo(pid interface{}, mergeRequest int, options ...OptionFunc) (*Todo, *Response, error) { +func (s *MergeRequestsService) CreateTodo(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*Todo, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -799,7 +801,7 @@ func (s *MergeRequestsService) CreateTodo(pid interface{}, mergeRequest int, opt // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#set-a-time-estimate-for-a-merge-request -func (s *MergeRequestsService) SetTimeEstimate(pid interface{}, mergeRequest int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *MergeRequestsService) SetTimeEstimate(pid interface{}, mergeRequest int, opt *SetTimeEstimateOptions, options ...RequestOptionFunc) (*TimeStats, *Response, error) { return s.timeStats.setTimeEstimate(pid, "merge_requests", mergeRequest, opt, options...) } @@ -807,7 +809,7 @@ func (s *MergeRequestsService) SetTimeEstimate(pid interface{}, mergeRequest int // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#reset-the-time-estimate-for-a-merge-request -func (s *MergeRequestsService) ResetTimeEstimate(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *MergeRequestsService) ResetTimeEstimate(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*TimeStats, *Response, error) { return s.timeStats.resetTimeEstimate(pid, "merge_requests", mergeRequest, options...) } @@ -815,7 +817,7 @@ func (s *MergeRequestsService) ResetTimeEstimate(pid interface{}, mergeRequest i // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#add-spent-time-for-a-merge-request -func (s *MergeRequestsService) AddSpentTime(pid interface{}, mergeRequest int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *MergeRequestsService) AddSpentTime(pid interface{}, mergeRequest int, opt *AddSpentTimeOptions, options ...RequestOptionFunc) (*TimeStats, *Response, error) { return s.timeStats.addSpentTime(pid, "merge_requests", mergeRequest, opt, options...) } @@ -823,7 +825,7 @@ func (s *MergeRequestsService) AddSpentTime(pid interface{}, mergeRequest int, o // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#reset-spent-time-for-a-merge-request -func (s *MergeRequestsService) ResetSpentTime(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *MergeRequestsService) ResetSpentTime(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*TimeStats, *Response, error) { return s.timeStats.resetSpentTime(pid, "merge_requests", mergeRequest, options...) } @@ -831,6 +833,6 @@ func (s *MergeRequestsService) ResetSpentTime(pid interface{}, mergeRequest int, // // GitLab API docs: // https://docs.gitlab.com/ce/api/merge_requests.html#get-time-tracking-stats -func (s *MergeRequestsService) GetTimeSpent(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *MergeRequestsService) GetTimeSpent(pid interface{}, mergeRequest int, options ...RequestOptionFunc) (*TimeStats, *Response, error) { return s.timeStats.getTimeSpent(pid, "merge_requests", mergeRequest, options...) } diff --git a/vendor/github.com/xanzy/go-gitlab/milestones.go b/vendor/github.com/xanzy/go-gitlab/milestones.go index f3f7f7c8c2..c276ab2e0a 100644 --- a/vendor/github.com/xanzy/go-gitlab/milestones.go +++ b/vendor/github.com/xanzy/go-gitlab/milestones.go @@ -65,7 +65,7 @@ type ListMilestonesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/milestones.html#list-project-milestones -func (s *MilestonesService) ListMilestones(pid interface{}, opt *ListMilestonesOptions, options ...OptionFunc) ([]*Milestone, *Response, error) { +func (s *MilestonesService) ListMilestones(pid interface{}, opt *ListMilestonesOptions, options ...RequestOptionFunc) ([]*Milestone, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -90,7 +90,7 @@ func (s *MilestonesService) ListMilestones(pid interface{}, opt *ListMilestonesO // // GitLab API docs: // https://docs.gitlab.com/ce/api/milestones.html#get-single-milestone -func (s *MilestonesService) GetMilestone(pid interface{}, milestone int, options ...OptionFunc) (*Milestone, *Response, error) { +func (s *MilestonesService) GetMilestone(pid interface{}, milestone int, options ...RequestOptionFunc) (*Milestone, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -126,7 +126,7 @@ type CreateMilestoneOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/milestones.html#create-new-milestone -func (s *MilestonesService) CreateMilestone(pid interface{}, opt *CreateMilestoneOptions, options ...OptionFunc) (*Milestone, *Response, error) { +func (s *MilestonesService) CreateMilestone(pid interface{}, opt *CreateMilestoneOptions, options ...RequestOptionFunc) (*Milestone, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -163,7 +163,7 @@ type UpdateMilestoneOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/milestones.html#edit-milestone -func (s *MilestonesService) UpdateMilestone(pid interface{}, milestone int, opt *UpdateMilestoneOptions, options ...OptionFunc) (*Milestone, *Response, error) { +func (s *MilestonesService) UpdateMilestone(pid interface{}, milestone int, opt *UpdateMilestoneOptions, options ...RequestOptionFunc) (*Milestone, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -188,7 +188,7 @@ func (s *MilestonesService) UpdateMilestone(pid interface{}, milestone int, opt // // GitLab API docs: // https://docs.gitlab.com/ce/api/milestones.html#delete-project-milestone -func (s *MilestonesService) DeleteMilestone(pid interface{}, milestone int, options ...OptionFunc) (*Response, error) { +func (s *MilestonesService) DeleteMilestone(pid interface{}, milestone int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -212,7 +212,7 @@ type GetMilestoneIssuesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/milestones.html#get-all-issues-assigned-to-a-single-milestone -func (s *MilestonesService) GetMilestoneIssues(pid interface{}, milestone int, opt *GetMilestoneIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) { +func (s *MilestonesService) GetMilestoneIssues(pid interface{}, milestone int, opt *GetMilestoneIssuesOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -245,7 +245,7 @@ type GetMilestoneMergeRequestsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/milestones.html#get-all-merge-requests-assigned-to-a-single-milestone -func (s *MilestonesService) GetMilestoneMergeRequests(pid interface{}, milestone int, opt *GetMilestoneMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *MilestonesService) GetMilestoneMergeRequests(pid interface{}, milestone int, opt *GetMilestoneMergeRequestsOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/namespaces.go b/vendor/github.com/xanzy/go-gitlab/namespaces.go index 9add6449b1..4e928804d7 100644 --- a/vendor/github.com/xanzy/go-gitlab/namespaces.go +++ b/vendor/github.com/xanzy/go-gitlab/namespaces.go @@ -56,7 +56,7 @@ type ListNamespacesOptions struct { // ListNamespaces gets a list of projects accessible by the authenticated user. // // GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces -func (s *NamespacesService) ListNamespaces(opt *ListNamespacesOptions, options ...OptionFunc) ([]*Namespace, *Response, error) { +func (s *NamespacesService) ListNamespaces(opt *ListNamespacesOptions, options ...RequestOptionFunc) ([]*Namespace, *Response, error) { req, err := s.client.NewRequest("GET", "namespaces", opt, options) if err != nil { return nil, nil, err @@ -76,7 +76,7 @@ func (s *NamespacesService) ListNamespaces(opt *ListNamespacesOptions, options . // // GitLab API docs: // https://docs.gitlab.com/ce/api/namespaces.html#search-for-namespace -func (s *NamespacesService) SearchNamespace(query string, options ...OptionFunc) ([]*Namespace, *Response, error) { +func (s *NamespacesService) SearchNamespace(query string, options ...RequestOptionFunc) ([]*Namespace, *Response, error) { var q struct { Search string `url:"search,omitempty" json:"search,omitempty"` } @@ -100,7 +100,7 @@ func (s *NamespacesService) SearchNamespace(query string, options ...OptionFunc) // // GitLab API docs: // https://docs.gitlab.com/ce/api/namespaces.html#get-namespace-by-id -func (s *NamespacesService) GetNamespace(id interface{}, options ...OptionFunc) (*Namespace, *Response, error) { +func (s *NamespacesService) GetNamespace(id interface{}, options ...RequestOptionFunc) (*Namespace, *Response, error) { namespace, err := parseID(id) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/notes.go b/vendor/github.com/xanzy/go-gitlab/notes.go index 91ecf450e8..b8d599e4cd 100644 --- a/vendor/github.com/xanzy/go-gitlab/notes.go +++ b/vendor/github.com/xanzy/go-gitlab/notes.go @@ -102,7 +102,7 @@ type ListIssueNotesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#list-project-issue-notes -func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssueNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) { +func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssueNotesOptions, options ...RequestOptionFunc) ([]*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -127,7 +127,7 @@ func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssue // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#get-single-issue-note -func (s *NotesService) GetIssueNote(pid interface{}, issue, note int, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) GetIssueNote(pid interface{}, issue, note int, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -162,7 +162,7 @@ type CreateIssueNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#create-new-issue-note -func (s *NotesService) CreateIssueNote(pid interface{}, issue int, opt *CreateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) CreateIssueNote(pid interface{}, issue int, opt *CreateIssueNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -196,7 +196,7 @@ type UpdateIssueNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#modify-existing-issue-note -func (s *NotesService) UpdateIssueNote(pid interface{}, issue, note int, opt *UpdateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) UpdateIssueNote(pid interface{}, issue, note int, opt *UpdateIssueNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -221,7 +221,7 @@ func (s *NotesService) UpdateIssueNote(pid interface{}, issue, note int, opt *Up // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#delete-an-issue-note -func (s *NotesService) DeleteIssueNote(pid interface{}, issue, note int, options ...OptionFunc) (*Response, error) { +func (s *NotesService) DeleteIssueNote(pid interface{}, issue, note int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -251,7 +251,7 @@ type ListSnippetNotesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#list-all-snippet-notes -func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, opt *ListSnippetNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) { +func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, opt *ListSnippetNotesOptions, options ...RequestOptionFunc) ([]*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -276,7 +276,7 @@ func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, opt *ListS // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#get-single-snippet-note -func (s *NotesService) GetSnippetNote(pid interface{}, snippet, note int, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) GetSnippetNote(pid interface{}, snippet, note int, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -311,7 +311,7 @@ type CreateSnippetNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#create-new-snippet-note -func (s *NotesService) CreateSnippetNote(pid interface{}, snippet int, opt *CreateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) CreateSnippetNote(pid interface{}, snippet int, opt *CreateSnippetNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -345,7 +345,7 @@ type UpdateSnippetNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#modify-existing-snippet-note -func (s *NotesService) UpdateSnippetNote(pid interface{}, snippet, note int, opt *UpdateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) UpdateSnippetNote(pid interface{}, snippet, note int, opt *UpdateSnippetNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -370,7 +370,7 @@ func (s *NotesService) UpdateSnippetNote(pid interface{}, snippet, note int, opt // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#delete-a-snippet-note -func (s *NotesService) DeleteSnippetNote(pid interface{}, snippet, note int, options ...OptionFunc) (*Response, error) { +func (s *NotesService) DeleteSnippetNote(pid interface{}, snippet, note int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -400,7 +400,7 @@ type ListMergeRequestNotesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#list-all-merge-request-notes -func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int, opt *ListMergeRequestNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) { +func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int, opt *ListMergeRequestNotesOptions, options ...RequestOptionFunc) ([]*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -425,7 +425,7 @@ func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int, // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#get-single-merge-request-note -func (s *NotesService) GetMergeRequestNote(pid interface{}, mergeRequest, note int, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) GetMergeRequestNote(pid interface{}, mergeRequest, note int, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -459,7 +459,7 @@ type CreateMergeRequestNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#create-new-merge-request-note -func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int, opt *CreateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int, opt *CreateMergeRequestNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -493,7 +493,7 @@ type UpdateMergeRequestNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note -func (s *NotesService) UpdateMergeRequestNote(pid interface{}, mergeRequest, note int, opt *UpdateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) UpdateMergeRequestNote(pid interface{}, mergeRequest, note int, opt *UpdateMergeRequestNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -518,7 +518,7 @@ func (s *NotesService) UpdateMergeRequestNote(pid interface{}, mergeRequest, not // // GitLab API docs: // https://docs.gitlab.com/ce/api/notes.html#delete-a-merge-request-note -func (s *NotesService) DeleteMergeRequestNote(pid interface{}, mergeRequest, note int, options ...OptionFunc) (*Response, error) { +func (s *NotesService) DeleteMergeRequestNote(pid interface{}, mergeRequest, note int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -548,7 +548,7 @@ type ListEpicNotesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/notes.html#list-all-epic-notes -func (s *NotesService) ListEpicNotes(gid interface{}, epic int, opt *ListEpicNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) { +func (s *NotesService) ListEpicNotes(gid interface{}, epic int, opt *ListEpicNotesOptions, options ...RequestOptionFunc) ([]*Note, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -573,7 +573,7 @@ func (s *NotesService) ListEpicNotes(gid interface{}, epic int, opt *ListEpicNot // // GitLab API docs: // https://docs.gitlab.com/ee/api/notes.html#get-single-epic-note -func (s *NotesService) GetEpicNote(gid interface{}, epic, note int, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) GetEpicNote(gid interface{}, epic, note int, options ...RequestOptionFunc) (*Note, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -606,7 +606,7 @@ type CreateEpicNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/notes.html#create-new-epic-note -func (s *NotesService) CreateEpicNote(gid interface{}, epic int, opt *CreateEpicNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) CreateEpicNote(gid interface{}, epic int, opt *CreateEpicNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -638,7 +638,7 @@ type UpdateEpicNoteOptions struct { // UpdateEpicNote modifies existing note of an epic. // // https://docs.gitlab.com/ee/api/notes.html#modify-existing-epic-note -func (s *NotesService) UpdateEpicNote(gid interface{}, epic, note int, opt *UpdateEpicNoteOptions, options ...OptionFunc) (*Note, *Response, error) { +func (s *NotesService) UpdateEpicNote(gid interface{}, epic, note int, opt *UpdateEpicNoteOptions, options ...RequestOptionFunc) (*Note, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -662,7 +662,7 @@ func (s *NotesService) UpdateEpicNote(gid interface{}, epic, note int, opt *Upda // DeleteEpicNote deletes an existing note of a merge request. // // https://docs.gitlab.com/ee/api/notes.html#delete-an-epic-note -func (s *NotesService) DeleteEpicNote(gid interface{}, epic, note int, options ...OptionFunc) (*Response, error) { +func (s *NotesService) DeleteEpicNote(gid interface{}, epic, note int, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/notifications.go b/vendor/github.com/xanzy/go-gitlab/notifications.go index c044831b93..70c8cb75b4 100644 --- a/vendor/github.com/xanzy/go-gitlab/notifications.go +++ b/vendor/github.com/xanzy/go-gitlab/notifications.go @@ -50,7 +50,7 @@ func (ns NotificationSettings) String() string { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notification_settings.html#global-notification-settings -func (s *NotificationSettingsService) GetGlobalSettings(options ...OptionFunc) (*NotificationSettings, *Response, error) { +func (s *NotificationSettingsService) GetGlobalSettings(options ...RequestOptionFunc) (*NotificationSettings, *Response, error) { u := "notification_settings" req, err := s.client.NewRequest("GET", u, nil, options) @@ -90,7 +90,7 @@ type NotificationSettingsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/notification_settings.html#update-global-notification-settings -func (s *NotificationSettingsService) UpdateGlobalSettings(opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) { +func (s *NotificationSettingsService) UpdateGlobalSettings(opt *NotificationSettingsOptions, options ...RequestOptionFunc) (*NotificationSettings, *Response, error) { if opt.Level != nil && *opt.Level == GlobalNotificationLevel { return nil, nil, errors.New( "notification level 'global' is not valid for global notification settings") @@ -116,7 +116,7 @@ func (s *NotificationSettingsService) UpdateGlobalSettings(opt *NotificationSett // // GitLab API docs: // https://docs.gitlab.com/ce/api/notification_settings.html#group-project-level-notification-settings -func (s *NotificationSettingsService) GetSettingsForGroup(gid interface{}, options ...OptionFunc) (*NotificationSettings, *Response, error) { +func (s *NotificationSettingsService) GetSettingsForGroup(gid interface{}, options ...RequestOptionFunc) (*NotificationSettings, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -141,7 +141,7 @@ func (s *NotificationSettingsService) GetSettingsForGroup(gid interface{}, optio // // GitLab API docs: // https://docs.gitlab.com/ce/api/notification_settings.html#group-project-level-notification-settings -func (s *NotificationSettingsService) GetSettingsForProject(pid interface{}, options ...OptionFunc) (*NotificationSettings, *Response, error) { +func (s *NotificationSettingsService) GetSettingsForProject(pid interface{}, options ...RequestOptionFunc) (*NotificationSettings, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -166,7 +166,7 @@ func (s *NotificationSettingsService) GetSettingsForProject(pid interface{}, opt // // GitLab API docs: // https://docs.gitlab.com/ce/api/notification_settings.html#update-group-project-level-notification-settings -func (s *NotificationSettingsService) UpdateSettingsForGroup(gid interface{}, opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) { +func (s *NotificationSettingsService) UpdateSettingsForGroup(gid interface{}, opt *NotificationSettingsOptions, options ...RequestOptionFunc) (*NotificationSettings, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -191,7 +191,7 @@ func (s *NotificationSettingsService) UpdateSettingsForGroup(gid interface{}, op // // GitLab API docs: // https://docs.gitlab.com/ce/api/notification_settings.html#update-group-project-level-notification-settings -func (s *NotificationSettingsService) UpdateSettingsForProject(pid interface{}, opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) { +func (s *NotificationSettingsService) UpdateSettingsForProject(pid interface{}, opt *NotificationSettingsOptions, options ...RequestOptionFunc) (*NotificationSettings, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/pages_domains.go b/vendor/github.com/xanzy/go-gitlab/pages_domains.go index da8f51497d..fea9910c87 100644 --- a/vendor/github.com/xanzy/go-gitlab/pages_domains.go +++ b/vendor/github.com/xanzy/go-gitlab/pages_domains.go @@ -18,6 +18,7 @@ type PagesDomainsService struct { // GitLab API docs: https://docs.gitlab.com/ce/api/pages_domains.html type PagesDomain struct { Domain string `json:"domain"` + AutoSslEnabled bool `json:"auto_ssl_enabled"` URL string `json:"url"` ProjectID int `json:"project_id"` Verified bool `json:"verified"` @@ -39,7 +40,7 @@ type ListPagesDomainsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/pages_domains.html#list-pages-domains -func (s *PagesDomainsService) ListPagesDomains(pid interface{}, opt *ListPagesDomainsOptions, options ...OptionFunc) ([]*PagesDomain, *Response, error) { +func (s *PagesDomainsService) ListPagesDomains(pid interface{}, opt *ListPagesDomainsOptions, options ...RequestOptionFunc) ([]*PagesDomain, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -64,7 +65,7 @@ func (s *PagesDomainsService) ListPagesDomains(pid interface{}, opt *ListPagesDo // // GitLab API docs: // https://docs.gitlab.com/ce/api/pages_domains.html#list-all-pages-domains -func (s *PagesDomainsService) ListAllPagesDomains(options ...OptionFunc) ([]*PagesDomain, *Response, error) { +func (s *PagesDomainsService) ListAllPagesDomains(options ...RequestOptionFunc) ([]*PagesDomain, *Response, error) { req, err := s.client.NewRequest("GET", "pages/domains", nil, options) if err != nil { return nil, nil, err @@ -83,7 +84,7 @@ func (s *PagesDomainsService) ListAllPagesDomains(options ...OptionFunc) ([]*Pag // // GitLab API docs: // https://docs.gitlab.com/ce/api/pages_domains.html#single-pages-domain -func (s *PagesDomainsService) GetPagesDomain(pid interface{}, domain string, options ...OptionFunc) (*PagesDomain, *Response, error) { +func (s *PagesDomainsService) GetPagesDomain(pid interface{}, domain string, options ...RequestOptionFunc) (*PagesDomain, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -107,18 +108,19 @@ func (s *PagesDomainsService) GetPagesDomain(pid interface{}, domain string, opt // CreatePagesDomainOptions represents the available CreatePagesDomain() options. // // GitLab API docs: -// // https://docs.gitlab.com/ce/api/pages_domains.html#create-new-pages-domain +// https://docs.gitlab.com/ce/api/pages_domains.html#create-new-pages-domain type CreatePagesDomainOptions struct { - Domain *string `url:"domain,omitempty" json:"domain,omitempty"` - Certificate *string `url:"certifiate,omitempty" json:"certifiate,omitempty"` - Key *string `url:"key,omitempty" json:"key,omitempty"` + Domain *string `url:"domain,omitempty" json:"domain,omitempty"` + AutoSslEnabled *bool `url:"auto_ssl_enabled,omitempty" json:"auto_ssl_enabled,omitempty"` + Certificate *string `url:"certifiate,omitempty" json:"certifiate,omitempty"` + Key *string `url:"key,omitempty" json:"key,omitempty"` } // CreatePagesDomain creates a new project pages domain. // // GitLab API docs: // https://docs.gitlab.com/ce/api/pages_domains.html#create-new-pages-domain -func (s *PagesDomainsService) CreatePagesDomain(pid interface{}, opt *CreatePagesDomainOptions, options ...OptionFunc) (*PagesDomain, *Response, error) { +func (s *PagesDomainsService) CreatePagesDomain(pid interface{}, opt *CreatePagesDomainOptions, options ...RequestOptionFunc) (*PagesDomain, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -144,15 +146,16 @@ func (s *PagesDomainsService) CreatePagesDomain(pid interface{}, opt *CreatePage // GitLab API docs: // https://docs.gitlab.com/ce/api/pages_domains.html#update-pages-domain type UpdatePagesDomainOptions struct { - Cerificate *string `url:"certifiate" json:"certifiate"` - Key *string `url:"key" json:"key"` + AutoSslEnabled *bool `url:"auto_ssl_enabled,omitempty" json:"auto_ssl_enabled,omitempty"` + Certificate *string `url:"certifiate,omitempty" json:"certifiate,omitempty"` + Key *string `url:"key,omitempty" json:"key,omitempty"` } // UpdatePagesDomain updates an existing project pages domain. // // GitLab API docs: // https://docs.gitlab.com/ce/api/pages_domains.html#update-pages-domain -func (s *PagesDomainsService) UpdatePagesDomain(pid interface{}, domain string, opt *UpdatePagesDomainOptions, options ...OptionFunc) (*PagesDomain, *Response, error) { +func (s *PagesDomainsService) UpdatePagesDomain(pid interface{}, domain string, opt *UpdatePagesDomainOptions, options ...RequestOptionFunc) (*PagesDomain, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -177,7 +180,7 @@ func (s *PagesDomainsService) UpdatePagesDomain(pid interface{}, domain string, // // GitLab API docs: // https://docs.gitlab.com/ce/api/pages_domains.html#delete-pages-domain -func (s *PagesDomainsService) DeletePagesDomain(pid interface{}, domain string, options ...OptionFunc) (*Response, error) { +func (s *PagesDomainsService) DeletePagesDomain(pid interface{}, domain string, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go b/vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go index ebcf8297a6..b9eaa53522 100644 --- a/vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go +++ b/vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go @@ -63,7 +63,7 @@ type ListPipelineSchedulesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_schedules.html -func (s *PipelineSchedulesService) ListPipelineSchedules(pid interface{}, opt *ListPipelineSchedulesOptions, options ...OptionFunc) ([]*PipelineSchedule, *Response, error) { +func (s *PipelineSchedulesService) ListPipelineSchedules(pid interface{}, opt *ListPipelineSchedulesOptions, options ...RequestOptionFunc) ([]*PipelineSchedule, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -88,7 +88,7 @@ func (s *PipelineSchedulesService) ListPipelineSchedules(pid interface{}, opt *L // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_schedules.html -func (s *PipelineSchedulesService) GetPipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*PipelineSchedule, *Response, error) { +func (s *PipelineSchedulesService) GetPipelineSchedule(pid interface{}, schedule int, options ...RequestOptionFunc) (*PipelineSchedule, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -126,7 +126,7 @@ type CreatePipelineScheduleOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule -func (s *PipelineSchedulesService) CreatePipelineSchedule(pid interface{}, opt *CreatePipelineScheduleOptions, options ...OptionFunc) (*PipelineSchedule, *Response, error) { +func (s *PipelineSchedulesService) CreatePipelineSchedule(pid interface{}, opt *CreatePipelineScheduleOptions, options ...RequestOptionFunc) (*PipelineSchedule, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -164,7 +164,7 @@ type EditPipelineScheduleOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule -func (s *PipelineSchedulesService) EditPipelineSchedule(pid interface{}, schedule int, opt *EditPipelineScheduleOptions, options ...OptionFunc) (*PipelineSchedule, *Response, error) { +func (s *PipelineSchedulesService) EditPipelineSchedule(pid interface{}, schedule int, opt *EditPipelineScheduleOptions, options ...RequestOptionFunc) (*PipelineSchedule, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -190,7 +190,7 @@ func (s *PipelineSchedulesService) EditPipelineSchedule(pid interface{}, schedul // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_schedules.html#take-ownership-of-a-pipeline-schedule -func (s *PipelineSchedulesService) TakeOwnershipOfPipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*PipelineSchedule, *Response, error) { +func (s *PipelineSchedulesService) TakeOwnershipOfPipelineSchedule(pid interface{}, schedule int, options ...RequestOptionFunc) (*PipelineSchedule, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -215,7 +215,7 @@ func (s *PipelineSchedulesService) TakeOwnershipOfPipelineSchedule(pid interface // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_schedules.html#delete-a-pipeline-schedule -func (s *PipelineSchedulesService) DeletePipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*Response, error) { +func (s *PipelineSchedulesService) DeletePipelineSchedule(pid interface{}, schedule int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -245,7 +245,7 @@ type CreatePipelineScheduleVariableOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule -func (s *PipelineSchedulesService) CreatePipelineScheduleVariable(pid interface{}, schedule int, opt *CreatePipelineScheduleVariableOptions, options ...OptionFunc) (*PipelineVariable, *Response, error) { +func (s *PipelineSchedulesService) CreatePipelineScheduleVariable(pid interface{}, schedule int, opt *CreatePipelineScheduleVariableOptions, options ...RequestOptionFunc) (*PipelineVariable, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -280,7 +280,7 @@ type EditPipelineScheduleVariableOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule-variable -func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid interface{}, schedule int, key string, opt *EditPipelineScheduleVariableOptions, options ...OptionFunc) (*PipelineVariable, *Response, error) { +func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid interface{}, schedule int, key string, opt *EditPipelineScheduleVariableOptions, options ...RequestOptionFunc) (*PipelineVariable, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -305,7 +305,7 @@ func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid interface{}, // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_schedules.html#delete-a-pipeline-schedule-variable -func (s *PipelineSchedulesService) DeletePipelineScheduleVariable(pid interface{}, schedule int, key string, options ...OptionFunc) (*PipelineVariable, *Response, error) { +func (s *PipelineSchedulesService) DeletePipelineScheduleVariable(pid interface{}, schedule int, key string, options ...RequestOptionFunc) (*PipelineVariable, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go b/vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go index f4f83ca0de..999025aa2d 100644 --- a/vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go +++ b/vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go @@ -38,7 +38,7 @@ type ListPipelineTriggersOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_triggers.html#list-project-triggers -func (s *PipelineTriggersService) ListPipelineTriggers(pid interface{}, opt *ListPipelineTriggersOptions, options ...OptionFunc) ([]*PipelineTrigger, *Response, error) { +func (s *PipelineTriggersService) ListPipelineTriggers(pid interface{}, opt *ListPipelineTriggersOptions, options ...RequestOptionFunc) ([]*PipelineTrigger, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -63,7 +63,7 @@ func (s *PipelineTriggersService) ListPipelineTriggers(pid interface{}, opt *Lis // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_triggers.html#get-trigger-details -func (s *PipelineTriggersService) GetPipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*PipelineTrigger, *Response, error) { +func (s *PipelineTriggersService) GetPipelineTrigger(pid interface{}, trigger int, options ...RequestOptionFunc) (*PipelineTrigger, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -96,7 +96,7 @@ type AddPipelineTriggerOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_triggers.html#create-a-project-trigger -func (s *PipelineTriggersService) AddPipelineTrigger(pid interface{}, opt *AddPipelineTriggerOptions, options ...OptionFunc) (*PipelineTrigger, *Response, error) { +func (s *PipelineTriggersService) AddPipelineTrigger(pid interface{}, opt *AddPipelineTriggerOptions, options ...RequestOptionFunc) (*PipelineTrigger, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -129,7 +129,7 @@ type EditPipelineTriggerOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_triggers.html#update-a-project-trigger -func (s *PipelineTriggersService) EditPipelineTrigger(pid interface{}, trigger int, opt *EditPipelineTriggerOptions, options ...OptionFunc) (*PipelineTrigger, *Response, error) { +func (s *PipelineTriggersService) EditPipelineTrigger(pid interface{}, trigger int, opt *EditPipelineTriggerOptions, options ...RequestOptionFunc) (*PipelineTrigger, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -155,7 +155,7 @@ func (s *PipelineTriggersService) EditPipelineTrigger(pid interface{}, trigger i // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_triggers.html#take-ownership-of-a-project-trigger -func (s *PipelineTriggersService) TakeOwnershipOfPipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*PipelineTrigger, *Response, error) { +func (s *PipelineTriggersService) TakeOwnershipOfPipelineTrigger(pid interface{}, trigger int, options ...RequestOptionFunc) (*PipelineTrigger, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -180,7 +180,7 @@ func (s *PipelineTriggersService) TakeOwnershipOfPipelineTrigger(pid interface{} // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipeline_triggers.html#remove-a-project-trigger -func (s *PipelineTriggersService) DeletePipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*Response, error) { +func (s *PipelineTriggersService) DeletePipelineTrigger(pid interface{}, trigger int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -209,7 +209,7 @@ type RunPipelineTriggerOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/ci/triggers/README.html#triggering-a-pipeline -func (s *PipelineTriggersService) RunPipelineTrigger(pid interface{}, opt *RunPipelineTriggerOptions, options ...OptionFunc) (*Pipeline, *Response, error) { +func (s *PipelineTriggersService) RunPipelineTrigger(pid interface{}, opt *RunPipelineTriggerOptions, options ...RequestOptionFunc) (*Pipeline, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/pipelines.go b/vendor/github.com/xanzy/go-gitlab/pipelines.go index 071e5e502a..e5b9d99ce3 100644 --- a/vendor/github.com/xanzy/go-gitlab/pipelines.go +++ b/vendor/github.com/xanzy/go-gitlab/pipelines.go @@ -101,21 +101,23 @@ func (p PipelineInfo) String() string { // GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines type ListProjectPipelinesOptions struct { ListOptions - Scope *string `url:"scope,omitempty" json:"scope,omitempty"` - Status *BuildStateValue `url:"status,omitempty" json:"status,omitempty"` - Ref *string `url:"ref,omitempty" json:"ref,omitempty"` - SHA *string `url:"sha,omitempty" json:"sha,omitempty"` - YamlErrors *bool `url:"yaml_errors,omitempty" json:"yaml_errors,omitempty"` - Name *string `url:"name,omitempty" json:"name,omitempty"` - Username *string `url:"username,omitempty" json:"username,omitempty"` - OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` - Sort *string `url:"sort,omitempty" json:"sort,omitempty"` + Scope *string `url:"scope,omitempty" json:"scope,omitempty"` + Status *BuildStateValue `url:"status,omitempty" json:"status,omitempty"` + Ref *string `url:"ref,omitempty" json:"ref,omitempty"` + SHA *string `url:"sha,omitempty" json:"sha,omitempty"` + YamlErrors *bool `url:"yaml_errors,omitempty" json:"yaml_errors,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + Username *string `url:"username,omitempty" json:"username,omitempty"` + UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"` + UpdatedBefore *time.Time `url:"update_before,omitempty" json:"updated_before,omitempty"` + OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` + Sort *string `url:"sort,omitempty" json:"sort,omitempty"` } // ListProjectPipelines gets a list of project piplines. // // GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines -func (s *PipelinesService) ListProjectPipelines(pid interface{}, opt *ListProjectPipelinesOptions, options ...OptionFunc) ([]*PipelineInfo, *Response, error) { +func (s *PipelinesService) ListProjectPipelines(pid interface{}, opt *ListProjectPipelinesOptions, options ...RequestOptionFunc) ([]*PipelineInfo, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -139,7 +141,7 @@ func (s *PipelinesService) ListProjectPipelines(pid interface{}, opt *ListProjec // GetPipeline gets a single project pipeline. // // GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#get-a-single-pipeline -func (s *PipelinesService) GetPipeline(pid interface{}, pipeline int, options ...OptionFunc) (*Pipeline, *Response, error) { +func (s *PipelinesService) GetPipeline(pid interface{}, pipeline int, options ...RequestOptionFunc) (*Pipeline, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -163,7 +165,7 @@ func (s *PipelinesService) GetPipeline(pid interface{}, pipeline int, options .. // GetPipelineVariables gets the variables of a single project pipeline. // // GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#get-variables-of-a-pipeline -func (s *PipelinesService) GetPipelineVariables(pid interface{}, pipeline int, options ...OptionFunc) ([]*PipelineVariable, *Response, error) { +func (s *PipelinesService) GetPipelineVariables(pid interface{}, pipeline int, options ...RequestOptionFunc) ([]*PipelineVariable, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -195,7 +197,7 @@ type CreatePipelineOptions struct { // CreatePipeline creates a new project pipeline. // // GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#create-a-new-pipeline -func (s *PipelinesService) CreatePipeline(pid interface{}, opt *CreatePipelineOptions, options ...OptionFunc) (*Pipeline, *Response, error) { +func (s *PipelinesService) CreatePipeline(pid interface{}, opt *CreatePipelineOptions, options ...RequestOptionFunc) (*Pipeline, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -220,7 +222,7 @@ func (s *PipelinesService) CreatePipeline(pid interface{}, opt *CreatePipelineOp // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipelines.html#retry-failed-builds-in-a-pipeline -func (s *PipelinesService) RetryPipelineBuild(pid interface{}, pipeline int, options ...OptionFunc) (*Pipeline, *Response, error) { +func (s *PipelinesService) RetryPipelineBuild(pid interface{}, pipeline int, options ...RequestOptionFunc) (*Pipeline, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -245,7 +247,7 @@ func (s *PipelinesService) RetryPipelineBuild(pid interface{}, pipeline int, opt // // GitLab API docs: //https://docs.gitlab.com/ce/api/pipelines.html#cancel-a-pipelines-builds -func (s *PipelinesService) CancelPipelineBuild(pid interface{}, pipeline int, options ...OptionFunc) (*Pipeline, *Response, error) { +func (s *PipelinesService) CancelPipelineBuild(pid interface{}, pipeline int, options ...RequestOptionFunc) (*Pipeline, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -270,7 +272,7 @@ func (s *PipelinesService) CancelPipelineBuild(pid interface{}, pipeline int, op // // GitLab API docs: // https://docs.gitlab.com/ce/api/pipelines.html#delete-a-pipeline -func (s *PipelinesService) DeletePipeline(pid interface{}, pipeline int, options ...OptionFunc) (*Response, error) { +func (s *PipelinesService) DeletePipeline(pid interface{}, pipeline int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/project_badges.go b/vendor/github.com/xanzy/go-gitlab/project_badges.go index da2dc4d4ed..1490d36945 100644 --- a/vendor/github.com/xanzy/go-gitlab/project_badges.go +++ b/vendor/github.com/xanzy/go-gitlab/project_badges.go @@ -37,7 +37,7 @@ type ListProjectBadgesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_badges.html#list-all-badges-of-a-project -func (s *ProjectBadgesService) ListProjectBadges(pid interface{}, opt *ListProjectBadgesOptions, options ...OptionFunc) ([]*ProjectBadge, *Response, error) { +func (s *ProjectBadgesService) ListProjectBadges(pid interface{}, opt *ListProjectBadgesOptions, options ...RequestOptionFunc) ([]*ProjectBadge, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -62,7 +62,7 @@ func (s *ProjectBadgesService) ListProjectBadges(pid interface{}, opt *ListProje // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_badges.html#get-a-badge-of-a-project -func (s *ProjectBadgesService) GetProjectBadge(pid interface{}, badge int, options ...OptionFunc) (*ProjectBadge, *Response, error) { +func (s *ProjectBadgesService) GetProjectBadge(pid interface{}, badge int, options ...RequestOptionFunc) (*ProjectBadge, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -96,7 +96,7 @@ type AddProjectBadgeOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_badges.html#add-a-badge-to-a-project -func (s *ProjectBadgesService) AddProjectBadge(pid interface{}, opt *AddProjectBadgeOptions, options ...OptionFunc) (*ProjectBadge, *Response, error) { +func (s *ProjectBadgesService) AddProjectBadge(pid interface{}, opt *AddProjectBadgeOptions, options ...RequestOptionFunc) (*ProjectBadge, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -130,7 +130,7 @@ type EditProjectBadgeOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_badges.html#edit-a-badge-of-a-project -func (s *ProjectBadgesService) EditProjectBadge(pid interface{}, badge int, opt *EditProjectBadgeOptions, options ...OptionFunc) (*ProjectBadge, *Response, error) { +func (s *ProjectBadgesService) EditProjectBadge(pid interface{}, badge int, opt *EditProjectBadgeOptions, options ...RequestOptionFunc) (*ProjectBadge, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -156,7 +156,7 @@ func (s *ProjectBadgesService) EditProjectBadge(pid interface{}, badge int, opt // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_badges.html#remove-a-badge-from-a-project -func (s *ProjectBadgesService) DeleteProjectBadge(pid interface{}, badge int, options ...OptionFunc) (*Response, error) { +func (s *ProjectBadgesService) DeleteProjectBadge(pid interface{}, badge int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -185,7 +185,7 @@ type ProjectBadgePreviewOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_badges.html#preview-a-badge-from-a-project -func (s *ProjectBadgesService) PreviewProjectBadge(pid interface{}, opt *ProjectBadgePreviewOptions, options ...OptionFunc) (*ProjectBadge, *Response, error) { +func (s *ProjectBadgesService) PreviewProjectBadge(pid interface{}, opt *ProjectBadgePreviewOptions, options ...RequestOptionFunc) (*ProjectBadge, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/project_clusters.go b/vendor/github.com/xanzy/go-gitlab/project_clusters.go index d2be60e2e0..d6802da0a6 100644 --- a/vendor/github.com/xanzy/go-gitlab/project_clusters.go +++ b/vendor/github.com/xanzy/go-gitlab/project_clusters.go @@ -44,6 +44,7 @@ type ProjectCluster struct { ClusterType string `json:"cluster_type"` User *User `json:"user"` PlatformKubernetes *PlatformKubernetes `json:"platform_kubernetes"` + ManagementProject *ManagementProject `json:"management_project"` Project *Project `json:"project"` } @@ -60,11 +61,22 @@ type PlatformKubernetes struct { AuthorizationType string `json:"authorization_type"` } +// ManagementProject represents a GitLab Project Cluster management_project. +type ManagementProject struct { + ID int `json:"id"` + Description string `json:"description"` + Name string `json:"name"` + NameWithNamespace string `json:"name_with_namespace"` + Path string `json:"path"` + PathWithNamespace string `json:"path_with_namespace"` + CreatedAt *time.Time `json:"created_at"` +} + // ListClusters gets a list of all clusters in a project. // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_clusters.html#list-project-clusters -func (s *ProjectClustersService) ListClusters(pid interface{}, options ...OptionFunc) ([]*ProjectCluster, *Response, error) { +func (s *ProjectClustersService) ListClusters(pid interface{}, options ...RequestOptionFunc) ([]*ProjectCluster, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -89,7 +101,7 @@ func (s *ProjectClustersService) ListClusters(pid interface{}, options ...Option // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_clusters.html#get-a-single-project-cluster -func (s *ProjectClustersService) GetCluster(pid interface{}, cluster int, options ...OptionFunc) (*ProjectCluster, *Response, error) { +func (s *ProjectClustersService) GetCluster(pid interface{}, cluster int, options ...RequestOptionFunc) (*ProjectCluster, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -115,12 +127,13 @@ func (s *ProjectClustersService) GetCluster(pid interface{}, cluster int, option // GitLab API docs: // https://docs.gitlab.com/ee/api/project_clusters.html#add-existing-cluster-to-project type AddClusterOptions struct { - Name *string `url:"name,omitempty" json:"name,omitempty"` - Domain *string `url:"domain,omitempty" json:"domain,omitempty"` - Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` - Managed *bool `url:"managed,omitempty" json:"managed,omitempty"` - EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` - PlatformKubernetes *AddPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + Domain *string `url:"domain,omitempty" json:"domain,omitempty"` + Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"` + Managed *bool `url:"managed,omitempty" json:"managed,omitempty"` + EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` + PlatformKubernetes *AddPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"` + ManagementProjectID *string `url:"management_project_id,omitempty" json:"management_project_id,omitempty"` } // AddPlatformKubernetesOptions represents the available PlatformKubernetes options for adding. @@ -136,7 +149,7 @@ type AddPlatformKubernetesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_clusters.html#add-existing-cluster-to-project -func (s *ProjectClustersService) AddCluster(pid interface{}, opt *AddClusterOptions, options ...OptionFunc) (*ProjectCluster, *Response, error) { +func (s *ProjectClustersService) AddCluster(pid interface{}, opt *AddClusterOptions, options ...RequestOptionFunc) (*ProjectCluster, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -162,10 +175,11 @@ func (s *ProjectClustersService) AddCluster(pid interface{}, opt *AddClusterOpti // GitLab API docs: // https://docs.gitlab.com/ee/api/project_clusters.html#edit-project-cluster type EditClusterOptions struct { - Name *string `url:"name,omitempty" json:"name,omitempty"` - Domain *string `url:"domain,omitempty" json:"domain,omitempty"` - EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` - PlatformKubernetes *EditPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + Domain *string `url:"domain,omitempty" json:"domain,omitempty"` + EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"` + ManagementProjectID *string `url:"management_project_id,omitempty" json:"management_project_id,omitempty"` + PlatformKubernetes *EditPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"` } // EditPlatformKubernetesOptions represents the available PlatformKubernetes options for editing. @@ -180,7 +194,7 @@ type EditPlatformKubernetesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_clusters.html#edit-project-cluster -func (s *ProjectClustersService) EditCluster(pid interface{}, cluster int, opt *EditClusterOptions, options ...OptionFunc) (*ProjectCluster, *Response, error) { +func (s *ProjectClustersService) EditCluster(pid interface{}, cluster int, opt *EditClusterOptions, options ...RequestOptionFunc) (*ProjectCluster, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -205,7 +219,7 @@ func (s *ProjectClustersService) EditCluster(pid interface{}, cluster int, opt * // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_clusters.html#delete-project-cluster -func (s *ProjectClustersService) DeleteCluster(pid interface{}, cluster int, options ...OptionFunc) (*Response, error) { +func (s *ProjectClustersService) DeleteCluster(pid interface{}, cluster int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/project_import_export.go b/vendor/github.com/xanzy/go-gitlab/project_import_export.go index 839b187b5b..f052159c83 100644 --- a/vendor/github.com/xanzy/go-gitlab/project_import_export.go +++ b/vendor/github.com/xanzy/go-gitlab/project_import_export.go @@ -74,7 +74,7 @@ type ScheduleExportOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/project_import_export.html#schedule-an-export -func (s *ProjectImportExportService) ScheduleExport(pid interface{}, opt *ScheduleExportOptions, options ...OptionFunc) (*Response, error) { +func (s *ProjectImportExportService) ScheduleExport(pid interface{}, opt *ScheduleExportOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -93,7 +93,7 @@ func (s *ProjectImportExportService) ScheduleExport(pid interface{}, opt *Schedu // // GitLab API docs: // https://docs.gitlab.com/ce/api/project_import_export.html#export-status -func (s *ProjectImportExportService) ExportStatus(pid interface{}, options ...OptionFunc) (*ExportStatus, *Response, error) { +func (s *ProjectImportExportService) ExportStatus(pid interface{}, options ...RequestOptionFunc) (*ExportStatus, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -118,7 +118,7 @@ func (s *ProjectImportExportService) ExportStatus(pid interface{}, options ...Op // // GitLab API docs: // https://docs.gitlab.com/ce/api/project_import_export.html#export-download -func (s *ProjectImportExportService) ExportDownload(pid interface{}, options ...OptionFunc) ([]byte, *Response, error) { +func (s *ProjectImportExportService) ExportDownload(pid interface{}, options ...RequestOptionFunc) ([]byte, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -155,7 +155,7 @@ type ImportFileOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/project_import_export.html#import-a-file -func (s *ProjectImportExportService) ImportFile(opt *ImportFileOptions, options ...OptionFunc) (*ImportStatus, *Response, error) { +func (s *ProjectImportExportService) ImportFile(opt *ImportFileOptions, options ...RequestOptionFunc) (*ImportStatus, *Response, error) { req, err := s.client.NewRequest("POST", "projects/import", opt, options) if err != nil { return nil, nil, err @@ -174,7 +174,7 @@ func (s *ProjectImportExportService) ImportFile(opt *ImportFileOptions, options // // GitLab API docs: // https://docs.gitlab.com/ce/api/project_import_export.html#import-status -func (s *ProjectImportExportService) ImportStatus(pid interface{}, options ...OptionFunc) (*ImportStatus, *Response, error) { +func (s *ProjectImportExportService) ImportStatus(pid interface{}, options ...RequestOptionFunc) (*ImportStatus, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/project_members.go b/vendor/github.com/xanzy/go-gitlab/project_members.go index 54a25fdcca..0b4167820e 100644 --- a/vendor/github.com/xanzy/go-gitlab/project_members.go +++ b/vendor/github.com/xanzy/go-gitlab/project_members.go @@ -44,7 +44,7 @@ type ListProjectMembersOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project -func (s *ProjectMembersService) ListProjectMembers(pid interface{}, opt *ListProjectMembersOptions, options ...OptionFunc) ([]*ProjectMember, *Response, error) { +func (s *ProjectMembersService) ListProjectMembers(pid interface{}, opt *ListProjectMembersOptions, options ...RequestOptionFunc) ([]*ProjectMember, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -71,7 +71,7 @@ func (s *ProjectMembersService) ListProjectMembers(pid interface{}, opt *ListPro // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project-including-inherited-members -func (s *ProjectMembersService) ListAllProjectMembers(pid interface{}, opt *ListProjectMembersOptions, options ...OptionFunc) ([]*ProjectMember, *Response, error) { +func (s *ProjectMembersService) ListAllProjectMembers(pid interface{}, opt *ListProjectMembersOptions, options ...RequestOptionFunc) ([]*ProjectMember, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -96,7 +96,7 @@ func (s *ProjectMembersService) ListAllProjectMembers(pid interface{}, opt *List // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project -func (s *ProjectMembersService) GetProjectMember(pid interface{}, user int, options ...OptionFunc) (*ProjectMember, *Response, error) { +func (s *ProjectMembersService) GetProjectMember(pid interface{}, user int, options ...RequestOptionFunc) (*ProjectMember, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -134,7 +134,7 @@ type AddProjectMemberOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project -func (s *ProjectMembersService) AddProjectMember(pid interface{}, opt *AddProjectMemberOptions, options ...OptionFunc) (*ProjectMember, *Response, error) { +func (s *ProjectMembersService) AddProjectMember(pid interface{}, opt *AddProjectMemberOptions, options ...RequestOptionFunc) (*ProjectMember, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -168,7 +168,7 @@ type EditProjectMemberOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project -func (s *ProjectMembersService) EditProjectMember(pid interface{}, user int, opt *EditProjectMemberOptions, options ...OptionFunc) (*ProjectMember, *Response, error) { +func (s *ProjectMembersService) EditProjectMember(pid interface{}, user int, opt *EditProjectMemberOptions, options ...RequestOptionFunc) (*ProjectMember, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -193,7 +193,7 @@ func (s *ProjectMembersService) EditProjectMember(pid interface{}, user int, opt // // GitLab API docs: // https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project -func (s *ProjectMembersService) DeleteProjectMember(pid interface{}, user int, options ...OptionFunc) (*Response, error) { +func (s *ProjectMembersService) DeleteProjectMember(pid interface{}, user int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/project_snippets.go b/vendor/github.com/xanzy/go-gitlab/project_snippets.go index 9dc254f034..59ab1452fa 100644 --- a/vendor/github.com/xanzy/go-gitlab/project_snippets.go +++ b/vendor/github.com/xanzy/go-gitlab/project_snippets.go @@ -37,7 +37,7 @@ type ListProjectSnippetsOptions ListOptions // ListSnippets gets a list of project snippets. // // GitLab API docs: https://docs.gitlab.com/ce/api/project_snippets.html#list-snippets -func (s *ProjectSnippetsService) ListSnippets(pid interface{}, opt *ListProjectSnippetsOptions, options ...OptionFunc) ([]*Snippet, *Response, error) { +func (s *ProjectSnippetsService) ListSnippets(pid interface{}, opt *ListProjectSnippetsOptions, options ...RequestOptionFunc) ([]*Snippet, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -62,7 +62,7 @@ func (s *ProjectSnippetsService) ListSnippets(pid interface{}, opt *ListProjectS // // GitLab API docs: // https://docs.gitlab.com/ce/api/project_snippets.html#single-snippet -func (s *ProjectSnippetsService) GetSnippet(pid interface{}, snippet int, options ...OptionFunc) (*Snippet, *Response, error) { +func (s *ProjectSnippetsService) GetSnippet(pid interface{}, snippet int, options ...RequestOptionFunc) (*Snippet, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -100,7 +100,7 @@ type CreateProjectSnippetOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/project_snippets.html#create-new-snippet -func (s *ProjectSnippetsService) CreateSnippet(pid interface{}, opt *CreateProjectSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) { +func (s *ProjectSnippetsService) CreateSnippet(pid interface{}, opt *CreateProjectSnippetOptions, options ...RequestOptionFunc) (*Snippet, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -138,7 +138,7 @@ type UpdateProjectSnippetOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/project_snippets.html#update-snippet -func (s *ProjectSnippetsService) UpdateSnippet(pid interface{}, snippet int, opt *UpdateProjectSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) { +func (s *ProjectSnippetsService) UpdateSnippet(pid interface{}, snippet int, opt *UpdateProjectSnippetOptions, options ...RequestOptionFunc) (*Snippet, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -165,7 +165,7 @@ func (s *ProjectSnippetsService) UpdateSnippet(pid interface{}, snippet int, opt // // GitLab API docs: // https://docs.gitlab.com/ce/api/project_snippets.html#delete-snippet -func (s *ProjectSnippetsService) DeleteSnippet(pid interface{}, snippet int, options ...OptionFunc) (*Response, error) { +func (s *ProjectSnippetsService) DeleteSnippet(pid interface{}, snippet int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -184,7 +184,7 @@ func (s *ProjectSnippetsService) DeleteSnippet(pid interface{}, snippet int, opt // // GitLab API docs: // https://docs.gitlab.com/ce/api/project_snippets.html#snippet-content -func (s *ProjectSnippetsService) SnippetContent(pid interface{}, snippet int, options ...OptionFunc) ([]byte, *Response, error) { +func (s *ProjectSnippetsService) SnippetContent(pid interface{}, snippet int, options ...RequestOptionFunc) ([]byte, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/project_variables.go b/vendor/github.com/xanzy/go-gitlab/project_variables.go index 155e3e5584..86f9d0b8ca 100644 --- a/vendor/github.com/xanzy/go-gitlab/project_variables.go +++ b/vendor/github.com/xanzy/go-gitlab/project_variables.go @@ -58,7 +58,7 @@ type ListProjectVariablesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_level_variables.html#list-project-variables -func (s *ProjectVariablesService) ListVariables(pid interface{}, opt *ListProjectVariablesOptions, options ...OptionFunc) ([]*ProjectVariable, *Response, error) { +func (s *ProjectVariablesService) ListVariables(pid interface{}, opt *ListProjectVariablesOptions, options ...RequestOptionFunc) ([]*ProjectVariable, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -83,7 +83,7 @@ func (s *ProjectVariablesService) ListVariables(pid interface{}, opt *ListProjec // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_level_variables.html#show-variable-details -func (s *ProjectVariablesService) GetVariable(pid interface{}, key string, options ...OptionFunc) (*ProjectVariable, *Response, error) { +func (s *ProjectVariablesService) GetVariable(pid interface{}, key string, options ...RequestOptionFunc) (*ProjectVariable, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -122,7 +122,7 @@ type CreateProjectVariableOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable -func (s *ProjectVariablesService) CreateVariable(pid interface{}, opt *CreateProjectVariableOptions, options ...OptionFunc) (*ProjectVariable, *Response, error) { +func (s *ProjectVariablesService) CreateVariable(pid interface{}, opt *CreateProjectVariableOptions, options ...RequestOptionFunc) (*ProjectVariable, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -160,7 +160,7 @@ type UpdateProjectVariableOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_level_variables.html#update-variable -func (s *ProjectVariablesService) UpdateVariable(pid interface{}, key string, opt *UpdateProjectVariableOptions, options ...OptionFunc) (*ProjectVariable, *Response, error) { +func (s *ProjectVariablesService) UpdateVariable(pid interface{}, key string, opt *UpdateProjectVariableOptions, options ...RequestOptionFunc) (*ProjectVariable, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -185,7 +185,7 @@ func (s *ProjectVariablesService) UpdateVariable(pid interface{}, key string, op // // GitLab API docs: // https://docs.gitlab.com/ee/api/project_level_variables.html#remove-variable -func (s *ProjectVariablesService) RemoveVariable(pid interface{}, key string, options ...OptionFunc) (*Response, error) { +func (s *ProjectVariablesService) RemoveVariable(pid interface{}, key string, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/projects.go b/vendor/github.com/xanzy/go-gitlab/projects.go index 04c3c8948a..ad454787a9 100644 --- a/vendor/github.com/xanzy/go-gitlab/projects.go +++ b/vendor/github.com/xanzy/go-gitlab/projects.go @@ -69,6 +69,7 @@ type Project struct { ImportStatus string `json:"import_status"` ImportError string `json:"import_error"` Permissions *Permissions `json:"permissions"` + MarkedForDeletionAt *ISOTime `json:"marked_for_deletion_at"` Archived bool `json:"archived"` AvatarURL string `json:"avatar_url"` SharedRunnersEnabled bool `json:"shared_runners_enabled"` @@ -78,6 +79,7 @@ type Project struct { PublicBuilds bool `json:"public_builds"` OnlyAllowMergeIfPipelineSucceeds bool `json:"only_allow_merge_if_pipeline_succeeds"` OnlyAllowMergeIfAllDiscussionsAreResolved bool `json:"only_allow_merge_if_all_discussions_are_resolved"` + RemoveSourceBranchAfterMerge bool `json:"remove_source_branch_after_merge"` LFSEnabled bool `json:"lfs_enabled"` RequestAccessEnabled bool `json:"request_access_enabled"` MergeMethod MergeMethodValue `json:"merge_method"` @@ -92,10 +94,11 @@ type Project struct { GroupName string `json:"group_name"` GroupAccessLevel int `json:"group_access_level"` } `json:"shared_with_groups"` - Statistics *ProjectStatistics `json:"statistics"` - Links *Links `json:"_links,omitempty"` - CIConfigPath *string `json:"ci_config_path"` - CustomAttributes []*CustomAttribute `json:"custom_attributes"` + Statistics *ProjectStatistics `json:"statistics"` + Links *Links `json:"_links,omitempty"` + CIConfigPath string `json:"ci_config_path"` + CIDefaultGitDepth int `json:"ci_default_git_depth"` + CustomAttributes []*CustomAttribute `json:"custom_attributes"` } // Repository represents a repository. @@ -189,14 +192,15 @@ func (s Project) String() string { // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-project-level-rules type ProjectApprovalRule struct { - ID int `json:"id"` - Name string `json:"name"` - RuleType string `json:"rule_type"` - EligibleApprovers []*BasicUser `json:"eligible_approvers"` - ApprovalsRequired int `json:"approvals_required"` - Users []*BasicUser `json:"users"` - Groups []*Group `json:"groups"` - ContainsHiddenGroups bool `json:"contains_hidden_groups"` + ID int `json:"id"` + Name string `json:"name"` + RuleType string `json:"rule_type"` + EligibleApprovers []*BasicUser `json:"eligible_approvers"` + ApprovalsRequired int `json:"approvals_required"` + Users []*BasicUser `json:"users"` + Groups []*Group `json:"groups"` + ContainsHiddenGroups bool `json:"contains_hidden_groups"` + ProtectedBranches []*ProtectedBranch `json:"protected_branches"` } func (s ProjectApprovalRule) String() string { @@ -228,7 +232,7 @@ type ListProjectsOptions struct { // ListProjects gets a list of projects accessible by the authenticated user. // // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#list-projects -func (s *ProjectsService) ListProjects(opt *ListProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) { +func (s *ProjectsService) ListProjects(opt *ListProjectsOptions, options ...RequestOptionFunc) ([]*Project, *Response, error) { req, err := s.client.NewRequest("GET", "projects", opt, options) if err != nil { return nil, nil, err @@ -247,7 +251,7 @@ func (s *ProjectsService) ListProjects(opt *ListProjectsOptions, options ...Opti // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#list-user-projects -func (s *ProjectsService) ListUserProjects(uid interface{}, opt *ListProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) { +func (s *ProjectsService) ListUserProjects(uid interface{}, opt *ListProjectsOptions, options ...RequestOptionFunc) ([]*Project, *Response, error) { user, err := parseID(uid) if err != nil { return nil, nil, err @@ -290,7 +294,7 @@ type ListProjectUserOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#get-project-users -func (s *ProjectsService) ListProjectsUsers(pid interface{}, opt *ListProjectUserOptions, options ...OptionFunc) ([]*ProjectUser, *Response, error) { +func (s *ProjectsService) ListProjectsUsers(pid interface{}, opt *ListProjectUserOptions, options ...RequestOptionFunc) ([]*ProjectUser, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -319,7 +323,7 @@ type ProjectLanguages map[string]float32 // GetProjectLanguages gets a list of languages used by the project // // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#languages -func (s *ProjectsService) GetProjectLanguages(pid interface{}, options ...OptionFunc) (*ProjectLanguages, *Response, error) { +func (s *ProjectsService) GetProjectLanguages(pid interface{}, options ...RequestOptionFunc) (*ProjectLanguages, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -354,7 +358,7 @@ type GetProjectOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#get-single-project -func (s *ProjectsService) GetProject(pid interface{}, opt *GetProjectOptions, options ...OptionFunc) (*Project, *Response, error) { +func (s *ProjectsService) GetProject(pid interface{}, opt *GetProjectOptions, options ...RequestOptionFunc) (*Project, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -415,7 +419,7 @@ type GetProjectEventsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#get-project-events -func (s *ProjectsService) GetProjectEvents(pid interface{}, opt *GetProjectEventsOptions, options ...OptionFunc) ([]*ProjectEvent, *Response, error) { +func (s *ProjectsService) GetProjectEvents(pid interface{}, opt *GetProjectEventsOptions, options ...RequestOptionFunc) ([]*ProjectEvent, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -459,10 +463,12 @@ type CreateProjectOptions struct { OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"` OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"` MergeMethod *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"` + RemoveSourceBranchAfterMerge *bool `url:"remove_source_branch_after_merge,omitempty" json:"remove_source_branch_after_merge,omitempty"` LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"` RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"` TagList *[]string `url:"tag_list,omitempty" json:"tag_list,omitempty"` PrintingMergeRequestLinkEnabled *bool `url:"printing_merge_request_link_enabled,omitempty" json:"printing_merge_request_link_enabled,omitempty"` + BuildCoverageRegex *string `url:"build_coverage_regex,omitempty" json:"build_coverage_regex,omitempty"` CIConfigPath *string `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"` ApprovalsBeforeMerge *int `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"` Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"` @@ -476,7 +482,7 @@ type CreateProjectOptions struct { // CreateProject creates a new project owned by the authenticated user. // // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#create-project -func (s *ProjectsService) CreateProject(opt *CreateProjectOptions, options ...OptionFunc) (*Project, *Response, error) { +func (s *ProjectsService) CreateProject(opt *CreateProjectOptions, options ...RequestOptionFunc) (*Project, *Response, error) { req, err := s.client.NewRequest("POST", "projects", opt, options) if err != nil { return nil, nil, err @@ -503,7 +509,7 @@ type CreateProjectForUserOptions CreateProjectOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#create-project-for-user -func (s *ProjectsService) CreateProjectForUser(user int, opt *CreateProjectForUserOptions, options ...OptionFunc) (*Project, *Response, error) { +func (s *ProjectsService) CreateProjectForUser(user int, opt *CreateProjectForUserOptions, options ...RequestOptionFunc) (*Project, *Response, error) { u := fmt.Sprintf("projects/user/%d", user) req, err := s.client.NewRequest("POST", u, opt, options) @@ -542,10 +548,13 @@ type EditProjectOptions struct { OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"` OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"` MergeMethod *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"` + RemoveSourceBranchAfterMerge *bool `url:"remove_source_branch_after_merge,omitempty" json:"remove_source_branch_after_merge,omitempty"` LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"` RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"` TagList *[]string `url:"tag_list,omitempty" json:"tag_list,omitempty"` + BuildCoverageRegex *string `url:"build_coverage_regex,omitempty" json:"build_coverage_regex,omitempty"` CIConfigPath *string `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"` + CIDefaultGitDepth *int `url:"ci_default_git_depth,omitempty" json:"ci_default_git_depth,omitempty"` ApprovalsBeforeMerge *int `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"` ExternalAuthorizationClassificationLabel *string `url:"external_authorization_classification_label,omitempty" json:"external_authorization_classification_label,omitempty"` Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"` @@ -559,7 +568,7 @@ type EditProjectOptions struct { // EditProject updates an existing project. // // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#edit-project -func (s *ProjectsService) EditProject(pid interface{}, opt *EditProjectOptions, options ...OptionFunc) (*Project, *Response, error) { +func (s *ProjectsService) EditProject(pid interface{}, opt *EditProjectOptions, options ...RequestOptionFunc) (*Project, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -593,7 +602,7 @@ type ForkProjectOptions struct { // user. // // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#fork-project -func (s *ProjectsService) ForkProject(pid interface{}, opt *ForkProjectOptions, options ...OptionFunc) (*Project, *Response, error) { +func (s *ProjectsService) ForkProject(pid interface{}, opt *ForkProjectOptions, options ...RequestOptionFunc) (*Project, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -618,7 +627,7 @@ func (s *ProjectsService) ForkProject(pid interface{}, opt *ForkProjectOptions, // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#star-a-project -func (s *ProjectsService) StarProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) { +func (s *ProjectsService) StarProject(pid interface{}, options ...RequestOptionFunc) (*Project, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -643,7 +652,7 @@ func (s *ProjectsService) StarProject(pid interface{}, options ...OptionFunc) (* // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#unstar-a-project -func (s *ProjectsService) UnstarProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) { +func (s *ProjectsService) UnstarProject(pid interface{}, options ...RequestOptionFunc) (*Project, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -669,7 +678,7 @@ func (s *ProjectsService) UnstarProject(pid interface{}, options ...OptionFunc) // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#archive-a-project -func (s *ProjectsService) ArchiveProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) { +func (s *ProjectsService) ArchiveProject(pid interface{}, options ...RequestOptionFunc) (*Project, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -695,7 +704,7 @@ func (s *ProjectsService) ArchiveProject(pid interface{}, options ...OptionFunc) // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#unarchive-a-project -func (s *ProjectsService) UnarchiveProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) { +func (s *ProjectsService) UnarchiveProject(pid interface{}, options ...RequestOptionFunc) (*Project, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -720,7 +729,7 @@ func (s *ProjectsService) UnarchiveProject(pid interface{}, options ...OptionFun // (issues, merge requests etc.) // // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#remove-project -func (s *ProjectsService) DeleteProject(pid interface{}, options ...OptionFunc) (*Response, error) { +func (s *ProjectsService) DeleteProject(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -747,7 +756,7 @@ type ShareWithGroupOptions struct { // ShareProjectWithGroup allows to share a project with a group. // // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#share-project-with-group -func (s *ProjectsService) ShareProjectWithGroup(pid interface{}, opt *ShareWithGroupOptions, options ...OptionFunc) (*Response, error) { +func (s *ProjectsService) ShareProjectWithGroup(pid interface{}, opt *ShareWithGroupOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -765,7 +774,7 @@ func (s *ProjectsService) ShareProjectWithGroup(pid interface{}, opt *ShareWithG // DeleteSharedProjectFromGroup allows to unshare a project from a group. // // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#delete-a-shared-project-link-within-a-group -func (s *ProjectsService) DeleteSharedProjectFromGroup(pid interface{}, groupID int, options ...OptionFunc) (*Response, error) { +func (s *ProjectsService) DeleteSharedProjectFromGroup(pid interface{}, groupID int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -793,6 +802,8 @@ type ProjectMember struct { CreatedAt *time.Time `json:"created_at"` ExpiresAt *ISOTime `json:"expires_at"` AccessLevel AccessLevelValue `json:"access_level"` + WebURL string `json:"web_url"` + AvatarURL string `json:"avatar_url"` } // ProjectHook represents a project hook. @@ -802,6 +813,7 @@ type ProjectMember struct { type ProjectHook struct { ID int `json:"id"` URL string `json:"url"` + ConfidentialNoteEvents bool `json:"confidential_note_events"` ProjectID int `json:"project_id"` PushEvents bool `json:"push_events"` IssuesEvents bool `json:"issues_events"` @@ -825,7 +837,7 @@ type ListProjectHooksOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#list-project-hooks -func (s *ProjectsService) ListProjectHooks(pid interface{}, opt *ListProjectHooksOptions, options ...OptionFunc) ([]*ProjectHook, *Response, error) { +func (s *ProjectsService) ListProjectHooks(pid interface{}, opt *ListProjectHooksOptions, options ...RequestOptionFunc) ([]*ProjectHook, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -850,7 +862,7 @@ func (s *ProjectsService) ListProjectHooks(pid interface{}, opt *ListProjectHook // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#get-project-hook -func (s *ProjectsService) GetProjectHook(pid interface{}, hook int, options ...OptionFunc) (*ProjectHook, *Response, error) { +func (s *ProjectsService) GetProjectHook(pid interface{}, hook int, options ...RequestOptionFunc) (*ProjectHook, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -877,6 +889,7 @@ func (s *ProjectsService) GetProjectHook(pid interface{}, hook int, options ...O // https://docs.gitlab.com/ce/api/projects.html#add-project-hook type AddProjectHookOptions struct { URL *string `url:"url,omitempty" json:"url,omitempty"` + ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` @@ -894,7 +907,7 @@ type AddProjectHookOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#add-project-hook -func (s *ProjectsService) AddProjectHook(pid interface{}, opt *AddProjectHookOptions, options ...OptionFunc) (*ProjectHook, *Response, error) { +func (s *ProjectsService) AddProjectHook(pid interface{}, opt *AddProjectHookOptions, options ...RequestOptionFunc) (*ProjectHook, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -921,6 +934,7 @@ func (s *ProjectsService) AddProjectHook(pid interface{}, opt *AddProjectHookOpt // https://docs.gitlab.com/ce/api/projects.html#edit-project-hook type EditProjectHookOptions struct { URL *string `url:"url,omitempty" json:"url,omitempty"` + ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` @@ -938,7 +952,7 @@ type EditProjectHookOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#edit-project-hook -func (s *ProjectsService) EditProjectHook(pid interface{}, hook int, opt *EditProjectHookOptions, options ...OptionFunc) (*ProjectHook, *Response, error) { +func (s *ProjectsService) EditProjectHook(pid interface{}, hook int, opt *EditProjectHookOptions, options ...RequestOptionFunc) (*ProjectHook, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -964,7 +978,7 @@ func (s *ProjectsService) EditProjectHook(pid interface{}, hook int, opt *EditPr // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#delete-project-hook -func (s *ProjectsService) DeleteProjectHook(pid interface{}, hook int, options ...OptionFunc) (*Response, error) { +func (s *ProjectsService) DeleteProjectHook(pid interface{}, hook int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -996,7 +1010,7 @@ type ProjectForkRelation struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#create-a-forked-fromto-relation-between-existing-projects. -func (s *ProjectsService) CreateProjectForkRelation(pid int, fork int, options ...OptionFunc) (*ProjectForkRelation, *Response, error) { +func (s *ProjectsService) CreateProjectForkRelation(pid int, fork int, options ...RequestOptionFunc) (*ProjectForkRelation, *Response, error) { u := fmt.Sprintf("projects/%d/fork/%d", pid, fork) req, err := s.client.NewRequest("POST", u, nil, options) @@ -1017,7 +1031,7 @@ func (s *ProjectsService) CreateProjectForkRelation(pid int, fork int, options . // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#delete-an-existing-forked-from-relationship -func (s *ProjectsService) DeleteProjectForkRelation(pid int, options ...OptionFunc) (*Response, error) { +func (s *ProjectsService) DeleteProjectForkRelation(pid int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("projects/%d/fork", pid) req, err := s.client.NewRequest("DELETE", u, nil, options) @@ -1040,7 +1054,7 @@ type ProjectFile struct { // UploadFile upload a file from disk // // GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#upload-a-file -func (s *ProjectsService) UploadFile(pid interface{}, file string, options ...OptionFunc) (*ProjectFile, *Response, error) { +func (s *ProjectsService) UploadFile(pid interface{}, file string, options ...RequestOptionFunc) (*ProjectFile, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1090,7 +1104,7 @@ func (s *ProjectsService) UploadFile(pid interface{}, file string, options ...Op // // GitLab API docs: // https://docs.gitlab.com/ce/api/projects.html#list-forks-of-a-project -func (s *ProjectsService) ListProjectForks(pid interface{}, opt *ListProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) { +func (s *ProjectsService) ListProjectForks(pid interface{}, opt *ListProjectsOptions, options ...RequestOptionFunc) ([]*Project, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1116,24 +1130,26 @@ func (s *ProjectsService) ListProjectForks(pid interface{}, opt *ListProjectsOpt // GitLab API docs: // https://docs.gitlab.com/ee/api/projects.html#push-rules type ProjectPushRules struct { - ID int `json:"id"` - ProjectID int `json:"project_id"` - CommitMessageRegex string `json:"commit_message_regex"` - BranchNameRegex string `json:"branch_name_regex"` - DenyDeleteTag bool `json:"deny_delete_tag"` - CreatedAt *time.Time `json:"created_at"` - MemberCheck bool `json:"member_check"` - PreventSecrets bool `json:"prevent_secrets"` - AuthorEmailRegex string `json:"author_email_regex"` - FileNameRegex string `json:"file_name_regex"` - MaxFileSize int `json:"max_file_size"` + ID int `json:"id"` + ProjectID int `json:"project_id"` + CommitMessageRegex string `json:"commit_message_regex"` + BranchNameRegex string `json:"branch_name_regex"` + DenyDeleteTag bool `json:"deny_delete_tag"` + CreatedAt *time.Time `json:"created_at"` + MemberCheck bool `json:"member_check"` + PreventSecrets bool `json:"prevent_secrets"` + AuthorEmailRegex string `json:"author_email_regex"` + FileNameRegex string `json:"file_name_regex"` + MaxFileSize int `json:"max_file_size"` + CommitCommitterCheck bool `json:"commit_committer_check"` + RejectUnsignedCommits bool `json:"reject_unsigned_commits"` } // GetProjectPushRules gets the push rules of a project. // // GitLab API docs: // https://docs.gitlab.com/ee/api/projects.html#get-project-push-rules -func (s *ProjectsService) GetProjectPushRules(pid interface{}, options ...OptionFunc) (*ProjectPushRules, *Response, error) { +func (s *ProjectsService) GetProjectPushRules(pid interface{}, options ...RequestOptionFunc) (*ProjectPushRules, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1174,7 +1190,7 @@ type AddProjectPushRuleOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/projects.html#add-project-push-rule -func (s *ProjectsService) AddProjectPushRule(pid interface{}, opt *AddProjectPushRuleOptions, options ...OptionFunc) (*ProjectPushRules, *Response, error) { +func (s *ProjectsService) AddProjectPushRule(pid interface{}, opt *AddProjectPushRuleOptions, options ...RequestOptionFunc) (*ProjectPushRules, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1201,21 +1217,23 @@ func (s *ProjectsService) AddProjectPushRule(pid interface{}, opt *AddProjectPus // GitLab API docs: // https://docs.gitlab.com/ee/api/projects.html#edit-project-push-rule type EditProjectPushRuleOptions struct { - AuthorEmailRegex *string `url:"author_email_regex,omitempty" json:"author_email_regex,omitempty"` - BranchNameRegex *string `url:"branch_name_regex,omitempty" json:"branch_name_regex,omitempty"` - CommitMessageRegex *string `url:"commit_message_regex,omitempty" json:"commit_message_regex,omitempty"` - FileNameRegex *string `url:"file_name_regex,omitempty" json:"file_name_regex,omitempty"` - DenyDeleteTag *bool `url:"deny_delete_tag,omitempty" json:"deny_delete_tag,omitempty"` - MemberCheck *bool `url:"member_check,omitempty" json:"member_check,omitempty"` - PreventSecrets *bool `url:"prevent_secrets,omitempty" json:"prevent_secrets,omitempty"` - MaxFileSize *int `url:"max_file_size,omitempty" json:"max_file_size,omitempty"` + AuthorEmailRegex *string `url:"author_email_regex,omitempty" json:"author_email_regex,omitempty"` + BranchNameRegex *string `url:"branch_name_regex,omitempty" json:"branch_name_regex,omitempty"` + CommitMessageRegex *string `url:"commit_message_regex,omitempty" json:"commit_message_regex,omitempty"` + FileNameRegex *string `url:"file_name_regex,omitempty" json:"file_name_regex,omitempty"` + DenyDeleteTag *bool `url:"deny_delete_tag,omitempty" json:"deny_delete_tag,omitempty"` + MemberCheck *bool `url:"member_check,omitempty" json:"member_check,omitempty"` + PreventSecrets *bool `url:"prevent_secrets,omitempty" json:"prevent_secrets,omitempty"` + MaxFileSize *int `url:"max_file_size,omitempty" json:"max_file_size,omitempty"` + CommitCommitterCheck *bool `url:"commit_committer_check,omitempty" json:"commit_committer_check,omitempty"` + RejectUnsignedCommits *bool `url:"reject_unsigned_commits,omitempty" json:"reject_unsigned_commits,omitempty"` } // EditProjectPushRule edits a push rule for a specified project. // // GitLab API docs: // https://docs.gitlab.com/ee/api/projects.html#edit-project-push-rule -func (s *ProjectsService) EditProjectPushRule(pid interface{}, opt *EditProjectPushRuleOptions, options ...OptionFunc) (*ProjectPushRules, *Response, error) { +func (s *ProjectsService) EditProjectPushRule(pid interface{}, opt *EditProjectPushRuleOptions, options ...RequestOptionFunc) (*ProjectPushRules, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1242,7 +1260,7 @@ func (s *ProjectsService) EditProjectPushRule(pid interface{}, opt *EditProjectP // // GitLab API docs: // https://docs.gitlab.com/ee/api/projects.html#delete-project-push-rule -func (s *ProjectsService) DeleteProjectPushRule(pid interface{}, options ...OptionFunc) (*Response, error) { +func (s *ProjectsService) DeleteProjectPushRule(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -1275,7 +1293,7 @@ type ProjectApprovals struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-configuration -func (s *ProjectsService) GetApprovalConfiguration(pid interface{}, options ...OptionFunc) (*ProjectApprovals, *Response, error) { +func (s *ProjectsService) GetApprovalConfiguration(pid interface{}, options ...RequestOptionFunc) (*ProjectApprovals, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1313,7 +1331,7 @@ type ChangeApprovalConfigurationOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-configuration -func (s *ProjectsService) ChangeApprovalConfiguration(pid interface{}, opt *ChangeApprovalConfigurationOptions, options ...OptionFunc) (*ProjectApprovals, *Response, error) { +func (s *ProjectsService) ChangeApprovalConfiguration(pid interface{}, opt *ChangeApprovalConfigurationOptions, options ...RequestOptionFunc) (*ProjectApprovals, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1338,7 +1356,7 @@ func (s *ProjectsService) ChangeApprovalConfiguration(pid interface{}, opt *Chan // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-project-level-rules -func (s *ProjectsService) GetProjectApprovalRules(pid interface{}, options ...OptionFunc) ([]*ProjectApprovalRule, *Response, error) { +func (s *ProjectsService) GetProjectApprovalRules(pid interface{}, options ...RequestOptionFunc) ([]*ProjectApprovalRule, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1365,17 +1383,18 @@ func (s *ProjectsService) GetProjectApprovalRules(pid interface{}, options ...Op // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#create-project-level-rules type CreateProjectLevelRuleOptions struct { - Name *string `url:"name,omitempty" json:"name,omitempty"` - ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"` - UserIDs []int `url:"user_ids,omitempty" json:"user_ids,omitempty"` - GroupIDs []int `url:"group_ids,omitempty" json:"group_ids,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"` + UserIDs []int `url:"user_ids,omitempty" json:"user_ids,omitempty"` + GroupIDs []int `url:"group_ids,omitempty" json:"group_ids,omitempty"` + ProtectedBranchIDs []int `url:"protected_branch_ids,omitempty" json:"protected_branch_ids,omitempty"` } // CreateProjectApprovalRule creates a new project-level approval rule. // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#create-project-level-rules -func (s *ProjectsService) CreateProjectApprovalRule(pid interface{}, opt *CreateProjectLevelRuleOptions, options ...OptionFunc) (*ProjectApprovalRule, *Response, error) { +func (s *ProjectsService) CreateProjectApprovalRule(pid interface{}, opt *CreateProjectLevelRuleOptions, options ...RequestOptionFunc) (*ProjectApprovalRule, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1402,17 +1421,18 @@ func (s *ProjectsService) CreateProjectApprovalRule(pid interface{}, opt *Create // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#update-project-level-rules type UpdateProjectLevelRuleOptions struct { - Name *string `url:"name,omitempty" json:"name,omitempty"` - ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"` - UserIDs []int `url:"user_ids,omitempty" json:"user_ids,omitempty"` - GroupIDs []int `url:"group_ids,omitempty" json:"group_ids,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"` + UserIDs []int `url:"user_ids,omitempty" json:"user_ids,omitempty"` + GroupIDs []int `url:"group_ids,omitempty" json:"group_ids,omitempty"` + ProtectedBranchIDs []int `url:"protected_branch_ids,omitempty" json:"protected_branch_ids,omitempty"` } // UpdateProjectApprovalRule updates an existing approval rule with new options. // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#update-project-level-rules -func (s *ProjectsService) UpdateProjectApprovalRule(pid interface{}, approvalRule int, opt *UpdateProjectLevelRuleOptions, options ...OptionFunc) (*ProjectApprovalRule, *Response, error) { +func (s *ProjectsService) UpdateProjectApprovalRule(pid interface{}, approvalRule int, opt *UpdateProjectLevelRuleOptions, options ...RequestOptionFunc) (*ProjectApprovalRule, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1437,7 +1457,7 @@ func (s *ProjectsService) UpdateProjectApprovalRule(pid interface{}, approvalRul // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#delete-project-level-rules -func (s *ProjectsService) DeleteProjectApprovalRule(pid interface{}, approvalRule int, options ...OptionFunc) (*Response, error) { +func (s *ProjectsService) DeleteProjectApprovalRule(pid interface{}, approvalRule int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -1466,7 +1486,7 @@ type ChangeAllowedApproversOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-allowed-approvers -func (s *ProjectsService) ChangeAllowedApprovers(pid interface{}, opt *ChangeAllowedApproversOptions, options ...OptionFunc) (*ProjectApprovals, *Response, error) { +func (s *ProjectsService) ChangeAllowedApprovers(pid interface{}, opt *ChangeAllowedApproversOptions, options ...RequestOptionFunc) (*ProjectApprovals, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -1491,7 +1511,7 @@ func (s *ProjectsService) ChangeAllowedApprovers(pid interface{}, opt *ChangeAll // // GitLab API docs: // https://docs.gitlab.com/ee/api/projects.html#start-the-pull-mirroring-process-for-a-project-starter -func (s *ProjectsService) StartMirroringProject(pid interface{}, options ...OptionFunc) (*Response, error) { +func (s *ProjectsService) StartMirroringProject(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -1510,3 +1530,34 @@ func (s *ProjectsService) StartMirroringProject(pid interface{}, options ...Opti return resp, err } + +// TransferProjectOptions represents the available TransferProject() options. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#transfer-a-project-to-a-new-namespace +type TransferProjectOptions struct { + Namespace interface{} `url:"namespace,omitempty" json:"namespace,omitempty"` +} + +// TransferProject transfer a project into the specified namespace +// +// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#transfer-a-project-to-a-new-namespace +func (s *ProjectsService) TransferProject(pid interface{}, opt *TransferProjectOptions, options ...RequestOptionFunc) (*Project, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/transfer", pathEscape(project)) + + req, err := s.client.NewRequest("PUT", u, opt, options) + if err != nil { + return nil, nil, err + } + + p := new(Project) + resp, err := s.client.Do(req, p) + if err != nil { + return nil, resp, err + } + + return p, resp, err +} diff --git a/vendor/github.com/xanzy/go-gitlab/protected_branches.go b/vendor/github.com/xanzy/go-gitlab/protected_branches.go index 3567f6ebd6..bc7d14cd28 100644 --- a/vendor/github.com/xanzy/go-gitlab/protected_branches.go +++ b/vendor/github.com/xanzy/go-gitlab/protected_branches.go @@ -45,9 +45,11 @@ type BranchAccessDescription struct { // GitLab API docs: // https://docs.gitlab.com/ce/api/protected_branches.html#list-protected-branches type ProtectedBranch struct { - Name string `json:"name"` - PushAccessLevels []*BranchAccessDescription `json:"push_access_levels"` - MergeAccessLevels []*BranchAccessDescription `json:"merge_access_levels"` + ID int `json:"id"` + Name string `json:"name"` + PushAccessLevels []*BranchAccessDescription `json:"push_access_levels"` + MergeAccessLevels []*BranchAccessDescription `json:"merge_access_levels"` + CodeOwnerApprovalRequired bool `json:"code_owner_approval_required"` } // ListProtectedBranchesOptions represents the available ListProtectedBranches() @@ -61,7 +63,7 @@ type ListProtectedBranchesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/protected_branches.html#list-protected-branches -func (s *ProtectedBranchesService) ListProtectedBranches(pid interface{}, opt *ListProtectedBranchesOptions, options ...OptionFunc) ([]*ProtectedBranch, *Response, error) { +func (s *ProtectedBranchesService) ListProtectedBranches(pid interface{}, opt *ListProtectedBranchesOptions, options ...RequestOptionFunc) ([]*ProtectedBranch, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -86,7 +88,7 @@ func (s *ProtectedBranchesService) ListProtectedBranches(pid interface{}, opt *L // // GitLab API docs: // https://docs.gitlab.com/ce/api/protected_branches.html#get-a-single-protected-branch-or-wildcard-protected-branch -func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch string, options ...OptionFunc) (*ProtectedBranch, *Response, error) { +func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch string, options ...RequestOptionFunc) (*ProtectedBranch, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -113,9 +115,10 @@ func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch st // GitLab API docs: // https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches type ProtectRepositoryBranchesOptions struct { - Name *string `url:"name,omitempty" json:"name,omitempty"` - PushAccessLevel *AccessLevelValue `url:"push_access_level,omitempty" json:"push_access_level,omitempty"` - MergeAccessLevel *AccessLevelValue `url:"merge_access_level,omitempty" json:"merge_access_level,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + PushAccessLevel *AccessLevelValue `url:"push_access_level,omitempty" json:"push_access_level,omitempty"` + MergeAccessLevel *AccessLevelValue `url:"merge_access_level,omitempty" json:"merge_access_level,omitempty"` + CodeOwnerApprovalRequired *bool `url:"code_owner_approval_required,omitempty" json:"code_owner_approval_required,omitempty"` } // ProtectRepositoryBranches protects a single repository branch or several @@ -123,7 +126,7 @@ type ProtectRepositoryBranchesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches -func (s *ProtectedBranchesService) ProtectRepositoryBranches(pid interface{}, opt *ProtectRepositoryBranchesOptions, options ...OptionFunc) (*ProtectedBranch, *Response, error) { +func (s *ProtectedBranchesService) ProtectRepositoryBranches(pid interface{}, opt *ProtectRepositoryBranchesOptions, options ...RequestOptionFunc) (*ProtectedBranch, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -149,7 +152,7 @@ func (s *ProtectedBranchesService) ProtectRepositoryBranches(pid interface{}, op // // GitLab API docs: // https://docs.gitlab.com/ce/api/protected_branches.html#unprotect-repository-branches -func (s *ProtectedBranchesService) UnprotectRepositoryBranches(pid interface{}, branch string, options ...OptionFunc) (*Response, error) { +func (s *ProtectedBranchesService) UnprotectRepositoryBranches(pid interface{}, branch string, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -163,3 +166,31 @@ func (s *ProtectedBranchesService) UnprotectRepositoryBranches(pid interface{}, return s.client.Do(req, nil) } + +// RequireCodeOwnerApprovalsOptions represents the available +// RequireCodeOwnerApprovals() options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/protected_branches.html#require-code-owner-approvals-for-a-single-branch +type RequireCodeOwnerApprovalsOptions struct { + CodeOwnerApprovalRequired *bool `url:"code_owner_approval_required,omitempty" json:"code_owner_approval_required,omitempty"` +} + +// RequireCodeOwnerApprovals updates the code owner approval. +// +// Gitlab API docs: +// https://docs.gitlab.com/ee/api/protected_branches.html#require-code-owner-approvals-for-a-single-branch +func (s *ProtectedBranchesService) RequireCodeOwnerApprovals(pid interface{}, branch string, opt *RequireCodeOwnerApprovalsOptions, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/protected_branches/%s", pathEscape(project), url.PathEscape(branch)) + + req, err := s.client.NewRequest("PATCH", u, opt, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} diff --git a/vendor/github.com/xanzy/go-gitlab/protected_tags.go b/vendor/github.com/xanzy/go-gitlab/protected_tags.go index f50014d2f3..10957af53d 100644 --- a/vendor/github.com/xanzy/go-gitlab/protected_tags.go +++ b/vendor/github.com/xanzy/go-gitlab/protected_tags.go @@ -42,7 +42,7 @@ type ListProtectedTagsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ee/api/protected_tags.html#list-protected-tags -func (s *ProtectedTagsService) ListProtectedTags(pid interface{}, opt *ListProtectedTagsOptions, options ...OptionFunc) ([]*ProtectedTag, *Response, error) { +func (s *ProtectedTagsService) ListProtectedTags(pid interface{}, opt *ListProtectedTagsOptions, options ...RequestOptionFunc) ([]*ProtectedTag, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -67,7 +67,7 @@ func (s *ProtectedTagsService) ListProtectedTags(pid interface{}, opt *ListProte // // GitLab API docs: // https://docs.gitlab.com/ee/api/protected_tags.html#get-a-single-protected-tag-or-wildcard-protected-tag -func (s *ProtectedTagsService) GetProtectedTag(pid interface{}, tag string, options ...OptionFunc) (*ProtectedTag, *Response, error) { +func (s *ProtectedTagsService) GetProtectedTag(pid interface{}, tag string, options ...RequestOptionFunc) (*ProtectedTag, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -103,7 +103,7 @@ type ProtectRepositoryTagsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/protected_tags.html#protect-repository-tags -func (s *ProtectedTagsService) ProtectRepositoryTags(pid interface{}, opt *ProtectRepositoryTagsOptions, options ...OptionFunc) (*ProtectedTag, *Response, error) { +func (s *ProtectedTagsService) ProtectRepositoryTags(pid interface{}, opt *ProtectRepositoryTagsOptions, options ...RequestOptionFunc) (*ProtectedTag, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -129,7 +129,7 @@ func (s *ProtectedTagsService) ProtectRepositoryTags(pid interface{}, opt *Prote // // GitLab API docs: // https://docs.gitlab.com/ee/api/protected_tags.html#unprotect-repository-tags -func (s *ProtectedTagsService) UnprotectRepositoryTags(pid interface{}, tag string, options ...OptionFunc) (*Response, error) { +func (s *ProtectedTagsService) UnprotectRepositoryTags(pid interface{}, tag string, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/registry.go b/vendor/github.com/xanzy/go-gitlab/registry.go index 41fff709fc..57f4575001 100644 --- a/vendor/github.com/xanzy/go-gitlab/registry.go +++ b/vendor/github.com/xanzy/go-gitlab/registry.go @@ -57,7 +57,7 @@ type ListRegistryRepositoriesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ee/api/container_registry.html#list-registry-repositories -func (s *ContainerRegistryService) ListRegistryRepositories(pid interface{}, opt *ListRegistryRepositoriesOptions, options ...OptionFunc) ([]*RegistryRepository, *Response, error) { +func (s *ContainerRegistryService) ListRegistryRepositories(pid interface{}, opt *ListRegistryRepositoriesOptions, options ...RequestOptionFunc) ([]*RegistryRepository, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -82,7 +82,7 @@ func (s *ContainerRegistryService) ListRegistryRepositories(pid interface{}, opt // // GitLab API docs: // https://docs.gitlab.com/ee/api/container_registry.html#delete-registry-repository -func (s *ContainerRegistryService) DeleteRegistryRepository(pid interface{}, repository int, options ...OptionFunc) (*Response, error) { +func (s *ContainerRegistryService) DeleteRegistryRepository(pid interface{}, repository int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -108,7 +108,7 @@ type ListRegistryRepositoryTagsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ee/api/container_registry.html#list-repository-tags -func (s *ContainerRegistryService) ListRegistryRepositoryTags(pid interface{}, repository int, opt *ListRegistryRepositoryTagsOptions, options ...OptionFunc) ([]*RegistryRepositoryTag, *Response, error) { +func (s *ContainerRegistryService) ListRegistryRepositoryTags(pid interface{}, repository int, opt *ListRegistryRepositoryTagsOptions, options ...RequestOptionFunc) ([]*RegistryRepositoryTag, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -136,7 +136,7 @@ func (s *ContainerRegistryService) ListRegistryRepositoryTags(pid interface{}, r // // GitLab API docs: // https://docs.gitlab.com/ee/api/container_registry.html#get-details-of-a-repository-tag -func (s *ContainerRegistryService) GetRegistryRepositoryTagDetail(pid interface{}, repository int, tagName string, options ...OptionFunc) (*RegistryRepositoryTag, *Response, error) { +func (s *ContainerRegistryService) GetRegistryRepositoryTagDetail(pid interface{}, repository int, tagName string, options ...RequestOptionFunc) (*RegistryRepositoryTag, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -165,7 +165,7 @@ func (s *ContainerRegistryService) GetRegistryRepositoryTagDetail(pid interface{ // // GitLab API docs: // https://docs.gitlab.com/ee/api/container_registry.html#delete-a-repository-tag -func (s *ContainerRegistryService) DeleteRegistryRepositoryTag(pid interface{}, repository int, tagName string, options ...OptionFunc) (*Response, error) { +func (s *ContainerRegistryService) DeleteRegistryRepositoryTag(pid interface{}, repository int, tagName string, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -200,7 +200,7 @@ type DeleteRegistryRepositoryTagsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/container_registry.html#delete-repository-tags-in-bulk -func (s *ContainerRegistryService) DeleteRegistryRepositoryTags(pid interface{}, repository int, opt *DeleteRegistryRepositoryTagsOptions, options ...OptionFunc) (*Response, error) { +func (s *ContainerRegistryService) DeleteRegistryRepositoryTags(pid interface{}, repository int, opt *DeleteRegistryRepositoryTagsOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/releaselinks.go b/vendor/github.com/xanzy/go-gitlab/releaselinks.go index b14be1f669..04daaa8686 100644 --- a/vendor/github.com/xanzy/go-gitlab/releaselinks.go +++ b/vendor/github.com/xanzy/go-gitlab/releaselinks.go @@ -30,7 +30,7 @@ type ListReleaseLinksOptions ListOptions // ListReleaseLinks gets assets as links from a Release. // // GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#get-links -func (s *ReleaseLinksService) ListReleaseLinks(pid interface{}, tagName string, opt *ListReleaseLinksOptions, options ...OptionFunc) ([]*ReleaseLink, *Response, error) { +func (s *ReleaseLinksService) ListReleaseLinks(pid interface{}, tagName string, opt *ListReleaseLinksOptions, options ...RequestOptionFunc) ([]*ReleaseLink, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -54,7 +54,7 @@ func (s *ReleaseLinksService) ListReleaseLinks(pid interface{}, tagName string, // GetReleaseLink returns a link from release assets. // // GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#get-a-link -func (s *ReleaseLinksService) GetReleaseLink(pid interface{}, tagName string, link int, options ...OptionFunc) (*ReleaseLink, *Response, error) { +func (s *ReleaseLinksService) GetReleaseLink(pid interface{}, tagName string, link int, options ...RequestOptionFunc) (*ReleaseLink, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -89,7 +89,7 @@ type CreateReleaseLinkOptions struct { // CreateReleaseLink creates a link. // // GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#create-a-link -func (s *ReleaseLinksService) CreateReleaseLink(pid interface{}, tagName string, opt *CreateReleaseLinkOptions, options ...OptionFunc) (*ReleaseLink, *Response, error) { +func (s *ReleaseLinksService) CreateReleaseLink(pid interface{}, tagName string, opt *CreateReleaseLinkOptions, options ...RequestOptionFunc) (*ReleaseLink, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -123,7 +123,7 @@ type UpdateReleaseLinkOptions struct { // UpdateReleaseLink updates an asset link. // // GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#update-a-link -func (s *ReleaseLinksService) UpdateReleaseLink(pid interface{}, tagName string, link int, opt *UpdateReleaseLinkOptions, options ...OptionFunc) (*ReleaseLink, *Response, error) { +func (s *ReleaseLinksService) UpdateReleaseLink(pid interface{}, tagName string, link int, opt *UpdateReleaseLinkOptions, options ...RequestOptionFunc) (*ReleaseLink, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -150,7 +150,7 @@ func (s *ReleaseLinksService) UpdateReleaseLink(pid interface{}, tagName string, // DeleteReleaseLink deletes a link from release. // // GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#delete-a-link -func (s *ReleaseLinksService) DeleteReleaseLink(pid interface{}, tagName string, link int, options ...OptionFunc) (*ReleaseLink, *Response, error) { +func (s *ReleaseLinksService) DeleteReleaseLink(pid interface{}, tagName string, link int, options ...RequestOptionFunc) (*ReleaseLink, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/releases.go b/vendor/github.com/xanzy/go-gitlab/releases.go index 8202e98534..39df844c80 100644 --- a/vendor/github.com/xanzy/go-gitlab/releases.go +++ b/vendor/github.com/xanzy/go-gitlab/releases.go @@ -52,7 +52,7 @@ type ListReleasesOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/releases/index.html#list-releases -func (s *ReleasesService) ListReleases(pid interface{}, opt *ListReleasesOptions, options ...OptionFunc) ([]*Release, *Response, error) { +func (s *ReleasesService) ListReleases(pid interface{}, opt *ListReleasesOptions, options ...RequestOptionFunc) ([]*Release, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -77,7 +77,7 @@ func (s *ReleasesService) ListReleases(pid interface{}, opt *ListReleasesOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/releases/index.html#get-a-release-by-a-tag-name -func (s *ReleasesService) GetRelease(pid interface{}, tagName string, options ...OptionFunc) (*Release, *Response, error) { +func (s *ReleasesService) GetRelease(pid interface{}, tagName string, options ...RequestOptionFunc) (*Release, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -131,7 +131,7 @@ type CreateReleaseOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/releases/index.html#create-a-release -func (s *ReleasesService) CreateRelease(pid interface{}, opts *CreateReleaseOptions, options ...OptionFunc) (*Release, *Response, error) { +func (s *ReleasesService) CreateRelease(pid interface{}, opts *CreateReleaseOptions, options ...RequestOptionFunc) (*Release, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -165,7 +165,7 @@ type UpdateReleaseOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/releases/index.html#update-a-release -func (s *ReleasesService) UpdateRelease(pid interface{}, tagName string, opts *UpdateReleaseOptions, options ...OptionFunc) (*Release, *Response, error) { +func (s *ReleasesService) UpdateRelease(pid interface{}, tagName string, opts *UpdateReleaseOptions, options ...RequestOptionFunc) (*Release, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -190,7 +190,7 @@ func (s *ReleasesService) UpdateRelease(pid interface{}, tagName string, opts *U // // GitLab API docs: // https://docs.gitlab.com/ce/api/releases/index.html#delete-a-release -func (s *ReleasesService) DeleteRelease(pid interface{}, tagName string, options ...OptionFunc) (*Release, *Response, error) { +func (s *ReleasesService) DeleteRelease(pid interface{}, tagName string, options ...RequestOptionFunc) (*Release, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/repositories.go b/vendor/github.com/xanzy/go-gitlab/repositories.go index 96766aea77..1c37d118eb 100644 --- a/vendor/github.com/xanzy/go-gitlab/repositories.go +++ b/vendor/github.com/xanzy/go-gitlab/repositories.go @@ -61,7 +61,7 @@ type ListTreeOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/repositories.html#list-repository-tree -func (s *RepositoriesService) ListTree(pid interface{}, opt *ListTreeOptions, options ...OptionFunc) ([]*TreeNode, *Response, error) { +func (s *RepositoriesService) ListTree(pid interface{}, opt *ListTreeOptions, options ...RequestOptionFunc) ([]*TreeNode, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -87,7 +87,7 @@ func (s *RepositoriesService) ListTree(pid interface{}, opt *ListTreeOptions, op // // GitLab API docs: // https://docs.gitlab.com/ce/api/repositories.html#get-a-blob-from-repository -func (s *RepositoriesService) Blob(pid interface{}, sha string, options ...OptionFunc) ([]byte, *Response, error) { +func (s *RepositoriesService) Blob(pid interface{}, sha string, options ...RequestOptionFunc) ([]byte, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -112,7 +112,7 @@ func (s *RepositoriesService) Blob(pid interface{}, sha string, options ...Optio // // GitLab API docs: // https://docs.gitlab.com/ce/api/repositories.html#raw-blob-content -func (s *RepositoriesService) RawBlobContent(pid interface{}, sha string, options ...OptionFunc) ([]byte, *Response, error) { +func (s *RepositoriesService) RawBlobContent(pid interface{}, sha string, options ...RequestOptionFunc) ([]byte, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -146,7 +146,7 @@ type ArchiveOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/repositories.html#get-file-archive -func (s *RepositoriesService) Archive(pid interface{}, opt *ArchiveOptions, options ...OptionFunc) ([]byte, *Response, error) { +func (s *RepositoriesService) Archive(pid interface{}, opt *ArchiveOptions, options ...RequestOptionFunc) ([]byte, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -177,7 +177,7 @@ func (s *RepositoriesService) Archive(pid interface{}, opt *ArchiveOptions, opti // // GitLab API docs: // https://docs.gitlab.com/ce/api/repositories.html#get-file-archive -func (s *RepositoriesService) StreamArchive(pid interface{}, w io.Writer, opt *ArchiveOptions, options ...OptionFunc) (*Response, error) { +func (s *RepositoriesService) StreamArchive(pid interface{}, w io.Writer, opt *ArchiveOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -227,7 +227,7 @@ type CompareOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits -func (s *RepositoriesService) Compare(pid interface{}, opt *CompareOptions, options ...OptionFunc) (*Compare, *Response, error) { +func (s *RepositoriesService) Compare(pid interface{}, opt *CompareOptions, options ...RequestOptionFunc) (*Compare, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -266,12 +266,16 @@ func (c Contributor) String() string { // ListContributorsOptions represents the available ListContributors() options. // // GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html#contributors -type ListContributorsOptions ListOptions +type ListContributorsOptions struct { + ListOptions + OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"` + Sort *string `url:"sort,omitempty" json:"sort,omitempty"` +} // Contributors gets the repository contributors list. // // GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html#contributors -func (s *RepositoriesService) Contributors(pid interface{}, opt *ListContributorsOptions, options ...OptionFunc) ([]*Contributor, *Response, error) { +func (s *RepositoriesService) Contributors(pid interface{}, opt *ListContributorsOptions, options ...RequestOptionFunc) ([]*Contributor, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -305,7 +309,7 @@ type MergeBaseOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/repositories.html#merge-base -func (s *RepositoriesService) MergeBase(pid interface{}, opt *MergeBaseOptions, options ...OptionFunc) (*Commit, *Response, error) { +func (s *RepositoriesService) MergeBase(pid interface{}, opt *MergeBaseOptions, options ...RequestOptionFunc) (*Commit, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/repository_files.go b/vendor/github.com/xanzy/go-gitlab/repository_files.go index 2614931959..7cd21d0c5b 100644 --- a/vendor/github.com/xanzy/go-gitlab/repository_files.go +++ b/vendor/github.com/xanzy/go-gitlab/repository_files.go @@ -63,7 +63,7 @@ type GetFileOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/repository_files.html#get-file-from-repository -func (s *RepositoryFilesService) GetFile(pid interface{}, fileName string, opt *GetFileOptions, options ...OptionFunc) (*File, *Response, error) { +func (s *RepositoryFilesService) GetFile(pid interface{}, fileName string, opt *GetFileOptions, options ...RequestOptionFunc) (*File, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -101,7 +101,7 @@ type GetFileMetaDataOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/repository_files.html#get-file-from-repository -func (s *RepositoryFilesService) GetFileMetaData(pid interface{}, fileName string, opt *GetFileMetaDataOptions, options ...OptionFunc) (*File, *Response, error) { +func (s *RepositoryFilesService) GetFileMetaData(pid interface{}, fileName string, opt *GetFileMetaDataOptions, options ...RequestOptionFunc) (*File, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -154,7 +154,7 @@ type GetRawFileOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/repository_files.html#get-raw-file-from-repository -func (s *RepositoryFilesService) GetRawFile(pid interface{}, fileName string, opt *GetRawFileOptions, options ...OptionFunc) ([]byte, *Response, error) { +func (s *RepositoryFilesService) GetRawFile(pid interface{}, fileName string, opt *GetRawFileOptions, options ...RequestOptionFunc) ([]byte, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -208,7 +208,7 @@ type CreateFileOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/repository_files.html#create-new-file-in-repository -func (s *RepositoryFilesService) CreateFile(pid interface{}, fileName string, opt *CreateFileOptions, options ...OptionFunc) (*FileInfo, *Response, error) { +func (s *RepositoryFilesService) CreateFile(pid interface{}, fileName string, opt *CreateFileOptions, options ...RequestOptionFunc) (*FileInfo, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -251,7 +251,7 @@ type UpdateFileOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/repository_files.html#update-existing-file-in-repository -func (s *RepositoryFilesService) UpdateFile(pid interface{}, fileName string, opt *UpdateFileOptions, options ...OptionFunc) (*FileInfo, *Response, error) { +func (s *RepositoryFilesService) UpdateFile(pid interface{}, fileName string, opt *UpdateFileOptions, options ...RequestOptionFunc) (*FileInfo, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -291,7 +291,7 @@ type DeleteFileOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/repository_files.html#delete-existing-file-in-repository -func (s *RepositoryFilesService) DeleteFile(pid interface{}, fileName string, opt *DeleteFileOptions, options ...OptionFunc) (*Response, error) { +func (s *RepositoryFilesService) DeleteFile(pid interface{}, fileName string, opt *DeleteFileOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/request_options.go b/vendor/github.com/xanzy/go-gitlab/request_options.go new file mode 100644 index 0000000000..9485aed0e2 --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/request_options.go @@ -0,0 +1,30 @@ +package gitlab + +import ( + "context" + + retryablehttp "github.com/hashicorp/go-retryablehttp" +) + +// RequestOptionFunc can be passed to all API requests to customize the API request. +type RequestOptionFunc func(*retryablehttp.Request) error + +// WithSudo takes either a username or user ID and sets the SUDO request header +func WithSudo(uid interface{}) RequestOptionFunc { + return func(req *retryablehttp.Request) error { + user, err := parseID(uid) + if err != nil { + return err + } + req.Header.Set("SUDO", user) + return nil + } +} + +// WithContext runs the request with the provided context +func WithContext(ctx context.Context) RequestOptionFunc { + return func(req *retryablehttp.Request) error { + *req = *req.WithContext(ctx) + return nil + } +} diff --git a/vendor/github.com/xanzy/go-gitlab/resource_label_events.go b/vendor/github.com/xanzy/go-gitlab/resource_label_events.go index e9ff66a346..8d290b74da 100644 --- a/vendor/github.com/xanzy/go-gitlab/resource_label_events.go +++ b/vendor/github.com/xanzy/go-gitlab/resource_label_events.go @@ -70,7 +70,7 @@ type ListLabelEventsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ee/api/resource_label_events.html#list-project-issue-label-events -func (s *ResourceLabelEventsService) ListIssueLabelEvents(pid interface{}, issue int, opt *ListLabelEventsOptions, options ...OptionFunc) ([]*LabelEvent, *Response, error) { +func (s *ResourceLabelEventsService) ListIssueLabelEvents(pid interface{}, issue int, opt *ListLabelEventsOptions, options ...RequestOptionFunc) ([]*LabelEvent, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -95,7 +95,7 @@ func (s *ResourceLabelEventsService) ListIssueLabelEvents(pid interface{}, issue // // GitLab API docs: // https://docs.gitlab.com/ee/api/resource_label_events.html#get-single-issue-label-event -func (s *ResourceLabelEventsService) GetIssueLabelEvent(pid interface{}, issue int, event int, options ...OptionFunc) (*LabelEvent, *Response, error) { +func (s *ResourceLabelEventsService) GetIssueLabelEvent(pid interface{}, issue int, event int, options ...RequestOptionFunc) (*LabelEvent, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -121,7 +121,7 @@ func (s *ResourceLabelEventsService) GetIssueLabelEvent(pid interface{}, issue i // // GitLab API docs: // https://docs.gitlab.com/ee/api/resource_label_events.html#list-group-epic-label-events -func (s *ResourceLabelEventsService) ListGroupEpicLabelEvents(gid interface{}, epic int, opt *ListLabelEventsOptions, options ...OptionFunc) ([]*LabelEvent, *Response, error) { +func (s *ResourceLabelEventsService) ListGroupEpicLabelEvents(gid interface{}, epic int, opt *ListLabelEventsOptions, options ...RequestOptionFunc) ([]*LabelEvent, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -146,7 +146,7 @@ func (s *ResourceLabelEventsService) ListGroupEpicLabelEvents(gid interface{}, e // // GitLab API docs: // https://docs.gitlab.com/ee/api/resource_label_events.html#get-single-epic-label-event -func (s *ResourceLabelEventsService) GetGroupEpicLabelEvent(gid interface{}, epic int, event int, options ...OptionFunc) (*LabelEvent, *Response, error) { +func (s *ResourceLabelEventsService) GetGroupEpicLabelEvent(gid interface{}, epic int, event int, options ...RequestOptionFunc) (*LabelEvent, *Response, error) { group, err := parseID(gid) if err != nil { return nil, nil, err @@ -172,7 +172,7 @@ func (s *ResourceLabelEventsService) GetGroupEpicLabelEvent(gid interface{}, epi // // GitLab API docs: // https://docs.gitlab.com/ee/api/resource_label_events.html#list-project-merge-request-label-events -func (s *ResourceLabelEventsService) ListMergeLabelEvents(pid interface{}, request int, opt *ListLabelEventsOptions, options ...OptionFunc) ([]*LabelEvent, *Response, error) { +func (s *ResourceLabelEventsService) ListMergeLabelEvents(pid interface{}, request int, opt *ListLabelEventsOptions, options ...RequestOptionFunc) ([]*LabelEvent, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -197,7 +197,7 @@ func (s *ResourceLabelEventsService) ListMergeLabelEvents(pid interface{}, reque // // GitLab API docs: // https://docs.gitlab.com/ee/api/resource_label_events.html#get-single-merge-request-label-event -func (s *ResourceLabelEventsService) GetMergeRequestLabelEvent(pid interface{}, request int, event int, options ...OptionFunc) (*LabelEvent, *Response, error) { +func (s *ResourceLabelEventsService) GetMergeRequestLabelEvent(pid interface{}, request int, event int, options ...RequestOptionFunc) (*LabelEvent, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/runners.go b/vendor/github.com/xanzy/go-gitlab/runners.go index d3330d44f5..775c3e11f3 100644 --- a/vendor/github.com/xanzy/go-gitlab/runners.go +++ b/vendor/github.com/xanzy/go-gitlab/runners.go @@ -70,6 +70,7 @@ type RunnerDetails struct { Revision string `json:"revision"` TagList []string `json:"tag_list"` Version string `json:"version"` + Locked bool `json:"locked"` AccessLevel string `json:"access_level"` MaximumTimeout int `json:"maximum_timeout"` Groups []struct { @@ -95,7 +96,7 @@ type ListRunnersOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#list-owned-runners -func (s *RunnersService) ListRunners(opt *ListRunnersOptions, options ...OptionFunc) ([]*Runner, *Response, error) { +func (s *RunnersService) ListRunners(opt *ListRunnersOptions, options ...RequestOptionFunc) ([]*Runner, *Response, error) { req, err := s.client.NewRequest("GET", "runners", opt, options) if err != nil { return nil, nil, err @@ -115,7 +116,7 @@ func (s *RunnersService) ListRunners(opt *ListRunnersOptions, options ...OptionF // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#list-all-runners -func (s *RunnersService) ListAllRunners(opt *ListRunnersOptions, options ...OptionFunc) ([]*Runner, *Response, error) { +func (s *RunnersService) ListAllRunners(opt *ListRunnersOptions, options ...RequestOptionFunc) ([]*Runner, *Response, error) { req, err := s.client.NewRequest("GET", "runners/all", opt, options) if err != nil { return nil, nil, err @@ -134,7 +135,7 @@ func (s *RunnersService) ListAllRunners(opt *ListRunnersOptions, options ...Opti // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#get-runner-39-s-details -func (s *RunnersService) GetRunnerDetails(rid interface{}, options ...OptionFunc) (*RunnerDetails, *Response, error) { +func (s *RunnersService) GetRunnerDetails(rid interface{}, options ...RequestOptionFunc) (*RunnerDetails, *Response, error) { runner, err := parseID(rid) if err != nil { return nil, nil, err @@ -173,7 +174,7 @@ type UpdateRunnerDetailsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#update-runner-39-s-details -func (s *RunnersService) UpdateRunnerDetails(rid interface{}, opt *UpdateRunnerDetailsOptions, options ...OptionFunc) (*RunnerDetails, *Response, error) { +func (s *RunnersService) UpdateRunnerDetails(rid interface{}, opt *UpdateRunnerDetailsOptions, options ...RequestOptionFunc) (*RunnerDetails, *Response, error) { runner, err := parseID(rid) if err != nil { return nil, nil, err @@ -198,7 +199,7 @@ func (s *RunnersService) UpdateRunnerDetails(rid interface{}, opt *UpdateRunnerD // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#remove-a-runner -func (s *RunnersService) RemoveRunner(rid interface{}, options ...OptionFunc) (*Response, error) { +func (s *RunnersService) RemoveRunner(rid interface{}, options ...RequestOptionFunc) (*Response, error) { runner, err := parseID(rid) if err != nil { return nil, err @@ -229,7 +230,7 @@ type ListRunnerJobsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#list-runner-39-s-jobs -func (s *RunnersService) ListRunnerJobs(rid interface{}, opt *ListRunnerJobsOptions, options ...OptionFunc) ([]*Job, *Response, error) { +func (s *RunnersService) ListRunnerJobs(rid interface{}, opt *ListRunnerJobsOptions, options ...RequestOptionFunc) ([]*Job, *Response, error) { runner, err := parseID(rid) if err != nil { return nil, nil, err @@ -261,7 +262,7 @@ type ListProjectRunnersOptions ListRunnersOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#list-project-s-runners -func (s *RunnersService) ListProjectRunners(pid interface{}, opt *ListProjectRunnersOptions, options ...OptionFunc) ([]*Runner, *Response, error) { +func (s *RunnersService) ListProjectRunners(pid interface{}, opt *ListProjectRunnersOptions, options ...RequestOptionFunc) ([]*Runner, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -295,7 +296,7 @@ type EnableProjectRunnerOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project -func (s *RunnersService) EnableProjectRunner(pid interface{}, opt *EnableProjectRunnerOptions, options ...OptionFunc) (*Runner, *Response, error) { +func (s *RunnersService) EnableProjectRunner(pid interface{}, opt *EnableProjectRunnerOptions, options ...RequestOptionFunc) (*Runner, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -320,7 +321,7 @@ func (s *RunnersService) EnableProjectRunner(pid interface{}, opt *EnableProject // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#disable-a-runner-from-project -func (s *RunnersService) DisableProjectRunner(pid interface{}, runner int, options ...OptionFunc) (*Response, error) { +func (s *RunnersService) DisableProjectRunner(pid interface{}, runner int, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -355,7 +356,7 @@ type RegisterNewRunnerOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#register-a-new-runner -func (s *RunnersService) RegisterNewRunner(opt *RegisterNewRunnerOptions, options ...OptionFunc) (*Runner, *Response, error) { +func (s *RunnersService) RegisterNewRunner(opt *RegisterNewRunnerOptions, options ...RequestOptionFunc) (*Runner, *Response, error) { req, err := s.client.NewRequest("POST", "runners", opt, options) if err != nil { return nil, nil, err @@ -383,7 +384,7 @@ type DeleteRegisteredRunnerOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#delete-a-registered-runner -func (s *RunnersService) DeleteRegisteredRunner(opt *DeleteRegisteredRunnerOptions, options ...OptionFunc) (*Response, error) { +func (s *RunnersService) DeleteRegisteredRunner(opt *DeleteRegisteredRunnerOptions, options ...RequestOptionFunc) (*Response, error) { req, err := s.client.NewRequest("DELETE", "runners", opt, options) if err != nil { return nil, err @@ -405,7 +406,7 @@ type VerifyRegisteredRunnerOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/runners.html#verify-authentication-for-a-registered-runner -func (s *RunnersService) VerifyRegisteredRunner(opt *VerifyRegisteredRunnerOptions, options ...OptionFunc) (*Response, error) { +func (s *RunnersService) VerifyRegisteredRunner(opt *VerifyRegisteredRunnerOptions, options ...RequestOptionFunc) (*Response, error) { req, err := s.client.NewRequest("POST", "runners/verify", opt, options) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/search.go b/vendor/github.com/xanzy/go-gitlab/search.go index de3ad36207..7ea1bf089f 100644 --- a/vendor/github.com/xanzy/go-gitlab/search.go +++ b/vendor/github.com/xanzy/go-gitlab/search.go @@ -42,7 +42,7 @@ type searchOptions struct { // Projects searches the expression within projects // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-projects -func (s *SearchService) Projects(query string, opt *SearchOptions, options ...OptionFunc) ([]*Project, *Response, error) { +func (s *SearchService) Projects(query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Project, *Response, error) { var ps []*Project resp, err := s.search("projects", query, &ps, opt, options...) return ps, resp, err @@ -52,7 +52,7 @@ func (s *SearchService) Projects(query string, opt *SearchOptions, options ...Op // the specified group // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#group-search-api -func (s *SearchService) ProjectsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Project, *Response, error) { +func (s *SearchService) ProjectsByGroup(gid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Project, *Response, error) { var ps []*Project resp, err := s.searchByGroup(gid, "projects", query, &ps, opt, options...) return ps, resp, err @@ -61,7 +61,7 @@ func (s *SearchService) ProjectsByGroup(gid interface{}, query string, opt *Sear // Issues searches the expression within issues // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-issues -func (s *SearchService) Issues(query string, opt *SearchOptions, options ...OptionFunc) ([]*Issue, *Response, error) { +func (s *SearchService) Issues(query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { var is []*Issue resp, err := s.search("issues", query, &is, opt, options...) return is, resp, err @@ -71,7 +71,7 @@ func (s *SearchService) Issues(query string, opt *SearchOptions, options ...Opti // the specified group // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-issues -func (s *SearchService) IssuesByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Issue, *Response, error) { +func (s *SearchService) IssuesByGroup(gid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { var is []*Issue resp, err := s.searchByGroup(gid, "issues", query, &is, opt, options...) return is, resp, err @@ -81,7 +81,7 @@ func (s *SearchService) IssuesByGroup(gid interface{}, query string, opt *Search // the specified project // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-issues -func (s *SearchService) IssuesByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Issue, *Response, error) { +func (s *SearchService) IssuesByProject(pid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Issue, *Response, error) { var is []*Issue resp, err := s.searchByProject(pid, "issues", query, &is, opt, options...) return is, resp, err @@ -91,7 +91,7 @@ func (s *SearchService) IssuesByProject(pid interface{}, query string, opt *Sear // // GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-merge_requests -func (s *SearchService) MergeRequests(query string, opt *SearchOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *SearchService) MergeRequests(query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { var ms []*MergeRequest resp, err := s.search("merge_requests", query, &ms, opt, options...) return ms, resp, err @@ -102,7 +102,7 @@ func (s *SearchService) MergeRequests(query string, opt *SearchOptions, options // // GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-merge_requests -func (s *SearchService) MergeRequestsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *SearchService) MergeRequestsByGroup(gid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { var ms []*MergeRequest resp, err := s.searchByGroup(gid, "merge_requests", query, &ms, opt, options...) return ms, resp, err @@ -113,7 +113,7 @@ func (s *SearchService) MergeRequestsByGroup(gid interface{}, query string, opt // // GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-merge_requests -func (s *SearchService) MergeRequestsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) { +func (s *SearchService) MergeRequestsByProject(pid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*MergeRequest, *Response, error) { var ms []*MergeRequest resp, err := s.searchByProject(pid, "merge_requests", query, &ms, opt, options...) return ms, resp, err @@ -122,7 +122,7 @@ func (s *SearchService) MergeRequestsByProject(pid interface{}, query string, op // Milestones searches the expression within milestones // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-milestones -func (s *SearchService) Milestones(query string, opt *SearchOptions, options ...OptionFunc) ([]*Milestone, *Response, error) { +func (s *SearchService) Milestones(query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Milestone, *Response, error) { var ms []*Milestone resp, err := s.search("milestones", query, &ms, opt, options...) return ms, resp, err @@ -132,7 +132,7 @@ func (s *SearchService) Milestones(query string, opt *SearchOptions, options ... // the specified group // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-milestones -func (s *SearchService) MilestonesByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Milestone, *Response, error) { +func (s *SearchService) MilestonesByGroup(gid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Milestone, *Response, error) { var ms []*Milestone resp, err := s.searchByGroup(gid, "milestones", query, &ms, opt, options...) return ms, resp, err @@ -142,7 +142,7 @@ func (s *SearchService) MilestonesByGroup(gid interface{}, query string, opt *Se // the specified project // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-milestones -func (s *SearchService) MilestonesByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Milestone, *Response, error) { +func (s *SearchService) MilestonesByProject(pid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Milestone, *Response, error) { var ms []*Milestone resp, err := s.searchByProject(pid, "milestones", query, &ms, opt, options...) return ms, resp, err @@ -152,7 +152,7 @@ func (s *SearchService) MilestonesByProject(pid interface{}, query string, opt * // // GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-snippet_titles -func (s *SearchService) SnippetTitles(query string, opt *SearchOptions, options ...OptionFunc) ([]*Snippet, *Response, error) { +func (s *SearchService) SnippetTitles(query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Snippet, *Response, error) { var ss []*Snippet resp, err := s.search("snippet_titles", query, &ss, opt, options...) return ss, resp, err @@ -162,7 +162,7 @@ func (s *SearchService) SnippetTitles(query string, opt *SearchOptions, options // // GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-snippet_blobs -func (s *SearchService) SnippetBlobs(query string, opt *SearchOptions, options ...OptionFunc) ([]*Snippet, *Response, error) { +func (s *SearchService) SnippetBlobs(query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Snippet, *Response, error) { var ss []*Snippet resp, err := s.search("snippet_blobs", query, &ss, opt, options...) return ss, resp, err @@ -172,7 +172,7 @@ func (s *SearchService) SnippetBlobs(query string, opt *SearchOptions, options . // project // // GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-notes -func (s *SearchService) NotesByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Note, *Response, error) { +func (s *SearchService) NotesByProject(pid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Note, *Response, error) { var ns []*Note resp, err := s.searchByProject(pid, "notes", query, &ns, opt, options...) return ns, resp, err @@ -182,7 +182,7 @@ func (s *SearchService) NotesByProject(pid interface{}, query string, opt *Searc // // GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-wiki_blobs -func (s *SearchService) WikiBlobs(query string, opt *SearchOptions, options ...OptionFunc) ([]*Wiki, *Response, error) { +func (s *SearchService) WikiBlobs(query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Wiki, *Response, error) { var ws []*Wiki resp, err := s.search("wiki_blobs", query, &ws, opt, options...) return ws, resp, err @@ -193,7 +193,7 @@ func (s *SearchService) WikiBlobs(query string, opt *SearchOptions, options ...O // // GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-wiki_blobs -func (s *SearchService) WikiBlobsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Wiki, *Response, error) { +func (s *SearchService) WikiBlobsByGroup(gid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Wiki, *Response, error) { var ws []*Wiki resp, err := s.searchByGroup(gid, "wiki_blobs", query, &ws, opt, options...) return ws, resp, err @@ -204,7 +204,7 @@ func (s *SearchService) WikiBlobsByGroup(gid interface{}, query string, opt *Sea // // GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-wiki_blobs -func (s *SearchService) WikiBlobsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Wiki, *Response, error) { +func (s *SearchService) WikiBlobsByProject(pid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Wiki, *Response, error) { var ws []*Wiki resp, err := s.searchByProject(pid, "wiki_blobs", query, &ws, opt, options...) return ws, resp, err @@ -213,7 +213,7 @@ func (s *SearchService) WikiBlobsByProject(pid interface{}, query string, opt *S // Commits searches the expression within all commits // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-commits -func (s *SearchService) Commits(query string, opt *SearchOptions, options ...OptionFunc) ([]*Commit, *Response, error) { +func (s *SearchService) Commits(query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Commit, *Response, error) { var cs []*Commit resp, err := s.search("commits", query, &cs, opt, options...) return cs, resp, err @@ -223,7 +223,7 @@ func (s *SearchService) Commits(query string, opt *SearchOptions, options ...Opt // group // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-commits -func (s *SearchService) CommitsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Commit, *Response, error) { +func (s *SearchService) CommitsByGroup(gid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Commit, *Response, error) { var cs []*Commit resp, err := s.searchByGroup(gid, "commits", query, &cs, opt, options...) return cs, resp, err @@ -233,7 +233,7 @@ func (s *SearchService) CommitsByGroup(gid interface{}, query string, opt *Searc // specified project // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-commits -func (s *SearchService) CommitsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Commit, *Response, error) { +func (s *SearchService) CommitsByProject(pid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Commit, *Response, error) { var cs []*Commit resp, err := s.searchByProject(pid, "commits", query, &cs, opt, options...) return cs, resp, err @@ -253,7 +253,7 @@ type Blob struct { // Blobs searches the expression within all blobs // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-blobs -func (s *SearchService) Blobs(query string, opt *SearchOptions, options ...OptionFunc) ([]*Blob, *Response, error) { +func (s *SearchService) Blobs(query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Blob, *Response, error) { var bs []*Blob resp, err := s.search("blobs", query, &bs, opt, options...) return bs, resp, err @@ -263,7 +263,7 @@ func (s *SearchService) Blobs(query string, opt *SearchOptions, options ...Optio // group // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-blobs -func (s *SearchService) BlobsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Blob, *Response, error) { +func (s *SearchService) BlobsByGroup(gid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Blob, *Response, error) { var bs []*Blob resp, err := s.searchByGroup(gid, "blobs", query, &bs, opt, options...) return bs, resp, err @@ -273,7 +273,7 @@ func (s *SearchService) BlobsByGroup(gid interface{}, query string, opt *SearchO // project // // GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-blobs -func (s *SearchService) BlobsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Blob, *Response, error) { +func (s *SearchService) BlobsByProject(pid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*Blob, *Response, error) { var bs []*Blob resp, err := s.searchByProject(pid, "blobs", query, &bs, opt, options...) return bs, resp, err @@ -282,7 +282,7 @@ func (s *SearchService) BlobsByProject(pid interface{}, query string, opt *Searc // Users searches the expression within all users // // GitLab API docs: https://docs.gitlab.com/ee/api/search.html#scope-users -func (s *SearchService) Users(query string, opt *SearchOptions, options ...OptionFunc) ([]*User, *Response, error) { +func (s *SearchService) Users(query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*User, *Response, error) { var ret []*User resp, err := s.search("users", query, &ret, opt, options...) return ret, resp, err @@ -292,7 +292,7 @@ func (s *SearchService) Users(query string, opt *SearchOptions, options ...Optio // group // // GitLab API docs: https://docs.gitlab.com/ee/api/search.html#scope-users-1 -func (s *SearchService) UsersByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*User, *Response, error) { +func (s *SearchService) UsersByGroup(gid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*User, *Response, error) { var ret []*User resp, err := s.searchByGroup(gid, "users", query, &ret, opt, options...) return ret, resp, err @@ -302,13 +302,13 @@ func (s *SearchService) UsersByGroup(gid interface{}, query string, opt *SearchO // specified project // // GitLab API docs: https://docs.gitlab.com/ee/api/search.html#scope-users-2 -func (s *SearchService) UsersByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*User, *Response, error) { +func (s *SearchService) UsersByProject(pid interface{}, query string, opt *SearchOptions, options ...RequestOptionFunc) ([]*User, *Response, error) { var ret []*User resp, err := s.searchByProject(pid, "users", query, &ret, opt, options...) return ret, resp, err } -func (s *SearchService) search(scope, query string, result interface{}, opt *SearchOptions, options ...OptionFunc) (*Response, error) { +func (s *SearchService) search(scope, query string, result interface{}, opt *SearchOptions, options ...RequestOptionFunc) (*Response, error) { opts := &searchOptions{SearchOptions: *opt, Scope: scope, Search: query} req, err := s.client.NewRequest("GET", "search", opts, options) @@ -319,7 +319,7 @@ func (s *SearchService) search(scope, query string, result interface{}, opt *Sea return s.client.Do(req, result) } -func (s *SearchService) searchByGroup(gid interface{}, scope, query string, result interface{}, opt *SearchOptions, options ...OptionFunc) (*Response, error) { +func (s *SearchService) searchByGroup(gid interface{}, scope, query string, result interface{}, opt *SearchOptions, options ...RequestOptionFunc) (*Response, error) { group, err := parseID(gid) if err != nil { return nil, err @@ -336,7 +336,7 @@ func (s *SearchService) searchByGroup(gid interface{}, scope, query string, resu return s.client.Do(req, result) } -func (s *SearchService) searchByProject(pid interface{}, scope, query string, result interface{}, opt *SearchOptions, options ...OptionFunc) (*Response, error) { +func (s *SearchService) searchByProject(pid interface{}, scope, query string, result interface{}, opt *SearchOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/services.go b/vendor/github.com/xanzy/go-gitlab/services.go index 8d16cadc26..0e649804e7 100644 --- a/vendor/github.com/xanzy/go-gitlab/services.go +++ b/vendor/github.com/xanzy/go-gitlab/services.go @@ -43,7 +43,9 @@ type Service struct { PushEvents bool `json:"push_events"` IssuesEvents bool `json:"issues_events"` ConfidentialIssuesEvents bool `json:"confidential_issues_events"` + CommitEvents bool `json:"commit_events"` MergeRequestsEvents bool `json:"merge_requests_events"` + CommentOnEventEnabled bool `json:"comment_on_event_enabled"` TagPushEvents bool `json:"tag_push_events"` NoteEvents bool `json:"note_events"` ConfidentialNoteEvents bool `json:"confidential_note_events"` @@ -52,26 +54,71 @@ type Service struct { WikiPageEvents bool `json:"wiki_page_events"` } -// SetGitLabCIServiceOptions represents the available SetGitLabCIService() +// DroneCIService represents Drone CI service settings. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#drone-ci +type DroneCIService struct { + Service + Properties *DroneCIServiceProperties `json:"properties"` +} + +// DroneCIServiceProperties represents Drone CI specific properties. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#drone-ci +type DroneCIServiceProperties struct { + Token string `json:"token"` + DroneURL string `json:"drone_url"` + EnableSSLVerification bool `json:"enable_ssl_verification"` +} + +// GetDroneCIService gets Drone CI service settings for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#get-drone-ci-service-settings +func (s *ServicesService) GetDroneCIService(pid interface{}, options ...RequestOptionFunc) (*DroneCIService, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/services/drone-ci", pathEscape(project)) + + req, err := s.client.NewRequest("GET", u, nil, options) + if err != nil { + return nil, nil, err + } + + svc := new(DroneCIService) + resp, err := s.client.Do(req, svc) + if err != nil { + return nil, resp, err + } + + return svc, resp, err +} + +// SetDroneCIServiceOptions represents the available SetDroneCIService() // options. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#edit-gitlab-ci-service -type SetGitLabCIServiceOptions struct { - Token *string `url:"token,omitempty" json:"token,omitempty"` - ProjectURL *string `url:"project_url,omitempty" json:"project_url,omitempty"` +// https://docs.gitlab.com/ce/api/services.html#createedit-drone-ci-service +type SetDroneCIServiceOptions struct { + Token *string `url:"token" json:"token" ` + DroneURL *string `url:"drone_url" json:"drone_url"` + EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"` } -// SetGitLabCIService sets GitLab CI service for a project. +// SetDroneCIService sets Drone CI service for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#edit-gitlab-ci-service -func (s *ServicesService) SetGitLabCIService(pid interface{}, opt *SetGitLabCIServiceOptions, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#createedit-drone-ci-service +func (s *ServicesService) SetDroneCIService(pid interface{}, opt *SetDroneCIServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/gitlab-ci", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/drone-ci", pathEscape(project)) req, err := s.client.NewRequest("PUT", u, opt, options) if err != nil { @@ -81,16 +128,105 @@ func (s *ServicesService) SetGitLabCIService(pid interface{}, opt *SetGitLabCISe return s.client.Do(req, nil) } -// DeleteGitLabCIService deletes GitLab CI service settings for a project. +// DeleteDroneCIService deletes Drone CI service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#delete-gitlab-ci-service -func (s *ServicesService) DeleteGitLabCIService(pid interface{}, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#delete-drone-ci-service +func (s *ServicesService) DeleteDroneCIService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/gitlab-ci", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/drone-ci", pathEscape(project)) + + req, err := s.client.NewRequest("DELETE", u, nil, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// ExternalWikiService represents External Wiki service settings. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#external-wiki +type ExternalWikiService struct { + Service + Properties *ExternalWikiServiceProperties `json:"properties"` +} + +// ExternalWikiServiceProperties represents External Wiki specific properties. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#external-wiki +type ExternalWikiServiceProperties struct { + ExternalWikiURL string `json:"external_wiki_url"` +} + +// GetExternalWikiService gets External Wiki service settings for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#get-external-wiki-service-settings +func (s *ServicesService) GetExternalWikiService(pid interface{}, options ...RequestOptionFunc) (*ExternalWikiService, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/services/external-wiki", pathEscape(project)) + + req, err := s.client.NewRequest("GET", u, nil, options) + if err != nil { + return nil, nil, err + } + + svc := new(ExternalWikiService) + resp, err := s.client.Do(req, svc) + if err != nil { + return nil, resp, err + } + + return svc, resp, err +} + +// SetExternalWikiServiceOptions represents the available SetExternalWikiService() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#createedit-external-wiki-service +type SetExternalWikiServiceOptions struct { + ExternalWikiURL *string `url:"external_wiki_url,omitempty" json:"external_wiki_url,omitempty"` +} + +// SetExternalWikiService sets External Wiki service for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#createedit-external-wiki-service +func (s *ServicesService) SetExternalWikiService(pid interface{}, opt *SetExternalWikiServiceOptions, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/services/external-wiki", pathEscape(project)) + + req, err := s.client.NewRequest("PUT", u, opt, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeleteExternalWikiService deletes External Wiki service for project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#delete-external-wiki-service +func (s *ServicesService) DeleteExternalWikiService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/services/external-wiki", pathEscape(project)) req, err := s.client.NewRequest("DELETE", u, nil, options) if err != nil { @@ -122,7 +258,7 @@ type GithubServiceProperties struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/services.html#get-github-service-settings -func (s *ServicesService) GetGithubService(pid interface{}, options ...OptionFunc) (*GithubService, *Response, error) { +func (s *ServicesService) GetGithubService(pid interface{}, options ...RequestOptionFunc) (*GithubService, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -158,7 +294,7 @@ type SetGithubServiceOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/services.html#createedit-github-service -func (s *ServicesService) SetGithubService(pid interface{}, opt *SetGithubServiceOptions, options ...OptionFunc) (*Response, error) { +func (s *ServicesService) SetGithubService(pid interface{}, opt *SetGithubServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -177,7 +313,7 @@ func (s *ServicesService) SetGithubService(pid interface{}, opt *SetGithubServic // // GitLab API docs: // https://docs.gitlab.com/ce/api/services.html#delete-github-service -func (s *ServicesService) DeleteGithubService(pid interface{}, options ...OptionFunc) (*Response, error) { +func (s *ServicesService) DeleteGithubService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -192,26 +328,26 @@ func (s *ServicesService) DeleteGithubService(pid interface{}, options ...Option return s.client.Do(req, nil) } -// SetHipChatServiceOptions represents the available SetHipChatService() +// SetGitLabCIServiceOptions represents the available SetGitLabCIService() // options. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#edit-hipchat-service -type SetHipChatServiceOptions struct { - Token *string `url:"token,omitempty" json:"token,omitempty" ` - Room *string `url:"room,omitempty" json:"room,omitempty"` +// https://docs.gitlab.com/ce/api/services.html#edit-gitlab-ci-service +type SetGitLabCIServiceOptions struct { + Token *string `url:"token,omitempty" json:"token,omitempty"` + ProjectURL *string `url:"project_url,omitempty" json:"project_url,omitempty"` } -// SetHipChatService sets HipChat service for a project +// SetGitLabCIService sets GitLab CI service for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#edit-hipchat-service -func (s *ServicesService) SetHipChatService(pid interface{}, opt *SetHipChatServiceOptions, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#edit-gitlab-ci-service +func (s *ServicesService) SetGitLabCIService(pid interface{}, opt *SetGitLabCIServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/hipchat", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/gitlab-ci", pathEscape(project)) req, err := s.client.NewRequest("PUT", u, opt, options) if err != nil { @@ -221,16 +357,16 @@ func (s *ServicesService) SetHipChatService(pid interface{}, opt *SetHipChatServ return s.client.Do(req, nil) } -// DeleteHipChatService deletes HipChat service for project. +// DeleteGitLabCIService deletes GitLab CI service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#delete-hipchat-service -func (s *ServicesService) DeleteHipChatService(pid interface{}, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#delete-gitlab-ci-service +func (s *ServicesService) DeleteGitLabCIService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/hipchat", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/gitlab-ci", pathEscape(project)) req, err := s.client.NewRequest("DELETE", u, nil, options) if err != nil { @@ -240,71 +376,26 @@ func (s *ServicesService) DeleteHipChatService(pid interface{}, options ...Optio return s.client.Do(req, nil) } -// DroneCIService represents Drone CI service settings. -// -// GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#drone-ci -type DroneCIService struct { - Service - Properties *DroneCIServiceProperties `json:"properties"` -} - -// DroneCIServiceProperties represents Drone CI specific properties. -// -// GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#drone-ci -type DroneCIServiceProperties struct { - Token string `json:"token"` - DroneURL string `json:"drone_url"` - EnableSSLVerification bool `json:"enable_ssl_verification"` -} - -// GetDroneCIService gets Drone CI service settings for a project. -// -// GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#get-drone-ci-service-settings -func (s *ServicesService) GetDroneCIService(pid interface{}, options ...OptionFunc) (*DroneCIService, *Response, error) { - project, err := parseID(pid) - if err != nil { - return nil, nil, err - } - u := fmt.Sprintf("projects/%s/services/drone-ci", pathEscape(project)) - - req, err := s.client.NewRequest("GET", u, nil, options) - if err != nil { - return nil, nil, err - } - - svc := new(DroneCIService) - resp, err := s.client.Do(req, svc) - if err != nil { - return nil, resp, err - } - - return svc, resp, err -} - -// SetDroneCIServiceOptions represents the available SetDroneCIService() +// SetHipChatServiceOptions represents the available SetHipChatService() // options. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#createedit-drone-ci-service -type SetDroneCIServiceOptions struct { - Token *string `url:"token" json:"token" ` - DroneURL *string `url:"drone_url" json:"drone_url"` - EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"` +// https://docs.gitlab.com/ce/api/services.html#edit-hipchat-service +type SetHipChatServiceOptions struct { + Token *string `url:"token,omitempty" json:"token,omitempty" ` + Room *string `url:"room,omitempty" json:"room,omitempty"` } -// SetDroneCIService sets Drone CI service for a project. +// SetHipChatService sets HipChat service for a project // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#createedit-drone-ci-service -func (s *ServicesService) SetDroneCIService(pid interface{}, opt *SetDroneCIServiceOptions, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#edit-hipchat-service +func (s *ServicesService) SetHipChatService(pid interface{}, opt *SetHipChatServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/drone-ci", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/hipchat", pathEscape(project)) req, err := s.client.NewRequest("PUT", u, opt, options) if err != nil { @@ -314,16 +405,16 @@ func (s *ServicesService) SetDroneCIService(pid interface{}, opt *SetDroneCIServ return s.client.Do(req, nil) } -// DeleteDroneCIService deletes Drone CI service settings for a project. +// DeleteHipChatService deletes HipChat service for project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#delete-drone-ci-service -func (s *ServicesService) DeleteDroneCIService(pid interface{}, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#delete-hipchat-service +func (s *ServicesService) DeleteHipChatService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/drone-ci", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/hipchat", pathEscape(project)) req, err := s.client.NewRequest("DELETE", u, nil, options) if err != nil { @@ -333,54 +424,42 @@ func (s *ServicesService) DeleteDroneCIService(pid interface{}, options ...Optio return s.client.Do(req, nil) } -// SlackService represents Slack service settings. +// JenkinsCIService represents Jenkins CI service settings. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#slack -type SlackService struct { +// https://docs.gitlab.com/ee/api/services.html#jenkins-ci +type JenkinsCIService struct { Service - Properties *SlackServiceProperties `json:"properties"` + Properties *JenkinsCIServiceProperties `json:"properties"` } -// SlackServiceProperties represents Slack specific properties. +// JenkinsCIServiceProperties represents Jenkins CI specific properties. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#slack -type SlackServiceProperties struct { - WebHook string `json:"webhook,omitempty"` - Username string `json:"username,omitempty"` - Channel string `json:"channel,omitempty"` - NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines,omitempty"` - NotifyOnlyDefaultBranch BoolValue `json:"notify_only_default_branch,omitempty"` - ConfidentialIssueChannel string `json:"confidential_issue_channel,omitempty"` - ConfidentialNoteChannel string `json:"confidential_note_channel,omitempty"` - DeploymentChannel string `json:"deployment_channel,omitempty"` - IssueChannel string `json:"issue_channel,omitempty"` - MergeRequestChannel string `json:"merge_request_channel,omitempty"` - NoteChannel string `json:"note_channel,omitempty"` - TagPushChannel string `json:"tag_push_channel,omitempty"` - PipelineChannel string `json:"pipeline_channel,omitempty"` - PushChannel string `json:"push_channel,omitempty"` - WikiPageChannel string `json:"wiki_page_channel,omitempty"` +// https://docs.gitlab.com/ee/api/services.html#jenkins-ci +type JenkinsCIServiceProperties struct { + URL string `json:"jenkins_url,omitempty"` + ProjectName string `json:"project_name,omitempty"` + Username string `json:"username,omitempty"` } -// GetSlackService gets Slack service settings for a project. +// GetJenkinsCIService gets Jenkins CI service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings -func (s *ServicesService) GetSlackService(pid interface{}, options ...OptionFunc) (*SlackService, *Response, error) { +// https://docs.gitlab.com/ee/api/services.html#get-jenkins-ci-service-settings +func (s *ServicesService) GetJenkinsCIService(pid interface{}, options ...RequestOptionFunc) (*JenkinsCIService, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err } - u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/jenkins", pathEscape(project)) req, err := s.client.NewRequest("GET", u, nil, options) if err != nil { return nil, nil, err } - svc := new(SlackService) + svc := new(JenkinsCIService) resp, err := s.client.Do(req, svc) if err != nil { return nil, resp, err @@ -389,52 +468,28 @@ func (s *ServicesService) GetSlackService(pid interface{}, options ...OptionFunc return svc, resp, err } -// SetSlackServiceOptions represents the available SetSlackService() +// SetJenkinsCIServiceOptions represents the available SetJenkinsCIService() // options. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#edit-slack-service -type SetSlackServiceOptions struct { - WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"` - Username *string `url:"username,omitempty" json:"username,omitempty"` - Channel *string `url:"channel,omitempty" json:"channel,omitempty"` - NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"` - NotifyOnlyDefaultBranch *bool `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"` - ConfidentialIssueChannel *string `url:"confidential_issue_channel,omitempty" json:"confidential_issue_channel,omitempty"` - ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` - // TODO: Currently, GitLab ignores this option (not implemented yet?), so - // there is no way to set it. Uncomment when this is fixed. - // See: https://gitlab.com/gitlab-org/gitlab-ce/issues/49730 - //ConfidentialNoteChannel *string `json:"confidential_note_channel,omitempty"` - ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` - DeploymentChannel *string `url:"deployment_channel,omitempty" json:"deployment_channel,omitempty"` - DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"` - IssueChannel *string `url:"issue_channel,omitempty" json:"issue_channel,omitempty"` - IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` - MergeRequestChannel *string `url:"merge_request_channel,omitempty" json:"merge_request_channel,omitempty"` - MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` - TagPushChannel *string `url:"tag_push_channel,omitempty" json:"tag_push_channel,omitempty"` - TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"` - NoteChannel *string `url:"note_channel,omitempty" json:"note_channel,omitempty"` - NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"` - PipelineChannel *string `url:"pipeline_channel,omitempty" json:"pipeline_channel,omitempty"` - PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` - PushChannel *string `url:"push_channel,omitempty" json:"push_channel,omitempty"` - PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` - WikiPageChannel *string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"` - WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` +// https://docs.gitlab.com/ee/api/services.html#jenkins-ci +type SetJenkinsCIServiceOptions struct { + URL *string `url:"jenkins_url,omitempty" json:"jenkins_url,omitempty"` + ProjectName *string `url:"project_name,omitempty" json:"project_name,omitempty"` + Username *string `url:"username,omitempty" json:"username,omitempty"` + Password *string `url:"password,omitempty" json:"password,omitempty"` } -// SetSlackService sets Slack service for a project +// SetJenkinsCIService sets Jenkins service for a project // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#edit-slack-service -func (s *ServicesService) SetSlackService(pid interface{}, opt *SetSlackServiceOptions, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ee/api/services.html#create-edit-jenkins-ci-service +func (s *ServicesService) SetJenkinsCIService(pid interface{}, opt *SetJenkinsCIServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/jenkins", pathEscape(project)) req, err := s.client.NewRequest("PUT", u, opt, options) if err != nil { @@ -444,16 +499,16 @@ func (s *ServicesService) SetSlackService(pid interface{}, opt *SetSlackServiceO return s.client.Do(req, nil) } -// DeleteSlackService deletes Slack service for project. +// DeleteJenkinsCIService deletes Jenkins CI service for project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#delete-slack-service -func (s *ServicesService) DeleteSlackService(pid interface{}, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#delete-jira-service +func (s *ServicesService) DeleteJenkinsCIService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/jenkins", pathEscape(project)) req, err := s.client.NewRequest("DELETE", u, nil, options) if err != nil { @@ -519,7 +574,7 @@ func (p *JiraServiceProperties) UnmarshalJSON(b []byte) error { // // GitLab API docs: // https://docs.gitlab.com/ce/api/services.html#get-jira-service-settings -func (s *ServicesService) GetJiraService(pid interface{}, options ...OptionFunc) (*JiraService, *Response, error) { +func (s *ServicesService) GetJiraService(pid interface{}, options ...RequestOptionFunc) (*JiraService, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -551,14 +606,18 @@ type SetJiraServiceOptions struct { ProjectKey *string `url:"project_key,omitempty" json:"project_key,omitempty" ` Username *string `url:"username,omitempty" json:"username,omitempty" ` Password *string `url:"password,omitempty" json:"password,omitempty" ` + Active *bool `url:"active,omitempty" json:"active,omitempty"` JiraIssueTransitionID *string `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"` + CommitEvents *bool `url:"commit_events,omitempty" json:"commit_events,omitempty"` + MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` + CommentOnEventEnabled *bool `url:"comment_on_event_enabled,omitempty" json:"comment_on_event_enabled,omitempty"` } // SetJiraService sets Jira service for a project // // GitLab API docs: // https://docs.gitlab.com/ce/api/services.html#edit-jira-service -func (s *ServicesService) SetJiraService(pid interface{}, opt *SetJiraServiceOptions, options ...OptionFunc) (*Response, error) { +func (s *ServicesService) SetJiraService(pid interface{}, opt *SetJiraServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -577,7 +636,7 @@ func (s *ServicesService) SetJiraService(pid interface{}, opt *SetJiraServiceOpt // // GitLab API docs: // https://docs.gitlab.com/ce/api/services.html#delete-jira-service -func (s *ServicesService) DeleteJiraService(pid interface{}, options ...OptionFunc) (*Response, error) { +func (s *ServicesService) DeleteJiraService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -592,42 +651,40 @@ func (s *ServicesService) DeleteJiraService(pid interface{}, options ...OptionFu return s.client.Do(req, nil) } -// JenkinsCIService represents Jenkins CI service settings. +// MicrosoftTeamsService represents Microsoft Teams service settings. // // GitLab API docs: -// https://docs.gitlab.com/ee/api/services.html#jenkins-ci -type JenkinsCIService struct { +// https://docs.gitlab.com/ce/api/services.html#microsoft-teams +type MicrosoftTeamsService struct { Service - Properties *JenkinsCIServiceProperties `json:"properties"` + Properties *MicrosoftTeamsServiceProperties `json:"properties"` } -// JenkinsCIServiceProperties represents Jenkins CI specific properties. +// MicrosoftTeamsServiceProperties represents Microsoft Teams specific properties. // // GitLab API docs: -// https://docs.gitlab.com/ee/api/services.html#jenkins-ci -type JenkinsCIServiceProperties struct { - URL string `json:"jenkins_url,omitempty"` - ProjectName string `json:"project_name,omitempty"` - Username string `json:"username,omitempty"` +// https://docs.gitlab.com/ce/api/services.html#microsoft-teams +type MicrosoftTeamsServiceProperties struct { + WebHook string `json:"webhook"` } -// GetJenkinsCIService gets Jenkins CI service settings for a project. +// GetMicrosoftTeamsService gets MicrosoftTeams service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ee/api/services.html#get-jenkins-ci-service-settings -func (s *ServicesService) GetJenkinsCIService(pid interface{}, options ...OptionFunc) (*JenkinsCIService, *Response, error) { +// https://docs.gitlab.com/ce/api/services.html#get-microsoft-teams-service-settings +func (s *ServicesService) GetMicrosoftTeamsService(pid interface{}, options ...RequestOptionFunc) (*MicrosoftTeamsService, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err } - u := fmt.Sprintf("projects/%s/services/jenkins", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/microsoft-teams", pathEscape(project)) req, err := s.client.NewRequest("GET", u, nil, options) if err != nil { return nil, nil, err } - svc := new(JenkinsCIService) + svc := new(MicrosoftTeamsService) resp, err := s.client.Do(req, svc) if err != nil { return nil, resp, err @@ -636,47 +693,139 @@ func (s *ServicesService) GetJenkinsCIService(pid interface{}, options ...Option return svc, resp, err } -// SetJenkinsCIServiceOptions represents the available SetJenkinsCIService() +// SetMicrosoftTeamsServiceOptions represents the available SetMicrosoftTeamsService() // options. // // GitLab API docs: -// https://docs.gitlab.com/ee/api/services.html#jenkins-ci -type SetJenkinsCIServiceOptions struct { - URL *string `url:"jenkins_url,omitempty" json:"jenkins_url,omitempty"` - ProjectName *string `url:"project_name,omitempty" json:"project_name,omitempty"` - Username *string `url:"username,omitempty" json:"username,omitempty"` - Password *string `url:"password,omitempty" json:"password,omitempty"` +// https://docs.gitlab.com/ce/api/services.html#create-edit-microsoft-teams-service +type SetMicrosoftTeamsServiceOptions struct { + WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"` } -// SetJenkinsCIService sets Jenkins service for a project +// SetMicrosoftTeamsService sets Microsoft Teams service for a project // // GitLab API docs: -// https://docs.gitlab.com/ee/api/services.html#create-edit-jenkins-ci-service -func (s *ServicesService) SetJenkinsCIService(pid interface{}, opt *SetJenkinsCIServiceOptions, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#create-edit-microsoft-teams-service +func (s *ServicesService) SetMicrosoftTeamsService(pid interface{}, opt *SetMicrosoftTeamsServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/jenkins", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/microsoft-teams", pathEscape(project)) req, err := s.client.NewRequest("PUT", u, opt, options) if err != nil { return nil, err } + return s.client.Do(req, nil) +} + +// DeleteMicrosoftTeamsService deletes Microsoft Teams service for project. +// +// GitLab API docs: +// https://docs.gitlab.com/ce/api/services.html#delete-microsoft-teams-service +func (s *ServicesService) DeleteMicrosoftTeamsService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/services/microsoft-teams", pathEscape(project)) + + req, err := s.client.NewRequest("DELETE", u, nil, options) + if err != nil { + return nil, err + } return s.client.Do(req, nil) } -// DeleteJenkinsCIService deletes Jenkins CI service for project. +// PipelinesEmailService represents Pipelines Email service settings. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#delete-jira-service -func (s *ServicesService) DeleteJenkinsCIService(pid interface{}, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ee/api/services.html#pipeline-emails +type PipelinesEmailService struct { + Service + Properties *PipelinesEmailProperties `json:"properties"` +} + +// PipelinesEmailProperties represents PipelinesEmail specific properties. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/services.html#pipeline-emails +type PipelinesEmailProperties struct { + Recipients string `json:"recipients,omitempty"` + NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines,omitempty"` + NotifyOnlyDefaultBranch BoolValue `json:"notify_only_default_branch,omitempty"` +} + +// GetPipelinesEmailService gets Pipelines Email service settings for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/services.html#get-pipeline-emails-service-settings +func (s *ServicesService) GetPipelinesEmailService(pid interface{}, options ...RequestOptionFunc) (*PipelinesEmailService, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/services/pipelines-email", pathEscape(project)) + + req, err := s.client.NewRequest("GET", u, nil, options) + if err != nil { + return nil, nil, err + } + + svc := new(PipelinesEmailService) + resp, err := s.client.Do(req, svc) + if err != nil { + return nil, resp, err + } + + return svc, resp, err +} + +// SetPipelinesEmailServiceOptions represents the available SetPipelinesEmailService() +// options. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/services.html#pipeline-emails +type SetPipelinesEmailServiceOptions struct { + Recipients *string `url:"recipients,omitempty" json:"recipients,omitempty"` + NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"` + NotifyOnlyDefaultBranch *bool `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"` + AddPusher *bool `url:"add_pusher,omitempty" json:"add_pusher,omitempty"` + BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"` + PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` +} + +// SetPipelinesEmailService sets Pipelines Email service for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/services.html#pipeline-emails +func (s *ServicesService) SetPipelinesEmailService(pid interface{}, opt *SetPipelinesEmailServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/jenkins", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/pipelines-email", pathEscape(project)) + + req, err := s.client.NewRequest("PUT", u, opt, options) + if err != nil { + return nil, err + } + + return s.client.Do(req, nil) +} + +// DeletePipelinesEmailService deletes Pipelines Email service settings for a project. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/api/services.html#delete-pipeline-emails-service +func (s *ServicesService) DeletePipelinesEmailService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, err + } + u := fmt.Sprintf("projects/%s/services/pipelines-email", pathEscape(project)) req, err := s.client.NewRequest("DELETE", u, nil, options) if err != nil { @@ -686,40 +835,55 @@ func (s *ServicesService) DeleteJenkinsCIService(pid interface{}, options ...Opt return s.client.Do(req, nil) } -// MicrosoftTeamsService represents Microsoft Teams service settings. +// SlackService represents Slack service settings. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#microsoft-teams -type MicrosoftTeamsService struct { +// https://docs.gitlab.com/ce/api/services.html#slack +type SlackService struct { Service - Properties *MicrosoftTeamsServiceProperties `json:"properties"` + Properties *SlackServiceProperties `json:"properties"` } -// MicrosoftTeamsServiceProperties represents Microsoft Teams specific properties. +// SlackServiceProperties represents Slack specific properties. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#microsoft-teams -type MicrosoftTeamsServiceProperties struct { - WebHook string `json:"webhook"` +// https://docs.gitlab.com/ce/api/services.html#slack +type SlackServiceProperties struct { + WebHook string `json:"webhook,omitempty"` + Username string `json:"username,omitempty"` + Channel string `json:"channel,omitempty"` + NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines,omitempty"` + NotifyOnlyDefaultBranch BoolValue `json:"notify_only_default_branch,omitempty"` + BranchesToBeNotified string `json:"branches_to_be_notified,omitempty"` + ConfidentialIssueChannel string `json:"confidential_issue_channel,omitempty"` + ConfidentialNoteChannel string `json:"confidential_note_channel,omitempty"` + DeploymentChannel string `json:"deployment_channel,omitempty"` + IssueChannel string `json:"issue_channel,omitempty"` + MergeRequestChannel string `json:"merge_request_channel,omitempty"` + NoteChannel string `json:"note_channel,omitempty"` + TagPushChannel string `json:"tag_push_channel,omitempty"` + PipelineChannel string `json:"pipeline_channel,omitempty"` + PushChannel string `json:"push_channel,omitempty"` + WikiPageChannel string `json:"wiki_page_channel,omitempty"` } -// GetMicrosoftTeamsService gets MicrosoftTeams service settings for a project. +// GetSlackService gets Slack service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#get-microsoft-teams-service-settings -func (s *ServicesService) GetMicrosoftTeamsService(pid interface{}, options ...OptionFunc) (*MicrosoftTeamsService, *Response, error) { +// https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings +func (s *ServicesService) GetSlackService(pid interface{}, options ...RequestOptionFunc) (*SlackService, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err } - u := fmt.Sprintf("projects/%s/services/microsoft-teams", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) req, err := s.client.NewRequest("GET", u, nil, options) if err != nil { return nil, nil, err } - svc := new(MicrosoftTeamsService) + svc := new(SlackService) resp, err := s.client.Do(req, svc) if err != nil { return nil, resp, err @@ -728,43 +892,72 @@ func (s *ServicesService) GetMicrosoftTeamsService(pid interface{}, options ...O return svc, resp, err } -// SetMicrosoftTeamsServiceOptions represents the available SetMicrosoftTeamsService() +// SetSlackServiceOptions represents the available SetSlackService() // options. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#create-edit-microsoft-teams-service -type SetMicrosoftTeamsServiceOptions struct { - WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"` +// https://docs.gitlab.com/ce/api/services.html#edit-slack-service +type SetSlackServiceOptions struct { + WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"` + Username *string `url:"username,omitempty" json:"username,omitempty"` + Channel *string `url:"channel,omitempty" json:"channel,omitempty"` + NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"` + NotifyOnlyDefaultBranch *bool `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"` + BranchesToBeNotified *string `url:"branches_to_be_notified,omitempty" json:"branches_to_be_notified,omitempty"` + ConfidentialIssueChannel *string `url:"confidential_issue_channel,omitempty" json:"confidential_issue_channel,omitempty"` + ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"` + // TODO: Currently, GitLab ignores this option (not implemented yet?), so + // there is no way to set it. Uncomment when this is fixed. + // See: https://gitlab.com/gitlab-org/gitlab-ce/issues/49730 + //ConfidentialNoteChannel *string `json:"confidential_note_channel,omitempty"` + ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"` + DeploymentChannel *string `url:"deployment_channel,omitempty" json:"deployment_channel,omitempty"` + DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"` + IssueChannel *string `url:"issue_channel,omitempty" json:"issue_channel,omitempty"` + IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"` + MergeRequestChannel *string `url:"merge_request_channel,omitempty" json:"merge_request_channel,omitempty"` + MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` + TagPushChannel *string `url:"tag_push_channel,omitempty" json:"tag_push_channel,omitempty"` + TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"` + NoteChannel *string `url:"note_channel,omitempty" json:"note_channel,omitempty"` + NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"` + PipelineChannel *string `url:"pipeline_channel,omitempty" json:"pipeline_channel,omitempty"` + PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"` + PushChannel *string `url:"push_channel,omitempty" json:"push_channel,omitempty"` + PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` + WikiPageChannel *string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"` + WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"` } -// SetMicrosoftTeamsService sets Microsoft Teams service for a project +// SetSlackService sets Slack service for a project // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#create-edit-microsoft-teams-service -func (s *ServicesService) SetMicrosoftTeamsService(pid interface{}, opt *SetMicrosoftTeamsServiceOptions, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#edit-slack-service +func (s *ServicesService) SetSlackService(pid interface{}, opt *SetSlackServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/microsoft-teams", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) req, err := s.client.NewRequest("PUT", u, opt, options) if err != nil { return nil, err } + return s.client.Do(req, nil) } -// DeleteMicrosoftTeamsService deletes Microsoft Teams service for project. +// DeleteSlackService deletes Slack service for project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#delete-microsoft-teams-service -func (s *ServicesService) DeleteMicrosoftTeamsService(pid interface{}, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#delete-slack-service +func (s *ServicesService) DeleteSlackService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/microsoft-teams", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project)) req, err := s.client.NewRequest("DELETE", u, nil, options) if err != nil { @@ -774,40 +967,42 @@ func (s *ServicesService) DeleteMicrosoftTeamsService(pid interface{}, options . return s.client.Do(req, nil) } -// ExternalWikiService represents External Wiki service settings. +// CustomIssueTrackerService represents Custom Issue Tracker service settings. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#external-wiki -type ExternalWikiService struct { +// https://docs.gitlab.com/ce/api/services.html#custom-issue-tracker +type CustomIssueTrackerService struct { Service - Properties *ExternalWikiServiceProperties `json:"properties"` + Properties *CustomIssueTrackerServiceProperties `json:"properties"` } -// ExternalWikiServiceProperties represents External Wiki specific properties. +// CustomIssueTrackerServiceProperties represents Custom Issue Tracker specific properties. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#external-wiki -type ExternalWikiServiceProperties struct { - ExternalWikiURL string `json:"external_wiki_url"` +// https://docs.gitlab.com/ce/api/services.html#custom-issue-tracker +type CustomIssueTrackerServiceProperties struct { + ProjectURL string `json:"project_url,omitempty"` + IssuesURL string `json:"issues_url,omitempty"` + NewIssueURL string `json:"new_issue_url,omitempty"` } -// GetExternalWikiService gets External Wiki service settings for a project. +// GetCustomIssueTrackerService gets Custom Issue Tracker service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#get-external-wiki-service-settings -func (s *ServicesService) GetExternalWikiService(pid interface{}, options ...OptionFunc) (*ExternalWikiService, *Response, error) { +// https://docs.gitlab.com/ce/api/services.html#get-custom-issue-tracker-service-settings +func (s *ServicesService) GetCustomIssueTrackerService(pid interface{}, options ...RequestOptionFunc) (*CustomIssueTrackerService, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err } - u := fmt.Sprintf("projects/%s/services/external-wiki", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", pathEscape(project)) req, err := s.client.NewRequest("GET", u, nil, options) if err != nil { return nil, nil, err } - svc := new(ExternalWikiService) + svc := new(CustomIssueTrackerService) resp, err := s.client.Do(req, svc) if err != nil { return nil, resp, err @@ -816,25 +1011,30 @@ func (s *ServicesService) GetExternalWikiService(pid interface{}, options ...Opt return svc, resp, err } -// SetExternalWikiServiceOptions represents the available SetExternalWikiService() +// SetCustomIssueTrackerServiceOptions represents the available SetCustomIssueTrackerService() // options. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#createedit-external-wiki-service -type SetExternalWikiServiceOptions struct { - ExternalWikiURL *string `url:"external_wiki_url,omitempty" json:"external_wiki_url,omitempty"` +// https://docs.gitlab.com/ce/api/services.html#createedit-custom-issue-tracker-service +type SetCustomIssueTrackerServiceOptions struct { + NewIssueURL *string `url:"new_issue_url,omitempty" json:"new_issue_url,omitempty"` + IssuesURL *string `url:"issues_url,omitempty" json:"issues_url,omitempty"` + ProjectURL *string `url:"project_url,omitempty" json:"project_url,omitempty"` + Description *string `url:"description,omitempty" json:"description,omitempty"` + Title *string `url:"title,omitempty" json:"title,omitempty"` + PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` } -// SetExternalWikiService sets External Wiki service for a project. +// SetCustomIssueTrackerService sets Custom Issue Tracker service for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#createedit-external-wiki-service -func (s *ServicesService) SetExternalWikiService(pid interface{}, opt *SetExternalWikiServiceOptions, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#createedit-custom-issue-tracker-service +func (s *ServicesService) SetCustomIssueTrackerService(pid interface{}, opt *SetCustomIssueTrackerServiceOptions, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/external-wiki", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", pathEscape(project)) req, err := s.client.NewRequest("PUT", u, opt, options) if err != nil { @@ -844,16 +1044,16 @@ func (s *ServicesService) SetExternalWikiService(pid interface{}, opt *SetExtern return s.client.Do(req, nil) } -// DeleteExternalWikiService deletes External Wiki service for project. +// DeleteCustomIssueTrackerService deletes Custom Issue Tracker service settings for a project. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/services.html#delete-external-wiki-service -func (s *ServicesService) DeleteExternalWikiService(pid interface{}, options ...OptionFunc) (*Response, error) { +// https://docs.gitlab.com/ce/api/services.html#delete-custom-issue-tracker-service +func (s *ServicesService) DeleteCustomIssueTrackerService(pid interface{}, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err } - u := fmt.Sprintf("projects/%s/services/external-wiki", pathEscape(project)) + u := fmt.Sprintf("projects/%s/services/custom-issue-tracker", pathEscape(project)) req, err := s.client.NewRequest("DELETE", u, nil, options) if err != nil { diff --git a/vendor/github.com/xanzy/go-gitlab/settings.go b/vendor/github.com/xanzy/go-gitlab/settings.go index c25b28aabf..8811c8c208 100644 --- a/vendor/github.com/xanzy/go-gitlab/settings.go +++ b/vendor/github.com/xanzy/go-gitlab/settings.go @@ -55,11 +55,11 @@ type Settings struct { ContainerRegistryTokenExpireDelay int `json:"container_registry_token_expire_delay"` DefaultArtifactsExpireIn string `json:"default_artifacts_expire_in"` DefaultBranchProtection int `json:"default_branch_protection"` - DefaultGroupVisibility *VisibilityValue `json:"default_group_visibility"` + DefaultGroupVisibility VisibilityValue `json:"default_group_visibility"` DefaultProjectCreation int `json:"default_project_creation"` DefaultProjectsLimit int `json:"default_projects_limit"` - DefaultProjectVisibility *VisibilityValue `json:"default_project_visibility"` - DefaultSnippetVisibility *VisibilityValue `json:"default_snippet_visibility"` + DefaultProjectVisibility VisibilityValue `json:"default_project_visibility"` + DefaultSnippetVisibility VisibilityValue `json:"default_snippet_visibility"` DiffMaxPatchBytes int `json:"diff_max_patch_bytes"` DisabledOauthSignInSources []string `json:"disabled_oauth_sign_in_sources"` DNSRebindingProtectionEnabled bool `json:"dns_rebinding_protection_enabled"` @@ -205,7 +205,7 @@ func (s Settings) String() string { // // GitLab API docs: // https://docs.gitlab.com/ce/api/settings.html#get-current-application.settings -func (s *SettingsService) GetSettings(options ...OptionFunc) (*Settings, *Response, error) { +func (s *SettingsService) GetSettings(options ...RequestOptionFunc) (*Settings, *Response, error) { req, err := s.client.NewRequest("GET", "application/settings", nil, options) if err != nil { return nil, nil, err @@ -393,7 +393,7 @@ type UpdateSettingsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/settings.html#change-application.settings -func (s *SettingsService) UpdateSettings(opt *UpdateSettingsOptions, options ...OptionFunc) (*Settings, *Response, error) { +func (s *SettingsService) UpdateSettings(opt *UpdateSettingsOptions, options ...RequestOptionFunc) (*Settings, *Response, error) { req, err := s.client.NewRequest("PUT", "application/settings", opt, options) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go b/vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go index 83e7702450..45c205d9af 100644 --- a/vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go +++ b/vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go @@ -41,7 +41,7 @@ type QueueMetrics struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-queue-metrics -func (s *SidekiqService) GetQueueMetrics(options ...OptionFunc) (*QueueMetrics, *Response, error) { +func (s *SidekiqService) GetQueueMetrics(options ...RequestOptionFunc) (*QueueMetrics, *Response, error) { req, err := s.client.NewRequest("GET", "/sidekiq/queue_metrics", nil, options) if err != nil { return nil, nil, err @@ -78,7 +78,7 @@ type ProcessMetrics struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-process-metrics -func (s *SidekiqService) GetProcessMetrics(options ...OptionFunc) (*ProcessMetrics, *Response, error) { +func (s *SidekiqService) GetProcessMetrics(options ...RequestOptionFunc) (*ProcessMetrics, *Response, error) { req, err := s.client.NewRequest("GET", "/sidekiq/process_metrics", nil, options) if err != nil { return nil, nil, err @@ -109,7 +109,7 @@ type JobStats struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-job-statistics -func (s *SidekiqService) GetJobStats(options ...OptionFunc) (*JobStats, *Response, error) { +func (s *SidekiqService) GetJobStats(options ...RequestOptionFunc) (*JobStats, *Response, error) { req, err := s.client.NewRequest("GET", "/sidekiq/job_stats", nil, options) if err != nil { return nil, nil, err @@ -138,7 +138,7 @@ type CompoundMetrics struct { // Get a compound response of all the previously mentioned metrics // // GitLab API docs: https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-job-statistics -func (s *SidekiqService) GetCompoundMetrics(options ...OptionFunc) (*CompoundMetrics, *Response, error) { +func (s *SidekiqService) GetCompoundMetrics(options ...RequestOptionFunc) (*CompoundMetrics, *Response, error) { req, err := s.client.NewRequest("GET", "/sidekiq/compound_metrics", nil, options) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/snippets.go b/vendor/github.com/xanzy/go-gitlab/snippets.go index be232c8c2b..a8025de48d 100644 --- a/vendor/github.com/xanzy/go-gitlab/snippets.go +++ b/vendor/github.com/xanzy/go-gitlab/snippets.go @@ -64,7 +64,7 @@ type ListSnippetsOptions ListOptions // ListSnippets gets a list of snippets. // // GitLab API docs: https://docs.gitlab.com/ce/api/snippets.html#list-snippets -func (s *SnippetsService) ListSnippets(opt *ListSnippetsOptions, options ...OptionFunc) ([]*Snippet, *Response, error) { +func (s *SnippetsService) ListSnippets(opt *ListSnippetsOptions, options ...RequestOptionFunc) ([]*Snippet, *Response, error) { req, err := s.client.NewRequest("GET", "snippets", opt, options) if err != nil { return nil, nil, err @@ -83,7 +83,7 @@ func (s *SnippetsService) ListSnippets(opt *ListSnippetsOptions, options ...Opti // // GitLab API docs: // https://docs.gitlab.com/ce/api/snippets.html#single-snippet -func (s *SnippetsService) GetSnippet(snippet int, options ...OptionFunc) (*Snippet, *Response, error) { +func (s *SnippetsService) GetSnippet(snippet int, options ...RequestOptionFunc) (*Snippet, *Response, error) { u := fmt.Sprintf("snippets/%d", snippet) req, err := s.client.NewRequest("GET", u, nil, options) @@ -117,7 +117,7 @@ type CreateSnippetOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/snippets.html#create-new-snippet -func (s *SnippetsService) CreateSnippet(opt *CreateSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) { +func (s *SnippetsService) CreateSnippet(opt *CreateSnippetOptions, options ...RequestOptionFunc) (*Snippet, *Response, error) { req, err := s.client.NewRequest("POST", "snippets", opt, options) if err != nil { return nil, nil, err @@ -149,7 +149,7 @@ type UpdateSnippetOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/snippets.html#update-snippet -func (s *SnippetsService) UpdateSnippet(snippet int, opt *UpdateSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) { +func (s *SnippetsService) UpdateSnippet(snippet int, opt *UpdateSnippetOptions, options ...RequestOptionFunc) (*Snippet, *Response, error) { u := fmt.Sprintf("snippets/%d", snippet) req, err := s.client.NewRequest("PUT", u, opt, options) @@ -172,7 +172,7 @@ func (s *SnippetsService) UpdateSnippet(snippet int, opt *UpdateSnippetOptions, // // GitLab API docs: // https://docs.gitlab.com/ce/api/snippets.html#delete-snippet -func (s *SnippetsService) DeleteSnippet(snippet int, options ...OptionFunc) (*Response, error) { +func (s *SnippetsService) DeleteSnippet(snippet int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("snippets/%d", snippet) req, err := s.client.NewRequest("DELETE", u, nil, options) @@ -187,7 +187,7 @@ func (s *SnippetsService) DeleteSnippet(snippet int, options ...OptionFunc) (*Re // // GitLab API docs: // https://docs.gitlab.com/ce/api/snippets.html#snippet-content -func (s *SnippetsService) SnippetContent(snippet int, options ...OptionFunc) ([]byte, *Response, error) { +func (s *SnippetsService) SnippetContent(snippet int, options ...RequestOptionFunc) ([]byte, *Response, error) { u := fmt.Sprintf("snippets/%d/raw", snippet) req, err := s.client.NewRequest("GET", u, nil, options) @@ -214,7 +214,7 @@ type ExploreSnippetsOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/snippets.html#explore-all-public-snippets -func (s *SnippetsService) ExploreSnippets(opt *ExploreSnippetsOptions, options ...OptionFunc) ([]*Snippet, *Response, error) { +func (s *SnippetsService) ExploreSnippets(opt *ExploreSnippetsOptions, options ...RequestOptionFunc) ([]*Snippet, *Response, error) { req, err := s.client.NewRequest("GET", "snippets/public", nil, options) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/system_hooks.go b/vendor/github.com/xanzy/go-gitlab/system_hooks.go index d5209d4f76..041264e952 100644 --- a/vendor/github.com/xanzy/go-gitlab/system_hooks.go +++ b/vendor/github.com/xanzy/go-gitlab/system_hooks.go @@ -46,7 +46,7 @@ func (h Hook) String() string { // // GitLab API docs: // https://docs.gitlab.com/ce/api/system_hooks.html#list-system-hooks -func (s *SystemHooksService) ListHooks(options ...OptionFunc) ([]*Hook, *Response, error) { +func (s *SystemHooksService) ListHooks(options ...RequestOptionFunc) ([]*Hook, *Response, error) { req, err := s.client.NewRequest("GET", "hooks", nil, options) if err != nil { return nil, nil, err @@ -66,14 +66,20 @@ func (s *SystemHooksService) ListHooks(options ...OptionFunc) ([]*Hook, *Respons // GitLab API docs: // https://docs.gitlab.com/ce/api/system_hooks.html#add-new-system-hook-hook type AddHookOptions struct { - URL *string `url:"url,omitempty" json:"url,omitempty"` + URL *string `url:"url,omitempty" json:"url,omitempty"` + Token *string `url:"token,omitempty" json:"token,omitempty"` + PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"` + TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"` + MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"` + RepositoryUpdateEvents *bool `url:"repository_update_events,omitempty" json:"repository_update_events,omitempty"` + EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"` } // AddHook adds a new system hook hook. // // GitLab API docs: // https://docs.gitlab.com/ce/api/system_hooks.html#add-new-system-hook-hook -func (s *SystemHooksService) AddHook(opt *AddHookOptions, options ...OptionFunc) (*Hook, *Response, error) { +func (s *SystemHooksService) AddHook(opt *AddHookOptions, options ...RequestOptionFunc) (*Hook, *Response, error) { req, err := s.client.NewRequest("POST", "hooks", opt, options) if err != nil { return nil, nil, err @@ -108,7 +114,7 @@ func (h HookEvent) String() string { // // GitLab API docs: // https://docs.gitlab.com/ce/api/system_hooks.html#test-system-hook -func (s *SystemHooksService) TestHook(hook int, options ...OptionFunc) (*HookEvent, *Response, error) { +func (s *SystemHooksService) TestHook(hook int, options ...RequestOptionFunc) (*HookEvent, *Response, error) { u := fmt.Sprintf("hooks/%d", hook) req, err := s.client.NewRequest("GET", u, nil, options) @@ -131,7 +137,7 @@ func (s *SystemHooksService) TestHook(hook int, options ...OptionFunc) (*HookEve // // GitLab API docs: // https://docs.gitlab.com/ce/api/system_hooks.html#delete-system-hook -func (s *SystemHooksService) DeleteHook(hook int, options ...OptionFunc) (*Response, error) { +func (s *SystemHooksService) DeleteHook(hook int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("hooks/%d", hook) req, err := s.client.NewRequest("DELETE", u, nil, options) diff --git a/vendor/github.com/xanzy/go-gitlab/tags.go b/vendor/github.com/xanzy/go-gitlab/tags.go index a6072dc764..3c49dc26b2 100644 --- a/vendor/github.com/xanzy/go-gitlab/tags.go +++ b/vendor/github.com/xanzy/go-gitlab/tags.go @@ -66,7 +66,7 @@ type ListTagsOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/tags.html#list-project-repository-tags -func (s *TagsService) ListTags(pid interface{}, opt *ListTagsOptions, options ...OptionFunc) ([]*Tag, *Response, error) { +func (s *TagsService) ListTags(pid interface{}, opt *ListTagsOptions, options ...RequestOptionFunc) ([]*Tag, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -92,7 +92,7 @@ func (s *TagsService) ListTags(pid interface{}, opt *ListTagsOptions, options .. // // GitLab API docs: // https://docs.gitlab.com/ce/api/tags.html#get-a-single-repository-tag -func (s *TagsService) GetTag(pid interface{}, tag string, options ...OptionFunc) (*Tag, *Response, error) { +func (s *TagsService) GetTag(pid interface{}, tag string, options ...RequestOptionFunc) (*Tag, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -129,7 +129,7 @@ type CreateTagOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/tags.html#create-a-new-tag -func (s *TagsService) CreateTag(pid interface{}, opt *CreateTagOptions, options ...OptionFunc) (*Tag, *Response, error) { +func (s *TagsService) CreateTag(pid interface{}, opt *CreateTagOptions, options ...RequestOptionFunc) (*Tag, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -154,7 +154,7 @@ func (s *TagsService) CreateTag(pid interface{}, opt *CreateTagOptions, options // // GitLab API docs: // https://docs.gitlab.com/ce/api/tags.html#delete-a-tag -func (s *TagsService) DeleteTag(pid interface{}, tag string, options ...OptionFunc) (*Response, error) { +func (s *TagsService) DeleteTag(pid interface{}, tag string, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err @@ -186,7 +186,7 @@ type CreateReleaseNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/tags.html#create-a-new-release -func (s *TagsService) CreateReleaseNote(pid interface{}, tag string, opt *CreateReleaseNoteOptions, options ...OptionFunc) (*ReleaseNote, *Response, error) { +func (s *TagsService) CreateReleaseNote(pid interface{}, tag string, opt *CreateReleaseNoteOptions, options ...RequestOptionFunc) (*ReleaseNote, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -221,7 +221,7 @@ type UpdateReleaseNoteOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/tags.html#update-a-release -func (s *TagsService) UpdateReleaseNote(pid interface{}, tag string, opt *UpdateReleaseNoteOptions, options ...OptionFunc) (*ReleaseNote, *Response, error) { +func (s *TagsService) UpdateReleaseNote(pid interface{}, tag string, opt *UpdateReleaseNoteOptions, options ...RequestOptionFunc) (*ReleaseNote, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/time_stats.go b/vendor/github.com/xanzy/go-gitlab/time_stats.go index 437a4e01e3..dd1f550a4b 100644 --- a/vendor/github.com/xanzy/go-gitlab/time_stats.go +++ b/vendor/github.com/xanzy/go-gitlab/time_stats.go @@ -37,7 +37,7 @@ type SetTimeEstimateOptions struct { // setTimeEstimate sets the time estimate for a single project issue. // // GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html -func (s *timeStatsService) setTimeEstimate(pid interface{}, entity string, issue int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *timeStatsService) setTimeEstimate(pid interface{}, entity string, issue int, opt *SetTimeEstimateOptions, options ...RequestOptionFunc) (*TimeStats, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -61,7 +61,7 @@ func (s *timeStatsService) setTimeEstimate(pid interface{}, entity string, issue // resetTimeEstimate resets the time estimate for a single project issue. // // GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html -func (s *timeStatsService) resetTimeEstimate(pid interface{}, entity string, issue int, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *timeStatsService) resetTimeEstimate(pid interface{}, entity string, issue int, options ...RequestOptionFunc) (*TimeStats, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -92,7 +92,7 @@ type AddSpentTimeOptions struct { // addSpentTime adds spent time for a single project issue. // // GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html -func (s *timeStatsService) addSpentTime(pid interface{}, entity string, issue int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *timeStatsService) addSpentTime(pid interface{}, entity string, issue int, opt *AddSpentTimeOptions, options ...RequestOptionFunc) (*TimeStats, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -116,7 +116,7 @@ func (s *timeStatsService) addSpentTime(pid interface{}, entity string, issue in // resetSpentTime resets the spent time for a single project issue. // // GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html -func (s *timeStatsService) resetSpentTime(pid interface{}, entity string, issue int, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *timeStatsService) resetSpentTime(pid interface{}, entity string, issue int, options ...RequestOptionFunc) (*TimeStats, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -140,7 +140,7 @@ func (s *timeStatsService) resetSpentTime(pid interface{}, entity string, issue // getTimeSpent gets the spent time for a single project issue. // // GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html -func (s *timeStatsService) getTimeSpent(pid interface{}, entity string, issue int, options ...OptionFunc) (*TimeStats, *Response, error) { +func (s *timeStatsService) getTimeSpent(pid interface{}, entity string, issue int, options ...RequestOptionFunc) (*TimeStats, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/todos.go b/vendor/github.com/xanzy/go-gitlab/todos.go index 4c32d08582..dc8ebb0fe3 100644 --- a/vendor/github.com/xanzy/go-gitlab/todos.go +++ b/vendor/github.com/xanzy/go-gitlab/todos.go @@ -134,7 +134,7 @@ type ListTodosOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/todos.html#get-a-list-of-todos -func (s *TodosService) ListTodos(opt *ListTodosOptions, options ...OptionFunc) ([]*Todo, *Response, error) { +func (s *TodosService) ListTodos(opt *ListTodosOptions, options ...RequestOptionFunc) ([]*Todo, *Response, error) { req, err := s.client.NewRequest("GET", "todos", opt, options) if err != nil { return nil, nil, err @@ -152,7 +152,7 @@ func (s *TodosService) ListTodos(opt *ListTodosOptions, options ...OptionFunc) ( // MarkTodoAsDone marks a single pending todo given by its ID for the current user as done. // // GitLab API docs: https://docs.gitlab.com/ce/api/todos.html#mark-a-todo-as-done -func (s *TodosService) MarkTodoAsDone(id int, options ...OptionFunc) (*Response, error) { +func (s *TodosService) MarkTodoAsDone(id int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("todos/%d/mark_as_done", id) req, err := s.client.NewRequest("POST", u, nil, options) @@ -166,7 +166,7 @@ func (s *TodosService) MarkTodoAsDone(id int, options ...OptionFunc) (*Response, // MarkAllTodosAsDone marks all pending todos for the current user as done. // // GitLab API docs: https://docs.gitlab.com/ce/api/todos.html#mark-all-todos-as-done -func (s *TodosService) MarkAllTodosAsDone(options ...OptionFunc) (*Response, error) { +func (s *TodosService) MarkAllTodosAsDone(options ...RequestOptionFunc) (*Response, error) { req, err := s.client.NewRequest("POST", "todos/mark_as_done", nil, options) if err != nil { return nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/users.go b/vendor/github.com/xanzy/go-gitlab/users.go index c8015cda7a..36d8549ca9 100644 --- a/vendor/github.com/xanzy/go-gitlab/users.go +++ b/vendor/github.com/xanzy/go-gitlab/users.go @@ -24,9 +24,11 @@ import ( // List a couple of standard errors. var ( - ErrUserBlockPrevented = errors.New("Cannot block a user that is already blocked by LDAP synchronization") - ErrUserNotFound = errors.New("User does not exist") - ErrUserUnblockPrevented = errors.New("Cannot unblock a user that is blocked by LDAP synchronization") + ErrUserActivatePrevented = errors.New("Cannot activate a user that is blocked by admin or by LDAP synchronization") + ErrUserBlockPrevented = errors.New("Cannot block a user that is already blocked by LDAP synchronization") + ErrUserDeactivatePrevented = errors.New("Cannot deactivate a user that is blocked by admin or by LDAP synchronization, or that has any activity in past 180 days") + ErrUserNotFound = errors.New("User does not exist") + ErrUserUnblockPrevented = errors.New("Cannot unblock a user that is blocked by LDAP synchronization") ) // UsersService handles communication with the user related methods of @@ -116,7 +118,7 @@ type ListUsersOptions struct { // ListUsers gets a list of users. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-users -func (s *UsersService) ListUsers(opt *ListUsersOptions, options ...OptionFunc) ([]*User, *Response, error) { +func (s *UsersService) ListUsers(opt *ListUsersOptions, options ...RequestOptionFunc) ([]*User, *Response, error) { req, err := s.client.NewRequest("GET", "users", opt, options) if err != nil { return nil, nil, err @@ -134,7 +136,7 @@ func (s *UsersService) ListUsers(opt *ListUsersOptions, options ...OptionFunc) ( // GetUser gets a single user. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-user -func (s *UsersService) GetUser(user int, options ...OptionFunc) (*User, *Response, error) { +func (s *UsersService) GetUser(user int, options ...RequestOptionFunc) (*User, *Response, error) { u := fmt.Sprintf("users/%d", user) req, err := s.client.NewRequest("GET", u, nil, options) @@ -155,32 +157,33 @@ func (s *UsersService) GetUser(user int, options ...OptionFunc) (*User, *Respons // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-creation type CreateUserOptions struct { - Email *string `url:"email,omitempty" json:"email,omitempty"` - Password *string `url:"password,omitempty" json:"password,omitempty"` - ResetPassword *bool `url:"reset_password,omitempty" json:"reset_password,omitempty"` - Username *string `url:"username,omitempty" json:"username,omitempty"` - Name *string `url:"name,omitempty" json:"name,omitempty"` - Skype *string `url:"skype,omitempty" json:"skype,omitempty"` - Linkedin *string `url:"linkedin,omitempty" json:"linkedin,omitempty"` - Twitter *string `url:"twitter,omitempty" json:"twitter,omitempty"` - WebsiteURL *string `url:"website_url,omitempty" json:"website_url,omitempty"` - Organization *string `url:"organization,omitempty" json:"organization,omitempty"` - ProjectsLimit *int `url:"projects_limit,omitempty" json:"projects_limit,omitempty"` - ExternUID *string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"` - Provider *string `url:"provider,omitempty" json:"provider,omitempty"` - Bio *string `url:"bio,omitempty" json:"bio,omitempty"` - Location *string `url:"location,omitempty" json:"location,omitempty"` - Admin *bool `url:"admin,omitempty" json:"admin,omitempty"` - CanCreateGroup *bool `url:"can_create_group,omitempty" json:"can_create_group,omitempty"` - SkipConfirmation *bool `url:"skip_confirmation,omitempty" json:"skip_confirmation,omitempty"` - External *bool `url:"external,omitempty" json:"external,omitempty"` - PrivateProfile *bool `url:"private_profile,omitempty" json:"private_profile,omitempty"` + Email *string `url:"email,omitempty" json:"email,omitempty"` + Password *string `url:"password,omitempty" json:"password,omitempty"` + ResetPassword *bool `url:"reset_password,omitempty" json:"reset_password,omitempty"` + ForceRandomPassword *bool `url:"force_random_password,omitempty" json:"force_random_password,omitempty"` + Username *string `url:"username,omitempty" json:"username,omitempty"` + Name *string `url:"name,omitempty" json:"name,omitempty"` + Skype *string `url:"skype,omitempty" json:"skype,omitempty"` + Linkedin *string `url:"linkedin,omitempty" json:"linkedin,omitempty"` + Twitter *string `url:"twitter,omitempty" json:"twitter,omitempty"` + WebsiteURL *string `url:"website_url,omitempty" json:"website_url,omitempty"` + Organization *string `url:"organization,omitempty" json:"organization,omitempty"` + ProjectsLimit *int `url:"projects_limit,omitempty" json:"projects_limit,omitempty"` + ExternUID *string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"` + Provider *string `url:"provider,omitempty" json:"provider,omitempty"` + Bio *string `url:"bio,omitempty" json:"bio,omitempty"` + Location *string `url:"location,omitempty" json:"location,omitempty"` + Admin *bool `url:"admin,omitempty" json:"admin,omitempty"` + CanCreateGroup *bool `url:"can_create_group,omitempty" json:"can_create_group,omitempty"` + SkipConfirmation *bool `url:"skip_confirmation,omitempty" json:"skip_confirmation,omitempty"` + External *bool `url:"external,omitempty" json:"external,omitempty"` + PrivateProfile *bool `url:"private_profile,omitempty" json:"private_profile,omitempty"` } // CreateUser creates a new user. Note only administrators can create new users. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-creation -func (s *UsersService) CreateUser(opt *CreateUserOptions, options ...OptionFunc) (*User, *Response, error) { +func (s *UsersService) CreateUser(opt *CreateUserOptions, options ...RequestOptionFunc) (*User, *Response, error) { req, err := s.client.NewRequest("POST", "users", opt, options) if err != nil { return nil, nil, err @@ -224,7 +227,7 @@ type ModifyUserOptions struct { // of a user. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-modification -func (s *UsersService) ModifyUser(user int, opt *ModifyUserOptions, options ...OptionFunc) (*User, *Response, error) { +func (s *UsersService) ModifyUser(user int, opt *ModifyUserOptions, options ...RequestOptionFunc) (*User, *Response, error) { u := fmt.Sprintf("users/%d", user) req, err := s.client.NewRequest("PUT", u, opt, options) @@ -248,7 +251,7 @@ func (s *UsersService) ModifyUser(user int, opt *ModifyUserOptions, options ...O // latter not. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-deletion -func (s *UsersService) DeleteUser(user int, options ...OptionFunc) (*Response, error) { +func (s *UsersService) DeleteUser(user int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("users/%d", user) req, err := s.client.NewRequest("DELETE", u, nil, options) @@ -262,7 +265,7 @@ func (s *UsersService) DeleteUser(user int, options ...OptionFunc) (*Response, e // CurrentUser gets currently authenticated user. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#current-user -func (s *UsersService) CurrentUser(options ...OptionFunc) (*User, *Response, error) { +func (s *UsersService) CurrentUser(options ...RequestOptionFunc) (*User, *Response, error) { req, err := s.client.NewRequest("GET", "user", nil, options) if err != nil { return nil, nil, err @@ -290,7 +293,7 @@ type SSHKey struct { // ListSSHKeys gets a list of currently authenticated user's SSH keys. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-ssh-keys -func (s *UsersService) ListSSHKeys(options ...OptionFunc) ([]*SSHKey, *Response, error) { +func (s *UsersService) ListSSHKeys(options ...RequestOptionFunc) ([]*SSHKey, *Response, error) { req, err := s.client.NewRequest("GET", "user/keys", nil, options) if err != nil { return nil, nil, err @@ -316,7 +319,7 @@ type ListSSHKeysForUserOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#list-ssh-keys-for-user -func (s *UsersService) ListSSHKeysForUser(user int, opt *ListSSHKeysForUserOptions, options ...OptionFunc) ([]*SSHKey, *Response, error) { +func (s *UsersService) ListSSHKeysForUser(user int, opt *ListSSHKeysForUserOptions, options ...RequestOptionFunc) ([]*SSHKey, *Response, error) { u := fmt.Sprintf("users/%d/keys", user) req, err := s.client.NewRequest("GET", u, opt, options) @@ -336,7 +339,7 @@ func (s *UsersService) ListSSHKeysForUser(user int, opt *ListSSHKeysForUserOptio // GetSSHKey gets a single key. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-ssh-key -func (s *UsersService) GetSSHKey(key int, options ...OptionFunc) (*SSHKey, *Response, error) { +func (s *UsersService) GetSSHKey(key int, options ...RequestOptionFunc) (*SSHKey, *Response, error) { u := fmt.Sprintf("user/keys/%d", key) req, err := s.client.NewRequest("GET", u, nil, options) @@ -364,7 +367,7 @@ type AddSSHKeyOptions struct { // AddSSHKey creates a new key owned by the currently authenticated user. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-ssh-key -func (s *UsersService) AddSSHKey(opt *AddSSHKeyOptions, options ...OptionFunc) (*SSHKey, *Response, error) { +func (s *UsersService) AddSSHKey(opt *AddSSHKeyOptions, options ...RequestOptionFunc) (*SSHKey, *Response, error) { req, err := s.client.NewRequest("POST", "user/keys", opt, options) if err != nil { return nil, nil, err @@ -383,7 +386,7 @@ func (s *UsersService) AddSSHKey(opt *AddSSHKeyOptions, options ...OptionFunc) ( // admin. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-ssh-key-for-user -func (s *UsersService) AddSSHKeyForUser(user int, opt *AddSSHKeyOptions, options ...OptionFunc) (*SSHKey, *Response, error) { +func (s *UsersService) AddSSHKeyForUser(user int, opt *AddSSHKeyOptions, options ...RequestOptionFunc) (*SSHKey, *Response, error) { u := fmt.Sprintf("users/%d/keys", user) req, err := s.client.NewRequest("POST", u, opt, options) @@ -406,7 +409,7 @@ func (s *UsersService) AddSSHKeyForUser(user int, opt *AddSSHKeyOptions, options // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#delete-ssh-key-for-current-owner -func (s *UsersService) DeleteSSHKey(key int, options ...OptionFunc) (*Response, error) { +func (s *UsersService) DeleteSSHKey(key int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("user/keys/%d", key) req, err := s.client.NewRequest("DELETE", u, nil, options) @@ -422,7 +425,7 @@ func (s *UsersService) DeleteSSHKey(key int, options ...OptionFunc) (*Response, // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#delete-ssh-key-for-given-user -func (s *UsersService) DeleteSSHKeyForUser(user, key int, options ...OptionFunc) (*Response, error) { +func (s *UsersService) DeleteSSHKeyForUser(user, key int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("users/%d/keys/%d", user, key) req, err := s.client.NewRequest("DELETE", u, nil, options) @@ -436,7 +439,7 @@ func (s *UsersService) DeleteSSHKeyForUser(user, key int, options ...OptionFunc) // BlockUser blocks the specified user. Available only for admin. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#block-user -func (s *UsersService) BlockUser(user int, options ...OptionFunc) error { +func (s *UsersService) BlockUser(user int, options ...RequestOptionFunc) error { u := fmt.Sprintf("users/%d/block", user) req, err := s.client.NewRequest("POST", u, nil, options) @@ -464,7 +467,7 @@ func (s *UsersService) BlockUser(user int, options ...OptionFunc) error { // UnblockUser unblocks the specified user. Available only for admin. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#unblock-user -func (s *UsersService) UnblockUser(user int, options ...OptionFunc) error { +func (s *UsersService) UnblockUser(user int, options ...RequestOptionFunc) error { u := fmt.Sprintf("users/%d/unblock", user) req, err := s.client.NewRequest("POST", u, nil, options) @@ -489,6 +492,62 @@ func (s *UsersService) UnblockUser(user int, options ...OptionFunc) error { } } +// DeactivateUser deactivate the specified user. Available only for admin. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#deactivate-user +func (s *UsersService) DeactivateUser(user int, options ...RequestOptionFunc) error { + u := fmt.Sprintf("users/%d/deactivate", user) + + req, err := s.client.NewRequest("POST", u, nil, options) + if err != nil { + return err + } + + resp, err := s.client.Do(req, nil) + if err != nil && resp == nil { + return err + } + + switch resp.StatusCode { + case 201: + return nil + case 403: + return ErrUserDeactivatePrevented + case 404: + return ErrUserNotFound + default: + return fmt.Errorf("Received unexpected result code: %d", resp.StatusCode) + } +} + +// ActivateUser activate the specified user. Available only for admin. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#activate-user +func (s *UsersService) ActivateUser(user int, options ...RequestOptionFunc) error { + u := fmt.Sprintf("users/%d/activate", user) + + req, err := s.client.NewRequest("POST", u, nil, options) + if err != nil { + return err + } + + resp, err := s.client.Do(req, nil) + if err != nil && resp == nil { + return err + } + + switch resp.StatusCode { + case 201: + return nil + case 403: + return ErrUserActivatePrevented + case 404: + return ErrUserNotFound + default: + return fmt.Errorf("Received unexpected result code: %d", resp.StatusCode) + } +} + // Email represents an Email. // // GitLab API docs: https://doc.gitlab.com/ce/api/users.html#list-emails @@ -500,7 +559,7 @@ type Email struct { // ListEmails gets a list of currently authenticated user's Emails. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-emails -func (s *UsersService) ListEmails(options ...OptionFunc) ([]*Email, *Response, error) { +func (s *UsersService) ListEmails(options ...RequestOptionFunc) ([]*Email, *Response, error) { req, err := s.client.NewRequest("GET", "user/emails", nil, options) if err != nil { return nil, nil, err @@ -526,7 +585,7 @@ type ListEmailsForUserOptions ListOptions // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#list-emails-for-user -func (s *UsersService) ListEmailsForUser(user int, opt *ListEmailsForUserOptions, options ...OptionFunc) ([]*Email, *Response, error) { +func (s *UsersService) ListEmailsForUser(user int, opt *ListEmailsForUserOptions, options ...RequestOptionFunc) ([]*Email, *Response, error) { u := fmt.Sprintf("users/%d/emails", user) req, err := s.client.NewRequest("GET", u, opt, options) @@ -546,7 +605,7 @@ func (s *UsersService) ListEmailsForUser(user int, opt *ListEmailsForUserOptions // GetEmail gets a single email. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-email -func (s *UsersService) GetEmail(email int, options ...OptionFunc) (*Email, *Response, error) { +func (s *UsersService) GetEmail(email int, options ...RequestOptionFunc) (*Email, *Response, error) { u := fmt.Sprintf("user/emails/%d", email) req, err := s.client.NewRequest("GET", u, nil, options) @@ -573,7 +632,7 @@ type AddEmailOptions struct { // AddEmail creates a new email owned by the currently authenticated user. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-email -func (s *UsersService) AddEmail(opt *AddEmailOptions, options ...OptionFunc) (*Email, *Response, error) { +func (s *UsersService) AddEmail(opt *AddEmailOptions, options ...RequestOptionFunc) (*Email, *Response, error) { req, err := s.client.NewRequest("POST", "user/emails", opt, options) if err != nil { return nil, nil, err @@ -592,7 +651,7 @@ func (s *UsersService) AddEmail(opt *AddEmailOptions, options ...OptionFunc) (*E // admin. // // GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-email-for-user -func (s *UsersService) AddEmailForUser(user int, opt *AddEmailOptions, options ...OptionFunc) (*Email, *Response, error) { +func (s *UsersService) AddEmailForUser(user int, opt *AddEmailOptions, options ...RequestOptionFunc) (*Email, *Response, error) { u := fmt.Sprintf("users/%d/emails", user) req, err := s.client.NewRequest("POST", u, opt, options) @@ -615,7 +674,7 @@ func (s *UsersService) AddEmailForUser(user int, opt *AddEmailOptions, options . // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#delete-email-for-current-owner -func (s *UsersService) DeleteEmail(email int, options ...OptionFunc) (*Response, error) { +func (s *UsersService) DeleteEmail(email int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("user/emails/%d", email) req, err := s.client.NewRequest("DELETE", u, nil, options) @@ -631,7 +690,7 @@ func (s *UsersService) DeleteEmail(email int, options ...OptionFunc) (*Response, // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#delete-email-for-given-user -func (s *UsersService) DeleteEmailForUser(user, email int, options ...OptionFunc) (*Response, error) { +func (s *UsersService) DeleteEmailForUser(user, email int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("users/%d/emails/%d", user, email) req, err := s.client.NewRequest("DELETE", u, nil, options) @@ -671,7 +730,7 @@ type GetAllImpersonationTokensOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#get-all-impersonation-tokens-of-a-user -func (s *UsersService) GetAllImpersonationTokens(user int, opt *GetAllImpersonationTokensOptions, options ...OptionFunc) ([]*ImpersonationToken, *Response, error) { +func (s *UsersService) GetAllImpersonationTokens(user int, opt *GetAllImpersonationTokensOptions, options ...RequestOptionFunc) ([]*ImpersonationToken, *Response, error) { u := fmt.Sprintf("users/%d/impersonation_tokens", user) req, err := s.client.NewRequest("GET", u, opt, options) @@ -692,7 +751,7 @@ func (s *UsersService) GetAllImpersonationTokens(user int, opt *GetAllImpersonat // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#get-an-impersonation-token-of-a-user -func (s *UsersService) GetImpersonationToken(user, token int, options ...OptionFunc) (*ImpersonationToken, *Response, error) { +func (s *UsersService) GetImpersonationToken(user, token int, options ...RequestOptionFunc) (*ImpersonationToken, *Response, error) { u := fmt.Sprintf("users/%d/impersonation_tokens/%d", user, token) req, err := s.client.NewRequest("GET", u, nil, options) @@ -724,7 +783,7 @@ type CreateImpersonationTokenOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#create-an-impersonation-token -func (s *UsersService) CreateImpersonationToken(user int, opt *CreateImpersonationTokenOptions, options ...OptionFunc) (*ImpersonationToken, *Response, error) { +func (s *UsersService) CreateImpersonationToken(user int, opt *CreateImpersonationTokenOptions, options ...RequestOptionFunc) (*ImpersonationToken, *Response, error) { u := fmt.Sprintf("users/%d/impersonation_tokens", user) req, err := s.client.NewRequest("POST", u, opt, options) @@ -745,7 +804,7 @@ func (s *UsersService) CreateImpersonationToken(user int, opt *CreateImpersonati // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#revoke-an-impersonation-token -func (s *UsersService) RevokeImpersonationToken(user, token int, options ...OptionFunc) (*Response, error) { +func (s *UsersService) RevokeImpersonationToken(user, token int, options ...RequestOptionFunc) (*Response, error) { u := fmt.Sprintf("users/%d/impersonation_tokens/%d", user, token) req, err := s.client.NewRequest("DELETE", u, nil, options) @@ -777,7 +836,7 @@ type GetUserActivitiesOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#get-user-activities-admin-only -func (s *UsersService) GetUserActivities(opt *GetUserActivitiesOptions, options ...OptionFunc) ([]*UserActivity, *Response, error) { +func (s *UsersService) GetUserActivities(opt *GetUserActivitiesOptions, options ...RequestOptionFunc) ([]*UserActivity, *Response, error) { req, err := s.client.NewRequest("GET", "user/activities", opt, options) if err != nil { return nil, nil, err @@ -806,7 +865,7 @@ type UserStatus struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#user-status -func (s *UsersService) CurrentUserStatus(options ...OptionFunc) (*UserStatus, *Response, error) { +func (s *UsersService) CurrentUserStatus(options ...RequestOptionFunc) (*UserStatus, *Response, error) { req, err := s.client.NewRequest("GET", "user/status", nil, options) if err != nil { return nil, nil, err @@ -825,7 +884,7 @@ func (s *UsersService) CurrentUserStatus(options ...OptionFunc) (*UserStatus, *R // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#get-the-status-of-a-user -func (s *UsersService) GetUserStatus(user int, options ...OptionFunc) (*UserStatus, *Response, error) { +func (s *UsersService) GetUserStatus(user int, options ...RequestOptionFunc) (*UserStatus, *Response, error) { u := fmt.Sprintf("users/%d/status", user) req, err := s.client.NewRequest("GET", u, nil, options) @@ -855,7 +914,7 @@ type UserStatusOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/users.html#set-user-status -func (s *UsersService) SetUserStatus(opt *UserStatusOptions, options ...OptionFunc) (*UserStatus, *Response, error) { +func (s *UsersService) SetUserStatus(opt *UserStatusOptions, options ...RequestOptionFunc) (*UserStatus, *Response, error) { req, err := s.client.NewRequest("PUT", "user/status", opt, options) if err != nil { return nil, nil, err diff --git a/vendor/github.com/xanzy/go-gitlab/validate.go b/vendor/github.com/xanzy/go-gitlab/validate.go index a88e188409..099484ef1f 100644 --- a/vendor/github.com/xanzy/go-gitlab/validate.go +++ b/vendor/github.com/xanzy/go-gitlab/validate.go @@ -19,7 +19,7 @@ type LintResult struct { // Lint validates .gitlab-ci.yml content. // // GitLab API docs: https://docs.gitlab.com/ce/api/lint.html -func (s *ValidateService) Lint(content string, options ...OptionFunc) (*LintResult, *Response, error) { +func (s *ValidateService) Lint(content string, options ...RequestOptionFunc) (*LintResult, *Response, error) { var opts struct { Content string `url:"content,omitempty" json:"content,omitempty"` } diff --git a/vendor/github.com/xanzy/go-gitlab/wikis.go b/vendor/github.com/xanzy/go-gitlab/wikis.go index 06117212d6..ffabef845f 100644 --- a/vendor/github.com/xanzy/go-gitlab/wikis.go +++ b/vendor/github.com/xanzy/go-gitlab/wikis.go @@ -66,7 +66,7 @@ type ListWikisOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/wikis.html#list-wiki-pages -func (s *WikisService) ListWikis(pid interface{}, opt *ListWikisOptions, options ...OptionFunc) ([]*Wiki, *Response, error) { +func (s *WikisService) ListWikis(pid interface{}, opt *ListWikisOptions, options ...RequestOptionFunc) ([]*Wiki, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -91,7 +91,7 @@ func (s *WikisService) ListWikis(pid interface{}, opt *ListWikisOptions, options // // GitLab API docs: // https://docs.gitlab.com/ce/api/wikis.html#get-a-wiki-page -func (s *WikisService) GetWikiPage(pid interface{}, slug string, options ...OptionFunc) (*Wiki, *Response, error) { +func (s *WikisService) GetWikiPage(pid interface{}, slug string, options ...RequestOptionFunc) (*Wiki, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -127,7 +127,7 @@ type CreateWikiPageOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/wikis.html#create-a-new-wiki-page -func (s *WikisService) CreateWikiPage(pid interface{}, opt *CreateWikiPageOptions, options ...OptionFunc) (*Wiki, *Response, error) { +func (s *WikisService) CreateWikiPage(pid interface{}, opt *CreateWikiPageOptions, options ...RequestOptionFunc) (*Wiki, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -163,7 +163,7 @@ type EditWikiPageOptions struct { // // GitLab API docs: // https://docs.gitlab.com/ce/api/wikis.html#edit-an-existing-wiki-page -func (s *WikisService) EditWikiPage(pid interface{}, slug string, opt *EditWikiPageOptions, options ...OptionFunc) (*Wiki, *Response, error) { +func (s *WikisService) EditWikiPage(pid interface{}, slug string, opt *EditWikiPageOptions, options ...RequestOptionFunc) (*Wiki, *Response, error) { project, err := parseID(pid) if err != nil { return nil, nil, err @@ -188,7 +188,7 @@ func (s *WikisService) EditWikiPage(pid interface{}, slug string, opt *EditWikiP // // GitLab API docs: // https://docs.gitlab.com/ce/api/wikis.html#delete-a-wiki-page -func (s *WikisService) DeleteWikiPage(pid interface{}, slug string, options ...OptionFunc) (*Response, error) { +func (s *WikisService) DeleteWikiPage(pid interface{}, slug string, options ...RequestOptionFunc) (*Response, error) { project, err := parseID(pid) if err != nil { return nil, err |