Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve merge conflict and update jsdoc generator package #1

Closed
wants to merge 11 commits into from
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ docs/
dist/
coverage/
node_modules/

.nyc_output/
/out/
.DS_Store
npm-debug.log
sauce.json
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
docs/
coverage/
node_modules/

lib/
.nyc_output/
.DS_Store
sauce.json
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ node_js:
- '6'
- '5'
- '4'
- '0.12'


cache:
directories:
- node_modules
Expand All @@ -14,10 +13,10 @@ before_script:
- npm run lint
# - npm run build # will need this when we do sauce testing of compiled files
script:
- npm test
- npm run test-coverage
# - npm run test-dist # test the compiled files
# after_success:
# - npm run codecov # disabled temporarialy while I work out how to generate accurate coverage of ES2015 code
after_success:
- npm run codecov
before_deploy:
- npm run build
deploy:
Expand Down
118 changes: 48 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,19 @@

[![Downloads per month](https://img.shields.io/npm/dm/github-api.svg?maxAge=2592000)][npm-package]
[![Latest version](https://img.shields.io/npm/v/github-api.svg?maxAge=3600)][npm-package]
[![Gitter](https://img.shields.io/gitter/room/michael/github.js.svg?maxAge=2592000)][gitter]
[![Travis](https://img.shields.io/travis/michael/github.svg?maxAge=60)][travis-ci]
<!-- [![Codecov](https://img.shields.io/codecov/c/github/michael/github.svg?maxAge=2592000)][codecov] -->
[![Gitter](https://img.shields.io/gitter/room/github-tools/github.js.svg?maxAge=2592000)][gitter]
[![Travis](https://img.shields.io/travis/github-tools/github.svg?maxAge=60)][travis-ci]
[![Codecov](https://img.shields.io/codecov/c/github/github-tools/github.svg?maxAge=2592000)][codecov]

Github.js provides a minimal higher-level wrapper around Github's API. It was concieved in the context of
[Prose][prose], a content editor for GitHub.
Github.js provides a minimal higher-level wrapper around Github's API.

## [Read the docs][docs]

## Installation
Github.js is available from `npm` or [unpkg][unpkg].

```shell
npm install github-api
```

```html
<!-- 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:
* 6.x
* 5.x
* 4.x
* 0.12

## GitHub Tools

The team behind Github.js has created a whole organization, called [GitHub Tools](https://github.com/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.

## Samples
## Usage

```javascript
/*
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 the
raw HTTP request promise; this might change in the next version.
or using a new promise-based API. The promise-based API returns the raw Axios
request promise.
*/
import GitHub from 'github-api';

Expand All @@ -62,57 +31,66 @@ gist.create({
}
}).then(function({data}) {
// Promises!
let gistJson = data;
gist.read(function(err, gist, xhr) {
// if no error occurred then err == null

// gistJson === httpResponse.data

// xhr === httpResponse
});
let createdGist = data;
return gist.read();
}).then(function({data}) {
let retrievedGist = data;
// do interesting things
});
```

```javascript
import GitHub from 'github-api';
var GitHub = require('github-api');

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

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

const clayreimann = gh.getUser('clayreimann');
clayreimann.listStarredRepos()
.then(function({data: reposJson}) {
// do stuff with reposJson
});
var clayreimann = gh.getUser('clayreimann');
clayreimann.listStarredRepos(function(err, repos) {
// look at all the starred repos!
});
```

```javascript
var GitHub = require('github-api');
## API Documentation

// token auth
var gh = new GitHub({
token: 'MY_OAUTH_TOKEN'
});
[API documentation][docs] 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][unpkg].

var yahoo = gh.getOrganization('yahoo');
yahoo.listRepos(function(err, repos) {
// look at all the repos!
})
```shell
npm install github-api
```

[codecov]: https://codecov.io/github/michael/github?branch=master
[docs]: http://michael.github.io/github/
[gitter]: https://gitter.im/michael/github
```html
<!-- 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.

[codecov]: https://codecov.io/github/github-tools/github?branch=master
[docs]: http://github-tools.github.io/github/
[gitter]: https://gitter.im/github-tools/github
[npm-package]: https://www.npmjs.com/package/github-api/
[unpkg]: https://unpkg.com/github-api/
[prose]: http://prose.io
[travis-ci]: https://travis-ci.org/michael/github
[xhr-link]: http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
[travis-ci]: https://travis-ci.org/github-tools/github
Loading