Module: Gitlab::Client::GroupLabels

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/group_labels.rb

Overview

Note:

Requires GitLab 11.8+

Defines methods related to group labels.

Instance Method Summary collapse

Instance Method Details

#create_group_label(group, name, color, options = {}) ⇒ Gitlab::ObjectifiedHash

Creates a new group label.

Examples:

Gitlab.create_group_label('globex', 'Backlog', '#DD10AA')

Parameters:

  • group (Integer, String)

    The ID or name of a group.

  • name (String)

    The name of a label.

  • color (String)

    The color of a label.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :description (String)

    The description of the label.

Returns:



31
32
33
# File 'lib/gitlab/client/group_labels.rb', line 31

def create_group_label(group, name, color, options = {})
  post("/groups/#{url_encode group}/labels", body: options.merge(name: name, color: color))
end

#delete_group_label(group, name) ⇒ Gitlab::ObjectifiedHash

Deletes a group label.

Examples:

Gitlab.delete_group_label('globex', 'Backlog')

Parameters:

  • group (Integer, String)

    The ID or name of a group.

  • name (String)

    The name of a label.

Returns:



60
61
62
# File 'lib/gitlab/client/group_labels.rb', line 60

def delete_group_label(group, name)
  delete("/groups/#{url_encode group}/labels/#{name}")
end

#edit_group_label(group, name, options = {}) ⇒ Gitlab::ObjectifiedHash

Updates a group label.

Examples:

Gitlab.edit_group_label('globex', 'Backlog', { new_name: 'Priority' })
Gitlab.edit_group_label('globex', 'Backlog', { new_name: 'Priority', color: '#DD10AA' })

Parameters:

  • group (Integer, String)

    The ID or name of a group.

  • name (String)

    The name of a label.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :new_name (String)

    The new name of a label.

  • :color (String)

    The color of a label.

  • :description (String)

    The description of the label.

Returns:



48
49
50
# File 'lib/gitlab/client/group_labels.rb', line 48

def edit_group_label(group, name, options = {})
  put("/groups/#{url_encode group}/labels", body: options.merge(name: name))
end

#group_labels(group, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a list of group’s labels.

Examples:

Gitlab.group_labels('globex')

Parameters:

  • group (Integer, String)

    The ID or name of a group.

Returns:



16
17
18
# File 'lib/gitlab/client/group_labels.rb', line 16

def group_labels(group, options = {})
  get("/groups/#{url_encode group}/labels", query: options)
end

#subscribe_to_group_label(group, name) ⇒ Gitlab::ObjectifiedHash

Subscribes the user to a group label to receive notifications

Examples:

Gitlab.subscribe_to_group_label('globex', 'Backlog')

Parameters:

  • group (Integer, String)

    The ID or name of a group.

  • name (String)

    The name of a label.

Returns:



72
73
74
# File 'lib/gitlab/client/group_labels.rb', line 72

def subscribe_to_group_label(group, name)
  post("/groups/#{url_encode group}/labels/#{url_encode name}/subscribe")
end

#unsubscribe_from_group_label(group, name) ⇒ Gitlab::ObjectifiedHash

Unsubscribes the user from a group label to not receive notifications from it

Examples:

Gitlab.unsubscribe_from_group_label('globex', 'Backlog')

Parameters:

  • group (Integer, String)

    The ID or name of a group.

  • name (String)

    The name of a label.

Returns:



84
85
86
# File 'lib/gitlab/client/group_labels.rb', line 84

def unsubscribe_from_group_label(group, name)
  post("/groups/#{url_encode group}/labels/#{url_encode name}/unsubscribe")
end