Documentation ¶
Index ¶
- Constants
- func AllPermissions() []string
- func NewClientApiKey(pepper string) (key, hash string)
- func NewClientId() string
- func NewClientIdFrom(base string) string
- type ApplicationEvent
- type Client
- func (c *Client) DefaultSender(baseDomain string) MailAddress
- func (c *Client) HasPermission(permission string) bool
- func (c *Client) HasPermissionAnyOf(permissions []string) bool
- func (c *Client) Sanitize(baseDomain string) *Client
- func (c *Client) SenderOrDefault(baseDomain string) MailAddress
- func (c *Client) Validate() error
- func (c *Client) WithMailCount(count int) *Client
- type EventType
- type Mail
- type MailAddress
- type MailAddresses
- type MailSendRequest
- type MailSentPayload
- type SenderAddress
- type Template
- type User
- type Verification
Constants ¶
View Source
const ( PermissionSendMail = "send_mail" PermissionManageClient = "manage_client" PermissionManageUser = "manage_user" PermissionManageTemplate = "manage_template" ClientIdPrefixLength = 8 )
View Source
const ( MailPattern = "[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+" EmailAddrPattern = ".*\\s<(" + MailPattern + ")>|(" + MailPattern + ")" )
View Source
const ( VerificationScopeUser = "scope_user" VerificationScopeSender = "scope_sender_address" )
Variables ¶
This section is empty.
Functions ¶
func AllPermissions ¶
func AllPermissions() []string
func NewClientApiKey ¶
func NewClientId ¶
func NewClientId() string
func NewClientIdFrom ¶
Types ¶
type ApplicationEvent ¶
type Client ¶
type Client struct { ID string `json:"id" boltholdKey:"ID"` Description string `json:"description"` UserId string `json:"user_id" boltholdIndex:"UserId"` Permissions []string `json:"permissions"` Sender MailAddress `json:"sender"` ApiKey *string `json:"api_key"` // caution: usually you want to hide this! CreatedAt time.Time `json:"created_at"` CountMails int `json:"count_mails"` // not persisted }
func (*Client) DefaultSender ¶
func (c *Client) DefaultSender(baseDomain string) MailAddress
func (*Client) HasPermission ¶
func (*Client) HasPermissionAnyOf ¶
func (*Client) SenderOrDefault ¶
func (c *Client) SenderOrDefault(baseDomain string) MailAddress
func (*Client) WithMailCount ¶
type Mail ¶
type Mail struct { From MailAddress To MailAddresses Subject string Body string Type string Date time.Time MessageID string }
type MailAddress ¶
type MailAddress string
func (MailAddress) Domain ¶
func (m MailAddress) Domain() string
func (MailAddress) Raw ¶
func (m MailAddress) Raw() string
func (MailAddress) String ¶
func (m MailAddress) String() string
func (MailAddress) Valid ¶
func (m MailAddress) Valid() bool
type MailAddresses ¶
type MailAddresses []MailAddress
func (MailAddresses) RawStrings ¶
func (m MailAddresses) RawStrings() []string
func (MailAddresses) Strings ¶
func (m MailAddresses) Strings() []string
type MailSendRequest ¶
type MailSentPayload ¶
type MailSentPayload struct { From MailAddress `json:"from"` To MailAddresses `json:"to"` Size int `json:"size"` }
func (*MailSentPayload) FromMail ¶
func (p *MailSentPayload) FromMail(mail *Mail) *MailSentPayload
type SenderAddress ¶
type SenderAddress struct { MailAddress `json:"mail"` Verified bool `json:"verified"` }
type Template ¶
type Template struct { ID string `json:"id"` Name string `json:"name"` UserId string `json:"user_id" boltholdIndex:"UserId"` Content string `json:"content"` }
func (*Template) GuessIsHtml ¶
type User ¶
type User struct { ID string `json:"id" boltholdKey:"ID"` Password string `json:"password"` // clear before returning in a response ! Senders []SenderAddress `json:"senders"` Verified bool `json:"verified"` CreatedAt time.Time `json:"created_at"` }
func (*User) HasSender ¶
func (u *User) HasSender(sender MailAddress) bool
func (*User) HasVerifiedSender ¶
func (u *User) HasVerifiedSender(sender MailAddress) bool
type Verification ¶
type Verification struct { Token string `json:"token" boltholdKey:"Token"` UserId string `json:"user_id"` Scope string `json:"scope"` Subject string `json:"subject"` }
func NewVerification ¶
func NewVerification(user *User, scope, subject string) *Verification
Source Files ¶
Click to show internal directories.
Click to hide internal directories.