aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/pulls_reviews.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/pulls_reviews.go')
-rw-r--r--vendor/github.com/google/go-github/github/pulls_reviews.go36
1 files changed, 12 insertions, 24 deletions
diff --git a/vendor/github.com/google/go-github/github/pulls_reviews.go b/vendor/github.com/google/go-github/github/pulls_reviews.go
index c27b6a8..7d2acc4 100644
--- a/vendor/github.com/google/go-github/github/pulls_reviews.go
+++ b/vendor/github.com/google/go-github/github/pulls_reviews.go
@@ -40,6 +40,7 @@ func (c DraftReviewComment) String() string {
// PullRequestReviewRequest represents a request to create a review.
type PullRequestReviewRequest struct {
+ CommitID *string `json:"commit_id,omitempty"`
Body *string `json:"body,omitempty"`
Event *string `json:"event,omitempty"`
Comments []*DraftReviewComment `json:"comments,omitempty"`
@@ -65,17 +66,18 @@ func (r PullRequestReviewDismissalRequest) String() string {
// Read more about it here - https://github.com/google/go-github/issues/540
//
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#list-reviews-on-a-pull-request
-func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int) ([]*PullRequestReview, *Response, error) {
+func (s *PullRequestsService) ListReviews(ctx context.Context, owner, repo string, number int, opt *ListOptions) ([]*PullRequestReview, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews", owner, repo, number)
+ u, err := addOptions(u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
-
var reviews []*PullRequestReview
resp, err := s.client.Do(ctx, req, &reviews)
if err != nil {
@@ -100,9 +102,6 @@ func (s *PullRequestsService) GetReview(ctx context.Context, owner, repo string,
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
-
review := new(PullRequestReview)
resp, err := s.client.Do(ctx, req, review)
if err != nil {
@@ -127,9 +126,6 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
-
review := new(PullRequestReview)
resp, err := s.client.Do(ctx, req, review)
if err != nil {
@@ -145,18 +141,19 @@ func (s *PullRequestsService) DeletePendingReview(ctx context.Context, owner, re
// returned error format and remove this comment once it's fixed.
// Read more about it here - https://github.com/google/go-github/issues/540
//
-// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-a-single-reviews-comments
-func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number, reviewID int) ([]*PullRequestComment, *Response, error) {
+// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-comments-for-a-single-review
+func (s *PullRequestsService) ListReviewComments(ctx context.Context, owner, repo string, number, reviewID int, opt *ListOptions) ([]*PullRequestComment, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/pulls/%d/reviews/%d/comments", owner, repo, number, reviewID)
+ u, err := addOptions(u, opt)
+ if err != nil {
+ return nil, nil, err
+ }
req, err := s.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
-
var comments []*PullRequestComment
resp, err := s.client.Do(ctx, req, &comments)
if err != nil {
@@ -181,9 +178,6 @@ func (s *PullRequestsService) CreateReview(ctx context.Context, owner, repo stri
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
-
r := new(PullRequestReview)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
@@ -208,9 +202,6 @@ func (s *PullRequestsService) SubmitReview(ctx context.Context, owner, repo stri
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
-
r := new(PullRequestReview)
resp, err := s.client.Do(ctx, req, r)
if err != nil {
@@ -235,9 +226,6 @@ func (s *PullRequestsService) DismissReview(ctx context.Context, owner, repo str
return nil, nil, err
}
- // TODO: remove custom Accept header when this API fully launches
- req.Header.Set("Accept", mediaTypePullRequestReviewsPreview)
-
r := new(PullRequestReview)
resp, err := s.client.Do(ctx, req, r)
if err != nil {