smsglobal

package module
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 13 Imported by: 0

README

SMSGlobal API SDK

Use this library to integrate with Macrokiosk SMS Gateway API.

Get Started

  1. Install into existing go module
> go get github.com/berrypay/smsglobal

Documentation

Documentation for the library can be found here

Developer Note

Release will be gradual based on functionality completion each API set.

Status

This library is still in active development. Please check this repo for future updates.

Documentation

Index

Constants

View Source
const (
	ErrorOutputTemplate   string = "Error: %s\n"
	WarningOutputTemplate string = "Warning: %s\n"
)
View Source
const (
	SmsAPI               string = "/v2/sms"
	UserBasePath         string = "/v2/user"
	UserCreditBalanceAPI string = UserBasePath + "/credit-balance"
)
View Source
const (
	AuthHeaderTemplate string = `MAC id="%s", ts="%d", nonce="%s", mac="%s"`
)
View Source
const (
	SignatureTemplate string = "%d\n%s\n%s\n%s\n%s\n%d\n%s\n"
)

Variables

This section is empty.

Functions

func GetBaseUrl

func GetBaseUrl() string

func GetDefaultFrom

func GetDefaultFrom() string

func GetFullPath

func GetFullPath(api string) string

func GetHost

func GetHost() string

func GetPort

func GetPort() int

func GetSignature

func GetSignature(ts int64, nonce string, method string, uri string, extraData string) string

func GetTLS

func GetTLS() bool

func NewAuthHeader

func NewAuthHeader(ts int64, nonce string, method string, uri string, extraData string) string

func SetCredential

func SetCredential(credential *SmsGlobalCredential)

func SetDefaultFrom

func SetDefaultFrom(from string)

func SetHost

func SetHost(host string)

func SetPort

func SetPort(port int)

func SetTLS

func SetTLS(tls bool)

Types

type CreditBalanceResponse

type CreditBalanceResponse struct {
	Balance  float64 `json:"balance,omitempty"`
	Currency string  `json:"currency,omitempty"`
}

func GetAccountBalance

func GetAccountBalance(timeout int) (*CreditBalanceResponse, error)

type SendMultiSMSResponse added in v0.1.0

type SendMultiSMSResponse struct {
}

func SendMulti

func SendMulti(to string, from string, message string, title string, timeout int) (*SendMultiSMSResponse, error)

type SmsGlobalCredential

type SmsGlobalCredential struct {
	MasterUser string `json:"masterUser"`
	MasterPass string `json:"masterPass"`
	ApiKey     string `json:"apiKey"`
	ApiSecret  string `json:"apiSecret"`
}

func GetCredential

func GetCredential() *SmsGlobalCredential

type SmsGlobalDateTime added in v0.1.8

type SmsGlobalDateTime time.Time

func (*SmsGlobalDateTime) UnmarshalJSON added in v0.1.8

func (ct *SmsGlobalDateTime) UnmarshalJSON(b []byte) error

type SmsGlobalError

type SmsGlobalError struct {
	Code    int
	Message string
}

func NewFailedCallError

func NewFailedCallError(resp *http.Response) *SmsGlobalError

func NewSmsGlobalError

func NewSmsGlobalError(code int, message string) *SmsGlobalError

func (*SmsGlobalError) Error

func (m *SmsGlobalError) Error() string

type SmsGlobalPayloadDecodeError

type SmsGlobalPayloadDecodeError struct {
	Message string
}

func NewSmsGlobalPayloadDecodeError

func NewSmsGlobalPayloadDecodeError(message string) *SmsGlobalPayloadDecodeError

func (*SmsGlobalPayloadDecodeError) Error

type SmsGlobalSendSMSRequest added in v0.1.5

type SmsGlobalSendSMSRequest struct {
	Destination       string     `json:"destination,omitempty"`
	Message           string     `json:"message,omitempty"`
	Origin            string     `json:"origin,omitempty"`
	ScheduledDateTime *time.Time `json:"scheduledDateTime,omitempty"`
	Campaign          string     `json:"campaign,omitempty"`
	SharedPool        string     `json:"sharedPool,omitempty"`
	NotifyUrl         string     `json:"notifyUrl,omitempty"`
	IncomingUrl       string     `json:"incomingUrl,omitempty"`
	ExpiryDateTime    *time.Time `json:"expiryDateTime,omitempty"`
}

type SmsGlobalSendSMSResponse added in v0.1.5

type SmsGlobalSendSMSResponse struct {
	Messages []SmsGlobalSendSMSResponseMessageItem `json:"messages"`
}

type SmsGlobalSendSMSResponseMessageItem added in v0.1.5

type SmsGlobalSendSMSResponseMessageItem struct {
	Id          int64             `json:"id"`
	OutgoingId  int64             `json:"outgoingId"`
	Origin      string            `json:"origin"`
	Destination string            `json:"destination"`
	Message     string            `json:"message"`
	Status      string            `json:"status"`
	DateTime    SmsGlobalDateTime `json:"dateTime"`
}

func SendSingle

func SendSingle(to string, from string, title string, message string, timeout int) (*SmsGlobalSendSMSResponseMessageItem, error)

type SmsGlobalSettings

type SmsGlobalSettings struct {
	Host        string               `json:"host"`
	Port        int                  `json:"port"`
	TLS         bool                 `json:"tls"`
	Credential  *SmsGlobalCredential `json:"credential"`
	DefaultFrom string               `json:"defaultFrom"`
}
var Settings *SmsGlobalSettings

Jump to

Keyboard shortcuts

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