Skip to content

Commit

Permalink
preview pull request reviews
Browse files Browse the repository at this point in the history
resolves #480
  • Loading branch information
Joe Gallo committed Dec 19, 2016
1 parent 329c59c commit 92b5ee7
Show file tree
Hide file tree
Showing 4 changed files with 359 additions and 1 deletion.
55 changes: 55 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,55 @@ declare namespace Github {
sha?: string;
merge_method?: "merge"|"squash"|"rebase";
};
export type PullRequestsGetPullRequestReviewsParams =
& Owner
& Repo
& Number
& Page
& PerPage
;
export type PullRequestsGetPullRequestReviewParams =
& Owner
& Number
& Id
;
export type PullRequestsGetPullRequestReviewsCommentsParams =
& Owner
& Number
& Id
& Page
& PerPage
;
export type PullRequestsCreatePullRequestReviewParams =
& Owner
& Repo
& Number
& {
body?: string[];
event?: "APPROVE"|"REQUEST_CHANGES"|"COMMENT"|"PENDING";
comments?: Array;
path?: string;
position?: number;
};
export type PullRequestsSubmitPullRequestReviewParams =
& Owner
& Repo
& Number
& Id
& {
body?: string[];
event?: "APPROVE"|"REQUEST_CHANGES"|"COMMENT"|"PENDING";
};
export type PullRequestsDismissPullRequestReviewParams =
& Owner
& Repo
& Number
& Id
& Page
& PerPage
& {
message?: string;
};
export type PullRequestsGetCommentsParams =
& Owner
& Repo
Expand Down Expand Up @@ -2699,6 +2748,12 @@ declare class Github {
getFiles(params: Github.PullRequestsGetFilesParams, callback?: Github.Callback): Promise<any>;
checkMerged(params: Github.PullRequestsCheckMergedParams, callback?: Github.Callback): Promise<any>;
merge(params: Github.PullRequestsMergeParams, callback?: Github.Callback): Promise<any>;
getPullRequestReviews(params: Github.PullRequestsGetPullRequestReviewsParams, callback?: Github.Callback): Promise<any>;
getPullRequestReview(params: Github.PullRequestsGetPullRequestReviewParams, callback?: Github.Callback): Promise<any>;
getPullRequestReviewsComments(params: Github.PullRequestsGetPullRequestReviewsCommentsParams, callback?: Github.Callback): Promise<any>;
createPullRequestReview(params: Github.PullRequestsCreatePullRequestReviewParams, callback?: Github.Callback): Promise<any>;
submitPullRequestReview(params: Github.PullRequestsSubmitPullRequestReviewParams, callback?: Github.Callback): Promise<any>;
dismissPullRequestReview(params: Github.PullRequestsDismissPullRequestReviewParams, callback?: Github.Callback): Promise<any>;
getComments(params: Github.PullRequestsGetCommentsParams, callback?: Github.Callback): Promise<any>;
getCommentsForRepo(params: Github.PullRequestsGetCommentsForRepoParams, callback?: Github.Callback): Promise<any>;
getComment(params: Github.PullRequestsGetCommentParams, callback?: Github.Callback): Promise<any>;
Expand Down
55 changes: 55 additions & 0 deletions lib/index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -1294,6 +1294,55 @@ declare module "github" {
sha?: string;
merge_method?: "merge"|"squash"|"rebase";
};
declare type PullRequestsGetPullRequestReviewsParams =
& Owner
& Repo
& Number
& Page
& PerPage
;
declare type PullRequestsGetPullRequestReviewParams =
& Owner
& Number
& Id
;
declare type PullRequestsGetPullRequestReviewsCommentsParams =
& Owner
& Number
& Id
& Page
& PerPage
;
declare type PullRequestsCreatePullRequestReviewParams =
& Owner
& Repo
& Number
& {
body?: string[];
event?: "APPROVE"|"REQUEST_CHANGES"|"COMMENT"|"PENDING";
comments?: Array;
path?: string;
position?: number;
};
declare type PullRequestsSubmitPullRequestReviewParams =
& Owner
& Repo
& Number
& Id
& {
body?: string[];
event?: "APPROVE"|"REQUEST_CHANGES"|"COMMENT"|"PENDING";
};
declare type PullRequestsDismissPullRequestReviewParams =
& Owner
& Repo
& Number
& Id
& Page
& PerPage
& {
message?: string;
};
declare type PullRequestsGetCommentsParams =
& Owner
& Repo
Expand Down Expand Up @@ -2684,6 +2733,12 @@ declare module "github" {
getFiles(params: PullRequestsGetFilesParams, callback?: Callback): Promise<any>;
checkMerged(params: PullRequestsCheckMergedParams, callback?: Callback): Promise<any>;
merge(params: PullRequestsMergeParams, callback?: Callback): Promise<any>;
getPullRequestReviews(params: PullRequestsGetPullRequestReviewsParams, callback?: Callback): Promise<any>;
getPullRequestReview(params: PullRequestsGetPullRequestReviewParams, callback?: Callback): Promise<any>;
getPullRequestReviewsComments(params: PullRequestsGetPullRequestReviewsCommentsParams, callback?: Callback): Promise<any>;
createPullRequestReview(params: PullRequestsCreatePullRequestReviewParams, callback?: Callback): Promise<any>;
submitPullRequestReview(params: PullRequestsSubmitPullRequestReviewParams, callback?: Callback): Promise<any>;
dismissPullRequestReview(params: PullRequestsDismissPullRequestReviewParams, callback?: Callback): Promise<any>;
getComments(params: PullRequestsGetCommentsParams, callback?: Callback): Promise<any>;
getCommentsForRepo(params: PullRequestsGetCommentsForRepoParams, callback?: Callback): Promise<any>;
getComment(params: PullRequestsGetCommentParams, callback?: Callback): Promise<any>;
Expand Down
144 changes: 143 additions & 1 deletion lib/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,14 @@

"application/vnd.github.mockingbird-preview": [
"/repos/:owner/:repo/issues/:issue_number/timeline"
],

"application/vnd.github.black-cat-preview+json": [
"/repos/:owner/:repo/pulls/:number/reviews",
"/repos/:owner/pulls/:number/reviews/:id",
"/repos/:owner/pulls/:number/reviews/:id/comments",
"/repos/:owner/:repo/pulls/:number/reviews/:id/events",
"/repos/:owner/:repo/pulls/:number/reviews/:id/dismissals"
]
}
},
Expand Down Expand Up @@ -3992,7 +4000,141 @@
},
"description": "Merge a pull request (Merge Button)"
},


