Browse files

Moved building client to Usage section

  • Loading branch information...
1 parent 090d944 commit 9ca7e097a88ed65acf9582de8cfc500c6a87ca0f @pksunkara committed Aug 7, 2012
Showing with 33 additions and 33 deletions.
  1. +33 −33 README.md
View
66 README.md
@@ -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
@@ -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:__

0 comments on commit 9ca7e09

Please sign in to comment.