notifications

package
v1.18.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSlackTimeout = 5 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Color         string `json:"color,omitempty"`
	Fallback      string `json:"fallback,omitempty"`
	CallbackID    string `json:"callback_id,omitempty"`
	ID            int    `json:"id,omitempty"`
	AuthorID      string `json:"author_id,omitempty"`
	AuthorName    string `json:"author_name,omitempty"`
	AuthorSubname string `json:"author_subname,omitempty"`
	AuthorLink    string `json:"author_link,omitempty"`
	AuthorIcon    string `json:"author_icon,omitempty"`
	Title         string `json:"title,omitempty"`
	TitleLink     string `json:"title_link,omitempty"`
	Pretext       string `json:"pretext,omitempty"`
	Text          string `json:"text,omitempty"`
	ImageURL      string `json:"image_url,omitempty"`
	ThumbURL      string `json:"thumb_url,omitempty"`
	// Fields and actions are not defined.
	MarkdownIn []string    `json:"mrkdwn_in,omitempty"`
	Ts         json.Number `json:"ts,omitempty"`
}

type SimpleSlackRequest

type SimpleSlackRequest struct {
	Text      string
	IconEmoji string
}

type SlackClient

type SlackClient struct {
	WebHookUrl string
	UserName   string
	Channel    string
	TimeOut    time.Duration
}

func NewSlackClient added in v1.18.9

func NewSlackClient(configuration settings.IConfiguration) *SlackClient

func (SlackClient) SendError

func (sc SlackClient) SendError(message string, options ...string) (err error)

func (SlackClient) SendInfo

func (sc SlackClient) SendInfo(message string, options ...string) (err error)

func (SlackClient) SendJobNotification

func (sc SlackClient) SendJobNotification(job SlackJobNotification) error

func (SlackClient) SendSlackNotification

func (sc SlackClient) SendSlackNotification(sr SimpleSlackRequest) error

SendSlackNotification will post to an 'Incoming Webook' url setup in Slack Apps. It accepts some text and the slack channel is saved within Slack.

func (SlackClient) SendWarning

func (sc SlackClient) SendWarning(message string, options ...string) (err error)

type SlackJobNotification

type SlackJobNotification struct {
	Color     string
	IconEmoji string
	Details   string
	Text      string
}

type SlackMessage

type SlackMessage struct {
	Username    string       `json:"username,omitempty"`
	IconEmoji   string       `json:"icon_emoji,omitempty"`
	Channel     string       `json:"channel,omitempty"`
	Text        string       `json:"text,omitempty"`
	Attachments []Attachment `json:"attachments,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL