Help us shape the future of Go! Take the 2026 Go Developer Survey

sms

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 13 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)
}

type ISender

type ISender interface {
	SendOTPSMS(*OTP) error
	SendOTPCallout(*OTP) error
	SendMessage(*Message) 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)

type LogEntity

type LogEntity interface {
	orm.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 *orm.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 {
	OrmService     *orm.Engine
	Clock          clock.Clock
	GatewayFactory map[string]Gateway
	Logger         LogEntity
}

func (*Sender) SendMessage

func (s *Sender) SendMessage(message *Message) error

func (*Sender) SendOTPCallout

func (s *Sender) SendOTPCallout(otp *OTP) error

func (*Sender) SendOTPSMS

func (s *Sender) SendOTPSMS(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)

type TwilioGateway

type TwilioGateway struct {
	SID         string
	Token       string
	FromNumber  string
	AuthyURL    string
	AuthyAPIKey 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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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