Documentation
¶
Index ¶
Constants ¶
View Source
const ( EventUpload = "upload" EventFeedback = "feedback" EventOfficeMention = "office-mention" )
View Source
const ( TypeDirect = "direct" TypeAccumulated = "accumulated" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccumulationPolicy ¶
type AccumulationPolicy struct {
WindowSeconds int `json:"window_seconds" mapstructure:"window_seconds"`
MaxItems int `json:"max_items" mapstructure:"max_items"`
}
AccumulationPolicy controls how accumulated notifications are grouped.
type Envelope ¶
type Envelope struct {
ID string `json:"id"`
EventType string `json:"event_type"`
SubmittingUser string `json:"submitting_user"`
Sender string `json:"sender,omitempty"`
Recipients []string `json:"recipients"`
TemplateData map[string]any `json:"template_data,omitempty"`
SubmittedAt time.Time `json:"submitted_at"`
// The following fields are resolved by the notification worker from event
// rules before dispatch or accumulation. They are not accepted from
// producers.
Type string `json:"type,omitempty"`
DedupKey string `json:"dedup_key,omitempty"`
Handlers []string `json:"handlers,omitempty"`
TemplateName string `json:"template_name,omitempty"`
Accumulation AccumulationPolicy `json:"accumulation,omitempty"`
}
Envelope is the durable notification message sent through NATS and stored in SQL for accumulated notifications.
type EventRule ¶
type EventRule struct {
Type string `json:"type" mapstructure:"type"`
DedupKeyTemplate string `json:"dedup_key_template,omitempty" mapstructure:"dedup_key_template"`
Handlers map[string]HandlerRule `json:"handlers" mapstructure:"handlers"`
Accumulation AccumulationPolicy `json:"accumulation,omitempty" mapstructure:"accumulation"`
}
EventRule configures how one notification event type is delivered.
type HandlerRule ¶
type HandlerRule struct {
TemplateName string `json:"template_name,omitempty" mapstructure:"template_name"`
}
HandlerRule configures one handler for a notification event.
Click to show internal directories.
Click to hide internal directories.