Documentation ¶
Index ¶
- 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 ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ItemsToPlain ¶ added in v0.4.0
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 ¶ added in v0.4.2
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 ¶ added in v0.4.0
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 ¶ added in v0.5.0
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 ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (mi *MessageItem) WithField(key, value string) *MessageItem
WithField appends the key/value pair to the message items fields
type MessageLevel ¶ added in v0.4.0
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 ¶ added in v0.4.0
func (level MessageLevel) String() string
type MessageLimit ¶ added in v0.4.0
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 ¶ added in v0.5.0
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 ¶ added in v0.4.0
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