From 9c81adaf840ed2780436ca89c0554801304dd944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 15 Sep 2022 12:04:03 +0100 Subject: [PATCH 1/3] apply Go 1.19's gofmt It fixes up godocs slightly. --- changes.go | 3 ++- doc.go | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/changes.go b/changes.go index 797deee..20b2f9e 100644 --- a/changes.go +++ b/changes.go @@ -348,7 +348,8 @@ type FixReplacementInfo struct { Replacement string `json:"replacement,omitempty"` } -// AttentionSetInfo entity contains details of users that are in the attention set. +// AttentionSetInfo entity contains details of users that are in the attention set. +// // https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-info type AttentionSetInfo struct { // AccountInfo entity. diff --git a/doc.go b/doc.go index e3336ef..409c928 100644 --- a/doc.go +++ b/doc.go @@ -22,7 +22,7 @@ The services of a client divide the API into logical chunks and correspond to the structure of the Gerrit API documentation at https://gerrit-review.googlesource.com/Documentation/rest-api.html#_endpoints. -Authentication +# Authentication The go-gerrit library supports various methods to support the authentication. This methods are combined in the AuthenticationService that is available at client.Authentication. @@ -63,6 +63,5 @@ With this you can authenticate with HTTP Basic like this: Additionally when creating a new client, pass an http.Client that supports further actions for you. For more information regarding authentication have a look at the Gerrit documentation: https://gerrit-review.googlesource.com/Documentation/rest-api.html#authentication - */ package gerrit From c49e97145559febb178313da335bba3e47d2ca63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Thu, 15 Sep 2022 13:32:26 +0100 Subject: [PATCH 2/3] add new fields to ReviewInput In particular, I need ignore_automatic_attention_set_rules, but I'm adding all other missing fields in the struct too. I've added RecipientType as a named type, as it's an enum-like string. --- changes.go | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/changes.go b/changes.go index 20b2f9e..9c14fc5 100644 --- a/changes.go +++ b/changes.go @@ -228,16 +228,22 @@ type ReviewerInput struct { // ReviewInput entity contains information for adding a review to a revision. type ReviewInput struct { - Message string `json:"message,omitempty"` - Tag string `json:"tag,omitempty"` - Labels map[string]string `json:"labels,omitempty"` - Comments map[string][]CommentInput `json:"comments,omitempty"` - RobotComments map[string][]RobotCommentInput `json:"robot_comments,omitempty"` - StrictLabels bool `json:"strict_labels,omitempty"` - Drafts string `json:"drafts,omitempty"` - Notify string `json:"notify,omitempty"` - OmitDuplicateComments bool `json:"omit_duplicate_comments,omitempty"` - OnBehalfOf string `json:"on_behalf_of,omitempty"` + Message string `json:"message,omitempty"` + Tag string `json:"tag,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Comments map[string][]CommentInput `json:"comments,omitempty"` + RobotComments map[string][]RobotCommentInput `json:"robot_comments,omitempty"` + StrictLabels bool `json:"strict_labels,omitempty"` + Drafts string `json:"drafts,omitempty"` + Notify string `json:"notify,omitempty"` + OmitDuplicateComments bool `json:"omit_duplicate_comments,omitempty"` + OnBehalfOf string `json:"on_behalf_of,omitempty"` + Reviewers []ReviewerInput `json:"reviewers,omitempty"` + Ready bool `json:"ready,omitempty"` + WorkInProgress bool `json:"work_in_progress,omitempty"` + AddToAttentionSet []AttentionSetInput `json:"add_to_attention_set,omitempty"` + RemoveFromAttentionSet []AttentionSetInput `json:"remove_from_attention_set,omitempty"` + IgnoreAutomaticAttentionSetRules bool `json:"ignore_automatic_attention_set_rules,omitempty"` } // RelatedChangeAndCommitInfo entity contains information about a related change and commit. @@ -360,6 +366,19 @@ type AttentionSetInfo struct { Reason string `json:"reason"` } +type RecipientType string + +// AttentionSetInput entity contains details for adding users to the attention +// set and removing them from it. +// +// https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#attention-set-input +type AttentionSetInput struct { + User string `json:"user,omitempty"` + Reason string `json:"reason"` + Notify string `json:"notify,omitempty"` + NotifyDetails map[RecipientType]NotifyInfo `json:"notify_details,omitempty"` +} + // DiffIntralineInfo entity contains information about intraline edits in a file. // // The information consists of a list of pairs, From a9c67698c4cbe65e76de6be6048339e20cb33c1e Mon Sep 17 00:00:00 2001 From: Andy Grunwald Date: Sat, 17 Sep 2022 09:07:56 +0200 Subject: [PATCH 3/3] Add docs for RecipientType --- changes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changes.go b/changes.go index 9c14fc5..bb78868 100644 --- a/changes.go +++ b/changes.go @@ -365,7 +365,7 @@ type AttentionSetInfo struct { // The reason of for adding or removing the user. Reason string `json:"reason"` } - +// Doc: https://gerrit-review.googlesource.com/Documentation/user-notify.html#recipient-types type RecipientType string // AttentionSetInput entity contains details for adding users to the attention