Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attachment ¶
type Attachment struct { Fallback string `json:"fallback"` Pretext string `json:"pretext"` Title string `json:"title"` TitleLink string `json:"title_link"` Text string `json:"text"` Color string `json:"color"` Fields []MessageField `json:"fields"` }
Attachment is a slack attachment
type ChangeMerged ¶
type ChangeMerged struct{}
ChangeMerged handles the change-merged event
func (ChangeMerged) Message ¶
func (ChangeMerged) Message(e gerritssh.Event, _ project.Config, _ *gerrit.Client, me MessageEnricher) (Message, error)
Message implements the EventHandler interface
func (ChangeMerged) Type ¶
func (ChangeMerged) Type() string
Type implements the EventHandler interface
type CommentAdded ¶
type CommentAdded struct{}
CommentAdded handles the comment-added event
func (CommentAdded) Message ¶
func (CommentAdded) Message(e gerritssh.Event, _ project.Config, c *gerrit.Client, me MessageEnricher) (Message, error)
Message implements the EventHandler interface
func (CommentAdded) Type ¶
func (CommentAdded) Type() string
Type implements the EventHandler interface
type EventHandler ¶
type EventHandler interface { // Type should return the type the handler handles Type() string // Ignore should return true if the event should be ignored Ignore(gerritssh.Event, project.Config) (bool, error) // Message should return a Message for the event Message(gerritssh.Event, project.Config, *gerrit.Client, MessageEnricher) (Message, error) }
EventHandler takes a given Event and generates a Message
type Message ¶
type Message struct { Attachment Channel string }
Message is a single-attachment message
func (Message) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface
type MessageEnricher ¶
type MessageEnricher interface { // MentionUser takes an email and name and returns either a mention or their // name MentionUser(string, string) string }
MessageEnricher is used when building a message to mention a user
type MessageField ¶
type MessageField struct { Title string `json:"title"` Value string `json:"value"` Short bool `json:"short"` }
MessageField is a slack field
func OwnerField ¶
func OwnerField(e gerritssh.Event, me MessageEnricher) MessageField
OwnerField returns a Owner field with their name
func ProjectField ¶
func ProjectField(e gerritssh.Event) MessageField
ProjectField returns a Project field with the name
func ReviewersField ¶
func ReviewersField(e gerritssh.Event, rs []gerrit.ReviewerInfo, me MessageEnricher) MessageField
ReviewersField returns a Reviewers field with reviewers
type PatchSetCreated ¶
type PatchSetCreated struct{}
PatchSetCreated handles the patchset-created event
func (PatchSetCreated) Message ¶
func (PatchSetCreated) Message(e gerritssh.Event, pcfg project.Config, c *gerrit.Client, me MessageEnricher) (Message, error)
Message implements the EventHandler interface
func (PatchSetCreated) Type ¶
func (PatchSetCreated) Type() string
Type implements the EventHandler interface
type ReviewerAdded ¶
type ReviewerAdded struct{}
ReviewerAdded handles the reviewer-added event
func (ReviewerAdded) Message ¶
func (ReviewerAdded) Message(e gerritssh.Event, _ project.Config, _ *gerrit.Client, me MessageEnricher) (Message, error)
Message implements the EventHandler interface
func (ReviewerAdded) Type ¶
func (ReviewerAdded) Type() string
Type implements the EventHandler interface