Documentation ¶
Index ¶
- func NewAWSSESClient(accessKeyID, secretAccessKey, region, senderID string) (*awsSESClient, error)
- func NewAWSSNSClient(accessKeyID, secretAccessKey, region, senderID string) (*awsSNSClient, error)
- func NewTwilioClient(accountSid, authToken, senderID string) (*twilioClient, error)
- type Message
- type MessengerClient
- type MessengerClientMock
- type MessengerOptions
- type MessengerType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAWSSESClient ¶
NewAWSSESClient creates a new AWS SES client, that is used to send emails.
func NewAWSSNSClient ¶
NewAWSSNSClient creates a new awsSNSClient, that is used to send SMS messages.
func NewTwilioClient ¶
Types ¶
type Message ¶
func (*Message) ValidateFor ¶
func (s *Message) ValidateFor(messengerType MessengerType) error
ValidateFor validates if the message object is valid for the given messengerType.
type MessengerClient ¶
type MessengerClient interface { SendMessage(message Message) error MessengerType() MessengerType }
func GetClient ¶
func GetClient(opts MessengerOptions) (MessengerClient, error)
func NewDryRunClient ¶
func NewDryRunClient() (MessengerClient, error)
type MessengerClientMock ¶
func (*MessengerClientMock) MessengerType ¶
func (mc *MessengerClientMock) MessengerType() MessengerType
func (*MessengerClientMock) SendMessage ¶
func (mc *MessengerClientMock) SendMessage(message Message) error
type MessengerOptions ¶
type MessengerOptions struct { MessengerType MessengerType Environment string // Twilio TwilioAccountSID string TwilioAuthToken string TwilioServiceSID string // AWS AWSAccessKeyID string AWSSecretAccessKey string AWSRegion string // AWS SNS (SMS messages) AWSSNSSenderID string // AWS SES (EMAIL messages) AWSSESSenderID string }
type MessengerType ¶
type MessengerType string
const ( // MessengerTypeTwilioSMS is used to send SMS messages using Twilio. MessengerTypeTwilioSMS MessengerType = "TWILIO_SMS" // MessengerTypeAWSSMS is used to send SMS messages using AWS SNS. MessengerTypeAWSSMS MessengerType = "AWS_SMS" // MessengerTypeAWSEmail is used to send emails using AWS SES. MessengerTypeAWSEmail MessengerType = "AWS_EMAIL" // MessengerTypeDryRun is used for development environment MessengerTypeDryRun MessengerType = "DRY_RUN" )
ATTENTION: when adding a new type, make ure to update the MessengerType methods!
func ParseMessengerType ¶
func ParseMessengerType(messengerTypeStr string) (MessengerType, error)
func (MessengerType) All ¶
func (mt MessengerType) All() []MessengerType
func (MessengerType) IsEmail ¶
func (mt MessengerType) IsEmail() bool
func (MessengerType) IsSMS ¶
func (mt MessengerType) IsSMS() bool
func (MessengerType) ValidEmailTypes ¶
func (mt MessengerType) ValidEmailTypes() []MessengerType
func (MessengerType) ValidSMSTypes ¶
func (mt MessengerType) ValidSMSTypes() []MessengerType
Click to show internal directories.
Click to hide internal directories.