sms

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client a high level sms client that communicates the backend through GraphQL client

func New

func New(client client.Client) *Client

New constructs a sms client

func (*Client) CancelSms

func (c *Client) CancelSms(where map[string]interface{}) (int, error)

CancelSms cancel and delete sms requests

func (*Client) Send

func (c *Client) Send(inputs []SendSmsInput, variables map[string]string) (*SendSmsOutput, error)

Send a sms request

type MessageType

type MessageType int
const (
	MessageNormal MessageType = 0
	MessageOTP    MessageType = 1

	ErrCodeUnsupported
)

type Recipient

type Recipient struct {
	PhoneCode   int    `json:"phone_code"`
	PhoneNumber string `json:"phone_number"`
}

Recipient represents the international phone number

type SendSmsInput

type SendSmsInput struct {
	ClientName string       `json:"client_name,omitempty" graphql:"client_name"`
	TemplateID string       `json:"template_id,omitempty" graphql:"template_id"`
	Content    string       `json:"content,omitempty" graphql:"content"`
	Recipient  []Recipient  `json:"recipient" graphql:"recipient"`
	SendAfter  time.Time    `json:"send_after,omitempty" graphql:"send_after"`
	Metadata   *SmsMetadata `json:"metadata,omitempty" graphql:"metadata" scalar:"true"`
	Save       bool         `json:"save"`
	Locale     string       `json:"locale"`
}

SendSmsInput represents send sms input payload

type SendSmsOutput

type SendSmsOutput struct {
	Responses    []SendSmsResponse `json:"responses" graphql:"responses"`
	SuccessCount int               `json:"success_count" graphql:"success_count"`
	FailureCount int               `json:"failure_count" graphql:"failure_count"`
}

SendSmsOutput represents the summary result of sending sms

type SendSmsResponse

type SendSmsResponse struct {
	Success   bool        `json:"success" graphql:"success"`
	RequestID *string     `json:"request_id,omitempty" graphql:"request_id"`
	MessageID string      `json:"message_id,omitempty" graphql:"message_id"`
	Error     interface{} `json:"error,omitempty" graphql:"error"`
}

SendSmsResponse represents sms response from external service

type SmsMetadata

type SmsMetadata struct {
	BrandName   string      `json:"brand_name,omitempty"`
	MessageType MessageType `json:"message_type,omitempty"`
	Unicode     *bool       `json:"unicode,omitempty"`
}

SmsMetadata represents a sms metadata payload

Jump to

Keyboard shortcuts

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