module Octokit::Client::Labels

def add_label(repo, label, color = 'ffffff', options = {})

Other tags:
    Example: Add a new label "Version 1.0" with color "#cccccc" -

Other tags:
    See: https://developer.github.com/v3/issues/labels/#create-a-label -

Returns:
  • (Sawyer::Resource) - The new label

Parameters:
  • color (String) -- A color, in hex, without the leading #
  • label (String) -- A new label
  • repo (Integer, String, Repository, Hash) -- A GitHub repository
def add_label(repo, label, color = 'ffffff', options = {})
  post "#{Repository.path repo}/labels", options.merge({ name: label, color: color })
end

def add_labels_to_an_issue(repo, number, labels)

Other tags:
    Example: Add two labels for octokit/octokit.rb -

Other tags:
    See: https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue -

Returns:
  • (Array) - A list of the labels currently on the issue

Parameters:
  • labels (Array) -- An array of labels to apply to this Issue
  • number (Integer) -- Number ID of the issue
  • repo (Integer, String, Repository, Hash) -- A Github repository
def add_labels_to_an_issue(repo, number, labels)
  post "#{Repository.path repo}/issues/#{number}/labels", labels
end

def delete_label!(repo, label, options = {})

Other tags:
    Example: Delete the label "Version 1.0" from the repository. -

Other tags:
    See: https://developer.github.com/v3/issues/labels/#delete-a-label -

Returns:
  • (Boolean) - Success

Parameters:
  • label (String) -- String name of the label
  • repo (Integer, String, Repository, Hash) -- A GitHub repository
def delete_label!(repo, label, options = {})
  boolean_from_response :delete, "#{Repository.path repo}/labels/#{ERB::Util.url_encode(label)}", options
end

def label(repo, name, options = {})

Other tags:
    Example: Get the "V3 Addition" label from octokit/octokit.rb -

Other tags:
    See: https://developer.github.com/v3/issues/labels/#get-a-single-label -

Returns:
  • (Sawyer::Resource) - A single label from the repository

Parameters:
  • name (String) -- Name of the label
  • repo (Integer, String, Repository, Hash) -- A GitHub repository
def label(repo, name, options = {})
  get "#{Repository.path repo}/labels/#{ERB::Util.url_encode(name)}", options
end

def labels(repo, options = {})

Other tags:
    Example: List labels for octokit/octokit.rb -

Other tags:
    See: https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository -

Returns:
  • (Array) - A list of the labels across the repository

Parameters:
  • repo (Integer, String, Repository, Hash) -- A GitHub repository
def labels(repo, options = {})
  paginate "#{Repository.path repo}/labels", options
end

def labels_for_issue(repo, number, options = {})

Other tags:
    Example: List labels for octokit/octokit.rb, issue # 1 -

Other tags:
    See: https://developer.github.com/v3/issues/labels/#list-labels-on-an-issue -

Returns:
  • (Array) - A list of the labels currently on the issue

Parameters:
  • number (Integer) -- Number ID of the issue
  • repo (Integer, String, Repository, Hash) -- A GitHub repository
def labels_for_issue(repo, number, options = {})
  paginate "#{Repository.path repo}/issues/#{number}/labels", options
end

def labels_for_milestone(repo, number, options = {})

Other tags:
    Example: List all labels for milestone #2 on octokit/octokit.rb -

Other tags:
    See: http://developer.github.com/v3/issues/labels/#get-labels-for-every-issue-in-a-milestone -

Returns:
  • (Array) - A list of the labels across the milestone

Parameters:
  • number (Integer) -- Number ID of the milestone
  • repo (Integer, String, Repository, Hash) -- A GitHub repository
def labels_for_milestone(repo, number, options = {})
  paginate "#{Repository.path repo}/milestones/#{number}/labels", options
end

def remove_all_labels(repo, number, options = {})

Other tags:
    Example: Remove all labels from Issue #23 -

Other tags:
    See: https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue -

Returns:
  • (Boolean) - Success of operation

Parameters:
  • number (Integer) -- Number ID of the issue
  • repo (Integer, String, Repository, Hash) -- A GitHub repository
def remove_all_labels(repo, number, options = {})
  boolean_from_response :delete, "#{Repository.path repo}/issues/#{number}/labels", options
end

def remove_label(repo, number, label, options = {})

Other tags:
    Example: Remove the label "Version 1.0" from the repository. -

Other tags:
    See: https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue -

Returns:
  • (Array) - A list of the labels currently on the issue

Parameters:
  • label (String) -- String name of the label
  • number (Integer) -- Number ID of the issue
  • repo (Integer, String, Repository, Hash) -- A GitHub repository
def remove_label(repo, number, label, options = {})
  delete "#{Repository.path repo}/issues/#{number}/labels/#{ERB::Util.url_encode(label)}", options
end

def replace_all_labels(repo, number, labels, _options = {})

Other tags:
    Example: Replace labels for octokit/octokit.rb Issue #10 -

Other tags:
    See: https://developer.github.com/v3/issues/labels/#replace-all-labels-for-an-issue -

Returns:
  • (Array) - A list of the labels currently on the issue

Parameters:
  • labels (Array) -- An array of labels to use as replacement
  • number (Integer) -- Number ID of the issue
  • repo (Integer, String, Repository, Hash) -- A Github repository
def replace_all_labels(repo, number, labels, _options = {})
  put "#{Repository.path repo}/issues/#{number}/labels", labels
end

def update_label(repo, label, options = {})

Other tags:
    Example: Update the label "Version 1.0" with new color "#cceeaa" -

Other tags:
    See: https://developer.github.com/v3/issues/labels/#update-a-label -

Returns:
  • (Sawyer::Resource) - The updated label

Options Hash: (**options)
  • :color (String) -- An updated color value, in hex, without leading #
  • :name (String) -- An updated label name

Parameters:
  • options (Hash) -- A customizable set of options.
  • label (String) -- The name of the label which will be updated
  • repo (Integer, String, Repository, Hash) -- A GitHub repository
def update_label(repo, label, options = {})
  patch "#{Repository.path repo}/labels/#{ERB::Util.url_encode(label)}", options
end