Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d102be

Browse files
committed
feature(issue): allow users to fetch an issue's events
closes github-tools#180
1 parent 02daa5c commit 2d102be

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## master
4+
### Features
5+
* add `Issue.listIssueEvents`
6+
7+
### Fixes
8+
39
## 2.1.0
410
### Features
511
Team API

lib/Issue.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ class Issue extends Requestable {
4444
return this._requestAllPages(`/repos/${this.__repository}/issues`, options, cb);
4545
}
4646

47+
/**
48+
* List the events for an issue
49+
* @see https://developer.github.com/v3/issues/events/#list-events-for-an-issue
50+
* @param {number} issue - the issue to get events for
51+
* @param {Requestable.callback} [cb] - will receive the list of events
52+
* @return {Promise} - the promise for the http request
53+
*/
54+
listIssueEvents(issue, cb) {
55+
return this._request('GET', `/repos/${this.__repository}/issues/${issue}/events`, null, cb);
56+
}
57+
4758
/**
4859
* List comments on an issue
4960
* @see https://developer.github.com/v3/issues/comments/#list-comments-on-an-issue

test/issue.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ describe('Issue', function() {
3939
}));
4040
});
4141

42+
it('should get issue events', function() {
43+
return remoteIssues.listIssueEvents(remoteIssueId)
44+
.then(function({data: events}) {
45+
expect(events).to.be.an.array();
46+
});
47+
});
48+
4249
it('should get all milestones', function(done) {
4350
remoteIssues.listMilestones()
4451
.then(({data: milestones}) => {

0 commit comments

Comments
 (0)