Go-github: Add support for new Pull Request Reviews preview API.

Created on 14 Dec 2016  路  11Comments  路  Source: google/go-github

enhancement good first issue

Most helpful comment

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. 馃槃

All 11 comments

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

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.

@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.

I think you can add rest of methods like this https://github.com/google/go-github/compare/master...haya14busa:pull-reviews

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

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!

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.

Thanks for your response, @shurcooL!

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

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

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 https://github.com/google/go-github/commit/ebd6006516e1d6a2e027886e22cd95d6dec757cc.

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. 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

csandanov picture csandanov  路  3Comments

gmlewis picture gmlewis  路  3Comments

mungojam picture mungojam  路  3Comments

scriptonist picture scriptonist  路  3Comments

gmlewis picture gmlewis  路  3Comments