summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/xanzy/go-gitlab/labels.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/labels.go')
-rw-r--r--vendor/github.com/xanzy/go-gitlab/labels.go57
1 files changed, 56 insertions, 1 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/labels.go b/vendor/github.com/xanzy/go-gitlab/labels.go
index 37e7277622..0aab8c5e28 100644
--- a/vendor/github.com/xanzy/go-gitlab/labels.go
+++ b/vendor/github.com/xanzy/go-gitlab/labels.go
@@ -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)
+}