sms

package
v0.0.0-...-c4f7e29 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAmbiguousClient = errors.New("ambiguous SMS client")
View Source
var ErrMissingCustomSMSProviderConfiguration = errors.New("sms: custom provider configuration is missing")
View Source
var ErrMissingNexmoConfiguration = errors.New("nexmo: configuration is missing")
View Source
var ErrMissingTwilioConfiguration = errors.New("twilio: configuration is missing")
View Source
var ErrNoAvailableClient = errors.New("no available SMS client")

Functions

This section is empty.

Types

type Client

type Client struct {
	Logger                       Logger
	DevMode                      config.DevMode
	MessagingConfig              *config.MessagingConfig
	FeatureTestModeSMSSuppressed config.FeatureTestModeSMSSuppressed
	TestModeSMSConfig            *config.TestModeSMSConfig
	TwilioClient                 *TwilioClient
	NexmoClient                  *NexmoClient
	CustomClient                 *CustomClient
}

func (*Client) Send

func (c *Client) Send(opts SendOptions) error

type CustomClient

type CustomClient struct {
	Config      *config.CustomSMSProviderConfig
	SMSDenoHook SMSDenoHook
	SMSWebHook  SMSWebHook
}

func (*CustomClient) Send

func (c *CustomClient) Send(from string, to string, body string) error

type HookDenoClient

type HookDenoClient struct {
	hook.DenoClient
}

func NewHookDenoClient

func NewHookDenoClient(endpoint config.DenoEndpoint, logger hook.Logger, timeout SMSHookTimeout) HookDenoClient

type HookHTTPClient

type HookHTTPClient struct {
	*http.Client
}

func NewHookHTTPClient

func NewHookHTTPClient(timeout SMSHookTimeout) HookHTTPClient

type Logger

type Logger struct{ *log.Logger }

func NewLogger

func NewLogger(lf *log.Factory) Logger

type NexmoClient

type NexmoClient struct {
	NexmoClient *nexmo.Client
}

func NewNexmoClient

func NewNexmoClient(c *config.NexmoCredentials) *NexmoClient

func (*NexmoClient) Send

func (n *NexmoClient) Send(from string, to string, body string) error

type RawClient

type RawClient interface {
	Send(from string, to string, body string) error
}

type SMSDenoHook

type SMSDenoHook struct {
	hook.DenoHook
	Client HookDenoClient
}

func (*SMSDenoHook) Call

func (d *SMSDenoHook) Call(u *url.URL, payload SendSMSPayload) error

type SMSHookTimeout

type SMSHookTimeout struct {
	Timeout time.Duration
}

func NewSMSHookTimeout

func NewSMSHookTimeout(smsCfg *config.CustomSMSProviderConfig) SMSHookTimeout

type SMSWebHook

type SMSWebHook struct {
	hook.WebHook
	Client HookHTTPClient
}

func (*SMSWebHook) Call

func (w *SMSWebHook) Call(u *url.URL, payload SendSMSPayload) error

type SendOptions

type SendOptions struct {
	Sender string
	To     string
	Body   string
}

type SendSMSPayload

type SendSMSPayload struct {
	To   string `json:"to"`
	Body string `json:"body"`
}

type TwilioClient

type TwilioClient struct {
	TwilioClient        *twilio.RestClient
	MessagingServiceSID string
}

func NewTwilioClient

func NewTwilioClient(c *config.TwilioCredentials) *TwilioClient

func (*TwilioClient) Send

func (t *TwilioClient) Send(from string, to string, body string) error

Jump to

Keyboard shortcuts

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