Documentation ¶
Index ¶
- Constants
- func Sign(secret, value string) string
- func Unsign(secret, msg string) (string, bool)
- type Bounce
- type Complaint
- type JSONTime
- type Mail
- type MailRecipient
- type Mailer
- type NotificationsStore
- type SesMessage
- type SesNotification
- type Subscriber
- type SubscriberEx
- type SubscriberKey
- type SubscribersStore
Constants ¶
const ( SubscribersEndpoint = "/subscribers" SubscribeEndpoint = "/subscribe" UnsubscribeEndpoint = "/unsubscribe" ComplaintsEndpoint = "/complaints" ConfirmEndpoint = "/confirm" ParamNewsletter = "newsletter" ParamToken = "token" ParamEmail = "email" ParamName = "name" )
const ( SoftBounceType = "sb" HardBounceType = "hb" ComplaintType = "ct" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Complaint ¶
type Complaint struct { UserAgent string `json:"userAgent"` ComplainedRecipients []MailRecipient `json:"complainedRecipients"` ComplaintFeedbackType string `json:"complaintFeedbackType"` ArrivalDate string `json:"arrivalDate"` Timestamp string `json:"timestamp"` FeedbackID string `json:"feedbackId"` }
type JSONTime ¶
JSONTime is the time.Time with JSON marshal and unmarshal capability
func JsonTimeNow ¶
func JsonTimeNow() JSONTime
JsonTimeNow() is an alias to time.Now() casted to JSONTime
func (*JSONTime) MarshalJSON ¶
MarshalJSON will marshal using 2006-01-02T15:04:05+07:00 layout
func (*JSONTime) UnmarshalJSON ¶
UnmarshalJSON will unmarshal using 2006-01-02T15:04:05+07:00 layout
type Mail ¶
type Mail struct { Timestamp string `json:"timestamp"` Source string `json:"source"` MessageId string `json:"messageId"` HeadersTruncated bool `json:"headersTruncated"` Destination []string `json:"destination"` Headers []map[string]string `json:"headers"` CommonHeaders map[string]interface{} `json:"commonHeaders"` }
type MailRecipient ¶
type MailRecipient struct {
EmailAddress string `json:"emailAddress"`
}
type NotificationsStore ¶
type NotificationsStore interface { AddBounce(email, from string, isTransient bool) error AddComplaint(email, from string) error Notifications() (notifications []*SesNotification, err error) }
NotificationsStore is an interface used to manage SES bounce and complaint notifications from sesnotify API
type SesMessage ¶
type SesNotification ¶
type Subscriber ¶
type Subscriber struct { Name string `json:"name,omitempty"` Newsletter string `json:"newsletter"` Email string `json:"email"` CreatedAt JSONTime `json:"created_at"` UnsubscribedAt JSONTime `json:"unsubscribed_at"` ConfirmedAt JSONTime `json:"confirmed_at"` UserID string `json:"user_id,omitempty"` }
Subscriber incapsulates newsletter subscriber information stored in the DynamoDB table
func (*Subscriber) Confirmed ¶
func (s *Subscriber) Confirmed() bool
Confirmed checks if subscriber has confirmed the email via link
func (*Subscriber) Unsubscribed ¶
func (s *Subscriber) Unsubscribed() bool
Unsubscribed checks if subscriber pressed "Unsubscribe" link
func (*Subscriber) Validate ¶
func (s *Subscriber) Validate()
type SubscriberEx ¶
type SubscriberEx struct { Name string `json:"name" yaml:"name"` Newsletter string `json:"newsletter" yaml:"newsletter"` Email string `json:"email" yaml:"email"` Token string `json:"token" yaml:"token"` Confirmed bool `json:"confirmed" yaml:"confirmed"` Unsubscribed bool `json:"unsubscribed" yaml:"unsubscribed"` UserID string `json:"user_id" yaml:"user_id"` }
func NewSubscriberEx ¶
func NewSubscriberEx(s *Subscriber, secret string) *SubscriberEx
type SubscriberKey ¶
SubscriberKey is used for deletion of subscribers
type SubscribersStore ¶
type SubscribersStore interface { AddSubscriber(newsletter, email, name string) error RemoveSubscriber(newsletter, email string) error Subscribers(newsletter string) (subscribers []*Subscriber, err error) AddSubscribers(subscribers []*Subscriber) error DeleteSubscribers(keys []*SubscriberKey) error ConfirmSubscriber(newsletter, email string) error GetSubscriber(newsletter, email string) (*Subscriber, error) }
SubscribersStore is an interface used to manage subscribers DB from the main API