smsglobal

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: MIT Imports: 11 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 (
	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 (
	ErrorOutputTemplate string = "Error: %s\n"
)
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 SendMulti

func SendMulti() error

func SendSingle

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

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"`
	Currency string  `json:"currency"`
}

func GetAccountBalance

func GetAccountBalance(timeout int) (*CreditBalanceResponse, 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 SmsGlobalError

type SmsGlobalError struct {
	Code    string
	Message string
}

func NewFailedCallError

func NewFailedCallError(statusCode int) *SmsGlobalError

func NewSmsGlobalError

func NewSmsGlobalError(code string, 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 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