"get-pull-request-reviews": {
"url": "/repos/:owner/:repo/pulls/:number/reviews",
"method": "GET",
"params": {
"$owner": null,
"$repo": null,
"$number": null,
"$page": null,
"$per_page": null
},
"description": "List reviews on a pull request."
},

"get-pull-request-review": {
"url": "/repos/:owner/pulls/:number/reviews/:id",
"method": "GET",
"params": {
"$owner": null,
"$number": null,
"$id": null
},
"description": "Get a single pull request review."
},

"get-pull-request-reviews-comments": {
"url": "/repos/:owner/pulls/:number/reviews/:id/comments",
"method": "GET",
"params": {
"$owner": null,
"$number": null,
"$id": null,
"$page": null,
"$per_page": null
},
"description": "Get a single pull request reviews comments."
},

"create-pull-request-review": {
"url": "/repos/:owner/:repo/pulls/:number/reviews",
"method": "POST",
"params": {
"$owner": null,
"$repo": null,
"$number": null,
"body": {
"type": "String",
"required": false,
"validation": "",
"invalidmsg": "",
"description": "The body text of the pull request review."
},
"event": {
"type": "String",
"required": false,
"validation": "^(APPROVE|REQUEST_CHANGES|COMMENT|PENDING)$",
"invalidmsg": "Possible values are: `APPROVE`, `REQUEST_CHANGES`, `COMMENT`, `PENDING`. Default: `PENDING`",
"description": "The event to perform on the review upon submission, can be one of APPROVE, REQUEST_CHANGES, or COMMENT. If left blank, the review will be in the PENDING state.",
"enum": ["APPROVE", "REQUEST_CHANGES", "COMMENT", "PENDING"],
"default": "PENDING"
},
"comments": {
"type": "Array",
"required": false,
"validation": "",
"invalidmsg": "",
"description": "An array of comments part of the review."
},
"path": {
"type": "String",
"required": false,
"validation": "",
"invalidmsg": "",
"description": "The path to the file being commented on."
},
"position": {
"type": "Number",
"required": false,
"validation": "",
"invalidmsg": "",
"description": "The position in the file to be commented on."
}
},
"description": "Create a pull request review."
},

"submit-pull-request-review": {
"url": "/repos/:owner/:repo/pulls/:number/reviews/:id/events",
"method": "POST",
"params": {
"$owner": null,
"$repo": null,
"$number": null,
"$id": null,
"body": {
"type": "String",
"required": false,
"validation": "",
"invalidmsg": "",
"description": "The body text of the pull request review."
},
"event": {
"type": "String",
"required": false,
"validation": "^(APPROVE|REQUEST_CHANGES|COMMENT|PENDING)$",
"invalidmsg": "Possible values are: `APPROVE`, `REQUEST_CHANGES`, `COMMENT`, `PENDING`. Default: `PENDING`",
"description": "The event to perform on the review upon submission, can be one of APPROVE, REQUEST_CHANGES, or COMMENT. If left blank, the review will be in the PENDING state.",
"enum": ["APPROVE", "REQUEST_CHANGES", "COMMENT", "PENDING"],
"default": "PENDING"
}
},
"description": "Submit a pull request review."
},

"dismiss-pull-request-review": {
"url": "/repos/:owner/:repo/pulls/:number/reviews/:id/dismissals",
"method": "GET",
"params": {
"$owner": null,
"$repo": null,
"$number": null,
"$id": null,
"message": {
"type": "String",
"required": false,
"validation": "",
"invalidmsg": "",
"description": "The message for the pull request review dismissal."
},
"$page": null,
"$per_page": null
},
"description": "Dismiss a pull request review."
},

"get-comments": {
"url": "/repos/:owner/:repo/pulls/:number/comments",
"method": "GET",
Expand Down
Loading

0 comments on commit 92b5ee7

Please sign in to comment.