Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrQueueEmpty = errors.New("queue is empty")
Functions ¶
This section is empty.
Types ¶
type ConfigProvider ¶
type ConfigProvider interface {
CourierConfig(ctx context.Context) config.CourierConfigs
}
type Courier ¶
type Courier interface { Work(ctx context.Context) error QueueEmail(ctx context.Context, t EmailTemplate) (uuid.UUID, error) QueueSMS(ctx context.Context, t SMSTemplate) (uuid.UUID, error) SmtpDialer() *gomail.Dialer DispatchQueue(ctx context.Context) error DispatchMessage(ctx context.Context, msg Message) error SetGetEmailTemplateType(f func(t EmailTemplate) (TemplateType, error)) SetNewEmailTemplateFromMessage(f func(d template.Dependencies, msg Message) (EmailTemplate, error)) }
func NewCourier ¶
func NewCourier(ctx context.Context, deps Dependencies) Courier
type Dependencies ¶
type Dependencies interface { PersistenceProvider x.LoggingProvider ConfigProvider x.HTTPClientProvider }
type EmailTemplate ¶
type EmailTemplate interface { json.Marshaler EmailSubject(context.Context) (string, error) EmailBody(context.Context) (string, error) EmailBodyPlaintext(context.Context) (string, error) EmailRecipient() (string, error) }
func NewEmailTemplateFromMessage ¶
func NewEmailTemplateFromMessage(d template.Dependencies, msg Message) (EmailTemplate, error)
type Message ¶
type Message struct { ID uuid.UUID `json:"-" faker:"-" db:"id"` NID uuid.UUID `json:"-" faker:"-" db:"nid"` Status MessageStatus `json:"-" db:"status"` Type MessageType `json:"-" db:"type"` Recipient string `json:"-" db:"recipient"` Body string `json:"-" db:"body"` Subject string `json:"-" db:"subject"` TemplateType TemplateType `json:"-" db:"template_type"` TemplateData []byte `json:"-" db:"template_data"` // CreatedAt is a helper struct field for gobuffalo.pop. CreatedAt time.Time `json:"-" faker:"-" db:"created_at"` // UpdatedAt is a helper struct field for gobuffalo.pop. UpdatedAt time.Time `json:"-" faker:"-" db:"updated_at"` }
swagger:ignore
type MessageStatus ¶
type MessageStatus int
const ( MessageStatusQueued MessageStatus = iota + 1 MessageStatusSent MessageStatusProcessing MessageStatusAbandoned )
type MessageType ¶
type MessageType int
const ( MessageTypeEmail MessageType = iota + 1 MessageTypePhone )
type PersistenceProvider ¶
type PersistenceProvider interface {
CourierPersister() Persister
}
type SMSTemplate ¶
type SMSTemplate interface { json.Marshaler SMSBody(context.Context) (string, error) PhoneNumber() (string, error) }
func NewSMSTemplateFromMessage ¶
func NewSMSTemplateFromMessage(d Dependencies, m Message) (SMSTemplate, error)
type TemplateType ¶
type TemplateType string
const ( TypeRecoveryInvalid TemplateType = "recovery_invalid" TypeRecoveryValid TemplateType = "recovery_valid" TypeVerificationInvalid TemplateType = "verification_invalid" TypeVerificationValid TemplateType = "verification_valid" TypeOTP TemplateType = "otp" TypeTestStub TemplateType = "stub" )
func GetEmailTemplateType ¶
func GetEmailTemplateType(t EmailTemplate) (TemplateType, error)
func SMSTemplateType ¶
func SMSTemplateType(t SMSTemplate) (TemplateType, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.