diff --git a/lib/octonode/repo.js b/lib/octonode/repo.js index 0a0907b..dc3cee0 100644 --- a/lib/octonode/repo.js +++ b/lib/octonode/repo.js @@ -49,8 +49,10 @@ }); }; - Repo.prototype.commits = function(cb) { - return this.client.get("/repos/" + this.name + "/commits", function(err, s, b, h) { + Repo.prototype.commits = 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.name + "/commits"].concat(__slice.call(params), [function(err, s, b, h) { if (err) { return cb(err); } @@ -59,7 +61,7 @@ } else { return cb(null, b, h); } - }); + }])); }; Repo.prototype.commit = function(sha, cb) { diff --git a/src/octonode/repo.coffee b/src/octonode/repo.coffee index e4cea3b..c14ee17 100755 --- a/src/octonode/repo.coffee +++ b/src/octonode/repo.coffee @@ -38,8 +38,10 @@ class Repo # Get the commits for a repository # '/repos/pksunkara/hub/commits' GET - commits: (cb) -> - @client.get "/repos/#{@name}/commits", (err, s, b, h) -> + # - page or query object, optional - params[0] + # - per_page, optional - params[1] + commits: (params..., cb) -> + @client.get "/repos/#{@name}/commits", params..., (err, s, b, h) -> return cb(err) if err if s isnt 200 then cb(new Error("Repo commits error")) else cb null, b, h