octonode
Advanced tools
Comparing version 0.7.12 to 0.7.13
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var octonode; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var auth, qs, randomstring, request, url; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Client, Gist, HttpError, Issue, Label, Me, Milestone, Notification, Org, Pr, Release, Repo, Search, Team, User, extend, request, url, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Gist, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Issue, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Label; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Me, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Milestone; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Notification; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Org, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -135,2 +135,144 @@ var Pr; | ||
Pr.prototype.reviews = function(cb) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/reviews", function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Pr reviews error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
Pr.prototype.review = function(id, cb) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/reviews/" + id, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Pr review error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
Pr.prototype.removeReview = function(id, cb) { | ||
return this.client.del("/repos/" + this.repo + "/pulls/" + this.number + "/reviews/" + id, {}, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Pr removeReview error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
Pr.prototype.reviewComments = function(id, cb) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/reviews/" + id + "/comments", function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Pr reviewComments error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
Pr.prototype.createReview = function(reviewBody, cb) { | ||
return this.client.post("/repos/" + this.repo + "/pulls/" + this.number + "/reviews", reviewBody, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Pr createReview error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
Pr.prototype.submitReview = function(id, reviewBody, cb) { | ||
return this.client.post("/repos/" + this.repo + "/pulls/" + this.number + "/reviews/" + id + "/events", reviewBody, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Pr submitReview error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
Pr.prototype.dismissReview = function(id, dismissalMessage, cb) { | ||
var dismissal; | ||
dismissal = { | ||
message: dismissalMessage | ||
}; | ||
return this.client.put("/repos/" + this.repo + "/pulls/" + this.number + "/reviews/" + id + "/dismissals", dismissal, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Pr dismissReview error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
Pr.prototype.reviewRequests = function(cb) { | ||
return this.client.get("/repos/" + this.repo + "/pulls/" + this.number + "/requested_reviewers", function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Pr reviewRequests error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
Pr.prototype.createReviewRequests = function(usernames, cb) { | ||
var reviewRequest; | ||
reviewRequest = { | ||
reviewers: usernames | ||
}; | ||
return this.client.post("/repos/" + this.repo + "/pulls/" + this.number + "/requested_reviewers", reviewRequest, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 201) { | ||
return cb(new Error("Pr createReviewRequests error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
Pr.prototype.removeReviewRequests = function(usernames, cb) { | ||
var reviewRequest; | ||
reviewRequest = { | ||
reviewers: usernames | ||
}; | ||
return this.client.del("/repos/" + this.repo + "/pulls/" + this.number + "/requested_reviewers", reviewRequest, function(err, s, b, h) { | ||
if (err) { | ||
return cb(err); | ||
} | ||
if (s !== 200) { | ||
return cb(new Error("Pr removeReviewRequests error")); | ||
} else { | ||
return cb(null, b, h); | ||
} | ||
}); | ||
}; | ||
return Pr; | ||
@@ -137,0 +279,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Project; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Release; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Repo, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Search; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Team, |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.12.5 | ||
// Generated by CoffeeScript 1.12.6 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var User, |
{ | ||
"name": "octonode", | ||
"version": "0.7.12", | ||
"version": "0.7.13", | ||
"author": "Pavan Kumar Sunkara <pavan.sss1991@gmail.com> (http://pksunkara.github.com)", | ||
@@ -5,0 +5,0 @@ "description": "nodejs wrapper for github v3 api", |
@@ -870,2 +870,4 @@ # octonode [![Gitter chat](https://badges.gitter.im/pksunkara/octonode.svg)](https://gitter.im/pksunkara/octonode) | ||
This query supports [pagination](#pagination). | ||
```js | ||
@@ -1156,2 +1158,76 @@ ghorg.teams(callback); //array of teams | ||
``` | ||
#### List pull request reviews (GET /repos/pksunkara/hub/pulls/37/reviews) | ||
```js | ||
ghpr.reviews(callback); //array of pull request reviews | ||
``` | ||
#### Get a single pull request review (GET /repos/pksunkara/hub/pulls/37/reviews/104) | ||
```js | ||
ghpr.review(104, callback); //pull request review | ||
``` | ||
#### Delete a *pending* pull request review (DELETE /repos/pksunkara/hub/pulls/37/reviews/104) | ||
```js | ||
ghpr.removeReview(104, callback); //pull request review | ||
``` | ||
#### List comments for a pull request review (GET /repos/pksunkara/hub/pulls/37/reviews/104/comments) | ||
```js | ||
ghpr.reviewComments(104, callback); //array of review comments | ||
``` | ||
#### Create a pull request review (POST /repos/pksunkara/hub/pulls/37/reviews) | ||
```js | ||
ghpr.createReview({ | ||
body: 'review message', // optional | ||
comments: [ // optional | ||
{ | ||
body: 'comment message', // required for each optional comment | ||
path: 'file.txt', // required for each optional comment | ||
position: 4 // required for each optional comment | ||
} | ||
], | ||
event: 'APPROVE || COMMENT || REQUEST_CHANGES' // optional | ||
}, callback); //pull request review | ||
``` | ||
#### Submit a pull request review (POST /repos/pksunkara/hub/pulls/37/reviews/104/events) | ||
```js | ||
ghpr.submitReview(104, { | ||
body: 'review message', // optional | ||
event: 'APPROVE || COMMENT || REQUEST_CHANGES' // required | ||
}, callback); //pull request review | ||
``` | ||
#### Dismiss a pull request review (PUT /repos/pksunkara/hub/pulls/37/reviews/104/dismissals) | ||
```js | ||
ghpr.dismissReview(104, 'dismissal message', callback); //pull request review | ||
``` | ||
#### List review requests (GET /repos/pksunkara/hub/pulls/37/requested_reviewers) | ||
```js | ||
ghpr.reviewRequests(callback); //array of review requests | ||
``` | ||
#### Create review request(s) (POST /repos/pksunkara/hub/pulls/37/requested_reviewers) | ||
```js | ||
ghpr.createReviewRequests(['user1', 'user2'], callback); //pull request | ||
``` | ||
#### Delete review request(s) (DELETE /repos/pksunkara/hub/pulls/37/requested_reviewers) | ||
```js | ||
ghpr.removeReviewRequests(['user1', 'user2'], callback); //pull request | ||
``` | ||
## Github releases api | ||
@@ -1158,0 +1234,0 @@ |
144752
3285
1650