Documentation ¶
Index ¶
- type ApplicationsSettings
- type ApplicationsSettingsResponse
- type AreaCodeOrder
- type AreaCodeRequest
- type AreaCodeSearchAndOrderType
- type AssociatedSipPeer
- type AssociatedSipPeers
- type AssociatedSipPeersResponse
- type Client
- func (c *Client) AssociateApplication(ctx context.Context, siteID, peerID, applicationID string) (*ApplicationsSettingsResponse, error)
- func (c *Client) CreateMessage(ctx context.Context, data *CreateMessage) (*CreateMessageResponse, error)
- func (c *Client) CreatePeer(ctx context.Context, applicationID, siteID, peerName string, isDefault bool) (string, error)
- func (c *Client) Disconnect(ctx context.Context, numbers []string) (*DisconnectTelephoneNumberOrderResponse, error)
- func (c *Client) EnableMMS(ctx context.Context, siteID, peerID string) (*MmsFeatureResponse, error)
- func (c *Client) EnableSMS(ctx context.Context, siteID, peerID string) (*SipPeerSmsFeatureResponse, error)
- func (c *Client) GetAssociatedPeers(ctx context.Context, applicationID string) (*AssociatedSipPeersResponse, error)
- func (c *Client) GetDisconnect(ctx context.Context, id string) (*DisconnectTelephoneNumberOrderResponse, error)
- func (c *Client) GetNumbers(ctx context.Context, siteID, peerID string) (*SipPeerTelephoneNumbersResponse, error)
- func (c *Client) GetOrder(ctx context.Context, id string) (*OrderResponse, error)
- func (c *Client) OrderNumbersByAreaCode(ctx context.Context, siteID, peerID, areaCode string, n int) (*OrderResponse, error)
- func (c *Client) OrderTollFreeNumbers(ctx context.Context, siteID, peerID, mask string, n int) (*OrderResponse, error)
- func (c *Client) SearchNumbersByAreaCode(ctx context.Context, areaCode string, n int) (*SearchResult, error)
- func (c *Client) SearchTollFreeNumbers(ctx context.Context, mask string, n int) (*SearchResult, error)
- type CompletedNumbers
- type CreateMessage
- type CreateMessageResponse
- type DisconnectOrderRequest
- type DisconnectTelephoneNumberOrder
- type DisconnectTelephoneNumberOrderResponse
- type DisconnectTelephoneNumberOrderType
- type HTTPProtocol
- type HttpSettings
- type MmsFeature
- type MmsFeatureResponse
- type MmsSettings
- type Opts
- type OrderRequest
- type OrderResponse
- type OrderResponseOrder
- type Protocols
- type RateLimitError
- type SearchResult
- type SipPeer
- type SipPeerSmsFeature
- type SipPeerSmsFeatureResponse
- type SipPeerSmsFeatureSettings
- type SipPeerTelephoneNumbers
- type SipPeerTelephoneNumbersResponse
- type TelephoneNumber
- type TelephoneNumberList
- type TollFreeOrder
- type TollFreeOrderRequest
- type TollFreeWildCharSearchAndOrderType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationsSettings ¶
type ApplicationsSettings struct {
HttpMessagingV2AppId string
}
type ApplicationsSettingsResponse ¶
type ApplicationsSettingsResponse struct {
ApplicationsSettings ApplicationsSettings
}
type AreaCodeOrder ¶
type AreaCodeRequest ¶
type AreaCodeRequest struct { XMLName xml.Name `xml:"Order"` AreaCodeOrder }
type AssociatedSipPeer ¶
type AssociatedSipPeer struct { // SiteId is the ID of the site. SiteID string `xml:"SiteId"` // SiteName is the name of the site. SiteName string // PeerId is the ID of the peer. This is used alongside side-id to retrieve the actual numbers. PeerID string `xml:"PeerId"` }
AssociatedSipPeer returns an associated sip-peer (aka location) with the app.
type AssociatedSipPeers ¶
type AssociatedSipPeers struct {
Associated []AssociatedSipPeer `xml:"AssociatedSipPeer"`
}
AssociatedSipPeers is a list of associated sip peers.
type AssociatedSipPeersResponse ¶
type AssociatedSipPeersResponse struct {
Peers AssociatedSipPeers `xml:"AssociatedSipPeers"`
}
AssociatedSipPeersResponse struct
type Client ¶
type Client struct {
AccountsEndpoint, MessagingEndpoint string
// contains filtered or unexported fields
}
Client is main API object
func (*Client) AssociateApplication ¶
func (c *Client) AssociateApplication(ctx context.Context, siteID, peerID, applicationID string) (*ApplicationsSettingsResponse, error)
AssociateApplication associates the peer with the application.
func (*Client) CreateMessage ¶
func (c *Client) CreateMessage(ctx context.Context, data *CreateMessage) (*CreateMessageResponse, error)
CreateMessage sends a message (SMS/MMS)
func (*Client) CreatePeer ¶
func (c *Client) CreatePeer(ctx context.Context, applicationID, siteID, peerName string, isDefault bool) (string, error)
CreatePeer creates the Sip peer and returns its ID.
func (*Client) Disconnect ¶
func (c *Client) Disconnect(ctx context.Context, numbers []string) (*DisconnectTelephoneNumberOrderResponse, error)
Disconnect disconnects the given phone numbers.
func (*Client) EnableSMS ¶
func (c *Client) EnableSMS(ctx context.Context, siteID, peerID string) (*SipPeerSmsFeatureResponse, error)
EnableSMS enables SMS
func (*Client) GetAssociatedPeers ¶
func (c *Client) GetAssociatedPeers(ctx context.Context, applicationID string) (*AssociatedSipPeersResponse, error)
GetAssociatedPeers returns the associated sippeers (aka locations) for the application.
func (*Client) GetDisconnect ¶
func (c *Client) GetDisconnect(ctx context.Context, id string) (*DisconnectTelephoneNumberOrderResponse, error)
GetDisconnect returns information regarding the given disconnect by ID.
func (*Client) GetNumbers ¶
func (c *Client) GetNumbers(ctx context.Context, siteID, peerID string) (*SipPeerTelephoneNumbersResponse, error)
GetNumbers returns the toll-free numbers associated with the site.
func (*Client) OrderNumbersByAreaCode ¶
func (c *Client) OrderNumbersByAreaCode(ctx context.Context, siteID, peerID, areaCode string, n int) (*OrderResponse, error)
OrderNumbersByAreaCode purchases n numbers given area-code.
func (*Client) OrderTollFreeNumbers ¶
func (c *Client) OrderTollFreeNumbers(ctx context.Context, siteID, peerID, mask string, n int) (*OrderResponse, error)
OrderTollFreeNumbers purchases n numbers given toll-free mask.
func (*Client) SearchNumbersByAreaCode ¶
func (c *Client) SearchNumbersByAreaCode(ctx context.Context, areaCode string, n int) (*SearchResult, error)
SearchNumbersByAreaCode finds n numbers given area-code.
func (*Client) SearchTollFreeNumbers ¶
func (c *Client) SearchTollFreeNumbers(ctx context.Context, mask string, n int) (*SearchResult, error)
SearchTollFreeNumbers finds n numbers given tollfree mask.
type CompletedNumbers ¶
type CompletedNumbers struct {
TelephoneNumbers []TelephoneNumber `xml:"TelephoneNumber"`
}
type CreateMessage ¶
type CreateMessage struct { From string `json:"from,omitempty"` To interface{} `json:"to,omitempty"` Text string `json:"text,omitempty"` Media []string `json:"media,omitempty"` ApplicationID string `json:"applicationId,omitempty"` Tag string `json:"tag,omitempty"` }
CreateMessage struct
type CreateMessageResponse ¶
type CreateMessageResponse struct { ID string `json:"id"` Time *time.Time `json:"time,string"` From string `json:"from"` To interface{} `json:"to"` Text string `json:"text"` Media []string `json:"media"` ApplicationID string `json:"applicationId"` Tag string `json:"tag"` Direction string `json:"direction"` SegmentCount int32 `json:"segmentCount"` }
CreateMessageResponse stores status of sent message
type DisconnectOrderRequest ¶
type DisconnectTelephoneNumberOrder ¶
type DisconnectTelephoneNumberOrder struct { Name string `xml:"name,omitempty"` DisconnectTelephoneNumberOrderType DisconnectTelephoneNumberOrderType }
type DisconnectTelephoneNumberOrderResponse ¶
type DisconnectTelephoneNumberOrderResponse struct { OrderRequest DisconnectOrderRequest OrderStatus string }
type DisconnectTelephoneNumberOrderType ¶
type DisconnectTelephoneNumberOrderType struct {
TelephoneNumberList TelephoneNumberList
}
type HTTPProtocol ¶
type HTTPProtocol struct {
HttpSettings HttpSettings
}
type HttpSettings ¶
type HttpSettings struct {
ProxyPeerId int `xml:",omitempty"`
}
type MmsFeature ¶
type MmsFeature struct { MmsSettings MmsSettings Protocols Protocols }
type MmsFeatureResponse ¶
type MmsFeatureResponse struct {
MmsFeature MmsFeature
}
type MmsSettings ¶
type MmsSettings struct {
Protocol string
}
type Opts ¶
type Opts struct {
// mandatory options.
AccountID, APIToken, APISecret, UserName, Password string
//optional
AccountsEndpoint, MessagingEndpoint string
HTTPClient *http.Client
Verbose bool
}
Opts are the options to create the client.
type OrderRequest ¶
type OrderResponse ¶
type OrderResponse struct { Order OrderResponseOrder `xml:"Order"` OrderStatus string // Only relevant if OrderStatus == COMPLETE CompletedNumbers CompletedNumbers }
type OrderResponseOrder ¶
type Protocols ¶
type Protocols struct {
HTTP HTTPProtocol
}
type RateLimitError ¶
RateLimitError is error for 429 http error
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type SearchResult ¶
type SearchResult struct { ResultCount int TelephoneNumberList TelephoneNumberList }
type SipPeerSmsFeature ¶
type SipPeerSmsFeature struct { SipPeerSmsFeatureSettings SipPeerSmsFeatureSettings HttpSettings HttpSettings }
type SipPeerSmsFeatureResponse ¶
type SipPeerSmsFeatureResponse struct {
SipPeerSmsFeature SipPeerSmsFeature
}
type SipPeerTelephoneNumbers ¶
type SipPeerTelephoneNumbers struct {
Numbers []TelephoneNumber `xml:"SipPeerTelephoneNumber"`
}
SipPeerTelephoneNumbers is a collection of phone numbers.
type SipPeerTelephoneNumbersResponse ¶
type SipPeerTelephoneNumbersResponse struct {
Peers SipPeerTelephoneNumbers `xml:"SipPeerTelephoneNumbers"`
}
SipPeerTelephoneNumbersResponse is the response to fetching sip-peers.
type TelephoneNumber ¶
type TelephoneNumber struct {
FullNumber string
}
TelephoneNumber is the phone number.
type TelephoneNumberList ¶
type TelephoneNumberList struct {
TelephoneNumber []string
}
type TollFreeOrder ¶
type TollFreeOrderRequest ¶
type TollFreeOrderRequest struct { XMLName xml.Name `xml:"Order"` TollFreeOrder }