Documentation ¶
Index ¶
- Constants
- Variables
- type Action
- type BulkMessage
- type Client
- func (c Client) AdvancedMessage(m BulkMessage) (*MessageResponse, error)
- func (c Client) CreateNumberAction(actionData *Action, numberKey, configKey string) (*Action, error)
- func (c Client) CreateNumberConfig(numberKey string) (*ConfigResponse, error)
- func (c Client) GetSMSStatus(messageID string) (*MessageStatusWithID, error)
- func (c Client) ListPurchasedNumber(parmas NumberParmas) (*NumberResponse, error)
- func (c Client) Rent(numberKey string) (*Number, error)
- func (c Client) SearchNumber(parmas NumberParmas) (*NumberResponse, error)
- func (c Client) SingleMessage(m Message) (*MessageResponse, error)
- func (c Client) Unrent(numberKey string) error
- type ConfigResponse
- type Destination
- type Error
- type HTTPInterface
- type Message
- type MessageInfo
- type MessageResponse
- type MessageStatus
- type MessageStatusResponse
- type MessageStatusWithID
- type Number
- type NumberParmas
- type NumberPrice
- type NumberResponse
Constants ¶
const ( // BasePath ... BasePath = "https://api.infobip.com/" //SingleMessagePath for sending a single message SingleMessagePath = "sms/1/text/single" //AdvancedMessagePath for sending advanced messages AdvancedMessagePath = "sms/1/text/advanced" // AvailableNumberPath for searching number AvailableNumberPath = "numbers/1/numbers/available" // RentNumberPath for purchasing number RentNumberPath = "numbers/1/numbers" // UnrentNumberPath for purchasing number UnrentNumberPath = "numbers/1/numbers" // PurchasedNumberPath to get purchased number PurchasedNumberPath = "numbers/1/numbers" // SMSStatusPath for getting status SMSStatusPath = "sms/1/reports" )
const ( ForwardTypePull = "PULL" ForwardTypePost = "HTTP_FORWARD_POST" ForwardTypeGet = "HTTP_FORWARD_GET" )
Variables ¶
var ( // ErrForDestinationNonAlphanumeric ... ErrForDestinationNonAlphanumeric = Error{Err: "non-alphanumeric 'Destination' value must be between 3 and 14 numbers"} // ErrForFromNonAlphanumeric ... ErrForFromNonAlphanumeric = Error{Err: "non-alphanumeric 'From' value must be between 3 and 14 numbers"} // ErrForFromAlphanumeric ... ErrForFromAlphanumeric = Error{Err: "alphanumeric 'From' value must be between 3 and 13 characters"} // ErrForToNonAlphanumeric ... ErrForToNonAlphanumeric = Error{Err: "non-alphanumeric 'To' value must be between 3 and 14 numbers"} // ErrSMSStatusNotFound ... ErrSMSStatusNotFound = Error{Err: "SMS Status not found"} // ErrNoAuthentication ... ErrNoAuthentication = Error{Err: "Not auth format available"} )
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { ActionKey string `json:"actionKey,omitempty" url:"actionKey,omitempty"` Type string `json:"type,omitempty" url:"type,omitempty"` ForwardURL string `json:"forwardUrl,omitempty" url:"forwardUrl,omitempty"` CallbackData string `json:"callbackData,omitempty" url:"callbackData,omitempty"` }
type BulkMessage ¶
type BulkMessage struct { ID string `json:"bulkId,omitempty"` Messages []Message `json:"messages"` }
BulkMessage contains the body request for multiple messages
func (BulkMessage) Validate ¶
func (b BulkMessage) Validate() (err error)
Validate validates the entire message values
type Client ¶
type Client struct { BaseURL string Username string Password string ApiKey string HTTPClient HTTPInterface }
Client manages requests to Infobip
func ClientWithApiKey ¶
ClientWithApiKey returns a pointer to infobip.Client with Infobip funcs
func ClientWithBasicAuth ¶
ClientWithBasicAuth returns a pointer to infobip.Client with Infobip funcs
func (Client) AdvancedMessage ¶
func (c Client) AdvancedMessage(m BulkMessage) (*MessageResponse, error)
AdvancedMessage sends messages to the recipients
func (Client) CreateNumberAction ¶
func (c Client) CreateNumberAction(actionData *Action, numberKey, configKey string) (*Action, error)
CreateNumberAction create a action for a specific number key
func (Client) CreateNumberConfig ¶
func (c Client) CreateNumberConfig(numberKey string) (*ConfigResponse, error)
CreateNumberConfig create a config for a specific number key
func (Client) GetSMSStatus ¶
func (c Client) GetSMSStatus(messageID string) (*MessageStatusWithID, error)
GetSMSStatus return sms status
func (Client) ListPurchasedNumber ¶
func (c Client) ListPurchasedNumber(parmas NumberParmas) (*NumberResponse, error)
ListPurchasedNumber return a purchased number
func (Client) SearchNumber ¶
func (c Client) SearchNumber(parmas NumberParmas) (*NumberResponse, error)
SearchNumber return a list of available number
func (Client) SingleMessage ¶
func (c Client) SingleMessage(m Message) (*MessageResponse, error)
SingleMessage sends one message to one recipient
type ConfigResponse ¶
type Destination ¶
Destination contains the recipient
type HTTPInterface ¶
HTTPInterface helps Infobip tests
type Message ¶
type Message struct { From string `json:"from,omitempty"` Destinations []Destination `json:"destinations,omitempty"` To string `json:"to,omitempty"` Text string `json:"text"` Transliteration string `json:"transliteration,omitempty"` LanguageCode string `json:"languageCode,omitempty"` NotifyURL string `json:"notifyUrl,omitempty"` }
Message contains the body request
type MessageInfo ¶
type MessageInfo struct { ID string `json:"messageId"` To string `json:"to"` Status MessageStatus `json:"status"` SMSCount int `json:"smsCount"` }
MessageInfo ...
type MessageResponse ¶
type MessageResponse struct { BulkID string `json:"bulkId,omitempty"` Messages []MessageInfo `json:"messages"` }
MessageResponse body response
type MessageStatus ¶
type MessageStatus struct { ID int `json:"id"` Action string `json:"action,omitempty"` GroupID int `json:"groupId"` GroupName string `json:"groupName"` Name string `json:"name"` Description string `json:"description"` }
MessageStatus ...
type MessageStatusResponse ¶
type MessageStatusResponse struct {
Results []MessageStatusWithID `json:"results"`
}
MessageStatusResponse ...
type MessageStatusWithID ¶
type MessageStatusWithID struct { BulkID string `json:"bulkId,omitempty"` ID string `json:"messageId"` To string `json:"to"` Status MessageStatus `json:"status"` }
MessageStatusWithID ...
type NumberParmas ¶
type NumberParmas struct { Number string `json:"number,omitempty" url:"number,omitempty"` Capabilities string `json:"capabilities,omitempty" url:"capabilities,omitempty"` Country string `json:"country,omitempty" url:"country,omitempty"` Limit int `json:"limit,omitempty" url:"limit,omitempty"` Page int `json:"page,omitempty" url:"page,omitempty"` }