A higher-level wrapper around the Github API.
Github.js provides a minimal higher-level wrapper around Github's API. It was concieved in the context of Prose, a content editor for GitHub.
Github.js is available from
npm or npmcdn.
npm install github-api
<!-- just github-api source (5.3kb) --><!-- standalone (20.3kb) -->
Github.js is tested on Node:
The team behind Github.js has created a whole organization, called GitHub Tools, dedicated to GitHub and its API. In the near future this repository could be moved under the GitHub Tools organization as well. In the meantime, we recommend you to take a look at other projects of the organization.
/*Data can be retrieved from the API either using callbacks (as in versions < 1.0)or using a new promise-based API. For now the promise-based API just returns theraw HTTP request promise; this might change in the next version.*/import GitHub from 'github-api';// unauthenticated clientconst gh = ;let gist = ghgetGist; // not a gist yetgistcreatepublic: truedescription: 'My first gist'files:"file1.txt":contents: "Aren't gists great!"then// Promises!let gistJson = data;gistread// if no error occurred then err == null// gistJson === httpResponse.data// xhr === httpResponse;;
import GitHub from 'github-api';// basic authconst gh =username: 'FOO'password: 'NotFoo';const me = ghgetUser;melistNotifications// do some stuff;const clayreimann = ghgetUser'clayreimann';clayreimanngetStarredReposthen// do stuff with reposJson;
var GitHub = require'github-api';// token authvar gh =token: 'MY_OAUTH_TOKEN';var yahoo = ghgetOrganization'yahoo';yahoogetRepos// look at all the repos!