From 1ffd44ddf505e4904ca7b4097209613e4fdaf7da Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Tue, 11 Jul 2017 12:40:29 +0900 Subject: [PATCH 1/3] Add addLabel() to add a label to an issue --- lib/Issue.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Issue.js b/lib/Issue.js index c0151b5f..172cca56 100644 --- a/lib/Issue.js +++ b/lib/Issue.js @@ -246,6 +246,18 @@ class Issue extends Requestable { deleteLabel(label, cb) { return this._request('DELETE', `/repos/${this.__repository}/labels/${label}`, null, cb); } + + /** + * Add 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 {string} label - the name 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); + } } module.exports = Issue; From 345fd2d0e6a60fc62afbf1b40b5f456bb59bb327 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Tue, 11 Jul 2017 12:42:04 +0900 Subject: [PATCH 2/3] Add removeLabel() to remove a label from an issue --- lib/Issue.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Issue.js b/lib/Issue.js index 172cca56..82ca1675 100644 --- a/lib/Issue.js +++ b/lib/Issue.js @@ -258,6 +258,18 @@ class Issue extends Requestable { addLabel(issue, label, cb) { return this._request('POST', `/repos/${this.__repository}/issues/${issue}/labels`, label, cb); } + + /** + * Add label to 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; From f9db695c2e86de6a696e08d3e87c600bbbfe56d3 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Tue, 11 Jul 2017 21:31:42 +0900 Subject: [PATCH 3/3] Update comments --- lib/Issue.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Issue.js b/lib/Issue.js index 82ca1675..bce20790 100644 --- a/lib/Issue.js +++ b/lib/Issue.js @@ -248,10 +248,10 @@ class Issue extends Requestable { } /** - * Add label to an issue + * 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 {string} label - the name of the label to add to the issue + * @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 */ @@ -260,7 +260,7 @@ class Issue extends Requestable { } /** - * Add label to an issue + * 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