Documentation
¶
Index ¶
Constants ¶
View Source
const MaxProcessingTime = time.Second * 10
View Source
const NotificationType refs.IdentifiableType = "notification"
Variables ¶
View Source
var AllTargets = []Target{TargetMail, TargetScript}
Functions ¶
func NewDispatcher ¶
func NewDispatcher(repository store) dispatcher
Types ¶
type ContentType ¶
type ContentType string
ContentType represents a content type for the Msg
const ( ContentTypeTextPlain ContentType = "text/plain" ContentTypeTextHTML ContentType = "text/html" ContentTypeTextJSON ContentType = "text/json" )
func (ContentType) Valid ¶
func (t ContentType) Valid() error
type Dispatcher ¶
type Dispatcher interface {
Dispatch(ctx context.Context, refID refs.Identifiable, notification NotificationData) (refs.Identifiable, error)
}
type NotificationData ¶
type NotificationData struct { Target string `json:"target"` Recipients []string `json:"recipients"` Subject string `json:"subject"` Content string `json:"content"` ContentType ContentType `json:"content_type"` }
type NotificationDetails ¶
type NotificationDetails struct { RefID refs.Identifiable Data NotificationData State ProcessingState ID refs.Identifiable Out string Target Target Err string }
type NotificationID ¶
type NotificationID refs.Identifiable
type NotificationSummary ¶
type ProcessingState ¶
type ProcessingState string
const ProcessingStateDispatching ProcessingState = "dispatching"
const ProcessingStateDone ProcessingState = "done"
const ProcessingStateError ProcessingState = "error"
const ProcessingStateQueued ProcessingState = "queued"
type Store ¶
type Store interface { Create(ctx context.Context, details NotificationDetails) error SetDone(ctx context.Context, details NotificationDetails, out string) error SetError(ctx context.Context, details NotificationDetails, out, err string) error NotificationStream(target Target) chan NotificationDetails Close() error }
Click to show internal directories.
Click to hide internal directories.