Documentation ¶
Index ¶
- func Inbox(mailbox Mailbox, config Config) ([]interface{}, error)
- type Bundle
- type Config
- type Label
- type Mailbox
- type MailboxAPI
- func (m *MailboxAPI) GetInbox(writer http.ResponseWriter, req *http.Request)
- func (m *MailboxAPI) GetLabels(writer http.ResponseWriter, req *http.Request)
- func (m *MailboxAPI) HandleAllMessages(writer http.ResponseWriter, req *http.Request)
- func (m *MailboxAPI) HandleLabeledMessages(writer http.ResponseWriter, req *http.Request)
- func (m *MailboxAPI) HandleSingleMessage(writer http.ResponseWriter, req *http.Request)
- type Message
- type MessageContent
- type Notmuch
- type Thread
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bundle ¶
type Bundle struct { ID string `json:"id"` Type string `json:"type"` Date int64 `json:"date"` Threads []Thread `json:"threads"` }
A Bundle represents a group of Threads.
type Config ¶
type Config struct { Maildir string TLS bool CertificateFile string `toml:"certificate_file"` CertificateKey string `toml:"certificate_key"` Port int Inbox string Bundle []string Hidden []string }
Config holds any settings used to define the behaviour of the service. For example to set the port to host the API on etc.
func ReadConfigFile ¶
ReadConfigFile loads the configuration file from disk. Returns a Config object.
type Mailbox ¶
type Mailbox interface { Labels() ([]Label, error) ReadMessage(id string) (MessageContent, error) Search(query string) ([]Thread, error) }
The Mailbox interface acts as a wrapper for all email actions to abstract any direct email access from the business logic of the Pinbox API transport.
type MailboxAPI ¶
type MailboxAPI struct {
// contains filtered or unexported fields
}
MailboxAPI contains logic for handling mailbox http requests
func CreateMailboxAPI ¶
func CreateMailboxAPI(mailbox Mailbox, config Config) *MailboxAPI
CreateMailboxAPI creates a new Mailbox API instance. Return a new MailboxAPI reference.
func (*MailboxAPI) GetInbox ¶
func (m *MailboxAPI) GetInbox(writer http.ResponseWriter, req *http.Request)
GetInbox retrieves all inbox messages in the Mailbox.
func (*MailboxAPI) GetLabels ¶
func (m *MailboxAPI) GetLabels(writer http.ResponseWriter, req *http.Request)
GetLabels retrieves the available labels in the Mailbox.
func (*MailboxAPI) HandleAllMessages ¶
func (m *MailboxAPI) HandleAllMessages(writer http.ResponseWriter, req *http.Request)
HandleAllMessages retrieves all messages in the Mailbox.
func (*MailboxAPI) HandleLabeledMessages ¶
func (m *MailboxAPI) HandleLabeledMessages(writer http.ResponseWriter, req *http.Request)
HandleLabeledMessages retrieves any messages in the Mailbox with the specified labels.
func (*MailboxAPI) HandleSingleMessage ¶
func (m *MailboxAPI) HandleSingleMessage(writer http.ResponseWriter, req *http.Request)
HandleSingleMessage retrieves a message by ID from the Mailbox.
type Message ¶
type Message struct { ID string `json:"id"` Epoch int64 `json:"epoch"` Author string `json:"author"` Files []string `json:"files"` }
A Message represents an individual email.
type MessageContent ¶
type MessageContent struct { ID string `json:"id"` Epoch int64 `json:"epoch"` Author string `json:"author"` Content string `json:"content"` }
MessageContent is a container for the body of a Message.
type Notmuch ¶
Notmuch is a Mailbox object intended to interact with a Notmuch database. See https://notmuchmail.org/ for more information.
func CreateNotmuch ¶
CreateNotmuch creates a new Notmuch object ready to interact with the database specified by the given configuration.
func (*Notmuch) Labels ¶
Labels returns a list of Label objects corresponding to 'tags' configured in the Notmuch database. Any label IDs specified in Notmuch.ExcludeLabels will be omitted.
func (*Notmuch) ReadMessage ¶
func (mailbox *Notmuch) ReadMessage(id string) (MessageContent, error)
ReadMessage retrieves the content of an email. Returns a MessageContent object containing email body encoded in base64.
type Thread ¶
type Thread struct { ID string `json:"id"` Type string `json:"type"` Subject string `json:"subject"` NewestDate int64 `json:"newestDate"` OldestDate int64 `json:"oldestDate"` Authors []string `json:"authors"` Messages []Message `json:"messages"` }
A Thread represents a Message chain stored in the Mailbox.