notifier

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendEmail

func SendEmail(recipient string, message string, subject string) error

SendEmail provides the implementation of the EmailSender type for runtime usage.

func SendEmailErrorMock

func SendEmailErrorMock(recipient string, message string, subject string) error

SendEmailErrorMock mocks an error response about no response from the server.

func SendEmailMock

func SendEmailMock(recipient string, message string, subject string) error

SendEmailMock mocks the normal response of a successful send with no error.

func SendSms

func SendSms(smsNumber string, message string) error

SendSms provides the implementation of the SmsSender type for runtime usage.

func SendSmsErrorMock

func SendSmsErrorMock(smsNumber string, message string) error

SendSmsErrorMock mocks an error response about no response from the server.

func SendSmsMock

func SendSmsMock(smsNumber string, message string) error

SendSmsMock mocks the normal response of a successful send with no error.

Types

type EmailSender

type EmailSender func(recipient string, message string, subject string) error

EmailSender defines a function to do the work to send an email.

type Notifier

type Notifier struct {
	Site      database.Site
	Message   string
	Subject   string
	SendEmail EmailSender
	SendSms   SmsSender
}

Notifier sends the notifications to the recipients on a status change.

func NewNotifier

func NewNotifier(site database.Site, message string, subject string,
	sendEmail EmailSender, sendSms SmsSender) *Notifier

NewNotifier returns a new Notifier object to perform notifications about status change

func (*Notifier) Notify

func (n *Notifier) Notify()

Notify starts the notification for each contact for the site.

type SmsSender

type SmsSender func(smsNumber string, message string) error

SmsSender defines a function to do the work to send an SMS text message.

Jump to

Keyboard shortcuts

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