Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add add label to an issue #461

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions lib/Issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,30 @@ class Issue extends Requestable {
deleteLabel(label, cb) {
return this._request('DELETE', `/repos/${this.__repository}/labels/${label}`, null, cb);
}

/**
* Add a label to an issue
* @see https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
* @param {number} issue - the id of the issue to comment on
* @param {array} label - the names of the label to add to the issue
* @param {Requestable.callback} [cb] - will receive the status
* @return {Promise} - the promise for the http request
*/
addLabel(issue, label, cb) {
return this._request('POST', `/repos/${this.__repository}/issues/${issue}/labels`, label, cb);
}

/**
* Remove a label from an issue
* @see https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
* @param {number} issue - the id of the issue to comment on
* @param {string} label - the name of the label to remove to the issue
* @param {Requestable.callback} [cb] - will receive the status
* @return {Promise} - the promise for the http request
*/
removeLabel(issue, label, cb) {
return this._request('DELETE', `/repos/${this.__repository}/issues/${issue}/labels/${label}`, null, cb);
}
}

module.exports = Issue;