From b40dc9bc794d2b3e1b6f2edd7fa0640d7fe749b8 Mon Sep 17 00:00:00 2001 From: Guido Marucci Blas Date: Mon, 4 Mar 2013 02:20:25 -0300 Subject: [PATCH] Adds support for fetching repository issues --- README.md | 6 ++++++ github.js | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 02e026f2..8396e5d3 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,13 @@ gist.update(delta, function(err, gist) { }); ``` +## Issues API +To read all the issues of a given repository + +```js +github.getIssues(owner, repo, function(err, issues) {}) +``` ## Tests diff --git a/github.js b/github.js index f9a1d726..8a3a0d1f 100644 --- a/github.js +++ b/github.js @@ -481,9 +481,26 @@ }; }; + // Issues API + // ========== + + Github.Issue = function(options) { + var path = "/repos/" + options.owner + "/" + options.repo + "/issues"; + + this.list = function(options, cb) { + _request("GET", path, options, function(err, res) { + cb(err,res) + }); + }; + }; + // Top Level API // ------- + this.getIssues = function(owner, repo) { + return new Github.Issue({owner: owner, repo: repo}); + }; + this.getRepo = function(user, repo) { return new Github.Repository({user: user, name: repo}); };