Module: Octokit::Client::Labels
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
| Included In: | |
| Defined in: | lib/octokit/client/labels.rb | 
Overview
Methods for the Issue Labels API
Instance Method Summary
- 
    
      #add_label(repo, label, color = 'ffffff', options = {})  ⇒ Sawyer::Resource 
    
    Add a label to a repository. 
- 
    
      #add_labels_to_an_issue(repo, number, labels)  ⇒ Array<Sawyer::Resource> 
    
    Add label(s) to an Issue. 
- 
    
      #delete_label!(repo, label, options = {})  ⇒ Boolean 
    
    Delete a label from a repository. 
- 
    
      #label(repo, name, options = {})  ⇒ Sawyer::Resource 
    
    Get single label for a repository. 
- 
    
      #labels(repo, options = {})  ⇒ Array<Sawyer::Resource> 
    
    List available labels for a repository. 
- 
    
      #labels_for_issue(repo, number, options = {})  ⇒ Array<Sawyer::Resource> 
    
    List labels for a given issue. 
- 
    
      #labels_for_milestone(repo, number, options = {})  ⇒ Array<Sawyer::Resource> 
    
    Get labels for every issue in a milestone. 
- 
    
      #remove_all_labels(repo, number, options = {})  ⇒ Boolean 
    
    Remove all label from an Issue. 
- 
    
      #remove_label(repo, number, label, options = {})  ⇒ Array<Sawyer::Resource> 
    
    Remove a label from an Issue. 
- 
    
      #replace_all_labels(repo, number, labels, _options = {})  ⇒ Array<Sawyer::Resource> 
    
    Replace all labels on an Issue. 
- 
    
      #update_label(repo, label, options = {})  ⇒ Sawyer::Resource 
    
    Update a label. 
Instance Method Details
    #add_label(repo, label, color = 'ffffff', options = {})  ⇒ Sawyer::Resource 
  
Add a label to a repository
# File 'lib/octokit/client/labels.rb', line 43
def add_label(repo, label, color = 'ffffff', = {}) post "#{Repository.path repo}/labels", .merge({ name: label, color: color }) end
    #add_labels_to_an_issue(repo, number, labels)  ⇒ Array<Sawyer::Resource> 
  
Add label(s) to an Issue
# File 'lib/octokit/client/labels.rb', line 126
def add_labels_to_an_issue(repo, number, labels) post "#{Repository.path repo}/issues/#{number}/labels", labels end
    #delete_label!(repo, label, options = {})  ⇒ Boolean 
  
Delete a label from a repository.
This deletes the label from the repository, and removes it from all issues.
# File 'lib/octokit/client/labels.rb', line 72
def delete_label!(repo, label, = {}) boolean_from_response :delete, "#{Repository.path repo}/labels/#{ERB::Util.url_encode(label)}", end
    #label(repo, name, options = {})  ⇒ Sawyer::Resource 
  
Get single label for a repository
# File 'lib/octokit/client/labels.rb', line 30
def label(repo, name, = {}) get "#{Repository.path repo}/labels/#{ERB::Util.url_encode(name)}", end
    #labels(repo, options = {})  ⇒ Array<Sawyer::Resource> 
  
List available labels for a repository
# File 'lib/octokit/client/labels.rb', line 18
def labels(repo, = {}) paginate "#{Repository.path repo}/labels", end
    #labels_for_issue(repo, number, options = {})  ⇒ Array<Sawyer::Resource> 
  
List labels for a given issue
# File 'lib/octokit/client/labels.rb', line 113
def labels_for_issue(repo, number, = {}) paginate "#{Repository.path repo}/issues/#{number}/labels", end
    #labels_for_milestone(repo, number, options = {})  ⇒ Array<Sawyer::Resource> 
  
Get labels for every issue in a milestone
# File 'lib/octokit/client/labels.rb', line 151
def labels_for_milestone(repo, number, = {}) paginate "#{Repository.path repo}/milestones/#{number}/labels", end
    #remove_all_labels(repo, number, options = {})  ⇒ Boolean 
  
Remove all label from an Issue
This removes the label from the Issue
# File 'lib/octokit/client/labels.rb', line 101
def remove_all_labels(repo, number, = {}) boolean_from_response :delete, "#{Repository.path repo}/issues/#{number}/labels", end
    #remove_label(repo, number, label, options = {})  ⇒ Array<Sawyer::Resource> 
  
Remove a label from an Issue
This removes the label from the Issue
# File 'lib/octokit/client/labels.rb', line 87
def remove_label(repo, number, label, = {}) delete "#{Repository.path repo}/issues/#{number}/labels/#{ERB::Util.url_encode(label)}", end
    #replace_all_labels(repo, number, labels, _options = {})  ⇒ Array<Sawyer::Resource> 
  
Replace all labels on an Issue
# File 'lib/octokit/client/labels.rb', line 139
def replace_all_labels(repo, number, labels, = {}) put "#{Repository.path repo}/issues/#{number}/labels", labels end
    #update_label(repo, label, options = {})  ⇒ Sawyer::Resource 
  
Update a label
# File 'lib/octokit/client/labels.rb', line 58
def update_label(repo, label, = {}) patch "#{Repository.path repo}/labels/#{ERB::Util.url_encode(label)}", end