[Vendor] Update xanzy/go-gitlab v0.31.0 => v0.37.0 (#12701)

* update github.com/xanzy/go-gitlab v0.31.0 => v0.37.0

* vendor

* adapt changes

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
6543 2020-09-06 17:37:53 +02:00 committed by GitHub
parent 0ed5e103fe
commit 0c6a802731
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 2436 additions and 776 deletions

View file

@ -73,7 +73,11 @@ func (l Label) String() string {
// ListLabelsOptions represents the available ListLabels() options.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels
type ListLabelsOptions ListOptions
type ListLabelsOptions struct {
ListOptions
WithCounts *bool `url:"with_counts,omitempty" json:"with_counts,omitempty"`
IncludeAncestorGroups *bool `url:"include_ancestor_groups,omitempty" json:"include_ancestor_groups,omitempty"`
}
// ListLabels gets all labels for given project.
//
@ -99,6 +103,34 @@ func (s *LabelsService) ListLabels(pid interface{}, opt *ListLabelsOptions, opti
return l, resp, err
}
// GetLabel get a single label for a given project.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#get-a-single-project-label
func (s *LabelsService) GetLabel(pid interface{}, labelID interface{}, options ...RequestOptionFunc) (*Label, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
label, err := parseID(labelID)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/labels/%s", pathEscape(project), label)
req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
var l *Label
resp, err := s.client.Do(req, &l)
if err != nil {
return nil, resp, err
}
return l, resp, err
}
// CreateLabelOptions represents the available CreateLabel() options.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#create-a-new-label
@ -248,3 +280,26 @@ func (s *LabelsService) UnsubscribeFromLabel(pid interface{}, labelID interface{
return s.client.Do(req, nil)
}
// PromoteLabel Promotes a project label to a group label.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/labels.html#promote-a-project-label-to-a-group-label
func (s *LabelsService) PromoteLabel(pid interface{}, labelID interface{}, options ...RequestOptionFunc) (*Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, err
}
label, err := parseID(labelID)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/labels/%s/promote", pathEscape(project), label)
req, err := s.client.NewRequest("PUT", u, nil, options)
if err != nil {
return nil, err
}
return s.client.Do(req, nil)
}