Documentation
¶
Index ¶
Constants ¶
View Source
const (
Collection = "notifications"
)
Variables ¶
This section is empty.
Functions ¶
func BulkInserter ¶
func BulkInserter(ctx context.Context) (adb.BufferedInserter, error)
func InsertMany ¶
func InsertMany(items ...Notification) error
Types ¶
type Notification ¶
type Notification struct {
ID string `bson:"_id"`
Subscriber event.Subscriber `bson:"subscriber"`
Payload interface{} `bson:"payload"`
SentAt time.Time `bson:"sent_at"`
Error string `bson:"error,omitempty"`
}
func Find ¶
func Find(id string) (*Notification, error)
func New ¶
func New(e *event.EventLogEntry, trigger string, subscriber *event.Subscriber, payload interface{}) (*Notification, error)
New returns a new Notification, with a correctly initialised ID
func (*Notification) Composer ¶
func (n *Notification) Composer() (message.Composer, error)
Composer builds a grip/message.Composer for the notification. Composer is guaranteed to be non-nil if error is nil, but the composer may not be loggable
func (*Notification) MarkError ¶
func (n *Notification) MarkError(sendErr error) error
func (*Notification) MarkSent ¶
func (n *Notification) MarkSent() error
type NotificationStats ¶
type NotificationStats struct {
GithubPullRequest int `json:"github_pull_request" bson:"github_pull_request" yaml:"github_pull_request"`
JIRAIssue int `json:"jira_issue" bson:"jira_issue" yaml:"jira_issue"`
JIRAComment int `json:"jira_comment" bson:"jira_comment" yaml:"jira_comment"`
EvergreenWebhook int `json:"evergreen_webhook" bson:"evergreen_webhook" yaml:"evergreen_webhook"`
Email int `json:"email" bson:"email" yaml:"email"`
Slack int `json:"slack" bson:"slack" yaml:"slack"`
}
func CollectUnsentNotificationStats ¶
func CollectUnsentNotificationStats() (*NotificationStats, error)
type SlackPayload ¶
type SlackPayload struct {
Body string `bson:"body"`
Attachments []message.SlackAttachment `bson:"attachments"`
}
Click to show internal directories.
Click to hide internal directories.