octonode
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -91,2 +91,15 @@ // Generated by CoffeeScript 1.6.3 | ||
Repo.prototype.releases = function(cb) { | ||
return this.client.get("/repos/" + this.name + "/releases", function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Repo releases error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
Repo.prototype.languages = function(cb) { | ||
@@ -185,3 +198,5 @@ return this.client.get("/repos/" + this.name + "/languages", function(err, s, b, h) { | ||
} | ||
return this.client.get("/repos/" + this.name + "/readme?ref=" + cbOrRef, function(err, s, b, h) { | ||
return this.client.get("/repos/" + this.name + "/readme", { | ||
ref: cbOrRef | ||
}, function(err, s, b, h) { | ||
if (err) { | ||
@@ -203,3 +218,5 @@ return cb(err); | ||
} | ||
return this.client.get("/repos/" + this.name + "/contents/" + path + "?ref=" + cbOrRef, function(err, s, b, h) { | ||
return this.client.get("/repos/" + this.name + "/contents/" + path, { | ||
ref: cbOrRef | ||
}, function(err, s, b, h) { | ||
if (err) { | ||
@@ -262,3 +279,3 @@ return cb(err); | ||
Repo.prototype.tree = function(sha, cbOrRecursive, cb) { | ||
var url; | ||
var param; | ||
if ((cb == null) && cbOrRecursive) { | ||
@@ -268,7 +285,8 @@ cb = cbOrRecursive; | ||
} | ||
url = "/repos/" + this.name + "/git/trees/" + sha; | ||
if (cbOrRecursive) { | ||
url += "?recursive=1"; | ||
param = { | ||
recursive: 1 | ||
}; | ||
} | ||
return this.client.get(url, function(err, s, b, h) { | ||
return this.client.get("/repos/" + this.name + "/git/trees/" + sha, param, function(err, s, b, h) { | ||
if (err) { | ||
@@ -275,0 +293,0 @@ return cb(err); |
@@ -28,10 +28,10 @@ // Generated by CoffeeScript 1.6.3 | ||
var param; | ||
param = ''; | ||
param = {}; | ||
if (language) { | ||
param += "language=" + language + "&"; | ||
param['language'] = language; | ||
} | ||
if (start_page) { | ||
param += "start_page=" + start_page + "&"; | ||
param['start_page'] = start_page; | ||
} | ||
return this.client.get("/legacy/repos/search/" + keyword + "?" + param, function(err, s, b, h) { | ||
return this.client.get("/legacy/repos/search/" + keyword, param, function(err, s, b, h) { | ||
if (err) { | ||
@@ -50,7 +50,7 @@ return cb(err); | ||
var param; | ||
param = ''; | ||
param = {}; | ||
if (start_page) { | ||
param += "start_page=" + start_page + "&"; | ||
param['start_page'] = start_page; | ||
} | ||
return this.client.get("/legacy/user/search/" + keyword + "?" + param, function(err, s, b, h) { | ||
return this.client.get("/legacy/user/search/" + keyword, param, function(err, s, b, h) { | ||
if (err) { | ||
@@ -57,0 +57,0 @@ return cb(err); |
{ | ||
"name": "octonode", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"author": "Pavan Kumar Sunkara <pavan.sss1991@gmail.com> (http://pksunkara.github.com)", | ||
@@ -5,0 +5,0 @@ "description": "nodejs wrapper for github v3 api", |
@@ -34,3 +34,3 @@ # octonode | ||
client.get('/users/pksunkara', function (err, status, body) { | ||
client.get('/users/pksunkara', {}, function (err, status, body, headers) { | ||
console.log(body); //json object | ||
@@ -45,3 +45,3 @@ }); | ||
client.get('/user', function (err, status, body) { | ||
client.get('/user', {}, function (err, status, body, headers) { | ||
console.log(body); //json object | ||
@@ -59,3 +59,3 @@ }); | ||
client.get('/user', function (err, status, body) { | ||
client.get('/user', {}, function (err, status, body, headers) { | ||
console.log(body); //json object | ||
@@ -73,3 +73,3 @@ }); | ||
client.get('/user', function (err, status, body) { | ||
client.get('/user', {}, function (err, status, body, headers) { | ||
console.log(body); //json object | ||
@@ -444,2 +444,8 @@ }); | ||
#### Get the releases for a repository (GET /repos/pksunkara/hub/releases) | ||
```js | ||
ghrepo.releases(callback); //array of releases | ||
``` | ||
#### Get the languages for a repository (GET /repos/pksunkara/hub/languages) | ||
@@ -446,0 +452,0 @@ |
80135
1733
1000