slack

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

View Source
const (
	OK int = iota
	Warning
	Critical
	Other
)

notification status

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessory added in v0.9.0

type Accessory struct {
	Type    string    `json:"type"`
	Options []*Option `json:"options,omitempty"`
}

type Block added in v0.9.0

type Block struct {
	Type       string `json:"type"`
	*Text      `json:"text,omitempty"`
	Elements   []*Element `json:"elements,omitempty"`
	*Accessory `json:"accessory,omitempty"`
}

func (*Block) AddOverflowOption added in v0.9.0

func (b *Block) AddOverflowOption(msg string) error

type Element added in v0.9.0

type Element struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

type Message added in v0.9.0

type Message struct {
	Channel string   `json:"channel,omitempty"`
	Text    string   `json:"text,omitempty"`
	Blocks  []*Block `json:"blocks,omitempty"`
}

****************************************************************************** New code for the slack blocks payload, recomended to switch from attachements

func (*Message) AddBlockMsg added in v0.9.0

func (m *Message) AddBlockMsg(msg string)

func (*Message) AddElements added in v0.9.0

func (m *Message) AddElements(elements ...string)

type Option added in v0.9.0

type Option struct {
	*Text `json:"text,omitempty"` // type on this text must always be "plain_text"
	Value string                  `json:"value"`
}

on an overflow Option you cannot have more than 5 items

type Slack

type Slack struct {
	Channel string
	Prefix  string
	Url     string
	Title   string
}

func (*Slack) NewMessage added in v0.9.0

func (s *Slack) NewMessage(msg string) *Message

func (*Slack) Notify

func (s *Slack) Notify(message string, level int) error

Sends a slack message with a level indicator

func (*Slack) SendMessage added in v0.9.0

func (s *Slack) SendMessage(m *Message) error

type Text added in v0.9.0

type Text struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

Jump to

Keyboard shortcuts

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