Documentation
¶
Index ¶
- Constants
- func EnsureRuntimeDir() error
- func PIDPath() string
- func SocketPath() string
- type AccountInfo
- type ArchiveEmailsParams
- type AttachmentInfo
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) ReceiveMessage() (Message, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) Send(v interface{}) error
- func (c *Conn) SendError(id uint64, code int, message string) error
- func (c *Conn) SendEvent(eventType string, data interface{}) error
- func (c *Conn) SendResponse(id uint64, result interface{}) error
- type DeleteEmailsParams
- type Error
- type Event
- type ExportContactsParams
- type FetchEmailBodyParams
- type FetchEmailBodyResult
- type FetchEmailsParams
- type FetchFoldersParams
- type GetCachedBodyParams
- type GetCachedEmailsParams
- type MarkReadParams
- type Message
- type MoveEmailsParams
- type NewMailEvent
- type PingResult
- type RefreshFolderParams
- type Request
- type Response
- type SendEmailParams
- type SendRSVPParams
- type StatusResult
- type SubscribeParams
- type SyncCompleteEvent
- type SyncErrorEvent
- type SyncStartedEvent
- type UnsubscribeParams
Constants ¶
const ( ErrCodeParse = -32700 ErrCodeInvalidReq = -32600 ErrCodeNotFound = -32601 ErrCodeInternal = -32603 )
Standard error codes.
const ( MethodPing = "Ping" MethodGetStatus = "GetStatus" MethodGetAccounts = "GetAccounts" MethodReloadConfig = "ReloadConfig" MethodFetchEmails = "FetchEmails" MethodFetchEmailBody = "FetchEmailBody" MethodSendEmail = "SendEmail" MethodDeleteEmails = "DeleteEmails" MethodArchiveEmails = "ArchiveEmails" MethodMoveEmails = "MoveEmails" MethodMarkRead = "MarkRead" MethodFetchFolders = "FetchFolders" MethodRefreshFolder = "RefreshFolder" MethodSubscribe = "Subscribe" MethodUnsubscribe = "Unsubscribe" MethodSendRSVP = "SendRSVP" MethodGetCachedEmails = "GetCachedEmails" MethodGetCachedBody = "GetCachedBody" MethodExportContacts = "ExportContacts" )
RPC method names.
const ( EventNewMail = "NewMail" EventSyncStarted = "SyncStarted" EventSyncComplete = "SyncComplete" EventSyncError = "SyncError" EventEmailsUpdated = "EmailsUpdated" EventConfigReloaded = "ConfigReloaded" )
Event type names.
Variables ¶
This section is empty.
Functions ¶
func EnsureRuntimeDir ¶
func EnsureRuntimeDir() error
EnsureRuntimeDir creates the runtime directory if it doesn't exist.
func SocketPath ¶
func SocketPath() string
SocketPath returns the path to the daemon's Unix domain socket.
Types ¶
type AccountInfo ¶
type ArchiveEmailsParams ¶
type AttachmentInfo ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn wraps a net.Conn with newline-delimited JSON encoding/decoding.
func (*Conn) ReceiveMessage ¶
ReceiveMessage reads and decodes the next JSON message, returning a discriminated Message (Request, Response, or Event).
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote address of the connection.
func (*Conn) SendResponse ¶
SendResponse sends a successful response with the given result.
type DeleteEmailsParams ¶
type Event ¶
type Event struct {
Type string `json:"type"`
Data json.RawMessage `json:"data,omitempty"`
}
Event pushed from daemon to subscribed clients. No ID field.
type ExportContactsParams ¶
type ExportContactsParams struct {
Format string `json:"format"` // "json" or "csv"
}
type FetchEmailBodyParams ¶
type FetchEmailBodyResult ¶
type FetchEmailBodyResult struct {
Body string `json:"body"`
Attachments []AttachmentInfo `json:"attachments"`
}
type FetchEmailsParams ¶
type FetchFoldersParams ¶
type FetchFoldersParams struct {
AccountID string `json:"account_id"`
}
type GetCachedBodyParams ¶
type GetCachedEmailsParams ¶
type GetCachedEmailsParams struct {
Folder string `json:"folder"`
}
type MarkReadParams ¶
type Message ¶
Message is a union type for wire decoding. Exactly one of the fields will be populated based on the presence of "id" and "type".
func DecodeMessage ¶
func DecodeMessage(raw json.RawMessage) (Message, error)
Discriminate: if "type" present → Event, if "method" present → Request, else → Response.
type MoveEmailsParams ¶
type NewMailEvent ¶
type PingResult ¶
type PingResult struct {
Pong bool `json:"pong"`
}
type RefreshFolderParams ¶
type Request ¶
type Request struct {
ID uint64 `json:"id"`
Method string `json:"method"`
Params json.RawMessage `json:"params,omitempty"`
}
Request from client to daemon. Has an ID for matching responses.
type Response ¶
type Response struct {
ID uint64 `json:"id"`
Result json.RawMessage `json:"result,omitempty"`
Error *Error `json:"error,omitempty"`
}
Response from daemon to client. Matched to request by ID.
type SendEmailParams ¶
type SendEmailParams struct {
AccountID string `json:"account_id"`
To []string `json:"to"`
Cc []string `json:"cc,omitempty"`
Bcc []string `json:"bcc,omitempty"`
Subject string `json:"subject"`
Body string `json:"body"`
HTMLBody string `json:"html_body,omitempty"`
Attachments map[string][]byte `json:"attachments,omitempty"`
InReplyTo string `json:"in_reply_to,omitempty"`
References []string `json:"references,omitempty"`
SignSMIME bool `json:"sign_smime,omitempty"`
EncryptSMIME bool `json:"encrypt_smime,omitempty"`
SignPGP bool `json:"sign_pgp,omitempty"`
EncryptPGP bool `json:"encrypt_pgp,omitempty"`
}