Documentation ¶
Overview ¶
Package notification models notifications sent to users.
Index ¶
- Constants
- func FormatSlackTarget(target string) (string, error)
- func InsertMany(items ...Notification) error
- type Notification
- func (n *Notification) Composer() (message.Composer, error)
- func (n *Notification) MarkError(sendErr error) error
- func (n *Notification) MarkSent() error
- func (n *Notification) SenderKey() (evergreen.SenderKey, error)
- func (n *Notification) SetBSON(raw mgobson.Raw) error
- func (n *Notification) SetTaskMetadata(ID string, execution int)
- func (d *Notification) UnmarshalBSON(in []byte) error
- type NotificationMetadata
- type NotificationStats
- type SlackPayload
Constants ¶
View Source
const (
Collection = "notifications"
)
Variables ¶
This section is empty.
Functions ¶
func FormatSlackTarget ¶
FormatSlackTarget uses the slackMemberId instead of the userName when possible.
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,omitempty"` Error string `bson:"error,omitempty"` Metadata NotificationMetadata `bson:"metadata,omitempty"` }
func Find ¶
func Find(id string) (*Notification, error)
func FindByEventID ¶
func FindByEventID(id string) ([]Notification, error)
func FindUnprocessed ¶
func FindUnprocessed() ([]Notification, error)
func New ¶
func New(eventID, 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
func (*Notification) SenderKey ¶
func (n *Notification) SenderKey() (evergreen.SenderKey, error)
SenderKey returns an evergreen.SenderKey to get a grip sender for this notification from the evergreen environment
func (*Notification) SetTaskMetadata ¶
func (n *Notification) SetTaskMetadata(ID string, execution int)
func (*Notification) UnmarshalBSON ¶
func (d *Notification) UnmarshalBSON(in []byte) error
type NotificationMetadata ¶
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"` GithubCheck int `json:"github_check" bson:"github_check" yaml:"github_check"` GithubMerge int `json:"github_merge" bson:"github_merge" yaml:"github_merge"` EnqueuePatch int `json:"enqueue_patch" bson:"enqueue_patch" yaml:"enqueue_patch"` }
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.