notifications

package
v3.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Interface for all notification capabilities (sending emails to users and the UI)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NotificationManager

type NotificationManager interface {
	// Sending notifications
	SendGlobalEmail(content string, subject string) error
	SendAll(topic string, templateInput map[string]interface{}, userOverride []string, includeadmin bool) error
	SendAllDataSource(topic string, templateInput map[string]interface{}, userOverride []string, includeadmin bool, topicoverride string) error

	// UI-specific notifications
	SendUINotification(newNotification pixlUser.UINotificationItem) error
	GetUINotifications(userid string) ([]pixlUser.UINotificationItem, error)

	// Run-time cached list of users who are tracked
	GetTrack(userid string) (bool, bool)
	SetTrack(userid string, track bool)
}

type NotificationStack

type NotificationStack struct {
	Track cmap.ConcurrentMap //map[string]bool
	// contains filtered or unexported fields
}

NotificationStack - Thing that manages user notifications on UI and email including preferences

func MakeNotificationStack

func MakeNotificationStack(mongoClient *mongo.Client, envName string, timestamper timestamper.ITimeStamper, log logger.ILogger, adminEmails []string) (*NotificationStack, error)

func (*NotificationStack) GetTrack

func (n *NotificationStack) GetTrack(userid string) (bool, bool)

func (*NotificationStack) GetUINotifications

func (n *NotificationStack) GetUINotifications(userid string) ([]pixlUser.UINotificationItem, error)

GetUINotifications - Return Notifications for user and remove from stack

func (*NotificationStack) SendAll

func (n *NotificationStack) SendAll(topic string, templateInput map[string]interface{}, userOverride []string, includeadmin bool) error

SendAll - Generic function to trigger the same notification across all services to users who are signed up to receive them.

func (*NotificationStack) SendAllDataSource

func (n *NotificationStack) SendAllDataSource(topic string, templateInput map[string]interface{}, userOverride []string, includeadmin bool, topicoverride string) error

SendAllDataSource - Slight tweak to allow us to lookup topics for updates by the same tag and define emails instead of userids

func (*NotificationStack) SendGlobalEmail

func (n *NotificationStack) SendGlobalEmail(content string, subject string) error

SendGlobalEmail - Send an email to all users.

func (*NotificationStack) SendUINotification

func (n *NotificationStack) SendUINotification(newNotification pixlUser.UINotificationItem) error

SendUINotification - Dispatch notification to the stack

func (*NotificationStack) SetTrack

func (n *NotificationStack) SetTrack(userid string, track bool)

type TemplateContents

type TemplateContents struct {
	ContentMap  pixlUser.UserStruct
	TemplateMap map[string]interface{}
}

TemplateContents - Structure for template injection

Directories

Path Synopsis
Text templates for various types of notifications including HTML vs simple text versions
Text templates for various types of notifications including HTML vs simple text versions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL