Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaff2ceb

Browse files
committed
Docs: update the readme based
Updates are based onhttps://github.com/noffle/art-of-readmetravis skip
1 parent96cc1ac commitaff2ceb

File tree

1 file changed

+48
-62
lines changed

1 file changed

+48
-62
lines changed

‎README.md‎

Lines changed: 48 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,17 @@
33
[![Downloads per month](https://img.shields.io/npm/dm/github-api.svg?maxAge=2592000)][npm-package]
44
[![Latest version](https://img.shields.io/npm/v/github-api.svg?maxAge=3600)][npm-package]
55
[![Gitter](https://img.shields.io/gitter/room/michael/github.js.svg?maxAge=2592000)][gitter]
6-
[![Travis](https://img.shields.io/travis/michael/github.svg?maxAge=60)][travis-ci]
76
<!-- [![Codecov](https://img.shields.io/codecov/c/github/michael/github.svg?maxAge=2592000)][codecov]-->
87

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

12-
##[Read the docs][docs]
13-
14-
##Installation
15-
Github.js is available from`npm` or[unpkg][unpkg].
16-
17-
```shell
18-
npm install github-api
19-
```
20-
21-
```html
22-
<!-- just github-api source (5.3kb)-->
23-
<scriptsrc="https://unpkg.com/github-api/dist/GitHub.min.js"></script>
24-
25-
<!-- standalone (20.3kb)-->
26-
<scriptsrc="https://unpkg.com/github-api/dist/GitHub.bundle.min.js"></script>
27-
```
28-
29-
## Compatibility
30-
Github.js is tested on Node:
31-
* 6.x
32-
* 5.x
33-
* 4.x
34-
* 0.12
35-
36-
##GitHub Tools
37-
38-
The team behind Github.js has created a whole organization, called[GitHub Tools](https://github.com/github-tools),
39-
dedicated to GitHub and its API. In the near future this repository could be moved under the GitHub Tools organization
40-
as well. In the meantime, we recommend you to take a look at other projects of the organization.
41-
42-
##Samples
10+
##Usage
4311

4412
```javascript
4513
/*
4614
Data can be retrieved from the API either using callbacks (as in versions < 1.0)
47-
or using a new promise-based API.For now thepromise-based APIjustreturns the
48-
raw HTTPrequest promise; this might change in the next version.
15+
or using a new promise-based API.Thepromise-based API returns the raw Axios
16+
request promise.
4917
*/
5018
importGitHubfrom'github-api';
5119

@@ -62,52 +30,70 @@ gist.create({
6230
}
6331
}).then(function({data}) {
6432
// Promises!
65-
let gistJson= data;
66-
gist.read(function(err,gist,xhr) {
67-
// if no error occurred then err == null
68-
69-
// gistJson === httpResponse.data
70-
71-
// xhr === httpResponse
72-
});
33+
let createdGist= data;
34+
returngist.read();
35+
}).then(function({data}) {
36+
let retrievedGist= data;
37+
// do interesting things
7338
});
7439
```
7540

7641
```javascript
77-
importGitHubfrom'github-api';
42+
var GitHub=require('github-api');
7843

7944
// basic auth
80-
constgh=newGitHub({
45+
var gh=newGitHub({
8146
username:'FOO',
8247
password:'NotFoo'
48+
/* also acceptable:
49+
token: 'MY_OAUTH_TOKEN'
50+
*/
8351
});
8452

85-
constme=gh.getUser();
53+
var me=gh.getUser();// no user specified defaults to the user for whom credentials were provided
8654
me.listNotifications(function(err,notifications) {
8755
// do some stuff
8856
});
8957

90-
constclayreimann=gh.getUser('clayreimann');
91-
clayreimann.listStarredRepos()
92-
.then(function({data: reposJson}) {
93-
// do stuff with reposJson
94-
});
58+
var clayreimann=gh.getUser('clayreimann');
59+
clayreimann.listStarredRepos(function(err,repos) {
60+
// look at all the starred repos!
61+
});
9562
```
9663

97-
```javascript
98-
var GitHub=require('github-api');
64+
##API Documentation
9965

100-
// token auth
101-
var gh=newGitHub({
102-
token:'MY_OAUTH_TOKEN'
103-
});
66+
[API documentation][docs] is hosted on github pages, and is generated from JSDoc; any contributions
67+
should include updated JSDoc.
10468

105-
var yahoo=gh.getOrganization('yahoo');
106-
yahoo.listRepos(function(err,repos) {
107-
// look at all the repos!
108-
})
69+
##Installation
70+
Github.js is available from`npm` or[unpkg][unpkg].
71+
72+
```shell
73+
npm install github-api
10974
```
11075

76+
```html
77+
<!-- just github-api source (5.3kb)-->
78+
<scriptsrc="https://unpkg.com/github-api/dist/GitHub.min.js"></script>
79+
80+
<!-- standalone (20.3kb)-->
81+
<scriptsrc="https://unpkg.com/github-api/dist/GitHub.bundle.min.js"></script>
82+
```
83+
84+
## Compatibility
85+
Github.js is tested on Node:
86+
* 6.x
87+
* 5.x
88+
* 4.x
89+
* 0.12
90+
91+
##GitHub Tools
92+
93+
The team behind Github.js has created a whole organization, called[GitHub Tools](https://github.com/github-tools),
94+
dedicated to GitHub and its API. In the near future this repository could be moved under the GitHub Tools organization
95+
as well. In the meantime, we recommend you to take a look at other projects of the organization.
96+
11197
[codecov]:https://codecov.io/github/michael/github?branch=master
11298
[docs]:http://michael.github.io/github/
11399
[gitter]:https://gitter.im/michael/github

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp