Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEndpointInvalidType = fmt.Errorf("invalid endpoint type") ErrEndpointInvalidConfig = fmt.Errorf("invalid endpoint config") ErrEndpointNotFound = fmt.Errorf("endpoint not found") ErrEndpointNameConflict = fmt.Errorf("endpoint name conflit") ErrBridgesNotFound = fmt.Errorf("bridges not found") ErrMessageNotFound = fmt.Errorf("message not found") ErrAttachmentInvalid = fmt.Errorf("invalid attachment") )
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
UUID string
Name string
Type AttachmentType
Data []byte
}
func NewAttachment ¶
func NewAttachment(name string, data []byte) (*Attachment, error)
type AuthServicePort ¶
AuthServicePort handles authenticating users.
type Bridge ¶
type Bridge struct {
Name string `json:"name" mapstructure:"name"`
Endpoints []string `json:"endpoints" mapstructure:"endpoints"`
OnlyText bool `json:"only_text" mapstructure:"only_text"`
OnlyAttachments bool `json:"only_attachments" mapstructure:"only_attachments"`
Filters []Filter `json:"filters" mapstructure:"filters"`
}
func (*Bridge) EndpointMessage ¶ added in v0.1.0
func (b *Bridge) EndpointMessage(msg *Message) *EndpointMessage
type BridgeServicePort ¶
type BridgeServicePort interface {
// GetBridges returns a list of bridges that the message belongs to.
GetBridges(msg *Message) []Bridge
}
BridgeServicePort handles finding endpoints for messages.
type Config ¶
type Config struct {
ConfigSMTP ConfigSMTP `json:"smtp" mapstructure:"smtp"`
Bridges []Bridge `json:"bridges" mapstructure:"bridges"`
ConfigEndpoints []ConfigEndpoint `json:"endpoints" mapstructure:"endpoints"`
}
type ConfigEndpoint ¶
type ConfigSMTP ¶ added in v0.2.0
type EndpointMessage ¶ added in v0.1.0
type EndpointMessage struct {
Text string `json:"text"` // Text is the message body.
Attachments []*Attachment `json:"attachments"` // Attachments is a list of attachments.
}
func (*EndpointMessage) IsEmpty ¶ added in v0.3.0
func (em *EndpointMessage) IsEmpty() bool
type EndpointPort ¶
type EndpointPort interface {
// Send sends the message to the endpoint.
Send(msg *EndpointMessage) error
}
EndpointPort handles sending messages to an endpoint.
type EndpointRepositoryPort ¶ added in v0.2.0
type Filter ¶
type Message ¶
type Message struct {
Time time.Time `json:"time"` // Time message was received.
UUID string `json:"uuid"` // UUID of the message.
Subject string `json:"subject"` // Subject of the message.
From string `json:"from"` // From is the email address of the sender.
To map[string]bool `json:"to"` // To is the email addresses of the recipients.
Text string `json:"text"` // Text is the message body.
Attachments []*Attachment `json:"attachments"` // Attachments is a list of attachments.
}
type MessageRepositoryPort ¶
type MessageRepositoryPort interface {
// Create saves the message.
Create(msg *Message) error
// Update updates the message.
Update(msg *Message) error
}
MessageRepositoryPort handles storing messages.
type MessageServicePort ¶
type MessageServicePort interface {
// Create creates a new message and saves it.
Create(subject, from string, to map[string]bool, text string) (*Message, error)
// AddAttachment adds an attachment to a message.
AddAttachment(msg *Message, name string, data []byte) error
// Send finds endpoints for the message and sends to it.
Send(msg *Message) error
}
MessageServicePort handles creating and sending messages.
Click to show internal directories.
Click to hide internal directories.