Documentation ¶
Index ¶
- Constants
- Variables
- func UnixInt64Time(unixTime int64) time.Time
- type Account
- type Approval
- type AssigneeChangedEvent
- type Base
- type Change
- type ChangeAbandonedEvent
- type ChangeMergedEvent
- type ChangeRestoredEvent
- type CommentAddedEvent
- type Dependency
- type DroppedOutputEvent
- type FilePatch
- type GerritEvent
- type HashtagsChangedEvent
- type Label
- type Message
- type PatchSet
- type PatchSetComment
- type PatchSetCreatedEvent
- type PrivateStateChangedEvent
- type ProjectCreatedEvent
- type RefUpdate
- type RefUpdatedEvent
- type Requirement
- type ReviewerAddedEvent
- type ReviewerDeletedEvent
- type SubmitRecord
- type TopicChangedEvent
- type VoteDeletedEvent
- type WipStateChangedEvent
Constants ¶
const MaxEventPayloadSize = 10 * 1024 * 1024
MaxEventPayloadSize is the size of the largest event payload this system will allow. Larger event payloads will result in errors and will not be processed.
Variables ¶
var ( // EventDecodingError wraps errors encountered during event decoding. EventDecodingError = errs.Class("event decoding error") )
Functions ¶
func UnixInt64Time ¶
UnixInt64Time translates an int64 UNIX epoch time to a time.Time.
Types ¶
type Account ¶
type Account struct { // Name is the user's full name, if configured. Name string // Email is the user's preferred email address. Email string // Username is the user's username, if configured. Username string }
Account is a Gerrit user account.
func (*Account) DisplayName ¶
DisplayName gives a name we can use to refer to a Gerrit user without linking the user in chat (which may cause a notification we don't want sent).
type Approval ¶
type Approval struct { // Type is the internal name of the approval given. Type string // Description is the human readable category of the approval. Description string // Value is the value assigned by the approval, usually a numerical score. Value string // OldValue is the previous approval score, usually a numerical score. OldValue string `json:"oldValue"` // GrantedOn is the time in seconds since the UNIX epoch when this approval was added or last // updated. GrantedOn int64 `json:"grantedOn"` // By is the reviewer of the patchset. By Account }
Approval records a code review approval granted to a patchset.
type AssigneeChangedEvent ¶
type AssigneeChangedEvent struct { Base Change Change Changer Account OldAssignee Account `json:"oldAssignee"` }
AssigneeChangedEvent is sent when the assignee of a change has been modified.
type Base ¶
Base is a base for gerrit event types, providing the necessary methods for GerritEvent compatibility.
func (*Base) EventCreatedAt ¶
EventCreatedAt returns the type at which the event was created.
type Change ¶
type Change struct { // Project specifies the project path within Gerrit. Project string // Branch is the branch name within the project. Branch string // Topic is the name specified by the uploader for this change series. Topic string // ID gives the Gerrit Change-ID. ID string // Number is the (deprecated) change number. Number int // Subject is the description of a change. Subject string // Owner is the owner of a change series. Owner Account // URL gives the canonical URL to reach this change. URL string // CommitMessage gives the full commit message for the current patchset. CommitMessage string `json:"commitMessage"` // CreatedOn gives the time since the UNIX epoch when this change was created. CreatedOn int64 `json:"createdOn"` // LastUpdated gives the time since the UNIX epoch when this change was last updated. LastUpdated int64 `json:"lastUpdated"` // Open indicates whether the change is still open for review. Open bool // Status indicates the current state of this change ("NEW"/"MERGED"/"ABANDONED"). Status string // Private indicates if the change is private. Private bool // WIP indicates if the change is currently marked as a Work In Progress. WIP bool // Comments gives all inline/file comments for this change. Comments []Message // TrackingIDs gives all issue tracking system links, as scraped out of the commit // message based on the server's 'trackingid' sections. TrackingIDs []struct { // System is the name of the system as given in the gerrit.config file. System string // ID is the ID number as scraped. ID string } `json:"trackingIds"` // CurrentPatchSet gives the current patchset for this change. CurrentPatchSet PatchSet `json:"currentPatchSet"` // PatchSets holds all patchsets for this change. PatchSets []PatchSet `json:"patchSets"` // DependsOn is a list of changes on which this change depends. DependsOn []Dependency `json:"dependsOn"` // NeededBy is a list of changes which depend on this change. NeededBy []Dependency `json:"neededBy"` // SubmitRecords has information on whether this change has been or can be submitted. SubmitRecords []SubmitRecord `json:"submitRecords"` // AllReviewers is a list of reviewers added to this change. AllReviewers []Account `json:"allReviewers"` }
Change refers to a change being reviewed, or that was already reviewed.
type ChangeAbandonedEvent ¶
type ChangeAbandonedEvent struct { Base Change Change PatchSet PatchSet `json:"patchSet"` Abandoner Account Reason string }
ChangeAbandonedEvent is sent when a change has been abandoned.
type ChangeMergedEvent ¶
type ChangeMergedEvent struct { Base Change Change PatchSet PatchSet `json:"patchSet"` Submitter Account NewRev string `json:"newRev"` }
ChangeMergedEvent is sent when a change has been merged into the git repository.
type ChangeRestoredEvent ¶
type ChangeRestoredEvent struct { Base Change Change PatchSet PatchSet `json:"patchSet"` Restorer Account Reason string }
ChangeRestoredEvent is sent when an abandoned change has been restored.
type CommentAddedEvent ¶
type CommentAddedEvent struct { Base Change Change PatchSet PatchSet `json:"patchSet"` Author Account Approvals []Approval Comment string }
CommentAddedEvent is sent when a review comment has been posted on a change.
type Dependency ¶
type Dependency struct { // ID is the change identifier. ID string // Number is the (deprecated) change number. Number int // Revision is the patchset revision. Revision string // Ref is the ref name. Ref string // IsCurrentPatchSet indicates if the revision is the current patchset of the change. IsCurrentPatchSet bool `json:"isCurrentPatchSet"` }
Dependency is information about a change or patchset dependency.
type DroppedOutputEvent ¶
type DroppedOutputEvent struct {
Base
}
DroppedOutputEvent is sent to notify a client that events have been dropped.
type FilePatch ¶
type FilePatch struct { // File is the name of the file. If the file is renamed, the new name. File string // FileOld is the old name of the file, if the file is renamed. FileOld string `json:"fileOld"` // Type is the type of change ("ADDED"/"MODIFIED"/"DELETED"/"RENAMED"/"COPIED"/"REWRITE") Type string // Insertions is the number of insertions of this patch. Insertions int // Deletions is the number of deletions of this patch. Deletions int }
FilePatch is information about a patch on a file.
type GerritEvent ¶
GerritEvent is a common interface to various gerrit event structures.
func DecodeGerritEvent ¶
func DecodeGerritEvent(eventJSON []byte) (GerritEvent, error)
DecodeGerritEvent decodes a gerrit event from JSON to a GerritEvent structure.
type HashtagsChangedEvent ¶
type HashtagsChangedEvent struct {}
HashtagsChangedEvent is sent when the hashtags have been added to or removed from a change.
type Label ¶
type Label struct { // Label is the name of the label. Label string // Status is the status of the label ("OK"/"REJECT"/"NEED"/"MAY"/"IMPOSSIBLE"). Status string // By is the account that applied the label. By Account }
Label contains information about a code review label for a change.
type Message ¶
type Message struct { // Timestamp is the time in seconds since the UNIX epoch when this comment was added. Timestamp int64 // Reviewer is the account that added the comment. Reviewer Account // Message is the comment text. Message string }
Message is a comment added on a change by a reviewer.
type PatchSet ¶
type PatchSet struct { // Number is the patchset number. Number int // Revision is the git commit for this patchset. Revision string // Parents is the list of parent revisions. Parents []string // Ref is the git reference pointing at the revision. This reference is available through the // Gerrit Code Review server's Git interface for the containing change. Ref string // Uploader is the uploader of the patchset. Uploader Account // Author is the author of the patchset. Author Account // CreatedOn is the time in seconds since the UNIX epoch when this patchset was created. CreatedOn int64 `json:"createdOn"` // Kind is the kind of change uploaded ("REWORK"/"TRIVIAL_REBASE"/"MERGE_FIRST_PARENT_UPDATE"/ // "NO_CODE_CHANGE"/"NO_CHANGE"). Kind string // Approvals are the approvals granted to the patchset. Approvals []Approval // Comments gives all comments for this patchset. Comments []PatchSetComment // Files gives all changed files in this patchset. Files []FilePatch // SizeInsertions gives size information of insertions of this patchset. SizeInsertions int `json:"sizeInsertions"` // SizeDeletions gives size information of deletions of this patchset. SizeDeletions int `json:"sizeDeletions"` }
PatchSet refers to a specific patchset within a change.
type PatchSetComment ¶
type PatchSetComment struct { // File is the name of the file on which the comment was added. File string // Line is the line number at which the comment was added. Line int // Reviewer is the account that added the comment. Reviewer Account // Message is the comment text. Message string }
PatchSetComment is a comment added on a patchset by a reviewer.
type PatchSetCreatedEvent ¶
type PatchSetCreatedEvent struct { Base Change Change PatchSet PatchSet `json:"patchSet"` Uploader Account }
PatchSetCreatedEvent is sent when a new change has been uploaded, or a new patchset has been uploaded to an existing change.
type PrivateStateChangedEvent ¶
type PrivateStateChangedEvent struct { Base Change Change PatchSet PatchSet `json:"patchSet"` Changer Account }
PrivateStateChangedEvent is sent when the private state of the changeset has changed.
type ProjectCreatedEvent ¶
type ProjectCreatedEvent struct { Base ProjectName string `json:"projectName"` ProjectHead string `json:"projectHead"` }
ProjectCreatedEvent is sent when a new project has been created.
type RefUpdate ¶
type RefUpdate struct { // OldRev is the old value of the ref, prior to the update. OldRev string `json:"oldRev"` // NewRev is the new value the ref was updated to. Zero value // ("0000000000000000000000000000000000000000") indicates that the ref was deleted. NewRev string `json:"newRev"` // RefName is the full rev name within project. RefName string `json:"refName"` // Project is the project path in Gerrit. Project string }
RefUpdate is information about a ref that was updated.
type RefUpdatedEvent ¶
type RefUpdatedEvent struct { Base Submitter Account RefUpdate struct { // OldRev is the old value of the ref, prior to the update. OldRev string `json:"oldRev"` // NewRev is the new value the ref was updated to. NewRev string `json:"newRev"` // RefName is the full ref name within project. RefName string `json:"refName"` // Project is the project path within Gerrit. Project string } `json:"refUpdate"` }
RefUpdatedEvent is sent when a reference is updated in a git repository.
type Requirement ¶
type Requirement struct { // FallbackText is a human readable description of the requirement. FallbackText string `json:"fallbackText"` // Type is an alphanumerical (plus hyphens or underscores) string to identify what the // requirement is and why is was triggered. Can be seen as a class: requirements sharing the // same type were created for a similar reason, and the data structure will follow one set of // rules. Type string // Data is additional key-value data linked to this requirement. This is used in templates to // render rich status messages. Data map[string]string }
Requirement gives information about a requirement in order to submit a change.
type ReviewerAddedEvent ¶
type ReviewerAddedEvent struct { Base Change Change PatchSet PatchSet `json:"patchSet"` Reviewer Account }
ReviewerAddedEvent is sent when a reviewer is added to a change.
type ReviewerDeletedEvent ¶
type ReviewerDeletedEvent struct { Base Change Change PatchSet PatchSet `json:"patchSet"` Reviewer Account Remover Account Approvals []Approval Comment string }
ReviewerDeletedEvent is sent when a reviewer (with a vote) is removed from a change.
type SubmitRecord ¶
type SubmitRecord struct { // Status is the current changeset submit status ("OK"/"NOT_READY"/"RULE_ERROR"). Status string // Labels describes the state of each code review label, unless the status is RULE_ERROR. Labels []Label // Requirements describes what needs to be changed in order for the change to be submittable. Requirements []Requirement }
SubmitRecord is information about the submit status of a change.
type TopicChangedEvent ¶
type TopicChangedEvent struct { Base Change Change Changer Account OldTopic string `json:"oldTopic"` }
TopicChangedEvent is sent when the topic of a change has been changed.