message

package
v0.0.0-...-7578c0e Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValidationNone  = ValidationType("none")
	ValidationEmail = ValidationType("email")
	ValidationRegex = ValidationType("regex")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Title         string
	SendTo        string
	Token         string
	UserAgent     string
	RemoteAddress string
	TTL           time.Duration
}

type PushoverService

type PushoverService struct {
	// contains filtered or unexported fields
}

PushoverService is a service that uses Pushover API to send messages via Pushover.net.

func NewPushoverService

func NewPushoverService(apiToken string) *PushoverService

func (*PushoverService) DeliveryMethod

func (s *PushoverService) DeliveryMethod() string

func (*PushoverService) Send

func (s *PushoverService) Send(ctx context.Context, data Data) error

func (*PushoverService) ValidateReceiver

func (s *PushoverService) ValidateReceiver(ctx context.Context, pushoverUserKey string) error

type SMTPService

type SMTPService struct {
	Auth      smtp.Auth
	HostPort  string
	From      string
	TLSConfig *tls.Config
}

func NewSMTPService

func NewSMTPService(hostPort, username, password, fromEmail string, withTLS bool) (*SMTPService, error)

func (*SMTPService) DeliveryMethod

func (s *SMTPService) DeliveryMethod() string

func (*SMTPService) Send

func (s *SMTPService) Send(ctx context.Context, data Data) error

func (*SMTPService) ValidateReceiver

func (s *SMTPService) ValidateReceiver(ctx context.Context, email string) error

type ScriptService

type ScriptService struct {
	Script     string
	Validation ValidationType
	Regex      *regexp.Regexp
}

func NewScriptService

func NewScriptService(script string, validation ValidationType, regex *regexp.Regexp) *ScriptService

func (*ScriptService) DataToEnv

func (s *ScriptService) DataToEnv(data Data) []string

func (*ScriptService) DeliveryMethod

func (s *ScriptService) DeliveryMethod() string

func (*ScriptService) Send

func (s *ScriptService) Send(ctx context.Context, data Data) error

func (*ScriptService) ValidateReceiver

func (s *ScriptService) ValidateReceiver(ctx context.Context, receiver string) error

type Service

type Service interface {
	Send(ctx context.Context, data Data) error
	DeliveryMethod() string
	ValidateReceiver(ctx context.Context, receiver string) error
}

type ServiceMock

type ServiceMock struct {
	ReturnError error
}

func (*ServiceMock) DeliveryMethod

func (s *ServiceMock) DeliveryMethod() string

func (*ServiceMock) Send

func (s *ServiceMock) Send(ctx context.Context, data Data) error

func (*ServiceMock) ValidateReceiver

func (s *ServiceMock) ValidateReceiver(ctx context.Context, receiver string) error

type URLService

type URLService struct {
	// contains filtered or unexported fields
}

func NewURLService

func NewURLService(senderURL, baseURL string) *URLService

func (*URLService) DeliveryMethod

func (s *URLService) DeliveryMethod() string

func (*URLService) Send

func (s *URLService) Send(ctx context.Context, data Data) error

func (*URLService) ValidateReceiver

func (s *URLService) ValidateReceiver(ctx context.Context, email string) error

type ValidationType

type ValidationType string

Jump to

Keyboard shortcuts

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