Skip to content

Commit

Permalink
Moved building client to Usage section
Browse files Browse the repository at this point in the history
  • Loading branch information
pksunkara committed Aug 7, 2012
1 parent 090d944 commit 9ca7e09
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,39 @@ var ghgist = client.gist();
var ghteam = client.team(37);
```

### Build a client which accesses any public information

```js
var client = github.client();

client.get('/users/pksunkara', function (err, status, body) {
console.log(body); //json object
});
```

### Build a client from an access token

```js
var client = github.client('someaccesstoken');

client.get('/user', function (err, status, body) {
console.log(body); //json object
});
```

### Build a client from credentials

```js
var client = github.client({
username: 'pksunkara',
password: 'password'
});

client.get('/user', function (err, status, body) {
console.log(body); //json object
});
```

__Many of the below use cases use parts of the above code__

## Authentication
Expand Down Expand Up @@ -87,39 +120,6 @@ http.createServer(function (req, res) {
console.log('Server started on 3000');
```

### Build a client which accesses any public information

```js
var client = github.client();

client.get('/users/pksunkara', function (err, status, body) {
console.log(body); //json object
});
```

### Build a client from an access token

```js
var client = github.client('someaccesstoken');

client.get('/user', function (err, status, body) {
console.log(body); //json object
});
```

### Build a client from credentials

```js
var client = github.client({
username: 'pksunkara',
password: 'password'
});

client.get('/user', function (err, status, body) {
console.log(body); //json object
});
```

## API Callback Structure

__All the callbacks for the following will take first an error argument, then a data argument, like this:__
Expand Down

0 comments on commit 9ca7e09

Please sign in to comment.