diff --git a/lib/User.js b/lib/User.js index 3f3b4bb6..13b344a7 100644 --- a/lib/User.js +++ b/lib/User.js @@ -111,6 +111,26 @@ class User extends Requestable { return this._request('GET', this.__getScopedUrl('notifications'), options, cb); } + /** + * List events for a user + * @see https://developer.github.com/v3/activity/events/#list-events-performed-by-a-user + * @param {Object} [options={}] - any options to refine the search + * @param {Requestable.callback} [cb] - will receive the API response + * @return {Promise} - the promise for the http request + */ + listEvents(options, cb) { + options = options || {}; + if (typeof options === 'function') { + cb = options; + options = {}; + } + + options.since = this._dateToISO(options.since); + options.before = this._dateToISO(options.before); + + return this._request('GET', `/users/${this.__user}/events`, options, cb); + } + /** * Show the user's profile * @see https://developer.github.com/v3/users/#get-a-single-user diff --git a/test/user.spec.js b/test/user.spec.js index 2296781c..345ee7bc 100644 --- a/test/user.spec.js +++ b/test/user.spec.js @@ -42,6 +42,10 @@ describe('User', function() { user.listNotifications(assertArray(done)); }); + it('should get user activity', function(done) { + user.listEvents(assertArray(done)); + }); + it('should get user notifications with options', function(done) { const filterOpts = { all: true, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy