Documentation ¶
Index ¶
- Constants
- func ItemsToPlain(items []MessageItem) string
- type ConfigProp
- type ConfigQueryResolver
- type CustomURLService
- type EnumFormatter
- type Enummer
- type Field
- type Generator
- type MessageItem
- type MessageLevel
- type MessageLimit
- type Params
- type QueuedSender
- type RichSender
- type Sender
- type Service
- type ServiceConfig
- type ServiceOpts
- type StdLogger
- type Templater
Constants ¶
const ( // TitleKey is the common key for the title prop TitleKey = "title" // MessageKey is the common key for the message prop MessageKey = "message" )
Variables ¶
This section is empty.
Functions ¶
func ItemsToPlain ¶
func ItemsToPlain(items []MessageItem) string
ItemsToPlain joins together the MessageItems' Text using newlines Used implement the rich sender API by redirecting to the plain sender implementation
Types ¶
type ConfigProp ¶
ConfigProp interface is used to de-/serialize structs from/to a string representation
type ConfigQueryResolver ¶
type ConfigQueryResolver interface { Get(string) (string, error) Set(string, string) error QueryFields() []string }
ConfigQueryResolver is the interface used to get/set and list service config query fields
type CustomURLService ¶
type CustomURLService interface { Service GetConfigURLFromCustom(customURL *url.URL) (serviceURL *url.URL, err error) }
CustomURLService is the interface that needs to be implemented to support custom URLs in services
type EnumFormatter ¶
EnumFormatter translate enums between strings and numbers
type Enummer ¶
type Enummer interface {
Enums() map[string]EnumFormatter
}
Enummer contains fields that have associated EnumFormatter instances
type Generator ¶
type Generator interface {
Generate(service Service, props map[string]string, args []string) (ServiceConfig, error)
}
Generator is the interface for tools that generate service configurations from a user dialog
type MessageItem ¶
type MessageItem struct { Text string Timestamp time.Time Level MessageLevel Fields []Field }
MessageItem is an entry in a notification being sent by a service
func (*MessageItem) WithField ¶
func (mi *MessageItem) WithField(key, value string) *MessageItem
WithField appends the key/value pair to the message items fields
type MessageLevel ¶
type MessageLevel uint8
MessageLevel is used to denote the urgency of a message item
const ( // Unknown is the default message level Unknown MessageLevel = iota // Debug is the lowest kind of known message level Debug // Info is generally used as the "normal" message level Info // Warning is generally used to denote messages that might be OK, but can cause problems Warning // Error is generally used for messages about things that did not go as planned Error // MessageLevelCount is used to create arrays that maps levels to other values MessageLevelCount = int(messageLevelCount) )
func (MessageLevel) String ¶
func (level MessageLevel) String() string
type MessageLimit ¶
type MessageLimit struct { ChunkSize int TotalChunkSize int // Maximum number of chunks (including the last chunk for meta data) ChunkCount int }
MessageLimit is used for declaring the payload limits for services upstream APIs
type Params ¶
Params is the string map used to provide additional variables to the service templates
func (Params) SetMessage ¶
SetMessage sets the "message" param to the specified value
type QueuedSender ¶
type QueuedSender interface { Enqueuef(format string, v ...interface{}) Enqueue(message string) Flush(params *map[string]string) Service() Service }
QueuedSender is the interface for a proxied sender that queues messages before sending
type RichSender ¶
type RichSender interface {
SendItems(items []MessageItem, params Params) error
}
RichSender is the interface needed to implement to send rich notifications
type Service ¶
type Service interface { Sender Templater Initialize(serviceURL *url.URL, logger StdLogger) error SetLogger(logger StdLogger) }
Service is the public common interface for all notification services
type ServiceConfig ¶
ServiceConfig is the common interface for all types of service configurations
type ServiceOpts ¶
ServiceOpts is the interface describing the service options