Add support for new Pull Request Reviews preview API. #495

Open
shurcooL opened this Issue Dec 14, 2016 · 11 comments

Projects

None yet

3 participants

@sahildua2305
Collaborator

I'd like to work on this @shurcooL. Can you please help me in getting started?
Will it be similar to pulls_comments.go?

@haya14busa

Hi!

@sahildua2305 I started to work on this now to use this API for my personal project, and it's in progress.
But, you commented first, so I think you can do this if you want, otherwise please let me handle it.

As for the progress, I just only implemented PullRequestReviewService.List, so progress is small.

@sahildua2305
Collaborator

@haya14busa thanks for offering. I'd really like to work on this. However, I'll need help in getting started. I'm new to Go.

@haya14busa

I think you can add rest of methods like this master...haya14busa:pull-reviews

I guess we can also use PullRequestsService instead of adding new PullRequestReviewService.

@shurcooL
Collaborator
shurcooL commented Dec 16, 2016 edited

Thanks for offering to work on this, @sahildua2305 and @haya14busa.

How about @sahildua2305 takes this and @haya14busa, you can help out with reviewing the PR and iterating on it as needed?

Can you please help me in getting started?
Will it be similar to pulls_comments.go?

I've looked at the new API. It's 6 new endpoints, and they're quite similar/related to pull requests.

I agree with @haya14busa, it looks like simply adding them to the existing PullRequestsService would be a good solution. It doesn't seem that a new service PullRequestReviewService is needed here. PR reviews are pretty similar to usual comments on PRs. It's also quite analogous to comments that issues have, and those are just a part of IssuesService.

So, let's go with adding 6 methods to PullRequestsService, similar to what's in pulls_comments.go.

For example, Get a single review endpoint can look like this (rough draft to give you a starting point):

// GetReview gets a single review for the specified pull request.
//
// GitHub API docs: https://developer.github.com/v3/pulls/reviews/#get-a-single-review
func (s *PullRequestsService) GetReview(owner string, repo string, number int, reviewID int) (*PullRequestReview, *Response, error) {
	...
}

@sahildua2305, you can look at @haya14busa's current implementation, it's quite good so far, with the exception that you want to go with the existing PullRequestsService.

Feel free to make a PR as soon as you have something started, if you'd like early feedback or to make sure you're on the right path. Thanks again!

@haya14busa

Thank you for the response, @shurcooL!

Ok, I'm happy to help @sahildua2305! Please notify me when you open a pull request or want some helps.

@haya14busa haya14busa referenced this issue in haya14busa/reviewdog Dec 16, 2016
Open

GitHub: Try Preview Pull Request Reviews API #58

@sahildua2305
Collaborator

Thanks for your response, @shurcooL!

Also thank you for offering help, @haya14busa. I'll inform you as I open the PR soon.

@sahildua2305
Collaborator

@shurcooL @haya14busa I am just getting started with my work on this. How do I test my changes?

@shurcooL
Collaborator

First, make sure all existing tests pass by running go test github.com/google/go-github/github.

You can write a simple program that exercises your new code and hits the real GitHub API, and see if it works as expected.

Then write unit tests that are similar to the ones that exist. It helps to get a real GitHub API response and make your mock handler return something equivalent.

Also see the unit test that @haya14busa wrote in ebd6006.

@sahildua2305
Collaborator

Thanks @shurcooL! I got everything (related to environment and existing tests) working. I will test my changes, write tests and create a PR once at least one endpoint is covered. 😄

@sahildua2305 sahildua2305 added a commit to sahildua2305/go-github that referenced this issue Dec 16, 2016
@sahildua2305 sahildua2305 Add 'list all reviews' endpoint from new pull request review API
This commit adds only one of the total 6 endpoints made available
for developers preview. This is for initial review by other contributors. Once
reviewed, other endpoints will be added as well.

Partly fixes #495
7b47f69
@sahildua2305 sahildua2305 added a commit to sahildua2305/go-github that referenced this issue Dec 17, 2016
@sahildua2305 sahildua2305 Add 'list all reviews' endpoint from new pull request review API
This commit adds only one of the total 6 endpoints made available
for developers preview.

Partly fixes #495

EDIT: Fix minor things based on initial review.
38a474f
@sahildua2305 sahildua2305 added a commit to sahildua2305/go-github that referenced this issue Jan 5, 2017
@sahildua2305 sahildua2305 Add 'list all reviews' endpoint from new pull request review API
This commit adds only one of the total 6 endpoints made available
for developers preview.

Partly fixes #495

EDIT: Fix minor things based on initial review.
1b9303c
@sahildua2305 sahildua2305 added a commit to sahildua2305/go-github that referenced this issue Jan 17, 2017
@sahildua2305 sahildua2305 Add 'list all reviews' endpoint from new pull request review API
This commit adds only one of the total 6 endpoints made available
for developers preview.

Partly fixes #495

EDIT: Fix minor things based on initial review.
e793cee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment