Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 BridgeServicePort ¶
type BridgeServicePort interface {
GetEndpoints(msg *Message) []EndpointPort
}
BridgeServicePort handles finding endpoints for messages.
type Config ¶
type Config struct {
Port string `json:"port" mapstructure:"port"`
Bridges []Bridge `json:"bridges" mapstructure:"bridges"`
ConfigEndpoints []ConfigEndpoint `json:"endpoints" mapstructure:"endpoints"`
}
func (*Config) NewEndpoints ¶
func (c *Config) NewEndpoints(factory func(senderType string, config map[string]string) (EndpointPort, error)) map[string]EndpointPort
NewEndpoints creates a name to Endpoint map using a factory.
type ConfigEndpoint ¶
type EndpointPort ¶
EndpointPort handles sending messages to an endpoint.
type Filter ¶
type Filter struct {
To string `json:"to,omitempty" mapstructure:"to,omitempty"`
ToRegex bool `json:"to_regex,omitempty" mapstructure:"to_regex,omitempty"`
From string `json:"from,omitempty" mapstructure:"from,omitempty"`
FromRegex bool `json:"from_regex,omitempty" mapstructure:"from_regex,omitempty"`
}
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.