Documentation ¶
Index ¶
Constants ¶
const ( DefaultHTTPAddress = "https://api.multisend.co.il/MultiSendAPI/" DefaultSendSMSPage = "sendsms" DefaultDateTimeFormat = "2006-02-01+15:04:05" DefaultGETContentType = "text/plain; charset=UTF-8" DefaultPOSTContentType = "application/x-www-form-urlencoded" )
Default settings
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool bool
Bool is a boolean that understand also numeric values
type DLRType ¶
type DLRType string
DLRType holds information regarding the DLR
const ( DLRTypeSuccess DLRType = "888" DLRTypeNumberWithoutDevice DLRType = "000" DLRTypeDeviceMemoryFull1 DLRType = "003" DLRTypeFilteredMessage DLRType = "009" DLRTypeDeviceNotSupported DLRType = "012" DLRTypeServiceNotSupported DLRType = "021" DLRTypeDeviceMemoryFull2 DLRType = "032" DLRTypeMessageExpired DLRType = "041" )
The Types of given DLR
type MessageType ¶
type MessageType uint
MessageType is the type of message to tell the API to use
const ( MessageTypeUnknown MessageType = iota MessageTypeTTS MessageTypeSMS MessageTypeSMSAndTTS )
Type Of messages to use
func (*MessageType) Scan ¶
func (mt *MessageType) Scan(src interface{}) error
Scan implements the database interface for Scan
func (MessageType) String ¶
func (mt MessageType) String() string
type RESTSendSMS ¶
type RESTSendSMS struct { UserName string `url:"user"` Password string `url:"password"` From string `url:"from"` Recipient Recipients `url:"recipient"` Message string `url:"message"` MessageType MessageType `url:"message_type,omitempty"` ScheduleDateTime SchedulerDateTime `url:"scheduledatetime,omitempty"` International Bool `url:"international,omitempty"` DeliveryNotificationURL string `url:"deliverynotification_url,omitempty"` CustomerMessageID string `url:"customermessageid,omitempty"` DeliveryNotificationMethod string `url:"deliverynotificationmethod,omitempty"` SendID string `url:"sendID,omitempty"` }
RESTSendSMS holds the fields to send SMS using GET and POST requests
func (RESTSendSMS) SendSMS ¶
func (r RESTSendSMS) SendSMS( method string, client *http.Client, onResponse smshandler.Response) (*http.Response, error)
SendSMS sends the SMS implementing the RESTHandler interface
func (*RESTSendSMS) ToURL ¶
func (r *RESTSendSMS) ToURL() url.Values
ToURL converts the struct to url.Values
type Recipients ¶
type Recipients []string
Recipients holds a list of recipients to send them SMS
func (*Recipients) Add ¶
func (r *Recipients) Add(number string)
Add a new number for the recipients
func (Recipients) IsNumberExists ¶
func (r Recipients) IsNumberExists(number string) (bool, int)
IsNumberExists searches for a number if exists on the Recipients list if found returns true and the index
func (*Recipients) RemoveByIndex ¶
func (r *Recipients) RemoveByIndex(idx int) error
RemoveByIndex removes a number from Recipients based on an index if index is too small or too big, an error is raised
func (*Recipients) Scan ¶
func (r *Recipients) Scan(src interface{}) error
Scan implements the database interface for Scan
func (Recipients) String ¶
func (r Recipients) String() string
type Response ¶
type Response struct { Success bool `json:"success"` Message string `json:"message,omitempty"` SMSCount int `json:"smsCount,omitempty"` Error ResponseErrors `json:"error,omitempty"` }
Response holds the structure for response messages
func (*Response) FromResponse ¶
FromResponse implements the interface of Response
type ResponseErrors ¶
ResponseErrors is a map for holding error messages arrives from the Response
type SchedulerDateTime ¶
type SchedulerDateTime struct {
// contains filtered or unexported fields
}
SchedulerDateTime holds date and time format to schedule sms
func NewSchedulerDateTime ¶
func NewSchedulerDateTime(str string) (*SchedulerDateTime, error)
NewSchedulerDateTime initialize a new SchedulerDateTime.
func NewSchedulerFromTime ¶
func NewSchedulerFromTime(t time.Time) *SchedulerDateTime
NewSchedulerFromTime initialize a new SchedulerDateTime from time.Time
func (SchedulerDateTime) IsValid ¶
func (dt SchedulerDateTime) IsValid() bool
IsValid returns true if the date is valid
func (*SchedulerDateTime) Scan ¶
func (dt *SchedulerDateTime) Scan(src interface{}) error
Scan implements the database interface for Scan
func (*SchedulerDateTime) SetDateTime ¶
func (dt *SchedulerDateTime) SetDateTime(dateTime time.Time)
SetDateTime update SchedulerDateTime to a new date time
func (SchedulerDateTime) String ¶
func (dt SchedulerDateTime) String() string