notifications

package
v0.0.0-...-9ea7be0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name           string `json:"name"`
	Email          string `json:"email"`
	Cell           string `json:"cell"`
	DataCollection string `json:"data_collection"`
}

Config - config options for user

type DummyNotificationStack

type DummyNotificationStack struct {
	Notifications []UINotificationObj
	FS            fileaccess.FileAccess
	Bucket        string
	Track         map[string]bool
	AdminEmails   []string
	Environment   string
	Logger        logger.ILogger
}

func (*DummyNotificationStack) AddNotification

func (stack *DummyNotificationStack) AddNotification(obj UINotificationObj)

func (*DummyNotificationStack) CreateUserObject

func (stack *DummyNotificationStack) CreateUserObject(userid string, name string, email string) (UserStruct, error)

func (*DummyNotificationStack) FetchUserObject

func (stack *DummyNotificationStack) FetchUserObject(userid string, createIfNotExist bool, name string, email string) (UserStruct, error)

func (*DummyNotificationStack) GetTrack

func (stack *DummyNotificationStack) GetTrack(userid string) (bool, bool)

func (*DummyNotificationStack) GetUINotifications

func (stack *DummyNotificationStack) GetUINotifications(userid string) ([]UINotificationObj, error)

GetUINotifications - Return Notifications for user and remove from stack

func (*DummyNotificationStack) SendAll

func (stack *DummyNotificationStack) 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 (*DummyNotificationStack) SendAllDataSource

func (stack *DummyNotificationStack) 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 (*DummyNotificationStack) SendEmail

func (stack *DummyNotificationStack) SendEmail(topic string, templateInput map[string]interface{}, userOverride []string, userOverrideEmails []string, topiclookupoverride string, includeadmin bool) error

SendEmail - Send an email for a topic type

func (*DummyNotificationStack) SendGlobalEmail

func (stack *DummyNotificationStack) SendGlobalEmail(content string, subject string) error

SendGlobalEmail - Send an email to all users.

func (*DummyNotificationStack) SendUI

func (stack *DummyNotificationStack) SendUI(topic string, templateInput map[string]interface{}, userOverride []string, topiclookupoverride string) error

SendUI Send a notification to the UI stack.

func (*DummyNotificationStack) SendUINotification

func (stack *DummyNotificationStack) SendUINotification(newNotification UINotificationObj) error

SendUINotification - Dispatch notification to the stack

func (*DummyNotificationStack) SetTrack

func (stack *DummyNotificationStack) SetTrack(userid string, track bool)

func (*DummyNotificationStack) UpdateUserConfigFile

func (stack *DummyNotificationStack) UpdateUserConfigFile(userid string, data UserStruct) error

type Method

type Method struct {
	UI    bool `json:"ui"`
	Sms   bool `json:"sms"`
	Email bool `json:"email"`
}

Method - Notification Methods

type MongoUtils

type MongoUtils struct {
	SecretsCache     *secretcache.Cache
	ConnectionSecret string
	MongoUsername    string
	MongoPassword    string
	MongoEndpoint    string
	Log              logger.ILogger
	// contains filtered or unexported fields
}

func (*MongoUtils) Connect

func (m *MongoUtils) Connect() error

func (*MongoUtils) CreateMongoUserObject

func (m *MongoUtils) CreateMongoUserObject(user UserStruct) error

func (*MongoUtils) DeleteUINotifications

func (m *MongoUtils) DeleteUINotifications(user string) error

func (*MongoUtils) FetchMongoUserObject

func (m *MongoUtils) FetchMongoUserObject(userid string, exist bool, name string, email string) (UserStruct, error)

func (*MongoUtils) GetAllMongoUsers

func (m *MongoUtils) GetAllMongoUsers(log logger.ILogger) ([]UserStruct, error)

func (*MongoUtils) GetMongoSubscribersByEmailTopicID

func (m *MongoUtils) GetMongoSubscribersByEmailTopicID(override []string, searchtopic string, logger logger.ILogger) ([]UserStruct, error)

func (*MongoUtils) GetMongoSubscribersByTopic

func (m *MongoUtils) GetMongoSubscribersByTopic(searchtopic string, logger logger.ILogger) ([]UserStruct, error)

func (*MongoUtils) GetMongoSubscribersByTopicID

func (m *MongoUtils) GetMongoSubscribersByTopicID(override []string, searchtopic string, logger logger.ILogger) ([]UserStruct, error)

func (*MongoUtils) GetUINotifications

func (m *MongoUtils) GetUINotifications(user string) ([]UINotificationObj, error)

func (*MongoUtils) InsertUINotification

func (m *MongoUtils) InsertUINotification(newNotification UINotificationObj) error

func (*MongoUtils) UpdateMongoUserConfig

