Skip to content

Commit 18c7753

Browse files
authored
Add support for submit_requirement fields in ChangeInfo. (#169)
1 parent 0983e87 commit 18c7753

File tree

1 file changed

+73
-47
lines changed

1 file changed

+73
-47
lines changed

changes.go

Lines changed: 73 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -425,53 +425,54 @@ type ChangeInput struct {
425425

426426
// ChangeInfo entity contains information about a change.
427427
type ChangeInfo struct {
428-
ID string `json:"id"`
429-
URL string `json:"url,omitempty"`
430-
Project string `json:"project"`
431-
Branch string `json:"branch"`
432-
Topic string `json:"topic,omitempty"`
433-
AttentionSet map[string]AttentionSetInfo `json:"attention_set,omitempty"`
434-
Assignee AccountInfo `json:"assignee,omitempty"`
435-
Hashtags []string `json:"hashtags,omitempty"`
436-
ChangeID string `json:"change_id"`
437-
Subject string `json:"subject"`
438-
Status string `json:"status"`
439-
Created Timestamp `json:"created"`
440-
Updated Timestamp `json:"updated"`
441-
Submitted *Timestamp `json:"submitted,omitempty"`
442-
Submitter AccountInfo `json:"submitter,omitempty"`
443-
Starred bool `json:"starred,omitempty"`
444-
Reviewed bool `json:"reviewed,omitempty"`
445-
SubmitType string `json:"submit_type,omitempty"`
446-
Mergeable bool `json:"mergeable,omitempty"`
447-
Submittable bool `json:"submittable,omitempty"`
448-
Insertions int `json:"insertions"`
449-
Deletions int `json:"deletions"`
450-
TotalCommentCount int `json:"total_comment_count,omitempty"`
451-
UnresolvedCommentCount int `json:"unresolved_comment_count,omitempty"`
452-
Number int `json:"_number"`
453-
Owner AccountInfo `json:"owner"`
454-
Actions map[string]ActionInfo `json:"actions,omitempty"`
455-
Labels map[string]LabelInfo `json:"labels,omitempty"`
456-
PermittedLabels map[string][]string `json:"permitted_labels,omitempty"`
457-
RemovableReviewers []AccountInfo `json:"removable_reviewers,omitempty"`
458-
Reviewers map[string][]AccountInfo `json:"reviewers,omitempty"`
459-
PendingReviewers map[string][]AccountInfo `json:"pending_reviewers,omitempty"`
460-
ReviewerUpdates []ReviewerUpdateInfo `json:"reviewer_updates,omitempty"`
461-
Messages []ChangeMessageInfo `json:"messages,omitempty"`
462-
CurrentRevision string `json:"current_revision,omitempty"`
463-
Revisions map[string]RevisionInfo `json:"revisions,omitempty"`
464-
MoreChanges bool `json:"_more_changes,omitempty"`
465-
Problems []ProblemInfo `json:"problems,omitempty"`
466-
IsPrivate bool `json:"is_private,omitempty"`
467-
WorkInProgress bool `json:"work_in_progress,omitempty"`
468-
HasReviewStarted bool `json:"has_review_started,omitempty"`
469-
RevertOf int `json:"revert_of,omitempty"`
470-
SubmissionID string `json:"submission_id,omitempty"`
471-
CherryPickOfChange int `json:"cherry_pick_of_change,omitempty"`
472-
CherryPickOfPatchSet int `json:"cherry_pick_of_patch_set,omitempty"`
473-
ContainsGitConflicts bool `json:"contains_git_conflicts,omitempty"`
474-
BaseChange string `json:"base_change,omitempty"`
428+
ID string `json:"id"`
429+
URL string `json:"url,omitempty"`
430+
Project string `json:"project"`
431+
Branch string `json:"branch"`
432+
Topic string `json:"topic,omitempty"`
433+
AttentionSet map[string]AttentionSetInfo `json:"attention_set,omitempty"`
434+
Assignee AccountInfo `json:"assignee,omitempty"`
435+
Hashtags []string `json:"hashtags,omitempty"`
436+
ChangeID string `json:"change_id"`
437+
Subject string `json:"subject"`
438+
Status string `json:"status"`
439+
Created Timestamp `json:"created"`
440+
Updated Timestamp `json:"updated"`
441+
Submitted *Timestamp `json:"submitted,omitempty"`
442+
Submitter AccountInfo `json:"submitter,omitempty"`
443+
Starred bool `json:"starred,omitempty"`
444+
Reviewed bool `json:"reviewed,omitempty"`
445+
SubmitType string `json:"submit_type,omitempty"`
446+
Mergeable bool `json:"mergeable,omitempty"`
447+
Submittable bool `json:"submittable,omitempty"`
448+
Insertions int `json:"insertions"`
449+
Deletions int `json:"deletions"`
450+
TotalCommentCount int `json:"total_comment_count,omitempty"`
451+
UnresolvedCommentCount int `json:"unresolved_comment_count,omitempty"`
452+
Number int `json:"_number"`
453+
Owner AccountInfo `json:"owner"`
454+
Actions map[string]ActionInfo `json:"actions,omitempty"`
455+
Labels map[string]LabelInfo `json:"labels,omitempty"`
456+
PermittedLabels map[string][]string `json:"permitted_labels,omitempty"`
457+
RemovableReviewers []AccountInfo `json:"removable_reviewers,omitempty"`
458+
Reviewers map[string][]AccountInfo `json:"reviewers,omitempty"`
459+
PendingReviewers map[string][]AccountInfo `json:"pending_reviewers,omitempty"`
460+
ReviewerUpdates []ReviewerUpdateInfo `json:"reviewer_updates,omitempty"`
461+
Messages []ChangeMessageInfo `json:"messages,omitempty"`
462+
CurrentRevision string `json:"current_revision,omitempty"`
463+
Revisions map[string]RevisionInfo `json:"revisions,omitempty"`
464+
MoreChanges bool `json:"_more_changes,omitempty"`
465+
Problems []ProblemInfo `json:"problems,omitempty"`
466+
IsPrivate bool `json:"is_private,omitempty"`
467+
WorkInProgress bool `json:"work_in_progress,omitempty"`
468+
HasReviewStarted bool `json:"has_review_started,omitempty"`
469+
RevertOf int `json:"revert_of,omitempty"`
470+
SubmissionID string `json:"submission_id,omitempty"`
471+
CherryPickOfChange int `json:"cherry_pick_of_change,omitempty"`
472+
CherryPickOfPatchSet int `json:"cherry_pick_of_patch_set,omitempty"`
473+
ContainsGitConflicts bool `json:"contains_git_conflicts,omitempty"`
474+
BaseChange string `json:"base_change,omitempty"`
475+
SubmitRequirements []SubmitRequirementResultInfo `json:"submit_requirements,omitempty"`
475476
}
476477

477478
// LabelInfo entity contains information about a label on a change, always corresponding to the current patch set.
@@ -547,6 +548,31 @@ type CommentInfo struct {
547548
CommitID string `json:"commit_id,omitempty"`
548549
}
549550

551+
// SubmitRequirementExpressionInfo entity contains information about a submit requirement exppression.
552+
//
553+
// Docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-expression-info
554+
type SubmitRequirementExpressionInfo struct {
555+
Expression string `json:"expression,omitempty"`
556+
Fulfilled bool `json:"fulfilled"`
557+
Status string `json:"status"`
558+
PassingAtoms []string `json:"passing_atoms,omitempty"`
559+
FailingAtoms []string `json:"failing_atoms,omitempty"`
560+
ErrorMessage string `json:"error_message,omitempty"`
561+
}
562+
563+
// SubmitRequirementResultInfo entity describes the result of evaluating a submit requirement on a change.
564+
//
565+
// Docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#submit-requirement-result-info
566+
type SubmitRequirementResultInfo struct {
567+
Name string `json:"name"`
568+
Description string `json:"description,omitempty"`
569+
Status string `json:"status"`
570+
IsLegacy bool `json:"is_legacy"`
571+
ApplicabilityExpressionResult SubmitRequirementExpressionInfo `json:"applicability_expression_result,omitempty"`
572+
SubmittabilityExpressionResult SubmitRequirementExpressionInfo `json:"submittability_expression_result"`
573+
OverrideExpressionResult SubmitRequirementExpressionInfo `json:"override_expression_result,omitempty"`
574+
}
575+
550576
// QueryOptions specifies global parameters to query changes / reviewers.
551577
//
552578
// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes

0 commit comments

Comments
 (0)