Comparing version 0.3.9 to 0.4.0
// Generated by CoffeeScript 1.6.3 | ||
(function() { | ||
var Gist; | ||
var Gist, | ||
__slice = [].slice; | ||
@@ -10,4 +11,6 @@ Gist = (function() { | ||
Gist.prototype.list = function(cb) { | ||
return this.client.get("/gists", function(err, s, b) { | ||
Gist.prototype.list = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/gists"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -19,9 +22,11 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
Gist.prototype["public"] = function(cb) { | ||
return this.client.get("/gists/public", function(err, s, b) { | ||
Gist.prototype["public"] = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/gists/public"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -33,9 +38,11 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
Gist.prototype.starred = function(cb) { | ||
return this.client.get("/gists/starred", function(err, s, b) { | ||
Gist.prototype.starred = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/gists/starred"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -47,9 +54,11 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
Gist.prototype.user = function(user, cb) { | ||
return this.client.get("/users/" + user + "/gists", function(err, s, b) { | ||
Gist.prototype.user = function() { | ||
var cb, params, user, _i, _ref; | ||
params = 3 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 2) : (_i = 0, []), user = arguments[_i++], cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/users/" + user + "/gists"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -61,9 +70,9 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
Gist.prototype.get = function(id, cb) { | ||
return this.client.get("/gists/" + id, function(err, s, b) { | ||
return this.client.get("/gists/" + id, function(err, s, b, h) { | ||
if (err) { | ||
@@ -75,3 +84,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -82,3 +91,3 @@ }); | ||
Gist.prototype.create = function(gist, cb) { | ||
return this.client.post("/gists", gist, function(err, s, b) { | ||
return this.client.post("/gists", gist, function(err, s, b, h) { | ||
if (err) { | ||
@@ -90,3 +99,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -97,3 +106,3 @@ }); | ||
Gist.prototype.edit = function(id, gist, cb) { | ||
return this.client.post("/gists/" + id, gist, function(err, s, b) { | ||
return this.client.post("/gists/" + id, gist, function(err, s, b, h) { | ||
if (err) { | ||
@@ -105,3 +114,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -113,3 +122,3 @@ }); | ||
var _this = this; | ||
return this.client.del("/gists/" + id, {}, function(err, s, b) { | ||
return this.client.del("/gists/" + id, {}, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -122,3 +131,3 @@ return _this["delete"](id); | ||
Gist.prototype.fork = function(id) { | ||
return this.client.post("/gists/" + id + "/forks", {}, function(err, s, b) { | ||
return this.client.post("/gists/" + id + "/forks", {}, function(err, s, b, h) { | ||
if (err) { | ||
@@ -130,3 +139,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -138,3 +147,3 @@ }); | ||
var _this = this; | ||
return this.client.put("/gists/" + id + "/star", {}, function(err, s, b) { | ||
return this.client.put("/gists/" + id + "/star", {}, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -148,3 +157,3 @@ return _this.star(id); | ||
var _this = this; | ||
return this.client.del("/gists/" + id + "/unstar", {}, function(err, s, b) { | ||
return this.client.del("/gists/" + id + "/unstar", {}, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -157,7 +166,7 @@ return _this.unstar(id); | ||
Gist.prototype.check = function(id) { | ||
return this.client.get("/gists/" + id + "/star", function(err, s, b) { | ||
return this.client.get("/gists/" + id + "/star", function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204); | ||
return cb(null, s === 204, h); | ||
}); | ||
@@ -167,3 +176,3 @@ }; | ||
Gist.prototype.listComments = function(id, cb) { | ||
return this.client.get("/gists/" + id + "/comments", function(err, s, b) { | ||
return this.client.get("/gists/" + id + "/comments", function(err, s, b, h) { | ||
if (err) { | ||
@@ -175,3 +184,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -182,3 +191,3 @@ }); | ||
Gist.prototype.getComment = function(id, cb) { | ||
return this.client.get("/gists/comments/" + id, function(err, s, b) { | ||
return this.client.get("/gists/comments/" + id, function(err, s, b, h) { | ||
if (err) { | ||
@@ -190,3 +199,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -197,3 +206,3 @@ }); | ||
Gist.prototype.createComment = function(id, comment, cb) { | ||
return this.client.post("/gists/" + id + "/comments", comment, function(err, s, b) { | ||
return this.client.post("/gists/" + id + "/comments", comment, function(err, s, b, h) { | ||
if (err) { | ||
@@ -205,3 +214,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -212,3 +221,3 @@ }); | ||
Gist.prototype.updateComment = function(id, comment, cb) { | ||
return this.client.post("/gists/comments/" + id, comment, function(err, s, b) { | ||
return this.client.post("/gists/comments/" + id, comment, function(err, s, b, h) { | ||
if (err) { | ||
@@ -220,3 +229,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -228,3 +237,3 @@ }); | ||
var _this = this; | ||
return this.client.del("/gists/comments/" + id, {}, function(err, s, b) { | ||
return this.client.del("/gists/comments/" + id, {}, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -231,0 +240,0 @@ return _this.deleteComment(id); |
// Generated by CoffeeScript 1.6.3 | ||
(function() { | ||
var Issue; | ||
var Issue, | ||
__slice = [].slice; | ||
@@ -13,3 +14,3 @@ Issue = (function() { | ||
Issue.prototype.info = function(cb) { | ||
return this.client.get("/repos/" + this.repo + "/issues/" + this.number, function(err, s, b) { | ||
return this.client.get("/repos/" + this.repo + "/issues/" + this.number, function(err, s, b, h) { | ||
if (err) { | ||
@@ -21,3 +22,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -28,3 +29,3 @@ }); | ||
Issue.prototype.update = function(obj, cb) { | ||
return this.client.post("/repos/" + this.repo + "/issues/" + this.number, obj, function(err, s, b) { | ||
return this.client.post("/repos/" + this.repo + "/issues/" + this.number, obj, function(err, s, b, h) { | ||
if (err) { | ||
@@ -36,3 +37,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -42,4 +43,6 @@ }); | ||
Issue.prototype.comments = function(cb) { | ||
return this.client.get("/repos/" + this.repo + "/issues/" + this.number + "/comments", function(err, s, b) { | ||
Issue.prototype.comments = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/repos/" + this.repo + "/issues/" + this.number + "/comments"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -51,5 +54,5 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
@@ -56,0 +59,0 @@ |
@@ -19,3 +19,3 @@ // Generated by CoffeeScript 1.6.3 | ||
Me.prototype.info = function(cb) { | ||
return this.client.get('/user', function(err, s, b) { | ||
return this.client.get('/user', function(err, s, b, h) { | ||
if (err) { | ||
@@ -27,3 +27,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -34,3 +34,3 @@ }); | ||
Me.prototype.update = function(info, cb) { | ||
return this.client.post('/user', info, function(err, s, b) { | ||
return this.client.post('/user', info, function(err, s, b, h) { | ||
if (err) { | ||
@@ -42,3 +42,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -55,3 +55,3 @@ }); | ||
cb = cbOrEmails; | ||
return this.client.get('/user/emails', function(err, s, b) { | ||
return this.client.get('/user/emails', function(err, s, b, h) { | ||
if (err) { | ||
@@ -63,3 +63,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -71,3 +71,3 @@ }); | ||
Me.prototype.setEmails = function(emails, cb) { | ||
return this.client.post('/user/emails', emails, function(err, s, b) { | ||
return this.client.post('/user/emails', emails, function(err, s, b, h) { | ||
if (err) { | ||
@@ -79,3 +79,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -87,3 +87,3 @@ }); | ||
var _this = this; | ||
return this.client.del('/user/emails', emails, function(err, s, b) { | ||
return this.client.del('/user/emails', emails, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -95,4 +95,6 @@ return _this.deleteEmails(emails); | ||
Me.prototype.followers = function(cb) { | ||
return this.client.get('/user/followers', function(err, s, b) { | ||
Me.prototype.followers = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ['/user/followers'].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -104,5 +106,5 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
@@ -115,3 +117,3 @@ | ||
cb = cbOrUser; | ||
return this.client.get('/user/following', function(err, s, b) { | ||
return this.client.get('/user/following', function(err, s, b, h) { | ||
if (err) { | ||
@@ -123,3 +125,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -131,7 +133,7 @@ }); | ||
Me.prototype.checkFollowing = function(user, cb) { | ||
return this.client.get("/user/following/" + user, function(err, s, b) { | ||
return this.client.get("/user/following/" + user, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204); | ||
return cb(null, s === 204, h); | ||
}); | ||
@@ -142,3 +144,3 @@ }; | ||
var _this = this; | ||
return this.client.put("/user/following/" + user, {}, function(err, s, b) { | ||
return this.client.put("/user/following/" + user, {}, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -152,3 +154,3 @@ return _this.follow(user); | ||
var _this = this; | ||
return this.client.del("/user/following/" + user, {}, function(err, s, b) { | ||
return this.client.del("/user/following/" + user, {}, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -160,8 +162,8 @@ return _this.unfollow(user); | ||
Me.prototype.starred = function(cbOrUser, cb) { | ||
if ((cb != null) && typeof cbOrUser !== 'function') { | ||
return this.checkStarred(cbOrUser, cb); | ||
Me.prototype.starred = function(cbOrRepo, cb) { | ||
if ((cb != null) && typeof cbOrRepo !== 'function') { | ||
return this.checkStarred(cbOrRepo, cb); | ||
} else { | ||
cb = cbOrUser; | ||
return this.client.get('/user/starred', function(err, s, b) { | ||
cb = cbOrRepo; | ||
return this.client.get('/user/starred', function(err, s, b, h) { | ||
if (err) { | ||
@@ -173,3 +175,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -181,7 +183,7 @@ }); | ||
Me.prototype.checkStarred = function(repo, cb) { | ||
return this.client.get("/user/starred/" + repo, function(err, s, b) { | ||
return this.client.get("/user/starred/" + repo, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204); | ||
return cb(null, s === 204, h); | ||
}); | ||
@@ -192,3 +194,3 @@ }; | ||
var _this = this; | ||
return this.client.put("/user/starred/" + repo, {}, function(err, s, b) { | ||
return this.client.put("/user/starred/" + repo, {}, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -202,3 +204,3 @@ return _this.star(repo); | ||
var _this = this; | ||
return this.client.del("/user/starred/" + repo, {}, function(err, s, b) { | ||
return this.client.del("/user/starred/" + repo, {}, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -210,4 +212,6 @@ return _this.unstar(repo); | ||
Me.prototype.watched = function(cb) { | ||
return this.client.get('/user/subscriptions', function(err, s, b) { | ||
Me.prototype.watched = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ['/user/subscriptions'].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -219,5 +223,5 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
@@ -236,3 +240,3 @@ | ||
cb = cbOrIdOrKey; | ||
return this.client.get('/user/keys', function(err, s, b) { | ||
return this.client.get('/user/keys', function(err, s, b, h) { | ||
if (err) { | ||
@@ -244,3 +248,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -252,3 +256,3 @@ }); | ||
Me.prototype.getKey = function(id, cb) { | ||
return this.client.get("/user/keys/" + id, function(err, s, b) { | ||
return this.client.get("/user/keys/" + id, function(err, s, b, h) { | ||
if (err) { | ||
@@ -260,3 +264,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -267,3 +271,3 @@ }); | ||
Me.prototype.createKey = function(key, cb) { | ||
return this.client.post('/user/keys', key, function(err, s, b) { | ||
return this.client.post('/user/keys', key, function(err, s, b, h) { | ||
if (err) { | ||
@@ -275,3 +279,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -282,3 +286,3 @@ }); | ||
Me.prototype.updateKey = function(id, key, cb) { | ||
return this.client.post("/user/keys/" + id, key, function(err, s, b) { | ||
return this.client.post("/user/keys/" + id, key, function(err, s, b, h) { | ||
if (err) { | ||
@@ -290,3 +294,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -298,3 +302,3 @@ }); | ||
var _this = this; | ||
return this.client.del("/user/keys/" + id, {}, function(err, s, b) { | ||
return this.client.del("/user/keys/" + id, {}, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -310,4 +314,6 @@ return _this.deleteKey(id); | ||
Me.prototype.orgs = function(cb) { | ||
return this.client.get("/user/orgs", function(err, s, b) { | ||
Me.prototype.orgs = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/user/orgs"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -319,12 +325,12 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
Me.prototype.repo = function(name, cb) { | ||
Me.prototype.repo = function(nameOrRepo, cb) { | ||
if (typeof cb === 'function' && typeof nameOrRepo === 'object') { | ||
return this.createRepo(nameOrRepo, cb); | ||
} else { | ||
return this.client.repo(name); | ||
return this.client.repo(nameOrRepo); | ||
} | ||
@@ -336,3 +342,3 @@ }; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/user/repos"].concat(__slice.call(params), [function(err, s, b) { | ||
return (_ref = this.client).get.apply(_ref, ["/user/repos"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -344,3 +350,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -351,3 +357,3 @@ }])); | ||
Me.prototype.createRepo = function(repo, cb) { | ||
return this.client.post("/user/repos", repo, function(err, s, b) { | ||
return this.client.post("/user/repos", repo, function(err, s, b, h) { | ||
if (err) { | ||
@@ -359,3 +365,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -366,3 +372,3 @@ }); | ||
Me.prototype.fork = function(repo, cb) { | ||
return this.client.post("/repos/" + repo + "/forks", {}, function(err, s, b) { | ||
return this.client.post("/repos/" + repo + "/forks", {}, function(err, s, b, h) { | ||
if (err) { | ||
@@ -374,3 +380,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -377,0 +383,0 @@ }); |
// Generated by CoffeeScript 1.6.3 | ||
(function() { | ||
var Org; | ||
var Org, | ||
__slice = [].slice; | ||
@@ -12,3 +13,3 @@ Org = (function() { | ||
Org.prototype.info = function(cb) { | ||
return this.client.get("/orgs/" + this.name, function(err, s, b) { | ||
return this.client.get("/orgs/" + this.name, function(err, s, b, h) { | ||
if (err) { | ||
@@ -20,3 +21,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -27,3 +28,3 @@ }); | ||
Org.prototype.update = function(info, cb) { | ||
return this.client.post("/orgs/" + this.name, info, function(err, s, b) { | ||
return this.client.post("/orgs/" + this.name, info, function(err, s, b, h) { | ||
if (err) { | ||
@@ -35,3 +36,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -41,22 +42,27 @@ }); | ||
Org.prototype.repos = function(cbOrRepo, cb) { | ||
if (typeof cb === 'function' && typeof cbOrRepo === 'object') { | ||
return this.createRepo(cbOrRepo, cb); | ||
Org.prototype.repo = function(nameOrRepo, cb) { | ||
if (typeof cb === 'function' && typeof nameOrRepo === 'object') { | ||
return this.createRepo(nameOrRepo, cb); | ||
} else { | ||
cb = cbOrRepo; | ||
return this.client.get("/orgs/" + this.name + "/repos", function(err, s, b) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error('Org repos error')); | ||
} else { | ||
return cb(null, b); | ||
} | ||
}); | ||
return this.client.repo("" + this.name + "/" + nameOrRepo); | ||
} | ||
}; | ||
Org.prototype.repos = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/orgs/" + this.name + "/repos"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error('Org repos error')); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}])); | ||
}; | ||
Org.prototype.createRepo = function(repo, cb) { | ||
return this.client.post("/orgs/" + this.name + "/repos", repo, function(err, s, b) { | ||
return this.client.post("/orgs/" + this.name + "/repos", repo, function(err, s, b, h) { | ||
if (err) { | ||
@@ -68,3 +74,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -75,3 +81,3 @@ }); | ||
Org.prototype.teams = function(cb) { | ||
return this.client.get("/orgs/" + this.name + "/teams", function(err, s, b) { | ||
return this.client.get("/orgs/" + this.name + "/teams", function(err, s, b, h) { | ||
if (err) { | ||
@@ -83,3 +89,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -90,3 +96,3 @@ }); | ||
Org.prototype.members = function(cb) { | ||
return this.client.get("/orgs/" + this.name + "/members", function(err, s, b) { | ||
return this.client.get("/orgs/" + this.name + "/members", function(err, s, b, h) { | ||
if (err) { | ||
@@ -98,3 +104,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -105,7 +111,7 @@ }); | ||
Org.prototype.member = function(user, cb) { | ||
return this.client.getNoFollow("/orgs/" + this.name + "/members/" + user, function(err, s, b) { | ||
return this.client.getNoFollow("/orgs/" + this.name + "/members/" + user, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204 || s === 302); | ||
return cb(null, s === 204, h); | ||
}); | ||
@@ -112,0 +118,0 @@ }; |
@@ -13,3 +13,3 @@ // Generated by CoffeeScript 1.6.3 | ||
Pr.prototype.info = function(cb) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number, function(err, s, b) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number, function(err, s, b, h) { | ||
if (err) { | ||
@@ -21,3 +21,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -28,3 +28,3 @@ }); | ||
Pr.prototype.update = function(obj, cb) { | ||
return this.client.post("/repos/" + this.repo + "/pulls/" + this.number, obj, function(err, s, b) { | ||
return this.client.post("/repos/" + this.repo + "/pulls/" + this.number, obj, function(err, s, b, h) { | ||
if (err) { | ||
@@ -36,3 +36,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -49,11 +49,7 @@ }); | ||
Pr.prototype.merged = function(cb) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/merge", function(err, s, b) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/merge", function(err, s, b, h) { | ||
if (err && err.message === 'null') { | ||
return cb(null, false); | ||
} | ||
if (s !== 204) { | ||
return cb(new Error("Pr merged error")); | ||
} else { | ||
return cb(null, true); | ||
} | ||
return cb(null, s === 204, h); | ||
}); | ||
@@ -63,9 +59,15 @@ }; | ||
Pr.prototype.merge = function(msg, cb) { | ||
return this.client.put("/repos/" + this.repo + "/pulls/" + this.number + "/merge", { | ||
var commit; | ||
commit = { | ||
commit_message: msg | ||
}, function(err, s, b) { | ||
}; | ||
return this.client.put("/repos/" + this.repo + "/pulls/" + this.number + "/merge", commit, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, b); | ||
if (s !== 200) { | ||
return cb(new Error("Pr merge error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
@@ -75,3 +77,3 @@ }; | ||
Pr.prototype.commits = function(cb) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/commits", function(err, s, b) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/commits", function(err, s, b, h) { | ||
if (err) { | ||
@@ -83,3 +85,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -90,3 +92,3 @@ }); | ||
Pr.prototype.comments = function(cb) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/comments", function(err, s, b) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/comments", function(err, s, b, h) { | ||
if (err) { | ||
@@ -98,3 +100,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -105,3 +107,3 @@ }); | ||
Pr.prototype.files = function(cb) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/files", function(err, s, b) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/files", function(err, s, b, h) { | ||
if (err) { | ||
@@ -113,3 +115,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -116,0 +118,0 @@ }); |
@@ -13,3 +13,3 @@ // Generated by CoffeeScript 1.6.3 | ||
Repo.prototype.info = function(cb) { | ||
return this.client.get("/repos/" + this.name, function(err, s, b) { | ||
return this.client.get("/repos/" + this.name, function(err, s, b, h) { | ||
if (err) { | ||
@@ -21,3 +21,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -32,3 +32,3 @@ }); | ||
cb = cbOrUser; | ||
return this.client.get("repos/" + this.name + "/collaborators", function(err, s, b) { | ||
return this.client.get("repos/" + this.name + "/collaborators", function(err, s, b, h) { | ||
if (err) { | ||
@@ -40,3 +40,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -48,11 +48,7 @@ }); | ||
Repo.prototype.hasCollaborator = function(user, cb) { | ||
return this.client.get("repos/" + this.name + "/collaborators/" + user, function(err, s, b) { | ||
return this.client.get("repos/" + this.name + "/collaborators/" + user, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 204 && s !== 404) { | ||
return cb(new Error("Repo hasCollaborator error")); | ||
} else { | ||
return cb(null, b); | ||
} | ||
return cb(null, s === 204, h); | ||
}); | ||
@@ -62,3 +58,3 @@ }; | ||
Repo.prototype.commits = function(cb) { | ||
return this.client.get("/repos/" + this.name + "/commits", function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/commits", function(err, s, b, h) { | ||
if (err) { | ||
@@ -70,3 +66,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -77,3 +73,3 @@ }); | ||
Repo.prototype.commit = function(sha, cb) { | ||
return this.client.get("/repos/" + this.name + "/commits/" + sha, function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/commits/" + sha, function(err, s, b, h) { | ||
if (err) { | ||
@@ -85,3 +81,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -92,3 +88,3 @@ }); | ||
Repo.prototype.tags = function(cb) { | ||
return this.client.get("/repos/" + this.name + "/tags", function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/tags", function(err, s, b, h) { | ||
if (err) { | ||
@@ -100,3 +96,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -107,3 +103,3 @@ }); | ||
Repo.prototype.languages = function(cb) { | ||
return this.client.get("/repos/" + this.name + "/languages", function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/languages", function(err, s, b, h) { | ||
if (err) { | ||
@@ -115,3 +111,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -122,3 +118,3 @@ }); | ||
Repo.prototype.contributors = function(cb) { | ||
return this.client.get("/repos/" + this.name + "/contributors", function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/contributors", function(err, s, b, h) { | ||
if (err) { | ||
@@ -130,3 +126,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -137,3 +133,3 @@ }); | ||
Repo.prototype.teams = function(cb) { | ||
return this.client.get("/repos/" + this.name + "/teams", function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/teams", function(err, s, b, h) { | ||
if (err) { | ||
@@ -145,3 +141,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -152,3 +148,3 @@ }); | ||
Repo.prototype.branches = function(cb) { | ||
return this.client.get("/repos/" + this.name + "/branches", function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/branches", function(err, s, b, h) { | ||
if (err) { | ||
@@ -160,3 +156,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -177,3 +173,3 @@ }); | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/repos/" + this.name + "/issues"].concat(__slice.call(params), [function(err, s, b, headers) { | ||
return (_ref = this.client).get.apply(_ref, ["/repos/" + this.name + "/issues"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -185,3 +181,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b, headers); | ||
return cb(null, b, h); | ||
} | ||
@@ -192,7 +188,10 @@ }])); | ||
Repo.prototype.createIssue = function(issue, cb) { | ||
return this.client.post("/repos/" + this.name + "/issues", issue, function(err, s, b) { | ||
return this.client.post("/repos/" + this.name + "/issues", issue, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 201) { | ||
return cb(new Error("Repo createIssue error")); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -207,3 +206,3 @@ }); | ||
} | ||
return this.client.get("/repos/" + this.name + "/readme?ref=" + cbOrRef, function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/readme?ref=" + cbOrRef, function(err, s, b, h) { | ||
if (err) { | ||
@@ -215,3 +214,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -226,3 +225,3 @@ }); | ||
} | ||
return this.client.get("/repos/" + this.name + "/contents/" + path + "?ref=" + cbOrRef, function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/contents/" + path + "?ref=" + cbOrRef, function(err, s, b, h) { | ||
if (err) { | ||
@@ -234,3 +233,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -252,3 +251,3 @@ }); | ||
} else { | ||
return cb(null, h['Location']); | ||
return cb(null, h['Location'], h); | ||
} | ||
@@ -259,3 +258,3 @@ }); | ||
Repo.prototype.forks = function(cb) { | ||
return this.client.get("/repos/" + this.name + "/forks", function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/forks", function(err, s, b, h) { | ||
if (err) { | ||
@@ -267,3 +266,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -276,3 +275,3 @@ }); | ||
Accept: 'application/vnd.github.raw' | ||
}, function(err, s, b) { | ||
}, function(err, s, b, h) { | ||
if (err) { | ||
@@ -284,3 +283,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -300,3 +299,3 @@ }); | ||
} | ||
return this.client.get(url, function(err, s, b) { | ||
return this.client.get(url, function(err, s, b, h) { | ||
if (err) { | ||
@@ -308,3 +307,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -316,3 +315,3 @@ }); | ||
var _this = this; | ||
return this.client.del("/repos/" + this.name, {}, function(err, s, b) { | ||
return this.client.del("/repos/" + this.name, {}, function(err, s, b, h) { | ||
if ((err != null) || s !== 204) { | ||
@@ -335,3 +334,3 @@ return _this.destroy(); | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/repos/" + this.name + "/pulls"].concat(__slice.call(params), [function(err, s, b) { | ||
return (_ref = this.client).get.apply(_ref, ["/repos/" + this.name + "/pulls"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -343,3 +342,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -350,3 +349,3 @@ }])); | ||
Repo.prototype.createPr = function(pr, cb) { | ||
return this.client.post("/repos/" + this.name + "/pulls", pr, function(err, s, b) { | ||
return this.client.post("/repos/" + this.name + "/pulls", pr, function(err, s, b, h) { | ||
if (err) { | ||
@@ -358,3 +357,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -365,3 +364,3 @@ }); | ||
Repo.prototype.statuses = function(ref, cb) { | ||
return this.client.get("/repos/" + this.name + "/statuses/" + ref, function(err, s, b) { | ||
return this.client.get("/repos/" + this.name + "/statuses/" + ref, function(err, s, b, h) { | ||
if (err) { | ||
@@ -373,3 +372,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -380,3 +379,3 @@ }); | ||
Repo.prototype.status = function(sha, obj, cb) { | ||
return this.client.post("/repos/" + this.name + "/statuses/" + sha, obj, function(err, s, b) { | ||
return this.client.post("/repos/" + this.name + "/statuses/" + sha, obj, function(err, s, b, h) { | ||
if (err) { | ||
@@ -388,3 +387,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -395,7 +394,5 @@ }); | ||
Repo.prototype.stargazers = function() { | ||
var cb, page, params, per_page, _i; | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
page = params[0] || 1; | ||
per_page = params[1] || 30; | ||
return this.client.get("/repos/" + this.name + "/stargazers", page, per_page, function(err, s, b, headers) { | ||
return (_ref = this.client).get.apply(_ref, ["/repos/" + this.name + "/stargazers"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -407,5 +404,5 @@ return cb(err); | ||
} else { | ||
return cb(null, b, headers); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
@@ -412,0 +409,0 @@ |
@@ -14,3 +14,3 @@ // Generated by CoffeeScript 1.6.3 | ||
} | ||
return this.client.get("/legacy/issues/search/" + repo + "/" + state + "/" + keyword, function(err, s, b) { | ||
return this.client.get("/legacy/issues/search/" + repo + "/" + state + "/" + keyword, function(err, s, b, h) { | ||
if (err) { | ||
@@ -22,3 +22,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b.issues); | ||
return cb(null, b.issues, h); | ||
} | ||
@@ -37,3 +37,3 @@ }); | ||
} | ||
return this.client.get("/legacy/repos/search/" + keyword + "?" + param, function(err, s, b) { | ||
return this.client.get("/legacy/repos/search/" + keyword + "?" + param, function(err, s, b, h) { | ||
if (err) { | ||
@@ -45,3 +45,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b.repositories); | ||
return cb(null, b.repositories, h); | ||
} | ||
@@ -57,3 +57,3 @@ }); | ||
} | ||
return this.client.get("/legacy/user/search/" + keyword + "?" + param, function(err, s, b) { | ||
return this.client.get("/legacy/user/search/" + keyword + "?" + param, function(err, s, b, h) { | ||
if (err) { | ||
@@ -65,3 +65,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b.users); | ||
return cb(null, b.users, h); | ||
} | ||
@@ -72,3 +72,3 @@ }); | ||
Search.prototype.emails = function(email, cb) { | ||
return this.client.get("/legacy/user/email/" + email, function(err, s, b) { | ||
return this.client.get("/legacy/user/email/" + email, function(err, s, b, h) { | ||
if (err) { | ||
@@ -80,3 +80,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b.user); | ||
return cb(null, b.user, h); | ||
} | ||
@@ -83,0 +83,0 @@ }); |
@@ -12,3 +12,3 @@ // Generated by CoffeeScript 1.6.3 | ||
Team.prototype.info = function(cb) { | ||
return this.client.get("/teams/" + this.id, function(err, s, b) { | ||
return this.client.get("/teams/" + this.id, function(err, s, b, h) { | ||
if (err) { | ||
@@ -20,3 +20,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -27,3 +27,3 @@ }); | ||
Team.prototype.members = function(cb) { | ||
return this.client.get("/teams/" + this.id + "/members", function(err, s, b) { | ||
return this.client.get("/teams/" + this.id + "/members", function(err, s, b, h) { | ||
if (err) { | ||
@@ -35,3 +35,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -42,7 +42,7 @@ }); | ||
Team.prototype.member = function(user, cb) { | ||
return this.client.get("/teams/" + this.id + "/members/" + user, function(err, s, b) { | ||
return this.client.get("/teams/" + this.id + "/members/" + user, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
return cb(null, s === 204); | ||
return cb(null, s === 204, h); | ||
}); | ||
@@ -49,0 +49,0 @@ }; |
// Generated by CoffeeScript 1.6.3 | ||
(function() { | ||
var User; | ||
var User, | ||
__slice = [].slice; | ||
@@ -19,3 +20,3 @@ User = (function() { | ||
User.prototype.info = function(cb) { | ||
return this.client.get("/users/" + this.login, function(err, s, b) { | ||
return this.client.get("/users/" + this.login, function(err, s, b, h) { | ||
if (err) { | ||
@@ -27,3 +28,3 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
@@ -33,4 +34,6 @@ }); | ||
User.prototype.followers = function(cb) { | ||
return this.client.get("/users/" + this.login + "/followers", function(err, s, b) { | ||
User.prototype.followers = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/users/" + this.login + "/followers"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -42,9 +45,11 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
User.prototype.following = function(cb) { | ||
return this.client.get("/users/" + this.login + "/following", function(err, s, b) { | ||
User.prototype.following = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/users/" + this.login + "/following"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -56,8 +61,10 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
User.prototype.events = function(events, cb) { | ||
User.prototype.events = function() { | ||
var cb, events, params, _i, _ref; | ||
params = 3 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 2) : (_i = 0, []), events = arguments[_i++], cb = arguments[_i++]; | ||
if (!cb && typeof events === 'function') { | ||
@@ -69,3 +76,3 @@ cb = events; | ||
} | ||
return this.client.get("/users/" + this.login + "/events", function(err, s, b) { | ||
return (_ref = this.client).get.apply(_ref, ["/users/" + this.login + "/events"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -77,10 +84,13 @@ return cb(err); | ||
} | ||
return cb(null, b.filter(function(event) { | ||
b = b.filter(function(event) { | ||
return events.indexOf(event.type) !== -1; | ||
})); | ||
}); | ||
}); | ||
return cb(null, b, h); | ||
}])); | ||
}; | ||
User.prototype.orgs = function(cb) { | ||
return this.client.get("/users/" + this.login + "/orgs", function(err, s, b) { | ||
User.prototype.orgs = function() { | ||
var cb, params, _i, _ref; | ||
params = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), cb = arguments[_i++]; | ||
return (_ref = this.client).get.apply(_ref, ["/users/" + this.login + "/orgs"].concat(__slice.call(params), [function(err, s, b, h) { | ||
if (err) { | ||
@@ -92,5 +102,5 @@ return cb(err); | ||
} else { | ||
return cb(null, b); | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}])); | ||
}; | ||
@@ -97,0 +107,0 @@ |
{ | ||
"name": "octonode", | ||
"version": "0.3.9", | ||
"version": "0.4.0", | ||
"author": "Pavan Kumar Sunkara <pavan.sss1991@gmail.com> (http://pksunkara.github.com)", | ||
@@ -5,0 +5,0 @@ "description": "nodejs wrapper for github v3 api", |
224
README.md
@@ -21,2 +21,4 @@ # octonode | ||
var ghorg = client.org('flatiron'); | ||
var ghissue = client.issue('pksunkara/hub', 37); | ||
var ghpr = client.pr('pksunkara/hub', 37); | ||
var ghgist = client.gist(); | ||
@@ -164,8 +166,32 @@ var ghteam = client.team(37); | ||
```js | ||
ghme.info(function(err, data) { | ||
ghme.info(function(err, data, headers) { | ||
console.log("error: " + err); | ||
console.log("data: " + data); | ||
console.log("headers:" + headers); | ||
}); | ||
``` | ||
## Pagination | ||
If a function is said to be supporting pagination, then that function can be used in many ways as shown below. Results from the function are arranged in [pages](http://developer.github.com/v3/#pagination). | ||
The page argument is optional and is used to specify which page of issues to retrieve. | ||
The perPage argument is also optional and is used to specify how many issues per page. | ||
```js | ||
// Normal usage of function | ||
ghrepo.issues(callback); //array of first 30 issues | ||
// Using pagination parameters | ||
ghrepo.issues(2, 100, callback); //array of second 100 issues | ||
ghrepo.issues(10, callback); //array of 30 issues from page 10 | ||
// Pagination parameters can be set with query object too | ||
ghrepo.issues({ | ||
page: 2, | ||
per_page: 100, | ||
state: 'closed' | ||
}, callback); //array of second 100 issues which are closed | ||
``` | ||
## Github authenticated user api | ||
@@ -218,2 +244,4 @@ | ||
This query supports [pagination](#pagination). | ||
```js | ||
@@ -271,6 +299,42 @@ ghme.following(callback); //array of github users | ||
#### Get the starred repos for the user (GET /user/starred) | ||
This query supports [pagination](#pagination). | ||
```js | ||
ghme.starred(callback); //array of repos | ||
``` | ||
#### Check if you have starred a repository (GET /user/starred/pksunkara/octonode) | ||
```js | ||
ghme.starred('flatiron/flatiron', callback); //boolean | ||
``` | ||
#### Star a repository (PUT /user/starred/pksunkara/octonode) | ||
```js | ||
ghme.star('flatiron/flatiron'); | ||
``` | ||
#### Unstar a repository (DELETE /user/starred/pksunkara/octonode) | ||
```js | ||
ghme.unstar('flatiron/flatiron'); | ||
``` | ||
#### Get the subscriptions of the user (GET /user/subscriptions) | ||
This query supports [pagination](#pagination). | ||
```js | ||
ghme.watched(callback); //array of repos | ||
``` | ||
#### List your public and private organizations (GET /user/orgs) | ||
This query supports [pagination](#pagination). | ||
```js | ||
ghme.orgs(callback); // array of orgs | ||
ghme.orgs(callback); //array of orgs | ||
``` | ||
@@ -280,2 +344,4 @@ | ||
This query supports [pagination](#pagination). | ||
```js | ||
@@ -288,3 +354,3 @@ ghme.repos(callback); //array of repos | ||
```js | ||
ghme.repos({ | ||
ghme.repo({ | ||
"name": "Hello-World", | ||
@@ -313,2 +379,4 @@ "description": "This is your first repo", | ||
This query supports [pagination](#pagination). | ||
```js | ||
@@ -320,2 +388,4 @@ ghuser.followers(callback); //array of github users | ||
This query supports [pagination](#pagination). | ||
```js | ||
@@ -325,9 +395,18 @@ ghuser.following(callback); //array of github users | ||
#### Get user organizations (GET /users/pksunkara/orgs) | ||
#### Get events performed by a user (GET /users/pksunkara/events) | ||
This query supports [pagination](#pagination). | ||
```js | ||
ghuser.events(['commit_comment'], callback); //array of events | ||
``` | ||
#### Get user public organizations (GET /users/pksunkara/orgs) | ||
This query supports [pagination](#pagination). | ||
```js | ||
ghuser.orgs(callback); //array of organizations | ||
``` | ||
## Github repositories api | ||
@@ -359,2 +438,7 @@ | ||
#### Get a certain commit for a repository (GET /repos/pksunkara/hub/commits/18293abcd72) | ||
```js | ||
ghrepo.commit('18293abcd72', callback); //commit | ||
``` | ||
#### Get the tags for a repository (GET /repos/pksunkara/hub/tags) | ||
@@ -386,19 +470,39 @@ | ||
Issues are arranged in [pages](http://developer.github.com/v3/#pagination). | ||
The page argument is optional and is used to specify which page of issues to retrieve. | ||
The perPage argument is also optional and is used to specify how many issues per page. | ||
Alternatively, you can pass in [parameters](http://developer.github.com/v3/issues/#parameters-1) as an object. | ||
This query supports [pagination](#pagination). | ||
```js | ||
ghrepo.issues(page, perPage, callback); //array of issues | ||
ghrepo.issues(1, 100, callback); //array of first 100 issues | ||
ghrepo.issues(10, callback); //array of 30 issues from page 10 | ||
ghrepo.issues(callback); //array of first 30 issues | ||
ghrepo.issues({ | ||
page: 2, | ||
per_page: 100, | ||
state: 'closed' | ||
}, callback); //array of issues from page 2 of all closed issues | ||
ghrepo.issues(callback); //array of issues | ||
``` | ||
#### Create an issue for a repository (POST /repos/pksunkara/hub/issues) | ||
```js | ||
ghrepo.issue({ | ||
"title": "Found a bug", | ||
"body": "I'm having a problem with this.", | ||
"assignee": "octocat", | ||
"milestone": 1, | ||
"labels": ["Label1", "Label2"] | ||
}, callback); //issue | ||
``` | ||
#### Get the pull requests for a repository (GET /repos/pksunkara/hub/pulls) | ||
This query supports [pagination](#pagination). | ||
```js | ||
ghrepo.prs(callback); //array of pull requests | ||
``` | ||
#### Create a pull request (POST /repos/pksunkara/hub/pulls) | ||
```js | ||
ghrepo.pr({ | ||
"title": "Amazing new feature", | ||
"body": "Please pull this in!", | ||
"head": "octocat:new-feature", | ||
"base": "master" | ||
}, callback); //pull request | ||
``` | ||
#### Get the README for a repository (GET /repos/pksunkara/hub/readme) | ||
@@ -461,3 +565,3 @@ | ||
```js | ||
ghrepo.statuses('master', callback); // array of statuses | ||
ghrepo.statuses('master', callback); //array of statuses | ||
``` | ||
@@ -493,2 +597,4 @@ | ||
This query supports [pagination](#pagination). | ||
```js | ||
@@ -501,3 +607,3 @@ ghorg.repos(callback); //array of repos | ||
```js | ||
ghorg.repos({ | ||
ghorg.repo({ | ||
name: 'Hello-world', | ||
@@ -526,2 +632,72 @@ description: 'My first world program' | ||
## Github issues api | ||
#### Get a single issue (GET /repos/pksunkara/hub/issues/37) | ||
```js | ||
ghissue.info(callback); //issue | ||
``` | ||
#### Edit an issue for a repository (PATCH /repos/pksunkara/hub/issues/37) | ||
```js | ||
ghissue.update({ | ||
"title": "Found a bug and I am serious", | ||
}, callback); //issue | ||
``` | ||
#### List comments on an issue (GET /repos/pksunkara/hub/issues/37/comments) | ||
This query supports [pagination](#pagination). | ||
```js | ||
ghissue.comments(callback); //array of comments | ||
``` | ||
## Github pull requests api | ||
#### Get a single pull request (GET /repos/pksunkara/hub/pulls/37) | ||
```js | ||
ghpr.info(callback); //pull request | ||
``` | ||
#### Update a pull request (PATCH /repos/pksunkara/hub/pulls/37) | ||
```js | ||
ghpr.update({ | ||
'title': 'Wow this pr' | ||
}, callback); //pull request | ||
``` | ||
#### Close a pull request | ||
```js | ||
ghpr.close(callback); //pull request | ||
``` | ||
#### Get if a pull request has been merged (GET /repos/pksunkara/hub/pulls/37/merge) | ||
```js | ||
ghpr.merged(callback); //boolean | ||
``` | ||
#### List commits on a pull request (GET /repos/pksunkara/hub/pulls/37/commits) | ||
```js | ||
ghpr.commits(callback); //array of commits | ||
``` | ||
#### List comments on a pull request (GET /repos/pksunkara/hub/pulls/37/comments) | ||
```js | ||
ghpr.comments(callback); //array of comments | ||
``` | ||
#### List files in pull request (GET /repos/pksunkara/hub/pulls/37/files) | ||
```js | ||
ghpr.files(callback); //array of files | ||
``` | ||
## Github gists api | ||
@@ -531,2 +707,4 @@ | ||
This query supports [pagination](#pagination). | ||
```js | ||
@@ -538,2 +716,4 @@ ghgist.list(callback); //array of gists | ||
This query supports [pagination](#pagination). | ||
```js | ||
@@ -545,2 +725,4 @@ ghgist.public(callback); //array of gists | ||
This query supports [pagination](#pagination). | ||
```js | ||
@@ -552,2 +734,4 @@ ghgist.starred(callback); //array of gists | ||
This query supports [pagination](#pagination). | ||
```js | ||
@@ -554,0 +738,0 @@ ghgist.user('pksunkara', callback); //array of gists |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79599
1716
994