func (m *MongoUtils) UpdateMongoUserConfig(userid string, data UserStruct) error

type NotificationConfig

type NotificationConfig struct {
	Method `json:"method"`
}

NotificationConfig - Config specifically for notifications

type NotificationManager

type NotificationManager interface {
	FetchUserObject(userid string, createIfNotExist bool, name string, email string) (UserStruct, error)
	CreateUserObject(userid string, name string, email string) (UserStruct, error)
	UpdateUserConfigFile(userid string, data UserStruct) error
	SendEmail(topic string, templateInput map[string]interface{}, userOverride []string, userOverrideEmails []string, topiclookupoverride string, includeadmin bool) error
	SendUI(topic string, templateInput map[string]interface{}, userOverride []string, topiclookupoverride 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
	SendUINotification(newNotification UINotificationObj) error
	GetUINotifications(userid string) ([]UINotificationObj, error)
	GetTrack(userid string) (bool, bool)
	SetTrack(userid string, track bool)
	AddNotification(UINotificationObj)
	SendGlobalEmail(content string, subject string) error
}

type NotificationStack

type NotificationStack struct {
	Notifications []UINotificationObj
	FS            fileaccess.FileAccess
	Bucket        string
	Track         cmap.ConcurrentMap //map[string]bool
	AdminEmails   []string
	Environment   string
	Logger        logger.ILogger
	MongoUtils    *MongoUtils
}

NotificationStack - Controller for UI Notifications

func (*NotificationStack) AddNotification

func (stack *NotificationStack) AddNotification(obj UINotificationObj)

func (*NotificationStack) CreateUserObject

func (stack *NotificationStack) CreateUserObject(userid string, name string, email string) (UserStruct, error)

func (*NotificationStack) FetchUserObject

func (stack *NotificationStack) FetchUserObject(userid string, createIfNotExist bool, name string, email string) (UserStruct, error)

func (*NotificationStack) GetAllUsers

func (stack *NotificationStack) GetAllUsers() ([]UserStruct, error)

func (*NotificationStack) GetSubscribersByEmailTopicID

func (stack *NotificationStack) GetSubscribersByEmailTopicID(useroverride []string, topic string) ([]UserStruct, error)

func (*NotificationStack) GetSubscribersByTopic

func (stack *NotificationStack) GetSubscribersByTopic(topic string) ([]UserStruct, error)

func (*NotificationStack) GetSubscribersByTopicID

func (stack *NotificationStack) GetSubscribersByTopicID(useroverride []string, topic string) ([]UserStruct, error)

func (*NotificationStack) GetTrack

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

func (*NotificationStack) GetUINotifications

func (stack *NotificationStack) GetUINotifications(userid string) ([]UINotificationObj, error)

GetUINotifications - Return Notifications for user and remove from stack

func (*NotificationStack) InitUser

func (stack *NotificationStack) InitUser(name string, email string, userid string) UserStruct

func (*NotificationStack) SendAll

func (stack *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 (stack *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) SendEmail

func (stack *NotificationStack) SendEmail(topic string, templateInput map[string]interface{}, userOverride []string, userOverrideEmails []string, topiclookupoverride string, includeadmin bool) error

SendEmail - Send an email for a topic type

func (*NotificationStack) SendGlobalEmail

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

SendGlobalEmail - Send an email to all users.

func (*NotificationStack) SendUI

func (stack *NotificationStack) SendUI(topic string, templateInput map[string]interface{}, userOverride []string, topiclookupoverride string) error

SendUI Send a notification to the UI stack.

func (*NotificationStack) SendUINotification

func (stack *NotificationStack) SendUINotification(newNotification UINotificationObj) error

SendUINotification - Dispatch notification to the stack

func (*NotificationStack) SetTrack

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

func (*NotificationStack) UpdateUserConfigFile

func (stack *NotificationStack) UpdateUserConfigFile(userid string, data UserStruct) error

type Notifications

type Notifications struct {
	Topics          []Topics            `json:"topics"`
	Hints           []string            `json:"hints"`
	UINotifications []UINotificationObj `json:"uinotifications"`
}

Notifications - Object for notification settings

type TemplateContents

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

TemplateContents - Structure for template injection

type Topics

type Topics struct {
	Name   string             `json:"name"`
	Config NotificationConfig `json:"config"`
}

Topics - Notification Topics'

type UINotificationObj

type UINotificationObj struct {
	Topic     string    `json:"topic"`
	Message   string    `json:"message"`
	Timestamp time.Time `json:"timestamp"`
	UserID    string    `json:"userid"`
}

UINotificationObj - UI Notification Object

type UserStruct

type UserStruct struct {
	Userid        string `json:"userid"`
	Notifications `json:"notifications"`
	Config        `json:"userconfig"`
}

UserStruct - Structure for user configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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