github 0,0,2,0,-2,2,4,4 editorconfig travis-ci npm

A higher-level wrapper around the Github API. Intended for the browser.

2 years after BSD-3-Clause

Github.js

Downloads per month Latest version Gitter Travis Codecov

Github.js provides a minimal higher-level wrapper around Github's API.

Usage

/*
   Data can be retrieved from the API either using callbacks (as in versions < 1.0)
   or using a new promise-based API. The promise-based API returns the raw Axios
   request promise.
 */
import GitHub from 'github-api';

// unauthenticated client
const gh = new GitHub();
let gist = gh.getGist(); // not a gist yet
gist.create({
   public: true,
   description: 'My first gist',
   files: {
      "file1.txt": {
         content: "Aren't gists great!"
      }
   }
}).then(function({data}) {
   // Promises!
   let createdGist = data;
   return gist.read();
}).then(function({data}) {
   let retrievedGist = data;
   // do interesting things
});
var GitHub = require('github-api');

// basic auth
var gh = new GitHub({
   username: 'FOO',
   password: 'NotFoo'
   /* also acceptable:
      token: 'MY_OAUTH_TOKEN'
    */
});

var me = gh.getUser(); // no user specified defaults to the user for whom credentials were provided
me.listNotifications(function(err, notifications) {
   // do some stuff
});

var clayreimann = gh.getUser('clayreimann');
clayreimann.listStarredRepos(function(err, repos) {
   // look at all the starred repos!
});

API Documentation

API documentation is hosted on github pages, and is generated from JSDoc; any contributions should include updated JSDoc.

Installation

Github.js is available from npm or unpkg.

npm install github-api
<!-- just github-api source (5.3kb) -->
<script src="https://unpkg.com/github-api/dist/GitHub.min.js"></script>

<!-- standalone (20.3kb) -->
<script src="https://unpkg.com/github-api/dist/GitHub.bundle.min.js"></script>

Compatibility

Github.js is tested on Node.js:

  • 6.x

Note: Github.js uses Promise, hence it will not work in Node.js < 4 without polyfill.

Related Repositories

resume.github.com

resume.github.com

Resumes generated using the GitHub informations ...

github-cheat-sheet

github-cheat-sheet

A list of cool features of Git and GitHub. ...

dear-github

dear-github

:incoming_envelope: An open letter to GitHub from the maintainers of open sourc ...

github-changelog-generator

github-changelog-generator

Automatically generate change log from your tags, issues, labels and pull reques ...

github-corners

github-corners

A fresher "Fork me on GitHub" callout. ...


Top Contributors

AurelioDeRosa clayreimann ingalls aendrew mattpass darvin iamdanfox coderaiser ctalau jlord STRd6 captn3m0 knsh14 mtscout6 maxogden randalpinto raphink tricknotes ele828 kpdecker mironal tristen PeterDaveHello arosenberg01 BernhardBezdek mscdex cassioscabral ConnorCartwright dafortune klcodanr

Dependencies

package version
axios ^0.15.2
debug ^2.2.0
js-base64 ^2.1.9
utf8 ^2.1.1
dev babel-core ^6.7.7
babel-plugin-add-module-exports ^0.2.1
babel-plugin-istanbul 3.0.0
babel-plugin-transform-es2015-modules-umd ^6.5.0
babel-preset-es2015 ^6.5.0
babel-register ^6.7.2
babelify ^7.3.0
browserify ^13.0.0
codecov ^1.0.1
del ^2.2.0
eslint-config-google ^0.7.0
eslint-plugin-mocha ^4.7.0
gulp ^3.9.0
gulp-babel ^6.1.2
gulp-eslint ^3.0.1
gulp-jscs ^4.0.0
gulp-jscs-stylish ^1.3.0
gulp-rename ^1.2.2
gulp-sourcemaps ^2.2.0
gulp-uglify ^2.0.0
jsdoc ^3.4.0
minami ^1.1.1
mocha ^3.1.2
must ^0.13.1
nock ^9.0.2
nyc 9.0.1
vinyl-buffer ^1.0.0
vinyl-source-stream ^1.1.0

Releases

-   v2.4.0 zip tar
-   v2.3.0 zip tar
-   v2.2.0 zip tar
-   v2.1.0 zip tar
-   v2.0.0 zip tar
-   v1.3.0 zip tar
-   v1.2.1 zip tar
-   v1.2.0 zip tar
-   v1.1.0 zip tar
-   v1.0.0 zip tar
-   v0.11.2 zip tar
-   v0.11.1 zip tar
-   v0.11.0 zip tar
-   v0.10.7 zip tar
-   v0.10.6 zip tar
-   v0.10.5 zip tar
-   v0.10.4 zip tar
-   v0.10.3 zip tar
-   v0.10.2 zip tar
-   v0.10.1 zip tar
-   v0.10.0 zip tar
-   v0.9.2 zip tar
-   v0.9.0 zip tar
-   v0.8.1 zip tar
-   v0.8.0 zip tar
-   v0.7.0 zip tar
-   v0.6.0 zip tar
-   v0.5.2 zip tar
-   v0.5.1 zip tar
-   v0.5.0 zip tar