Documentation ¶
Index ¶
- Constants
- func GetBaseUrl() string
- func GetDefaultFrom() string
- func GetFullPath(api string) string
- func GetHost() string
- func GetPort() int
- func GetSignature(ts int64, nonce string, method string, uri string, extraData string) string
- func GetTLS() bool
- func NewAuthHeader(ts int64, nonce string, method string, uri string, extraData string) string
- func SendMulti() error
- func SendSingle(to string, from string, message string, title string, timeout int) error
- func SetCredential(credential *SmsGlobalCredential)
- func SetDefaultFrom(from string)
- func SetHost(host string)
- func SetPort(port int)
- func SetTLS(tls bool)
- type CreditBalanceResponse
- type SmsGlobalCredential
- type SmsGlobalError
- type SmsGlobalPayloadDecodeError
- type SmsGlobalSettings
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 GetSignature ¶
func NewAuthHeader ¶
func SendSingle ¶
func SetCredential ¶
func SetCredential(credential *SmsGlobalCredential)
func SetDefaultFrom ¶
func SetDefaultFrom(from string)
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 ¶
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 ¶
func (m *SmsGlobalPayloadDecodeError) Error() string
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
Click to show internal directories.
Click to hide internal directories.