sms

package
v0.0.0-...-94a151a Latest Latest
Warning

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

Go to latest
Published: May 15, 2020 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

View Source
const (
	Sandbox = "sandbox"
	Prod    = "production"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FetchMessageResponse

type FetchMessageResponse struct {
	SMS SMS `json:"SMSMessageData"`
}

FetchMessageResponse is a model

type FetchSubscriptionResponse

type FetchSubscriptionResponse struct {
	Subscriptions []Subscription
}

FetchSubscriptionResponse is a model

type Message

type Message struct {
	From   string `json:"from"`
	To     string `json:"to"`
	Text   string `json:"text"`
	LinkID string `json:"linkId"`
	Date   string `json:"date"`
	ID     int64  `json:"id"`
}

Message is a model

type Recipient

type Recipient struct {
	Number    string `json:"number"`
	Cost      string `json:"cost"`
	Status    string `json:"status"`
	MessageID string `json:"messageId"`
}

Recipient is a model

type SMS

type SMS struct {
	Messages []Message `json:"Recipients"`
}

SMS is a model

type SMS2

type SMS2 struct {
	Recipients []Recipient `json:"recipients"`
}

SMS2 is a model

type SendMessageResponse

type SendMessageResponse struct {
	SMS SMS2 `json:"SMSMessageData"`
}

SendMessageResponse is a model

type Service

type Service struct {
	Username string
	APIKey   string
	Env      string
}

Service is a model

func NewService

func NewService(username, apiKey, env string) Service

NewService returns a new service

func (Service) CreateSubscription

func (service Service) CreateSubscription(username, shortCode, keyword, phoneNumber, checkoutToken string) (*SubscriptionResponse, error)

CreateSubscription - POST

func (Service) FetchMessage

func (service Service) FetchMessage(username, lastReceivedID string) (*FetchMessageResponse, error)

FetchMessage - username = query

func (Service) FetchSubscription

func (service Service) FetchSubscription(username, shortCode, keyword, lastReceivedID string) (*FetchSubscriptionResponse, error)

FetchSubscription - query

func (Service) Send

func (service Service) Send(from, to, message string) (*SendMessageResponse, error)

Send - POST

func (Service) SendBulk

func (service Service) SendBulk(from, to, message string, bulkMode int, enqueue string) (*SendMessageResponse, error)

SendBulk - POST

func (Service) SendBulkToMany

func (service Service) SendBulkToMany(from, message string, to []string, bulkMode int, enqueue string) (*SendMessageResponse, error)

SendBulkToMany is a utility method to send to many recipients at the same time

func (Service) SendPremium

func (service Service) SendPremium(username, to, from, message, keyword,
	linkID, retryDurationInHours string, bulkMode int) (*SendMessageResponse, error)

SendPremium - POST

func (Service) SendToMany

func (service Service) SendToMany(from, message string, to []string) (*SendMessageResponse, error)

SendToMany is a utility method to send to many recipients at the same time

type Subscription

type Subscription struct {
	ID          int64  `json:"id"`
	PhoneNumber string `json:"phoneNumber"`
	Date        string `json:"date"`
}

Subscription is a model

type SubscriptionResponse

type SubscriptionResponse struct {
	Success     string `json:"success"`
	Description string `json:"description"`
}

SubscriptionResponse is a model

Jump to

Keyboard shortcuts

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