smsonline

package module
v0.0.0-...-0f31bc7 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2016 License: MIT Imports: 8 Imported by: 0

README

Go client for SMS Online provider

Build Status Go Report Card

Library for sending sms through https://sms-online.com provider

smsonline-bulk

##Usages

func main() {
    client := smsonline.NewSmsOnlineClient("user", "secret", "UTF-8")
    response, err := client.SendSimpleSms("from", "to", "text", "charset")
    
    if err != nil {
        log.Println(err)
    }
    
    if response.Code != smsonline.CodeOk {
        log.Println(response.Message)
    }
}
  • charset - charset, default 'UTF-8'
  • from - sender name
  • to - receiver phone number
  • text - sms message text
  • delay - message sending delay
  • ack - acknowledgment: 0 - reporting, 1 - no report (default)

##Authors xjewer

##Licence

MIT

Documentation

Index

Constants

View Source
const (
	// CodeOk successful request
	CodeOk = 0
	// CodeSyntaxDataError syntax data error
	CodeSyntaxDataError = -1
	// CodeAuthenticationError authentication error
	CodeAuthenticationError = -2
	// CodeReject reject
	CodeReject = -3
	// CodeSystemError system error
	CodeSystemError = -4
	// CodeLimitReached limit reached
	CodeLimitReached = -5
)

response format - http://smsonline-bulk.readthedocs.io/en/latest/bulk_sms.html

Variables

This section is empty.

Functions

This section is empty.

Types

type SmsOnline

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

SmsOnline is sms online client

func NewSmsOnlineClient

func NewSmsOnlineClient(username, secret, charset string, httpClient *http.Client) *SmsOnline

NewSmsOnlineClient initializes new SmsOnline client

func NewSmsOnlineClientCustom

func NewSmsOnlineClientCustom(username, secret, charset, url string, httpClient *http.Client) *SmsOnline

NewSmsOnlineClientCustom initializes new SmsOnline client with custom BaseUrl

func (*SmsOnline) SendSimpleSms

func (c *SmsOnline) SendSimpleSms(from, to, text, charset string) (*SmsResponse, error)

SendSimpleSms send simple sms

func (*SmsOnline) SendSms

func (c *SmsOnline) SendSms(from, to, text, charset string, delay int, ack bool) (*SmsResponse, error)

SendSms send sms with some additional options such as delay, ack, binary

type SmsResponse

type SmsResponse struct {
	Code    int    `xml:"code"`
	Message string `xml:"tech_message"`
}

SmsResponse is a sms online response data

Jump to

Keyboard shortcuts

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