Documentation ¶
Index ¶
Constants ¶
const ( // NSuccess is a success level. NSuccess = "SUCCESS" // NInfo is information level. NInfo = "INFO" // NWarning is a warning level. NWarning = "WARN" // NError is an error level. NError = "ERROR" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
Backend is a functional option to configure a sending backend.
func WithGithubPRComment ¶
WithGithubPRComment is a functional option used in AddComment method.
func WithSlackMessage ¶
WithSlackMessage is a functional option used in AddComment method to se d notification to slack.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles notification backends which implement Sender interface.
func NewHandler ¶
NewHandler returns a new instance of a Handler and initializes backends.
func (*Handler) AddComment ¶
func (h *Handler) AddComment(ctx context.Context, level NotificationLevel, title, body string, backends ...Backend) error
AddComment adds a new comment to backends.
type Message ¶
type Message struct { Title string Body string Channel string // contains filtered or unexported fields }
Message is an object of a slack message
type NotificationLevel ¶
type NotificationLevel string
NotificationLevel is a custom type to indicate a message severity.
type Sender ¶
type Sender interface { ID() SenderID Notify(ctx context.Context, level NotificationLevel, title, body string) error }
Sender defines a generic interface for notification services. A context object could be used to pass a complex messages as a context value.
func NewGithubCommentSender ¶
NewGithubCommentSender constructs an implementation of github comment notification of Sender interface.