Documentation
¶
Index ¶
- type APITransport
- type Action
- type Auth
- type CallFrom
- type CallTo
- type CreateCallOpts
- type JWTAuth
- type KeySecretAuth
- type Ncco
- type NotifyAction
- type NumberBuyOpts
- type NumberCancelOpts
- type NumberSearchOpts
- type NumberUpdateOpts
- type NumbersClient
- func (client *NumbersClient) Buy(country string, msisdn string, opts NumberBuyOpts) (numbers.Response, NumbersErrorResponse, error)
- func (client *NumbersClient) Cancel(country string, msisdn string, opts NumberCancelOpts) (numbers.Response, NumbersErrorResponse, error)
- func (client *NumbersClient) List(opts NumbersOpts) (numbers.InboundNumbers, error)
- func (client *NumbersClient) Search(country string, opts NumberSearchOpts) (numbers.AvailableNumbers, error)
- func (client *NumbersClient) Update(country string, msisdn string, opts NumberUpdateOpts) (numbers.Response, NumbersErrorResponse, error)
- type NumbersErrorResponse
- type NumbersOpts
- type SMSClient
- type SMSOpts
- type TalkAction
- type VerifyClient
- func (client *VerifyClient) Cancel(requestID string) (verify.ControlResponse, verify.ControlErrorResponse, error)
- func (client *VerifyClient) Check(requestID string, code string) (verify.CheckResponse, verify.CheckErrorResponse, error)
- func (client *VerifyClient) Request(number string, brand string, opts VerifyOpts) (verify.RequestResponse, verify.RequestErrorResponse, error)
- func (client *VerifyClient) Search(requestID string) (verify.SearchResponse, verify.SearchErrorResponse, error)
- func (client *VerifyClient) TriggerNextEvent(requestID string) (verify.ControlResponse, verify.ControlErrorResponse, error)
- type VerifyOpts
- type VoiceClient
- type VoiceErrorGeneralResponse
- type VoiceErrorInvalidParamsResponse
- type VoiceErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APITransport ¶
type APITransport struct {
APISecret string
// Transport is the underlying HTTP transport to use when making requests.
// It will default to http.DefaultTransport if nil.
Transport http.RoundTripper
}
APITransport lets us add extra HTTP features and pass them around elegantly
func (*APITransport) Client ¶
func (t *APITransport) Client() *http.Client
Client is our HTTP Client with custom rountripper set
type Action ¶
type Action interface {
// contains filtered or unexported methods
}
Action is an interface to ensure all Actions have a prepare()
type Auth ¶
type Auth interface {
GetCreds() []string
}
Auth types are various but support a common interface
type CallTo ¶
type CallTo struct {
Type string
Number string
DtmfAnswer string
Uri string
Extension string
ContentType string
Headers map[string]string
}
CallTo details of the callee
type CreateCallOpts ¶
CreateCallOpts: Options for creating a call
type JWTAuth ¶
type JWTAuth struct {
JWT string
}
JWTAuth is an Auth type to represent a JWT token
func CreateAuthFromAppPrivateKey ¶
CreateAuthFromAppPrivateKey is a helper method to generate auth from an Application ID and a []byte of the private key (use with ioutil.ReadFile)
func CreateAuthFromJwtTokenGenerator ¶
CreateAuthFromJwtTokenGenerator accepts a token generator struct, use this to set more of the options on the generator.
type KeySecretAuth ¶
type KeySecretAuth struct {
// contains filtered or unexported fields
}
KeySecretAuth is an Auth type to represent the API key and API secret combination
func CreateAuthFromKeySecret ¶
func CreateAuthFromKeySecret(apiKey string, apiSecret string) *KeySecretAuth
CreateAuthFromKeySecret returns an Auth type given an API key and API secret
func (*KeySecretAuth) GetCreds ¶
func (auth *KeySecretAuth) GetCreds() []string
GetCreds gives an array of credential strings
type Ncco ¶
type Ncco struct {
// contains filtered or unexported fields
}
Ncco is a parent type to hold the actions
func (*Ncco) GetActions ¶
func (n *Ncco) GetActions() []interface{}
GetActions to get all the actions
type NotifyAction ¶
type NotifyAction struct {
Action string `json:"action,omitempty"`
Payload map[string]string `json:"payload,omitempty"`
EventUrl []string `json:"eventUrl,omitempty"`
EventMethod string `json:"eventMethod,omitempty"`
}
NotifyAction to represent a Notify Action
type NumberBuyOpts ¶
type NumberBuyOpts struct {
TargetAPIKey string
}
NumberBuyOpts enables users to set the Target API Key (and any future params)
type NumberCancelOpts ¶
type NumberCancelOpts struct {
TargetAPIKey string
}
NumberCancelOpts enables users to set the Target API Key (and any future params)
type NumberSearchOpts ¶
type NumberSearchOpts struct {
Type string
Features string
Pattern string
SearchPattern int32
Size int32
Index int32
}
NumberSearchOpts sets the optional values in the Search method
type NumberUpdateOpts ¶
type NumberUpdateOpts struct {
AppID string
MoHTTPURL string
VoiceCallbackType string
VoiceCallbackValue string
VoiceStatusCallback string
MessagesCallbackType string
MessagesCallbackValue string
}
NumberUpdateOpts sets all the various fields for the number config
type NumbersClient ¶
type NumbersClient struct {
Config *numbers.Configuration
// contains filtered or unexported fields
}
NumbersClient for working with the Numbers API
func NewNumbersClient ¶
func NewNumbersClient(Auth Auth) *NumbersClient
NewNumbersClient Creates a new Numbers Client, supplying an Auth to work with
func (*NumbersClient) Buy ¶
func (client *NumbersClient) Buy(country string, msisdn string, opts NumberBuyOpts) (numbers.Response, NumbersErrorResponse, error)
Buy the best phone number to use in your app
func (*NumbersClient) Cancel ¶
func (client *NumbersClient) Cancel(country string, msisdn string, opts NumberCancelOpts) (numbers.Response, NumbersErrorResponse, error)
Cancel a number already in your account
func (*NumbersClient) List ¶
func (client *NumbersClient) List(opts NumbersOpts) (numbers.InboundNumbers, error)
List shows the numbers you already own, filters and pagination are available
func (*NumbersClient) Search ¶
func (client *NumbersClient) Search(country string, opts NumberSearchOpts) (numbers.AvailableNumbers, error)
Search lets you find a great phone number to use in your application
func (*NumbersClient) Update ¶
func (client *NumbersClient) Update(country string, msisdn string, opts NumberUpdateOpts) (numbers.Response, NumbersErrorResponse, error)
Update the configuration for your number
type NumbersErrorResponse ¶
type NumbersErrorResponse struct {
ErrorCode string `json:"error-code,omitempty"`
ErrorCodeLabel string `json:"error-code-label,omitempty"`
}
NumbersErrorResponse is the error format for the Numbers API
type NumbersOpts ¶
type NumbersOpts struct {
ApplicationID string
HasApplication string // string because it's tri-state, not boolean
Country string
Pattern string
SearchPattern int32
Size int32
Index int32
}
NumbersOpts sets the options to use in finding the numbers already in the user's account
type SMSClient ¶
type SMSClient struct {
Config *sms.Configuration
// contains filtered or unexported fields
}
SMSClient for working with the SMS API
func NewSMSClient ¶
NewSMSClient Creates a new SMS Client, supplying an Auth to work with
type SMSOpts ¶
SMSOpts holds all the optional values that can be set when sending an SMS, check the https://developer.nexmo.com/api/sms API reference for more information
type TalkAction ¶
type TalkAction struct {
Action string `json:"action,omitempty"`
Text string `json:"text"`
Loop string `json:"-"`
BargeIn bool `json:"bargeIn"`
Level int `json:"level"`
VoiceName string `json:"voiceName,omitempty"`
CalculatedLoopValue int `json:"loop"`
}
TalkAction is a text-to-speech feature. Beware that the "Loop" field is a string here, and the CalculatedLoopValue is used to assemble the correct value when sending
type VerifyClient ¶
type VerifyClient struct {
Config *verify.Configuration
// contains filtered or unexported fields
}
VerifyClient for working with the Verify API
func NewVerifyClient ¶
func NewVerifyClient(Auth Auth) *VerifyClient
NewVerifyClient Creates a new Verify Client, supplying an Auth to work with
func (*VerifyClient) Cancel ¶
func (client *VerifyClient) Cancel(requestID string) (verify.ControlResponse, verify.ControlErrorResponse, error)
Cancel an in-progress request (check API docs for when this is possible)
func (*VerifyClient) Check ¶
func (client *VerifyClient) Check(requestID string, code string) (verify.CheckResponse, verify.CheckErrorResponse, error)
Check the user-supplied code for this request ID
func (*VerifyClient) Request ¶
func (client *VerifyClient) Request(number string, brand string, opts VerifyOpts) (verify.RequestResponse, verify.RequestErrorResponse, error)
Request a number is verified for ownership
func (*VerifyClient) Search ¶
func (client *VerifyClient) Search(requestID string) (verify.SearchResponse, verify.SearchErrorResponse, error)
Search for an earlier request by id
func (*VerifyClient) TriggerNextEvent ¶
func (client *VerifyClient) TriggerNextEvent(requestID string) (verify.ControlResponse, verify.ControlErrorResponse, error)
TriggerNextEvent moves on to the next event in the workflow
type VerifyOpts ¶
type VerifyOpts struct {
Country string
SenderID string
CodeLength int32
Lg string
PinExpiry int32
NextEventWait int32
WorkflowID int32
}
VerifyOpts holds all the optional arguments for the verify request function
type VoiceClient ¶
type VoiceClient struct {
Config *voice.Configuration
JWT string
}
VoiceClient for working with the Voice API
func NewVoiceClient ¶
func NewVoiceClient(Auth Auth) *VoiceClient
NewVoiceClient Creates a new Voice Client, supplying an Auth to work with
func (*VoiceClient) CreateCall ¶
func (client *VoiceClient) CreateCall(opts CreateCallOpts) (voice.CreateCallResponse, VoiceErrorResponse, error)
CreateCall Makes a phone call given the from/to details and either an AnswerURL or an NCCO
func (*VoiceClient) GetCalls ¶
func (client *VoiceClient) GetCalls() (voice.GetCallsResponse, VoiceErrorResponse, error)
List your calls
type VoiceErrorGeneralResponse ¶
type VoiceErrorGeneralResponse struct {
Type string `json:"type, omitempty"`
Title string `json:"error_title, omitempty"`
}
VoiceErrorGeneralResponse covers some common error types that come from the webserver/gateway rather than the API itself
type VoiceErrorInvalidParamsResponse ¶
type VoiceErrorInvalidParamsResponse struct {
Type int `json:"type, omitempty"`
Title string `json:"title, omitempty"`
Detail string `json:"detail, omitempty"`
Instance string `json:"instance, omitempty"`
InvalidParameters []map[string]string `json:"invalid_parameters, omitempty"`
}
VoiceErrorInvalidParamsResponse can come with a 400 response if it is caused by some invalid_parameters
type VoiceErrorResponse ¶
type VoiceErrorResponse struct {
Error interface{}
}
VoiceErrorResponse is a container for error types since we can get more than one type of error back and they have incompatible data types
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
cli/vongo
command
|
|
|
cli/vongo/cmd
Package cmd is an example app Package cmd is an example app Package cmd is an example app Package cmd is an example app
|
Package cmd is an example app Package cmd is an example app Package cmd is an example app Package cmd is an example app |