Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill in review_types when listing reviews #1

Merged
merged 1 commit into from
Aug 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions v5/pivotal/stories.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,26 @@ type BlockerRequest struct {

// Review is a review on a PT story
type Review struct {
ID int `json:"id,omitempty"`
StoryID int `json:"story_id,omitempty"`
ReviewTypeID int `json:"review_type_id,omitempty"`
ReviewerID int `json:"reviewer_id,omitempty"`
Status string `json:"status,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Kind string `json:"kind,omitempty"`
ID int `json:"id,omitempty"`
StoryID int `json:"story_id,omitempty"`
ReviewType *ReviewType `json:"review_type,omitempty"`
ReviewTypeID int `json:"review_type_id,omitempty"`
ReviewerID int `json:"reviewer_id,omitempty"`
Status string `json:"status,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Kind string `json:"kind,omitempty"`
}

// ReviewType is a review_type resource.
type ReviewType struct {
ID int `json:"id,omitempty"`
ProjectID int `json:"project_id,omitempty"`
Name string `json:"name,omitempty"`
Hidden bool `json:"hidden,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Kind string `json:"kind,omitempty"`
}

// StoryService wraps the client context and allows for interaction
Expand Down Expand Up @@ -479,7 +491,11 @@ func (service *StoryService) ListReviews(
storyID int,
) ([]*Review, *http.Response, error) {

u := fmt.Sprintf("projects/%v/stories/%v/reviews", projectID, storyID)
u := fmt.Sprintf(
"projects/%v/stories/%v/reviews?fields=id,story_id,review_type,review_type_id,reviewer_id,status,created_at,updated_at,kind",
projectID,
storyID,
)
req, err := service.client.NewRequest("GET", u, nil)
if err != nil {
return nil, nil, err
Expand Down