gh-user-events
Get the list of events on Github performed by a user
const ghUserEvents = ; ;
id: '3476797099' type: 'WatchEvent' actor: id: 1131567 login: 'shinnn' gravatar_id: '' url: 'https://api.github.com/users/shinnn' avatar_url: 'https://avatars.githubusercontent.com/u/1131567?' repo: id: 32662888 name: 'purescript-contrib/node-purescript-bin' url: 'https://api.github.com/repos/purescript-contrib/node-purescript-bin' payload: action: 'started' public: true created_at: '2015-12-27T09:28:25Z' org: id: 7391813 login: 'purescript-contrib' gravatar_id: '' url: 'https://api.github.com/orgs/purescript-contrib' avatar_url: 'https://avatars.githubusercontent.com/u/7391813?' // ...
Installation
npm install gh-user-events
API
const ghUserEvents = ;
ghUserEvents(username [, options])
username: String
(a Github username, for example https://github.com/shinnn → 'shinnn'
)
options: Object
(gh-get
options and the additional ones)
Return: Promise
instance
It creates API requests to get the list of events performed by the specific Github user.
When it gets the list successfully, the promise will be fulfilled with an array of event information objects.
When one of the request fails, the promise will be rejected with an error.
options.maxPageSize
Type: String
(1
... 10
)
Default: 10
Set the number of pages to request per function call. One page includes up to 30 items. All items in the pages will be joined into one array when the promise is fulfilled.
Note that it creates multiple API requests if maxPageSize
option is more than 1. In other words, one function call requires at least the same number of remaining rate limit as this option.
Race condition
Under race condition, for example a new event occurs while sending multiple paginated API requests, the result rarely includes some duplicated values. In this case gh-user-events omits the duplicates from the array. Therefore, the number of items sometimes doesn't correspond with 30 * options.maxPageSize
.
options.publicOnly
Type: Boolean
Default: false
true
restricts the events to only public ones even if you are authenticated as the given user.
License
Copyright (c) 2015 - 2016 Shinnosuke Watanabe
Licensed under the MIT License.