Skip to content

Commit

Permalink
feature(User): Add List starred gists API (github-tools#475)
Browse files Browse the repository at this point in the history
* get list of starred gist api
  • Loading branch information
knsh14 authored and clayreimann committed Apr 9, 2019
1 parent dcc3472 commit cd26446
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,23 @@ class User extends Requestable {
return this._requestAllPages(this.__getScopedUrl('starred'), requestOptions, cb);
}

/**
* Gets the list of starred gists for the user
* @see https://developer.github.com/v3/gists/#list-starred-gists
* @param {Object} [options={}] - any options to refine the search
* @param {Requestable.callback} [cb] - will receive the list of gists
* @return {Promise} - the promise for the http request
*/
listStarredGists(options, cb) {
options = options || {};
if (typeof options === 'function') {
cb = options;
options = {};
}
options.since = this._dateToISO(options.since);
return this._request('GET', '/gists/starred', options, cb);
}

/**
* List email addresses for a user
* @see https://developer.github.com/v3/users/emails/#list-email-addresses-for-a-user
Expand Down
7 changes: 7 additions & 0 deletions test/user.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ describe('User', function() {
user.listStarredRepos(assertArray(done));
});

it('should show user\'s starred gists', function(done) {
const option = {
since: '2015-01-01T00:00:00Z',
};
user.listStarredGists(option, assertArray(done));
});

it('should follow user', function(done) {
user.follow('ingalls', assertSuccessful(done));
});
Expand Down

0 comments on commit cd26446

Please sign in to comment.