sms

package
v0.8.50 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Sinch  = "sinch"
	Twilio = "twilio"

	Kavenegar = "kavenegar"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBLog

type DBLog struct {
	// contains filtered or unexported fields
}

func (*DBLog) Do

func (db *DBLog) Do()

type Gateway

type Gateway interface {
	SendOTPSMS(*OTP) (string, error)
	SendOTPCallout(*OTP) (string, error)
	SendSMSMessage(*Message) (string, error)
	SendCalloutMessage(*Message) (string, error)
	SendVerificationSMS(*OTP) (string, error)
	SendVerificationCallout(*OTP) (string, error)
	VerifyCode(*OTP) (string, error)
}

type ISender

type ISender interface {
	SendOTPSMS(ormService *beeorm.Engine, otp *OTP) error
	SendOTPCallout(ormService *beeorm.Engine, otp *OTP) error
	SendMessage(ormService *beeorm.Engine, message *Message) error
	SendVerificationSMS(ormService *beeorm.Engine, otp *OTP) error
	SendVerificationCallout(ormService *beeorm.Engine, otp *OTP) error
	VerifyCode(ormService *beeorm.Engine, otp *OTP) error
}

type KavenegarGateway

type KavenegarGateway struct {
	APIKey string
	Sender string
}

func (*KavenegarGateway) SendCalloutMessage

func (g *KavenegarGateway) SendCalloutMessage(message *Message) (string, error)

func (*KavenegarGateway) SendOTPCallout

func (g *KavenegarGateway) SendOTPCallout(otp *OTP) (string, error)

func (*KavenegarGateway) SendOTPSMS

func (g *KavenegarGateway) SendOTPSMS(otp *OTP) (string, error)

func (*KavenegarGateway) SendSMSMessage

func (g *KavenegarGateway) SendSMSMessage(message *Message) (string, error)

func (*KavenegarGateway) SendVerificationCallout added in v0.8.35

func (g *KavenegarGateway) SendVerificationCallout(otp *OTP) (string, error)

func (*KavenegarGateway) SendVerificationSMS added in v0.8.35

func (g *KavenegarGateway) SendVerificationSMS(otp *OTP) (string, error)

func (*KavenegarGateway) VerifyCode added in v0.8.35

func (g *KavenegarGateway) VerifyCode(opt *OTP) (string, error)

type LogEntity

type LogEntity interface {
	beeorm.Entity
	SetStatus(string)
	SetTo(string)
	SetText(string)
	SetFromPrimaryGateway(string)
	SetFromSecondaryGateway(string)
	SetPrimaryGatewayError(string)
	SetSecondaryGatewayError(string)
	SetType(string)
	SetSentAt(time time.Time)
}

type Logger

type Logger interface {
	Do()
}

func NewSmsLog

func NewSmsLog(ormService *beeorm.Engine, entity LogEntity) Logger

type Message

type Message struct {
	Text     string
	Number   string
	Provider *Provider
}

type OTP

type OTP struct {
	OTP      string
	Number   string
	CC       string
	Provider *Provider
	Template string
}

type Provider

type Provider struct {
	Primary   string
	Secondary string
}

type Sender

type Sender struct {
	Clock          clock.Clock
	GatewayFactory map[string]Gateway
	Logger         LogEntity
}

func (*Sender) SendMessage

func (s *Sender) SendMessage(ormService *beeorm.Engine, message *Message) error

func (*Sender) SendOTPCallout

func (s *Sender) SendOTPCallout(ormService *beeorm.Engine, otp *OTP) error

func (*Sender) SendOTPSMS

func (s *Sender) SendOTPSMS(ormService *beeorm.Engine, otp *OTP) error

func (*Sender) SendVerificationCallout added in v0.8.35

func (s *Sender) SendVerificationCallout(ormService *beeorm.Engine, otp *OTP) error

func (*Sender) SendVerificationSMS added in v0.8.35

func (s *Sender) SendVerificationSMS(ormService *beeorm.Engine, otp *OTP) error

func (*Sender) VerifyCode added in v0.8.35

func (s *Sender) VerifyCode(ormService *beeorm.Engine, otp *OTP) error

type SinchGateway

type SinchGateway struct {
	Clock        clock.Clock
	AppID        string
	AppSecret    string
	MsgURL       string
	FromNumber   string
	CallURL      string
	CallerNumber string
}

func (*SinchGateway) SendCalloutMessage

func (g *SinchGateway) SendCalloutMessage(message *Message) (string, error)

func (*SinchGateway) SendOTPCallout

func (g *SinchGateway) SendOTPCallout(otp *OTP) (string, error)

func (*SinchGateway) SendOTPSMS

func (g *SinchGateway) SendOTPSMS(otp *OTP) (string, error)

func (*SinchGateway) SendSMSMessage

func (g *SinchGateway) SendSMSMessage(message *Message) (string, error)

func (*SinchGateway) SendVerificationCallout added in v0.8.35

func (g *SinchGateway) SendVerificationCallout(otp *OTP) (string, error)

func (*SinchGateway) SendVerificationSMS added in v0.8.35

func (g *SinchGateway) SendVerificationSMS(otp *OTP) (string, error)

func (*SinchGateway) VerifyCode added in v0.8.35

func (g *SinchGateway) VerifyCode(opt *OTP) (string, error)

type TwilioGateway

type TwilioGateway struct {
	SID         string
	Token       string
	FromNumber  string
	AuthyURL    string
	AuthyAPIKey string
	VerifyURL   string
	VerifySID   string
}

func (*TwilioGateway) SendCalloutMessage

func (g *TwilioGateway) SendCalloutMessage(message *Message) (string, error)

func (*TwilioGateway) SendOTPCallout

func (g *TwilioGateway) SendOTPCallout(otp *OTP) (string, error)

func (*TwilioGateway) SendOTPSMS

func (g *TwilioGateway) SendOTPSMS(otp *OTP) (string, error)

func (*TwilioGateway) SendSMSMessage

func (g *TwilioGateway) SendSMSMessage(message *Message) (string, error)

func (*TwilioGateway) SendVerificationCallout added in v0.8.35

func (g *TwilioGateway) SendVerificationCallout(otp *OTP) (string, error)

func (*TwilioGateway) SendVerificationSMS added in v0.8.35

func (g *TwilioGateway) SendVerificationSMS(otp *OTP) (string, error)

func (*TwilioGateway) VerifyCode added in v0.8.35

func (g *TwilioGateway) VerifyCode(otp *OTP) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL