octonode
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -2,0 +3,0 @@ var octonode; |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -2,0 +3,0 @@ var auth, qs, request; |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -50,4 +51,8 @@ var Client, Gist, Me, Org, Repo, Team, User, request; | ||
var uri; | ||
if (path == null) path = '/'; | ||
if (path[0] !== '/') path = '/' + path; | ||
if (path == null) { | ||
path = '/'; | ||
} | ||
if (path[0] !== '/') { | ||
path = '/' + path; | ||
} | ||
uri = "https://"; | ||
@@ -89,3 +94,5 @@ uri += typeof this.token === 'object' ? "" + this.token.username + ":" + this.token.password + "@" : ''; | ||
}, function(err, res, body) { | ||
if (err) return callback(err); | ||
if (err) { | ||
return callback(err); | ||
} | ||
return _this.errorHandle(res, body, callback); | ||
@@ -97,3 +104,5 @@ }); | ||
var _this = this; | ||
if (content == null) content = {}; | ||
if (content == null) { | ||
content = {}; | ||
} | ||
return request({ | ||
@@ -107,3 +116,5 @@ uri: this.query(path), | ||
}, function(err, res, body) { | ||
if (err) return callback(err); | ||
if (err) { | ||
return callback(err); | ||
} | ||
return _this.errorHandle(res, body, callback); | ||
@@ -115,3 +126,5 @@ }); | ||
var _this = this; | ||
if (content == null) content = {}; | ||
if (content == null) { | ||
content = {}; | ||
} | ||
return request({ | ||
@@ -125,3 +138,5 @@ uri: this.query(path), | ||
}, function(err, res, body) { | ||
if (err) return callback(err); | ||
if (err) { | ||
return callback(err); | ||
} | ||
return _this.errorHandle(res, body, callback); | ||
@@ -133,3 +148,5 @@ }); | ||
var _this = this; | ||
if (content == null) content = {}; | ||
if (content == null) { | ||
content = {}; | ||
} | ||
return request({ | ||
@@ -143,3 +160,5 @@ uri: this.query(path), | ||
}, function(err, res, body) { | ||
if (err) return callback(err); | ||
if (err) { | ||
return callback(err); | ||
} | ||
return _this.errorHandle(res, body, callback); | ||
@@ -146,0 +165,0 @@ }); |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -12,3 +13,5 @@ var Gist; | ||
return this.client.get("/gists", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -22,5 +25,7 @@ return cb(new Error('Gist list error')); | ||
Gist.prototype.public = function(cb) { | ||
Gist.prototype["public"] = function(cb) { | ||
return this.client.get("/gists/public", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -36,3 +41,5 @@ return cb(new Error('Gist public error')); | ||
return this.client.get("/gists/starred", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -48,3 +55,5 @@ return cb(new Error('Gist starred error')); | ||
return this.client.get("/users/" + user + "/gists", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -60,3 +69,5 @@ return cb(new Error('Gist user error')); | ||
return this.client.get("/gists/" + id, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -72,3 +83,5 @@ return cb(new Error('Gist get error')); | ||
return this.client.post("/gists", gist, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 201) { | ||
@@ -84,3 +97,5 @@ return cb(new Error('Gist create error')); | ||
return this.client.post("/gists/" + id, gist, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -97,3 +112,5 @@ return cb(new Error('Gist edit error')); | ||
return this.client.del("/gists/" + id, {}, function(err, s, b) { | ||
if ((err != null) || s !== 204) return _this["delete"](id); | ||
if ((err != null) || s !== 204) { | ||
return _this["delete"](id); | ||
} | ||
}); | ||
@@ -105,3 +122,5 @@ }; | ||
return this.client.put("/gists/" + id + "/star", {}, function(err, s, b) { | ||
if ((err != null) || s !== 204) return _this.star(id); | ||
if ((err != null) || s !== 204) { | ||
return _this.star(id); | ||
} | ||
}); | ||
@@ -113,3 +132,5 @@ }; | ||
return this.client.del("/gists/" + id + "/unstar", {}, function(err, s, b) { | ||
if ((err != null) || s !== 204) return _this.unstar(id); | ||
if ((err != null) || s !== 204) { | ||
return _this.unstar(id); | ||
} | ||
}); | ||
@@ -120,3 +141,5 @@ }; | ||
return this.client.get("/gists/" + id + "/star", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204); | ||
@@ -128,3 +151,5 @@ }); | ||
return this.client.get("/gists/" + id + "/comments", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -140,3 +165,5 @@ return cb(new Error('Gist comments error')); | ||
return this.client.get("/gists/comments/" + id, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -152,3 +179,5 @@ return cb(new Error('Gist getComment error')); | ||
return this.client.post("/gists/" + id + "/comments", comment, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 201) { | ||
@@ -164,3 +193,5 @@ return cb(new Error('Gist createComment error')); | ||
return this.client.post("/gists/comments/" + id, comment, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -177,3 +208,5 @@ return cb(new Error('Gist updateComment error')); | ||
return this.client.del("/gists/comments/" + id, {}, function(err, s, b) { | ||
if ((err != null) || s !== 204) return _this.deleteComment(id); | ||
if ((err != null) || s !== 204) { | ||
return _this.deleteComment(id); | ||
} | ||
}); | ||
@@ -180,0 +213,0 @@ }; |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -23,3 +24,5 @@ var Me, Org, User; | ||
return this.client.get('/user', function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -35,3 +38,5 @@ return cb(new Error('User info error')); | ||
return this.client.post('/user', info, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -53,3 +58,5 @@ return cb(new Error('User update error')); | ||
return this.client.get('/user/emails', function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -66,3 +73,5 @@ return cb(new Error('User emails error')); | ||
return this.client.post('/user/emails', emails, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 201) { | ||
@@ -79,3 +88,5 @@ return cb(new Error('User setEmails error')); | ||
return this.client.del('/user/emails', emails, function(err, s, b) { | ||
if ((err != null) || s !== 204) return _this.deleteEmails(emails); | ||
if ((err != null) || s !== 204) { | ||
return _this.deleteEmails(emails); | ||
} | ||
}); | ||
@@ -86,3 +97,5 @@ }; | ||
return this.client.get('/user/followers', function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -102,3 +115,5 @@ return cb(new Error('User followers error')); | ||
return this.client.get('/user/following', function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -115,3 +130,5 @@ return cb(new Error('User following error')); | ||
return this.client.get("/user/following/" + user, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204); | ||
@@ -124,3 +141,5 @@ }); | ||
return this.client.put("/user/following/" + user, {}, function(err, s, b) { | ||
if ((err != null) || s !== 204) return _this.follow(user); | ||
if ((err != null) || s !== 204) { | ||
return _this.follow(user); | ||
} | ||
}); | ||
@@ -132,3 +151,5 @@ }; | ||
return this.client.del("/user/following/" + user, {}, function(err, s, b) { | ||
if ((err != null) || s !== 204) return _this.unfollow(user); | ||
if ((err != null) || s !== 204) { | ||
return _this.unfollow(user); | ||
} | ||
}); | ||
@@ -149,3 +170,5 @@ }; | ||
return this.client.get('/user/keys', function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -162,3 +185,5 @@ return cb(new Error('User keys error')); | ||
return this.client.get("/user/keys/" + id, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -174,3 +199,5 @@ return cb(new Error('User getKey error')); | ||
return this.client.post('/user/keys', key, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 201) { | ||
@@ -186,3 +213,5 @@ return cb(new Error('User createKey error')); | ||
return this.client.post("/user/keys/" + id, key, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -199,3 +228,5 @@ return cb(new Error('User updateKey error')); | ||
return this.client.del("/user/keys/" + id, {}, function(err, s, b) { | ||
if ((err != null) || s !== 204) return _this.deleteKey(id); | ||
if ((err != null) || s !== 204) { | ||
return _this.deleteKey(id); | ||
} | ||
}); | ||
@@ -208,2 +239,15 @@ }; | ||
Me.prototype.orgs = function(cb) { | ||
return this.client.get("/user/orgs", function(err, s, b) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error('User orgs error')); | ||
} else { | ||
return cb(null, b); | ||
} | ||
}); | ||
}; | ||
Me.prototype.repos = function(cbOrRepo, cb) { | ||
@@ -215,3 +259,5 @@ if (typeof cb === 'function' && typeof cbOrRepo === 'object') { | ||
return this.client.get("/user/repos", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -228,3 +274,5 @@ return cb(new Error('User repos error')); | ||
return this.client.post("/user/repos", repo, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 201) { | ||
@@ -240,3 +288,5 @@ return cb(new Error('User createRepo error')); | ||
return this.client.post("/repos/" + repo + "/forks", {}, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 202) { | ||
@@ -243,0 +293,0 @@ return cb(new Error('User fork error')); |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -13,3 +14,5 @@ var Org; | ||
return this.client.get("/orgs/" + this.name, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -29,3 +32,5 @@ return cb(new Error('Org info error')); | ||
return this.client.get("/orgs/" + this.name + "/repos", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -42,3 +47,5 @@ return cb(new Error('Org repos error')); | ||
return this.client.post("/orgs/" + this.name + "/repos", repo, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 201) { | ||
@@ -54,3 +61,5 @@ return cb(new Error('Org createRepo error')); | ||
return this.client.get("/orgs/" + this.name + "/teams", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -66,3 +75,5 @@ return cb(new Error('Org teams error')); | ||
return this.client.get("/orgs/" + this.name + "/members", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -78,3 +89,5 @@ return cb(new Error('Org members error')); | ||
return this.client.get("/orgs/" + this.name + "/members/" + user, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204); | ||
@@ -81,0 +94,0 @@ }); |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -13,3 +14,5 @@ var Repo; | ||
return this.client.get("/repos/" + this.name, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -25,3 +28,5 @@ return cb(new Error("Repo info error")); | ||
return this.client.get("/repos/" + this.name + "/commits", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -37,3 +42,5 @@ return cb(new Error("Repo commits error")); | ||
return this.client.get("/repos/" + this.name + "/tags", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -49,3 +56,5 @@ return cb(new Error("Repo tags error")); | ||
return this.client.get("/repos/" + this.name + "/languages", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -61,3 +70,5 @@ return cb(new Error("Repo languages error")); | ||
return this.client.get("/repos/" + this.name + "/contributors", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -73,3 +84,5 @@ return cb(new Error("Repo contributors error")); | ||
return this.client.get("/repos/" + this.name + "/teams", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -85,3 +98,5 @@ return cb(new Error("Repo teams error")); | ||
return this.client.get("/repos/" + this.name + "/branches", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -97,3 +112,5 @@ return cb(new Error("Repo branches error")); | ||
return this.client.get("/repos/" + this.name + "/issues", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -113,3 +130,5 @@ return cb(new Error("Repo issues error")); | ||
return this.client.get("/repos/" + this.name + "/readme?ref=" + cbOrRef, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -129,3 +148,5 @@ return cb(new Error("Repo readme error")); | ||
return this.client.get("/repos/" + this.name + "/contents/" + path + "?ref=" + cbOrRef, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -145,3 +166,5 @@ return cb(new Error("Repo contents error")); | ||
return this.client.get("/repos/" + this.name + "/" + format + "/" + cbOrRef, function(err, s, b, h) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 302) { | ||
@@ -157,3 +180,5 @@ return cb(new Error("Repo archive error")); | ||
return this.client.get("/repos/" + this.name + "/forks", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -171,3 +196,5 @@ return cb(new Error("Repo forks error")); | ||
}, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -181,2 +208,11 @@ return cb(new Error("Repo blob error")); | ||
Repo.prototype.destroy = function() { | ||
var _this = this; | ||
return this.client.del("/repos/" + this.name, function(err, s, b) { | ||
if ((err != null) || s !== 204) { | ||
return _this.destroy(); | ||
} | ||
}); | ||
}; | ||
return Repo; | ||
@@ -183,0 +219,0 @@ |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -13,3 +14,5 @@ var Team; | ||
return this.client.get("/teams/" + this.id, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -25,3 +28,5 @@ return cb(new Error('Team info error')); | ||
return this.client.get("/teams/" + this.id + "/members", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -37,3 +42,5 @@ return cb(new Error('Team members error')); | ||
return this.client.get("/teams/" + this.id + "/members/" + user, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204); | ||
@@ -40,0 +47,0 @@ }); |
@@ -0,1 +1,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -20,3 +21,5 @@ var User; | ||
return this.client.get("/users/" + this.login, function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -32,3 +35,5 @@ return cb(new Error('User info error')); | ||
return this.client.get("/users/" + this.login + "/followers", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -44,3 +49,5 @@ return cb(new Error('User followers error')); | ||
return this.client.get("/users/" + this.login + "/following", function(err, s, b) { | ||
if (err) return cb(err); | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
@@ -47,0 +54,0 @@ return cb(new Error('User following error')); |
{ | ||
"name": "octonode", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": "Pavan Kumar Sunkara <pavan.sss1991@gmail.com> (http://pksunkara.github.com)", | ||
@@ -19,3 +19,2 @@ "description": "nodejs wrapper for github v3 api", | ||
"scripts": { | ||
"prepublish": "./node_modules/.bin/cake lib", | ||
"test": "./node_modules/.bin/vows --spec $(find test -name '*.js')" | ||
@@ -22,0 +21,0 @@ }, |
@@ -233,2 +233,8 @@ # octonode | ||
### List your public and private organizations (GET /user/orgs) | ||
```js | ||
ghme.orgs(callback); // array of orgs | ||
``` | ||
### List your repositories (GET /user/repos) | ||
@@ -240,3 +246,3 @@ | ||
### Create a repository (POST /user/respos) | ||
### Create a repository (POST /user/repos) | ||
@@ -355,2 +361,8 @@ ```js | ||
### Delete the repository (DELETE /repos/pksunkara/hub) | ||
```js | ||
ghrepo.destroy(); | ||
``` | ||
## Github organizations api | ||
@@ -357,0 +369,0 @@ |
49861
1091
676