bandwidth

package module
v0.0.0-...-ed99203 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

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 AreaCodeOrder struct {
	Name                       string `xml:",omitempty"`
	SiteID                     string `xml:"SiteId"`
	PeerID                     string `xml:"PeerId"`
	PartialAllowed             bool
	CustomerOrderID            string `xml:"CustomerOrderId,omitempty"`
	AreaCodeSearchAndOrderType AreaCodeSearchAndOrderType
}

type AreaCodeRequest

type AreaCodeRequest struct {
	XMLName xml.Name `xml:"Order"`
	AreaCodeOrder
}

type AreaCodeSearchAndOrderType

type AreaCodeSearchAndOrderType struct {
	AreaCode string
	Quantity int
}

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 New

func New(opts Opts) (*Client, error)

New creates new instances of api It returns Client instance. Use it to make API calls.

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) EnableMMS

func (c *Client) EnableMMS(ctx context.Context, siteID, peerID string) (*MmsFeatureResponse, error)

EnableMMS enables MMS

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

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) GetOrder

func (c *Client) GetOrder(ctx context.Context, id string) (*OrderResponse, error)

GetOrder returns information regarding the given order.

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 DisconnectOrderRequest struct {
	XMLName                            xml.Name `xml:"orderRequest"`
	OrderCreateDate                    time.Time
	ID                                 string `xml:"id"`
	DisconnectTelephoneNumberOrderType DisconnectTelephoneNumberOrderType
	DisconnectMode                     string
}

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 OrderRequest struct {
	Name           string
	SiteID         string `xml:"SiteId"`
	PeerID         string `xml:"PeerId"`
	PartialAllowed bool
}

type OrderResponse

type OrderResponse struct {
	Order       OrderResponseOrder `xml:"Order"`
	OrderStatus string
	// Only relevant if OrderStatus == COMPLETE
	CompletedNumbers CompletedNumbers
}

type OrderResponseOrder

type OrderResponseOrder struct {
	OrderCreated               time.Time
	PeerID                     string `xml:"PeerId"`
	BackOrderRequested         bool
	ID                         string `xml:"id"`
	AreaCodeSearchAndOrderType AreaCodeSearchAndOrderType
	PartiallyAllowed           bool
	SiteID                     string `xml:"SiteId"`
}

type Protocols

type Protocols struct {
	HTTP HTTPProtocol
}

type RateLimitError

type RateLimitError struct {
	Reset time.Time
}

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 SipPeer

type SipPeer struct {
	PeerName      string
	Description   string
	IsDefaultPeer bool
}

type SipPeerSmsFeature

type SipPeerSmsFeature struct {
	SipPeerSmsFeatureSettings SipPeerSmsFeatureSettings
	HttpSettings              HttpSettings
}

type SipPeerSmsFeatureResponse

type SipPeerSmsFeatureResponse struct {
	SipPeerSmsFeature SipPeerSmsFeature
}

type SipPeerSmsFeatureSettings

type SipPeerSmsFeatureSettings struct {
	TollFree    bool
	ShortCode   bool
	A2pLongCode string // DefaultOff?
	Protocol    string // HTTP
	Zone1       bool
	Zone2       bool
	Zone3       bool
	Zone4       bool
	Zone5       bool
}

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 TollFreeOrder struct {
	Name                               string `xml:",omitempty"`
	SiteID                             string `xml:"SiteId"`
	PeerID                             string `xml:"PeerId"`
	PartialAllowed                     bool
	CustomerOrderID                    string `xml:"CustomerOrderId,omitempty"`
	TollFreeWildCharSearchAndOrderType TollFreeWildCharSearchAndOrderType
}

type TollFreeOrderRequest

type TollFreeOrderRequest struct {
	XMLName xml.Name `xml:"Order"`
	TollFreeOrder
}

type TollFreeWildCharSearchAndOrderType

type TollFreeWildCharSearchAndOrderType struct {
	TollFreeWildCardPattern string
	Quantity                int
}

Jump to

Keyboard shortcuts

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