Skip to content

Commit

Permalink
listTags, listPulls, getPull & compare functions
Browse files Browse the repository at this point in the history
Partially taken from issue github-tools#73, also closes github-tools#73
  • Loading branch information
mattpass committed Oct 3, 2013
1 parent ab0b0f5 commit d6c15b8
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions github.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,46 @@
_request("DELETE", repoPath, options, cb);
};

// List all tags of a repository
// -------

this.listTags = function(cb) {
_request("GET", repoPath + "/tags", null, function(err, tags) {
if (err) return cb(err);
cb(null, tags);
});
};

// List all pull requests of a respository
// -------

this.listPulls = function(state, cb) {
_request("GET", repoPath + "/pulls" + (state ? '?state=' + state : ''), null, function(err, pulls) {
if (err) return cb(err);
cb(null, pulls);
});
};

// Gets details for a specific pull request
// -------

this.getPull = function(number, cb) {
_request("GET", repoPath + "/pulls/" + number, null, function(err, pull) {
if (err) return cb(err);
cb(null, pull);
});
};

// Retrieve the changes made between base and head
// -------

this.compare = function(base, head, cb) {
_request("GET", repoPath + "/compare/" + base + "..." + head, null, function(err, diff) {
if (err) return cb(err);
cb(null, diff);
});
};

// List all branches of a repository
// -------

Expand Down

0 comments on commit d6c15b8

Please sign in to comment.