Skip to content

Commit f9a86dd

Browse files
committed
Expose more ReviewInfo fields in the Go Gerrit client
1 parent 92427f6 commit f9a86dd

File tree

1 file changed

+58
-2
lines changed

1 file changed

+58
-2
lines changed

gerrit/gerrit.go

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,15 +502,49 @@ func (c *Client) ListFiles(ctx context.Context, changeID, revision string) (map[
502502
// ReviewInput contains information for adding a review to a revision.
503503
// See https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#review-input
504504
type ReviewInput struct {
505-
Message string `json:"message,omitempty"`
506-
Labels map[string]int `json:"labels,omitempty"`
505+
// The message to be added as review comment.
506+
Message string `json:"message,omitempty"`
507+
508+
// Apply this tag to the review comment message, votes, and inline comments.
509+
Tag string `json:"tag,omitempty"`
510+
511+
// The votes that should be added to the revision.
512+
Labels map[string]int `json:"labels,omitempty"`
507513

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

518+
// The robot comments that should be added as a map that maps a file path to
519+
// a list of RobotCommentInput entities.
520+
RobotComments map[string][]RobotCommentInput `json:"robot_comments,omitempty"`
521+
522+
// Draft handling that defines how draft comments are handled that are
523+
// already in the database but that were not also described in this input.
524+
// Allowed values are PUBLISH, PUBLISH_ALL_REVISIONS and KEEP.
525+
Drafts string `json:"drafts,omitempty"`
526+
527+
// Notify handling that defines to whom email notifications should be sent
528+
// after the review is stored.
529+
Notify string `json:"notify,omitempty"`
530+
531+
// Additional information about whom to notify about the update.
532+
NotifyDetails []NotifyInfo `json:"notify_details,omitempty"`
533+
534+
// Whether comments with the same content at the same place will be omitted.
535+
OmitDuplicateComments bool `json:"omit_duplicate_comments,omitempty"`
536+
537+
// {account-id} the review should be posted on behalf of.
538+
OnBehalfOf string `json:"on_behalf_of,omitempty"`
539+
512540
// Reviewers optionally specifies new reviewers to add to the change.
513541
Reviewers []ReviewerInput `json:"reviewers,omitempty"`
542+
543+
// If true, and if the change is work in progress, then start review.
544+
Ready bool `json:"ready,omitempty"`
545+
546+
// If true, mark the change as work in progress.
547+
WorkInProgress bool `json:"work_in_progress"`
514548
}
515549

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

568+
// RobotCommentInput contains information for creating an inline robot comment.
569+
type RobotCommentInput struct {
570+
// The ID of the robot that generated this comment.
571+
RobotID string `json:"robot_id"`
572+
573+
// An ID of the run of the robot.
574+
RobotRunID string `json:"robot_run_id"`
575+
576+
// URL to more information.
577+
URL string `json:"url,omitempty"`
578+
579+
// Robot specific properties as map that maps arbitrary keys to values.
580+
Properties map[string]string `json:"properties,omitempty"`
581+
}
582+
534583
type reviewInfo struct {
535584
Labels map[string]int `json:"labels,omitempty"`
536585
}
537586

587+
// NotifyInfo contains detailed information about who should be notified about an update.
588+
type NotifyInfo struct {
589+
// A list of account IDs that identify the accounts that should be should
590+
// be notified.
591+
Accounts []string `json:"accounts,omitempty"`
592+
}
593+
538594
// SetReview leaves a message on a change and/or modifies labels.
539595
// For the API call, see https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#set-review
540596
// The changeID is https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-id

0 commit comments

Comments
 (0)