smsapi

package
v0.0.0-...-fe7d464 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAmbiguousClient = errors.New("ambiguous SMS client")
View Source
var ErrKindAuthenticationFailed = apierrors.InternalError.WithReason("SMSGatewayAuthenticationFailed")
View Source
var ErrKindDeliveryRejected = apierrors.InternalError.WithReason("SMSGatewayDeliveryRejected")
View Source
var ErrKindInvalidPhoneNumber = apierrors.BadRequest.WithReason("SMSGatewayInvalidPhoneNumber")
View Source
var ErrKindRateLimited = apierrors.TooManyRequest.WithReason("SMSGatewayRateLimited")
View Source
var ErrNoAvailableClient = NoAvailableClient.
	New("no available SMS client")
View Source
var NoAvailableClient = apierrors.InternalError.
	WithReason("NoAvailableSMSClient")

Functions

This section is empty.

Types

type Client

type Client interface {
	Send(ctx context.Context, opts SendOptions) error
}

type SendError

type SendError struct {
	DumpedResponse []byte `json:"dumped_response,omitempty"`
}

func (*SendError) Error

func (e *SendError) Error() string

type SendOptions

type SendOptions struct {
	Sender            string
	To                string
	Body              string
	AppID             string
	TemplateName      string
	LanguageTag       string
	TemplateVariables *TemplateVariables
}

type TemplateVariables

type TemplateVariables struct {
	AppName     string `json:"app_name,omitempty"`
	ClientID    string `json:"client_id,omitempty"`
	Code        string `json:"code,omitempty"`
	Email       string `json:"email,omitempty"`
	HasPassword bool   `json:"has_password,omitempty"`
	Host        string `json:"host,omitempty"`
	Link        string `json:"link,omitempty"`
	Password    string `json:"password,omitempty"`
	Phone       string `json:"phone,omitempty"`
	State       string `json:"state,omitempty"`
	UILocales   string `json:"ui_locales,omitempty"`
	URL         string `json:"url,omitempty"`
	XState      string `json:"x_state,omitempty"`
}

func NewTemplateVariablesFromPreparedTemplateVariables

func NewTemplateVariablesFromPreparedTemplateVariables(v *translation.PreparedTemplateVariables) *TemplateVariables

Jump to

Keyboard shortcuts

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