inertia: Index | Files | Directories

package notify

import ""

Package notify provides experimental support for notifications providers.

Tracking issue:


Package Files

doc.go notifier.go slack.go

type Color Uses

type Color string

Color is used to represent message color for different states (i.e success, fail)

const (
    // Green for success messages
    Green Color = "good"
    // Yellow for warning messages
    Yellow Color = "warning"
    // Red for error messages
    Red Color = "danger"

type Message Uses

type Message struct {
    Text  string `json:"text"`
    Color string `json:"color"`

Message builds the attachments content of Message

type MessageArray Uses

type MessageArray struct {
    Attachments []Message `json:"attachments"`

MessageArray builds the json message to be posted to webhook

type Notifier Uses

type Notifier interface {
    Notify(string, Options) error
    IsEqual(Notifier) bool

Notifier manages notifications

func NewSlackNotifier Uses

func NewSlackNotifier(webhookURL string) Notifier

NewSlackNotifier creates a notifier with web hook url to slack channel. Passing it an empty url makes it a no-op notifier.

type Notifiers Uses

type Notifiers []Notifier

Notifiers is a collection of notification targets

func (Notifiers) Exists Uses

func (n Notifiers) Exists(nt Notifier) bool

Exists checks if the given notifier is already configured

func (Notifiers) Notify Uses

func (n Notifiers) Notify(msg string, opts Options) error

Notify delivers a notification to all targets

type Options Uses

type Options struct {
    Color Color

Options is used to configure formatting of notifications

type SlackNotifier Uses

type SlackNotifier struct {
    // contains filtered or unexported fields

SlackNotifier represents slack notifications

func (*SlackNotifier) IsEqual Uses

func (n *SlackNotifier) IsEqual(nt Notifier) bool

IsEqual implements Notifier by checking the provided notifier is a slack notifier and if it has the same hook URL

func (*SlackNotifier) Notify Uses

func (n *SlackNotifier) Notify(text string, options Options) error

Notify sends the notification


mocksCode generated by counterfeiter.

Package notify imports 7 packages (graph) and is imported by 2 packages. Updated 2021-01-28. Refresh now. Tools for package owners.