Skip to content
GitHub Api v3 library. Ideally, it should work in node via http request, and in browsers using jsonp.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Github api v3 library. ideally, it should work in node via http request, and in browsers using jsonp.

Quick docs

docco-generated docs


The only required dependency is underscore. Used mainly to implement class in a way similar to Backbone, thus enforcing functional programming style and providing a set of utility methods.

May introduce EventEmitter2 to provide emitter style, it has browser environment compatibility and may be used as a module than can be mixed in to any object in order to provide it with custom events an emit-ing ability.


every api methods takes a callback as last parameter. This try to follow the node convention:

function(err, values...){
  if(err) { return console.error(err); }
        do something


the exposed variable gh defined the raw request method, which api components must use to interact with the api. A simple in-memory caching strategy based on requested uri (may be soon slightly reworked to work with adapters or something, so that other caching strategy may be implemented).

Basically, an api access should be done just once, any other subsequent calls gets result from the built-in cache.

The gh.request method is wrapped by the gh.cache method.


Run the tests.

quick api overview

Head over to and check the uri endpoint that you'd like to test.

Most likely any GET request is supported.


show user info:

gh.request('/users/:user', {user: 'mklabs'}, console.log.bind(console));
gh.request('/users/:user', {user: 'github'}, console.log.bind(console));
gh.request('/users/:user', {user: 'somefancynamethatdoesnotexists'}, console.log.bind(console));

show repo info:

gh.request('/repos/:user/:repo', {user: 'loicdescotte', repo: 'coffeeblog'}, console.log.bind(console));

List public repositories for the specified user:

gh.request('/users/:user/repos', {user: 'mklabs'}, console.log.bind(console));

List public repositories for the specified user:

gh.request('/orgs/:org/repos', {org: 'github'}, console.log.bind(console));

Get a Tree:

gh.request('/repos/:user/:repo/git/trees/:sha', {
  user: 'github', 
  repo: '',
  sha: 'ddec68feb7486edb94be5e102f433cf25ccd7390'
}, console.log.bind(console));

Get a Tree Recursively:

gh.request('/repos/:user/:repo/git/trees/:sha?recursive=1', {
  user: 'github', 
  repo: '',
  sha: 'ddec68feb7486edb94be5e102f433cf25ccd7390'
}, console.log.bind(console));

notes on error

Callback functions can take any number of arguments, but the first argument is always an error or null.



  • v.0.0.1:
    • raw request method
    • caching request output
    • starting point of tree wrapper api
    • tests
Something went wrong with that request. Please try again.