channel

package
v0.0.0-...-6dc645d Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_CHANNEL  = "API"
	SMTP_CHANNEL = "SMTP"
)
View Source
const (
	HTML_EMAIL = "text/html"
	TEXT_EMAIL = "text/plain"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiChannel

type ApiChannel struct {
	Channel
	Api routes.Route
}

func (*ApiChannel) Execute

func (apiChannel *ApiChannel) Execute(ctx context.Context, r *http.Request, mt MessageTemplate) (response *http.Response, err error)

func (*ApiChannel) MakeFromJson

func (apiChannel *ApiChannel) MakeFromJson(ctx context.Context, rj *json.RawMessage) error

func (*ApiChannel) Send

func (apiChannel *ApiChannel) Send(ctx context.Context, msg string, templateId string, params url.Values) (map[string]interface{}, error)

type Channel

type Channel struct {
	ChannelType string `eru:"required"`
	ChannelName string `eru:"required"`
}

func (*Channel) Execute

func (channel *Channel) Execute(ctx context.Context, r *http.Request, mt MessageTemplate) (response *http.Response, err error)

func (*Channel) GetAttribute

func (channel *Channel) GetAttribute(attributeName string) (attributeValue interface{}, err error)

func (*Channel) ProcessMessageTemplate

func (channel *Channel) ProcessMessageTemplate(ctx context.Context, r *http.Request, mt MessageTemplate) (msg Message, err error)

type ChannelI

type ChannelI interface {
	Execute(ctx context.Context, r *http.Request, mt MessageTemplate) (response *http.Response, err error)
	GetAttribute(attributeName string) (attributeValue interface{}, err error)
	MakeFromJson(ctx context.Context, rj *json.RawMessage) error
	ProcessMessageTemplate(ctx context.Context, r *http.Request, mt MessageTemplate) (msg Message, err error)
}

func GetChannel

func GetChannel(channelType string) ChannelI

type Message

type Message struct {
	Subject string
	Msg     string
	To      []string
	Cc      []string
	Bcc     []string
}

type MessageTemplate

type MessageTemplate struct {
	TemplateType    string `eru:"required"`
	TemplateName    string `eru:"required"`
	TemplateId      string
	TemplateText    string `eru:"required"`
	TemplateSubject string
	ToUsers         string
	CcUsers         string
	BccUsers        string
}

type SmtpChannel

type SmtpChannel struct {
	Channel
	SmtpHost        string
	SmtpPort        int
	SmtpUser        string
	SmtpDisplayName string
	SmtpPassword    string
}

func (*SmtpChannel) Execute

func (smtpChannel *SmtpChannel) Execute(ctx context.Context, r *http.Request, mt MessageTemplate) (response *http.Response, err error)

func (*SmtpChannel) MakeFromJson

func (smtpChannel *SmtpChannel) MakeFromJson(ctx context.Context, rj *json.RawMessage) error

Jump to

Keyboard shortcuts

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