Documentation
¶
Index ¶
- Constants
- func IsValidMessageChannel(channel string, config *conf.GlobalConfiguration) bool
- type MessagebirdErrResponse
- type MessagebirdError
- type MessagebirdProvider
- type MessagebirdResponse
- type MessagebirdResponseRecipients
- type SmsProvider
- func GetSmsProvider(config conf.GlobalConfiguration) (SmsProvider, error)
- func NewMessagebirdProvider(config conf.MessagebirdProviderConfiguration) (SmsProvider, error)
- func NewTextlocalProvider(config conf.TextlocalProviderConfiguration) (SmsProvider, error)
- func NewTwilioProvider(config conf.TwilioProviderConfiguration) (SmsProvider, error)
- func NewTwilioVerifyProvider(config conf.TwilioVerifyProviderConfiguration) (SmsProvider, error)
- func NewVonageProvider(config conf.VonageProviderConfiguration) (SmsProvider, error)
- type SmsStatus
- type TextlocalError
- type TextlocalMessage
- type TextlocalProvider
- type TextlocalResponse
- type TwilioProvider
- type TwilioVerifyProvider
- type VerificationCheckResponse
- type VerificationResponse
- type VonageProvider
- type VonageResponse
- type VonageResponseMessage
Constants ¶
View Source
const SMSProvider = "sms"
View Source
const WhatsappProvider = "whatsapp"
Variables ¶
This section is empty.
Functions ¶
func IsValidMessageChannel ¶
func IsValidMessageChannel(channel string, config *conf.GlobalConfiguration) bool
Types ¶
type MessagebirdErrResponse ¶
type MessagebirdErrResponse struct {
Errors []MessagebirdError `json:"errors"`
}
func (MessagebirdErrResponse) Error ¶
func (t MessagebirdErrResponse) Error() string
type MessagebirdError ¶
type MessagebirdProvider ¶
type MessagebirdProvider struct {
Config *conf.MessagebirdProviderConfiguration
APIPath string
}
func (*MessagebirdProvider) SendMessage ¶
func (t *MessagebirdProvider) SendMessage(phone, message, channel, otp string) (string, error)
func (*MessagebirdProvider) SendSms ¶
func (t *MessagebirdProvider) SendSms(phone string, message string) (string, error)
Send an SMS containing the OTP with Messagebird's API
func (*MessagebirdProvider) VerifyOTP ¶
func (t *MessagebirdProvider) VerifyOTP(phone, code string) error
type MessagebirdResponse ¶
type MessagebirdResponse struct {
ID string `json:"id"`
Recipients MessagebirdResponseRecipients `json:"recipients"`
}
type MessagebirdResponseRecipients ¶
type MessagebirdResponseRecipients struct {
TotalSentCount int `json:"totalSentCount"`
}
type SmsProvider ¶
type SmsProvider interface {
SendMessage(phone, message, channel, otp string) (string, error)
VerifyOTP(phone, token string) error
}
var MockProvider SmsProvider = nil
overrides the SmsProvider set to always return the mock provider
func GetSmsProvider ¶
func GetSmsProvider(config conf.GlobalConfiguration) (SmsProvider, error)
func NewMessagebirdProvider ¶
func NewMessagebirdProvider(config conf.MessagebirdProviderConfiguration) (SmsProvider, error)
Creates a SmsProvider with the Messagebird Config
func NewTextlocalProvider ¶
func NewTextlocalProvider(config conf.TextlocalProviderConfiguration) (SmsProvider, error)
Creates a SmsProvider with the Textlocal Config
func NewTwilioProvider ¶
func NewTwilioProvider(config conf.TwilioProviderConfiguration) (SmsProvider, error)
Creates a SmsProvider with the Twilio Config
func NewTwilioVerifyProvider ¶
func NewTwilioVerifyProvider(config conf.TwilioVerifyProviderConfiguration) (SmsProvider, error)
Creates a SmsProvider with the Twilio Config
func NewVonageProvider ¶
func NewVonageProvider(config conf.VonageProviderConfiguration) (SmsProvider, error)
Creates a SmsProvider with the Vonage Config
type TextlocalError ¶
type TextlocalMessage ¶
type TextlocalMessage struct {
MessageID string `json:"id"`
}
type TextlocalProvider ¶
type TextlocalProvider struct {
Config *conf.TextlocalProviderConfiguration
APIPath string
}
func (*TextlocalProvider) SendMessage ¶
func (t *TextlocalProvider) SendMessage(phone, message, channel, otp string) (string, error)
func (*TextlocalProvider) SendSms ¶
func (t *TextlocalProvider) SendSms(phone string, message string) (string, error)
Send an SMS containing the OTP with Textlocal's API
func (*TextlocalProvider) VerifyOTP ¶
func (t *TextlocalProvider) VerifyOTP(phone, code string) error
type TextlocalResponse ¶
type TextlocalResponse struct {
Status string `json:"status"`
Errors []TextlocalError `json:"errors"`
Messages []TextlocalMessage `json:"messages"`
}
type TwilioProvider ¶
type TwilioProvider struct {
Config *conf.TwilioProviderConfiguration
APIPath string
}
func (*TwilioProvider) SendMessage ¶
func (t *TwilioProvider) SendMessage(phone, message, channel, otp string) (string, error)
func (*TwilioProvider) SendSms ¶
func (t *TwilioProvider) SendSms(phone, message, channel, otp string) (string, error)
Send an SMS containing the OTP with Twilio's API
func (*TwilioProvider) VerifyOTP ¶
func (t *TwilioProvider) VerifyOTP(phone, code string) error
type TwilioVerifyProvider ¶
type TwilioVerifyProvider struct {
Config *conf.TwilioVerifyProviderConfiguration
APIPath string
}
func (*TwilioVerifyProvider) SendMessage ¶
func (t *TwilioVerifyProvider) SendMessage(phone, message, channel, otp string) (string, error)
func (*TwilioVerifyProvider) SendSms ¶
func (t *TwilioVerifyProvider) SendSms(phone, message, channel string) (string, error)
Send an SMS containing the OTP with Twilio's API
func (*TwilioVerifyProvider) VerifyOTP ¶
func (t *TwilioVerifyProvider) VerifyOTP(phone, code string) error
type VerificationCheckResponse ¶
type VerificationCheckResponse struct {
To string `json:"to"`
Status string `json:"status"`
Channel string `json:"channel"`
Valid bool `json:"valid"`
ErrorCode string `json:"error_code"`
ErrorMessage string `json:"error_message"`
}
See: https://www.twilio.com/docs/verify/api/verification-check
type VerificationResponse ¶
type VonageProvider ¶
type VonageProvider struct {
Config *conf.VonageProviderConfiguration
APIPath string
}
func (*VonageProvider) SendMessage ¶
func (t *VonageProvider) SendMessage(phone, message, channel, otp string) (string, error)
func (*VonageProvider) SendSms ¶
func (t *VonageProvider) SendSms(phone string, message string) (string, error)
Send an SMS containing the OTP with Vonage's API
func (*VonageProvider) VerifyOTP ¶
func (t *VonageProvider) VerifyOTP(phone, code string) error
type VonageResponse ¶
type VonageResponse struct {
Messages []VonageResponseMessage `json:"messages"`
}
type VonageResponseMessage ¶
Click to show internal directories.
Click to hide internal directories.