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.

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

github-roam

github-roam

GitHub 漫游指南- a Chinese ebook on how to build a good build on Github. Explore the users' behavior. Find some thing interest. ...

github-cards

github-cards

The unofficial GitHub Cards. Card for your GitHub profile, card for your GitHub repositories. ...

awesome-github

awesome-github

A curated list of awesome GitHub guides, articles, sites, tools, projects and resources. 收集这个列表,只是为了更好地使用亲爱的GitHub,欢迎提交pr和issue。 ...

github-gem

github-gem

`github` command line helper for simplifying your GitHub experience. ...

kuitos.github.io

kuitos.github.io

Kuitos's Blog https://github.com/kuitos/kuitos.github.io/issues http://kuitos.github.io/ ...


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