Skip to content

Commit

Permalink
Merge pull request #40 from andygrunwald/fix-SetReview-return-value
Browse files Browse the repository at this point in the history
SetReview should return a ReviewResult
  • Loading branch information
andygrunwald committed Sep 11, 2017
2 parents b63100d + 139440f commit a2e6113
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ first. For more complete details see

## Versions

### latest (not yet released)
### 0.5.0

**WARNING**: This release includes breaking changes.

* [BREAKING CHANGE] The SetReview function was returning the wrong
entity type. (#40)

### 0.4.0

Expand Down
8 changes: 8 additions & 0 deletions changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ type ReviewInfo struct {
Labels map[string]int `json:"labels"`
}

// ReviewResult entity contains information regarding the updates that were
// made to a review.
type ReviewResult struct {
ReviewInfo
Reviewers map[string]AddReviewerResult `json:"reviewers,omitempty"`
Ready bool `json:"ready,omitempty"`
}

// TopicInput entity contains information for setting a topic.
type TopicInput struct {
Topic string `json:"topic,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions changes_reviewer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ type SuggestedReviewerInfo struct {

// AddReviewerResult entity describes the result of adding a reviewer to a change.
type AddReviewerResult struct {
Input string `json:"input,omitempty"`
Reviewers []ReviewerInfo `json:"reviewers,omitempty"`
CCS []ReviewerInfo `json:"ccs,omitempty"`
Error string `json:"error,omitempty"`
Confirm bool `json:"confirm,omitempty"`
}
Expand Down
4 changes: 2 additions & 2 deletions changes_revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,15 @@ func (s *ChangesService) ListFilesReviewed(changeID, revisionID string) (*[]File
// The review must be provided in the request body as a ReviewInput entity.
//
// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review
func (s *ChangesService) SetReview(changeID, revisionID string, input *ReviewInput) (*ReviewInfo, *Response, error) {
func (s *ChangesService) SetReview(changeID, revisionID string, input *ReviewInput) (*ReviewResult, *Response, error) {
u := fmt.Sprintf("changes/%s/revisions/%s/review", changeID, revisionID)

req, err := s.client.NewRequest("POST", u, input)
if err != nil {
return nil, nil, err
}

v := new(ReviewInfo)
v := new(ReviewResult)
resp, err := s.client.Do(req, v)
if err != nil {
return nil, resp, err
Expand Down

0 comments on commit a2e6113

Please sign in to comment.