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

Expose more ReviewInfo fields in the Go Gerrit client #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
60 changes: 58 additions & 2 deletions gerrit/gerrit.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,15 +502,49 @@ func (c *Client) ListFiles(ctx context.Context, changeID, revision string) (map[
// ReviewInput contains information for adding a review to a revision.
// See https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-input
type ReviewInput struct {
Message string `json:"message,omitempty"`
Labels map[string]int `json:"labels,omitempty"`
// The message to be added as review comment.
Message string `json:"message,omitempty"`

// Apply this tag to the review comment message, votes, and inline comments.
Tag string `json:"tag,omitempty"`

// The votes that should be added to the revision.
Labels map[string]int `json:"labels,omitempty"`

// Comments contains optional per-line comments to post.
// The map key is a file path (such as "src/foo/bar.go").
Comments map[string][]CommentInput `json:"comments,omitempty"`

// The robot comments that should be added as a map that maps a file path to
// a list of RobotCommentInput entities.
RobotComments map[string][]RobotCommentInput `json:"robot_comments,omitempty"`

// Draft handling that defines how draft comments are handled that are
// already in the database but that were not also described in this input.
// Allowed values are PUBLISH, PUBLISH_ALL_REVISIONS and KEEP.
Drafts string `json:"drafts,omitempty"`

// Notify handling that defines to whom email notifications should be sent
// after the review is stored.
Notify string `json:"notify,omitempty"`

// Additional information about whom to notify about the update.
NotifyDetails []NotifyInfo `json:"notify_details,omitempty"`

// Whether comments with the same content at the same place will be omitted.
OmitDuplicateComments bool `json:"omit_duplicate_comments,omitempty"`

// {account-id} the review should be posted on behalf of.
OnBehalfOf string `json:"on_behalf_of,omitempty"`

// Reviewers optionally specifies new reviewers to add to the change.
Reviewers []ReviewerInput `json:"reviewers,omitempty"`

// If true, and if the change is work in progress, then start review.
Ready bool `json:"ready,omitempty"`

// If true, mark the change as work in progress.
WorkInProgress bool `json:"work_in_progress"`
}

// ReviewerInput contains information for adding a reviewer to a change.
Expand All @@ -531,10 +565,32 @@ type CommentInput struct {
// TODO(haya14busa): more, as needed.
}

// RobotCommentInput contains information for creating an inline robot comment.
type RobotCommentInput struct {
// The ID of the robot that generated this comment.
RobotID string `json:"robot_id"`

// An ID of the run of the robot.
RobotRunID string `json:"robot_run_id"`

// URL to more information.
URL string `json:"url,omitempty"`

// Robot specific properties as map that maps arbitrary keys to values.
Properties map[string]string `json:"properties,omitempty"`
}

type reviewInfo struct {
Labels map[string]int `json:"labels,omitempty"`
}

// NotifyInfo contains detailed information about who should be notified about an update.
type NotifyInfo struct {
// A list of account IDs that identify the accounts that should be should
// be notified.
Accounts []string `json:"accounts,omitempty"`
}

// SetReview leaves a message on a change and/or modifies labels.
// For the API call, see https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review
// The changeID is https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-id
Expand Down