Documentation
¶
Index ¶
- Constants
- func EachAttachmentSourceRelativeWithPathPrefix(prefix string, each iter.Seq2[AttachmentSource, error]) iter.Seq2[AttachmentSource, error]
- type Attachment
- type AttachmentError
- type AttachmentReference
- type AttachmentSource
- type FieldComparisonMismatchError
- type Letter
- func (l Letter) AssertEqualityTo(b Letter) error
- func (l Letter) EachAttachmentSource() iter.Seq2[AttachmentSource, error]
- func (l Letter) EachWarning(fs fs.FS) iter.Seq2[*i18n.LocalizeConfig, error]
- func (l Letter) GetDatabase() string
- func (l Letter) GetExpiration() (t time.Duration, err error)
- func (l Letter) GetFrom() (mail.Address, error)
- func (l Letter) GetHeaders() (headers []header.Header, err error)
- func (l Letter) GetLanguage() (lang language.Tag, err error)
- func (l Letter) GetMediaConstraints() (m media.Constraints, err error)
- func (l Letter) GetSchedule() (s Schedule, err error)
- func (l Letter) GetSeed() (string, error)
- func (l Letter) GetSubject() (string, error)
- func (l Letter) IsEqualTo(b Letter) bool
- func (l Letter) IsValid(cxt context.Context, logger *slog.Logger) (ok bool)
- func (l Letter) LogValue() slog.Value
- func (l Letter) Validate() (err error)
- type LetterError
- type Mailer
- type Message
- type MessageError
- type Schedule
Constants ¶
View Source
const ( FieldNameID = "id" FieldNameSeed = "seed" FieldNameExtends = "extends" FieldNameDatabase = "queue" FieldNameSubject = "subject" FieldNameReplyTo = "reply_to" FieldNameAttachments = "attachments" FieldNameAttachmentName = "name" FieldNameAttachmentLocation = "location" FieldNameTemplates = "templates" FieldNameHeaders = "headers" FieldNameLanguage = "language" FieldNameMediaContraints = "media_constraints" FieldNameMediaConstraintsQuality = "quality" FieldNameMediaConstrainsResolution = "resolution" FieldNameMediaConstraintsWidth = "width" FieldNameMediaConstrainsHeight = "height" FieldNameSchedule = "schedule" FieldNameScheduleAfter = "after" FieldNameScheduleDelay = "delay" FieldNameScheduleStep = "step" FieldNameScheduleExpire = "expire" FieldNameScheduleFluctuate = "fluctuate" )
View Source
const Version = "dev"
Variables ¶
This section is empty.
Functions ¶
func EachAttachmentSourceRelativeWithPathPrefix ¶ added in v0.0.5
func EachAttachmentSourceRelativeWithPathPrefix(prefix string, each iter.Seq2[AttachmentSource, error]) iter.Seq2[AttachmentSource, error]
Types ¶
type Attachment ¶
type Attachment struct {
LetterID string
Name string
Source string
// Hash uint64 // for XXHash2
Hash string
// ContentID is the ID of the inline attachment to use in the message.
// It must conform to RFC 2392 format, including the angle brackets:
// <hash@domain.com>. Leave empty for standalone attachments that
// are not referenced by other parts of the message.
ContentID string
ContentType string
Content []byte
}
func NewAttachment ¶
func NewAttachment(b []byte, constraints media.Constraints) (a Attachment, err error)
func NewAttachmentFromFile ¶ added in v0.0.5
func NewAttachmentFromFile(fs fs.FS, p string, constraints media.Constraints) (a Attachment, err error)
func (Attachment) AssertEqualityTo ¶ added in v0.0.5
func (a Attachment) AssertEqualityTo(b Attachment) error
func (Attachment) IsEqualTo ¶ added in v0.0.5
func (a Attachment) IsEqualTo(b Attachment) bool
func (Attachment) LogValue ¶ added in v0.0.5
func (a Attachment) LogValue() slog.Value
func (Attachment) Validate ¶ added in v0.0.5
func (a Attachment) Validate() (err error)
func (Attachment) WithUpdatedHash ¶ added in v0.0.5
func (a Attachment) WithUpdatedHash() Attachment
type AttachmentError ¶ added in v0.0.5
type AttachmentError uint8
const ( ErrInvalidAttachment AttachmentError = iota ErrDuplicateAttachment )
func (AttachmentError) Error ¶ added in v0.0.5
func (err AttachmentError) Error() string
type AttachmentReference ¶ added in v0.0.5
type AttachmentSource ¶ added in v0.0.5
type FieldComparisonMismatchError ¶ added in v0.0.5
func (FieldComparisonMismatchError) Error ¶ added in v0.0.5
func (e FieldComparisonMismatchError) Error() string
type Letter ¶ added in v0.0.5
type Letter struct {
ID string
// Frontmatter orderedmap.OrderedMap[string, any]
Frontmatter map[string]any
Templates []Attachment
Content string
CreatedAt time.Time
SentAt time.Time
}
func NewLetterFromFile ¶ added in v0.0.5
func (Letter) AssertEqualityTo ¶ added in v0.0.5
func (Letter) EachAttachmentSource ¶ added in v0.0.5
func (l Letter) EachAttachmentSource() iter.Seq2[AttachmentSource, error]
func (Letter) EachWarning ¶ added in v0.0.5
func (Letter) GetDatabase ¶ added in v0.0.5
func (Letter) GetExpiration ¶ added in v0.1.0
func (Letter) GetFrom ¶ added in v0.0.5
GetFrom returns the address.FieldFrom address from the frontmatter. There must be only one valid address. Mutliple from addresses can disrupt delivery.
func (Letter) GetHeaders ¶ added in v0.0.5
func (Letter) GetLanguage ¶ added in v0.0.5
func (Letter) GetMediaConstraints ¶ added in v0.0.5
func (l Letter) GetMediaConstraints() (m media.Constraints, err error)
func (Letter) GetSchedule ¶ added in v0.0.5
func (Letter) GetSubject ¶ added in v0.0.5
type LetterError ¶ added in v0.0.5
type LetterError uint
const ( ErrNoSubject LetterError = iota + 1 // ErrNoQueue ErrDuplicateLetter ErrNoFromAddress ErrNoContent ErrNotFound ErrFieldNotFound )
func (LetterError) Error ¶ added in v0.0.5
func (l LetterError) Error() string
type Message ¶
type Message struct {
ID string
LetterID string
SeedKey string
Headers []header.Header
From mail.Address
To mail.Address
Subject string
Text string
HTML string
ScheduleAfter time.Time
ScheduledAt time.Time
SentAt time.Time
}
Message is an intent to delivery a copy of a letter to a particular recipient.
func (Message) AssertEqualityTo ¶ added in v0.0.5
type MessageError ¶ added in v0.0.5
type MessageError uint8
const ( ErrInvalidMessage MessageError = iota ErrDuplicateMessage ErrMessageNotFound )
func (MessageError) Error ¶ added in v0.0.5
func (err MessageError) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.