email

package
v0.0.0-...-540cd2b Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrEmailNotFound

func ErrEmailNotFound(identifer string) error

func ErrTemplateNotFound

func ErrTemplateNotFound(identifier string) error

Types

type CompactTemplate

type CompactTemplate struct {
	bun.BaseModel `bun:"table:template,alias:tpl"`
	Created       time.Time `bun:",notnull"`
	Subject       string    `bun:",notnull"`
	Id            int64     `bun:",pk" json:",string"`
}

type CreateNewEmailRequest

type CreateNewEmailRequest struct {
	Context    map[string]string     `json:"context"`
	ReplyTo    *models.EmailAddress  `json:"reply_to"`
	When       *models.DateTime      `json:"when"`
	BCC        []models.EmailAddress `json:"bcc"`
	From       models.EmailAddress   `json:"from"`
	To         []models.EmailAddress `json:"to"`
	TemplateId int64                 `json:"template_id,string"`
}

type CreateTemplateRequest

type CreateTemplateRequest struct {
	Subject string
	Text    string
	Html    string
}

type Email

type Email struct {
	bun.BaseModel `bun:"table:email,alias:em"`
	Created       time.Time `bun:",notnull"`
	ExpectedSent  time.Time `bun:"expected_sent,notnull"`

	ProcessedDate bun.NullTime `bun:",nullzero"`
	From          string       `bun:",notnull"`
	ReplyTo       string       `bun:"reply_to"`
	To            string       `bun:",notnull"`
	BCC           string       `bun:"bcc"`
	ContextRaw    string       `bun:"context,notnull"`
	TemplateId    int64        `bun:",notnull"`
	DomainId      int64        `bun:",notnull"`
	Id            int64        `bun:",pk"`
	// contains filtered or unexported fields
}

func NewEmail

func NewEmail(
	sNode *snowflake.Node,
	domainId int64,
	templateId int64,
	from string,
	to string,
	replyTo string,
	bcc string,
	context map[string]string,
	expectedSent *models.DateTime,
) (*Email, error)

func (*Email) GetContext

func (em *Email) GetContext() map[string]string

type EmailRepository

type EmailRepository interface {
	GetById(ctx context.Context, id int64) (*Email, error)
	Save(ctx context.Context, email *Email) error
}

type Template

type Template struct {
	bun.BaseModel `bun:"table:template,alias:tpl"`
	Created       time.Time `bun:",notnull"`
	Subject       string    `bun:",notnull"`
	Html          string    `bun:",notnull"`
	Text          string    `bun:",notnull"`
	Id            int64     `bun:",pk"`
}

func NewTemplate

func NewTemplate(
	sNode *snowflake.Node,
	text string,
	html string,
	subject string,
) *Template

type TemplateRepository

type TemplateRepository interface {
	GetById(ctx context.Context, id int64) (*Template, error)
	GetAll(ctx context.Context) ([]CompactTemplate, error)
	Save(ctx context.Context, tpl *Template) error
}

Jump to

Keyboard shortcuts

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