gerrit: add CommentInput field to ReviewInput
CommentInput field is needed to post inline comments.
Fixes golang/go#18830
Change-Id: I04a77621f0bbbc587bbeb2e050ac363c3bbc7cf5
Reviewed-on: https://go-review.googlesource.com/35991
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/gerrit/gerrit.go b/gerrit/gerrit.go
index cf3d5e7..63e5810 100644
--- a/gerrit/gerrit.go
+++ b/gerrit/gerrit.go
@@ -369,9 +369,24 @@
return &change, nil
}
+// 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"`
+
+ // 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"`
+}
+
+// CommentInput contains information for creating an inline comment.
+// See https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-input
+type CommentInput struct {
+ Line int `json:"line"`
+ Message string `json:"message"`
+
+ // TODO(haya14busa): more, as needed.
}
type reviewInfo struct {