Skip to content

Commit

Permalink
apply gofmt, add new fields to ReviewInput (#123)
Browse files Browse the repository at this point in the history
* apply Go 1.19's gofmt

It fixes up godocs slightly.

* 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.

* Add docs for RecipientType

Co-authored-by: Andy Grunwald <andy.grunwald@aiven.io>
  • Loading branch information
mvdan and andygrunwald authored Sep 17, 2022
1 parent 4fc9999 commit 2e881e2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
42 changes: 31 additions & 11 deletions changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -348,7 +354,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.
Expand All @@ -358,6 +365,19 @@ 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
// 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.
//
Expand Down
3 changes: 1 addition & 2 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

0 comments on commit 2e881e2

Please sign in to comment.