plivo

package module
v4.1.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: MIT Imports: 19 Imported by: 0

README

plivo-go

Build Status GoDoc

The Plivo Go SDK makes it simpler to integrate communications into your Go applications using the Plivo REST API. Using the SDK, you will be able to make voice calls, send SMS and generate Plivo XML to control your call flows.

Prerequisites

  • Go >= 1.7.x

Installation

To Install Stable release

You can use the Stable release using the go command.

$ go get github.com/plivo/plivo-go

You can also install by cloning this repository into your GOPATH.

To Install Beta release
  1. In terminal, using the following command, create a new folder called test-plivo-beta.

    $ mkdir test-plivo-beta
    

    Note: Make sure the new folder is outside your GOPATH.

  2. Change your directory to the new folder.

  3. Using the following command, initialize a new module:

    $ go mod init github.com/plivo/beta
    

    You will see the following return:

    $ go mod init github.com/plivo/beta
    
  4. Next, create a new go file with the following code:

    package main
    
    import (
    "fmt"
    "github.com/plivo/plivo-go"
    )
    
    const authId  = "auth_id"
    const authToken = "auth_token"
    
    func main() {
    	testPhloGetter()
    }
    
    func testPhloGetter() {
    	phloClient,err := plivo.NewPhloClient(authId, authToken, &plivo.ClientOptions{})
    	if err != nil {
    		panic(err)
    	}
    	response, err := phloClient.Phlos.Get("phlo_id")
    	if err != nil {
    		panic(err)
    	}
    	fmt.Printf("Response: %#v\n", response)
    }
    

    Note: Make sure you enter your auth_id and auth_token before you initialize the code.

  5. Run the following command to build the packages:

    $ go build
    
    payload_defined

    A file named go.mod will be generated.

  6. Open go.mod using the command vim go.mod and edit the plivo-go version to the beta version you want to download.

    payload_defined

    Note: You can see the full list of releases here.

    For example, change

    github.com/plivo/plivo-go v4.0.5+incompatible 
    

    to

    github.com/plivo/plivo-go v4.0.6-beta1
    
  7. Once done, save the go.mod.

  8. Run go build to build the packages.

    go.mod will be updated with the beta version.

You can now use the features available in the Beta branch.

Getting started

Authentication

To make the API requests, you need to create a Client and provide it with authentication credentials (which can be found at https://manage.plivo.com/dashboard/).

We recommend that you store your credentials in the PLIVO_AUTH_ID and the PLIVO_AUTH_TOKEN environment variables, so as to avoid the possibility of accidentally committing them to source control. If you do this, you can initialise the client with no arguments and it will automatically fetch them from the environment variables:

package main

import "github.com/plivo/plivo-go"

func main()  {
  client, err := plivo.NewClient("", "", &plivo.ClientOptions{})
  if err != nil {
    panic(err)
  }
}

Alternatively, you can specifiy the authentication credentials while initializing the Client.

package main

import "github.com/plivo/plivo-go"

func main()  {
 client, err := plivo.NewClient("your_auth_id", "your_auth_token", &plivo.ClientOptions{})
 if err != nil {
   panic(err)
 }
}

The Basics

The SDK uses consistent interfaces to create, retrieve, update, delete and list resources. The pattern followed is as follows:

client.Resources.Create(Params{}) // Create
client.Resources.Get(Id) // Get
client.Resources.Update(Id, Params{}) // Update
client.Resources.Delete(Id) // Delete
client.Resources.List() // List all resources, max 20 at a time

Using client.Resources.List() would list the first 20 resources by default (which is the first page, with limit as 20, and offset as 0). To get more, you will have to use limit and offset to get the second page of resources.

Examples

Send a message
package main

import "github.com/plivo/plivo-go"

func main()  {
  client, err := plivo.NewClient("", "", &plivo.ClientOptions{})
  if err != nil {
    panic(err)
  }
  client.Messages.Create(plivo.MessageCreateParams{
    Src: "the_source_number",
    Dst: "the_destination_number",
    Text: "Hello, world!",
  })
}
Make a call
package main

import "github.com/plivo/plivo-go"

func main()  {
  client, err := plivo.NewClient("", "", &plivo.ClientOptions{})
  if err != nil {
    panic(err)
  }
  client.Calls.Create(plivo.CallCreateParams{
    From: "the_source_number",
    To: "the_destination_number",
    AnswerURL: "http://answer.url",
  })
}
Generate Plivo XML
package main

import "github.com/plivo/plivo-go/plivo/xml"

func main()  {
  println(xml.ResponseElement{
    Contents: []interface{}{
      new(xml.SpeakElement).SetContents("Hello, world!"),
    },
    }.String())
}

This generates the following XML:

<Response>
  <Speak>Hello, world!</Speak>
</Response>
Run a PHLO
package main

import (
	"fmt"
	"plivo-go"
)

// Initialize the following params with corresponding values to trigger resources

const authId  = "auth_id"
const authToken = "auth_token"
const phloId = "phlo_id"

// with payload in request

func main() {
	testPhloRunWithParams()
}

func testPhloRunWithParams() {
	phloClient,err := plivo.NewPhloClient(authId, authToken, &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	phloGet, err := phloClient.Phlos.Get(phloId)
	if err != nil {
		panic(err)
	}
	//pass corresponding from and to values
	type params map[string]interface{}
	response, err := phloGet.Run(params{
		"from": "111111111",
		"to": "2222222222",
	})

	if (err != nil) {
		println(err)
	}
	fmt.Printf("Response: %#v\n", response)
}
More examples

Refer to the Plivo API Reference for more examples. Also refer to the guide to setting up dev environment on Plivo Developers Portal to setup a simple Go server & use it to test out your integration in under 5 minutes.

Reporting issues

Report any feedback or problems with this version by opening an issue on Github.

Documentation

Index

Constants

View Source
const ABORT_TRANSFER = "abort_transfer"
View Source
const HANGUP = "hangup"
View Source
const HOLD = "hold"
View Source
const RESUME_CALL = "resume_call"
View Source
const UNHOLD = "unhold"
View Source
const VOICEMAIL_DROP = "voicemail_drop"

Variables

This section is empty.

Functions

func ComputeSignature

func ComputeSignature(authToken, uri string, params map[string]string) string

func ComputeSignatureV2

func ComputeSignatureV2(authToken, uri string, nonce string) string

func Headers

func Headers(headers map[string]string) string

Some code from encode.go from the Go Standard Library

func Numbers

func Numbers(numbers ...string) string

func ValidateSignature

func ValidateSignature(authToken, uri string, params map[string]string, signature string) bool

func ValidateSignatureV2

func ValidateSignatureV2(uri string, nonce string, signature string, authToken string) bool

Types

type Account

type Account struct {
	AccountType  string `json:"account_type,omitempty" url:"account_type,omitempty"` // The type of your Plivo account. All accounts with funds are standard accounts. If your account is on free trial, this attribute will return developer.
	Address      string `json:"address,omitempty" url:"address,omitempty"`           // The postal address of the account which will be reflected in the invoices.
	ApiID        string `json:"api_id,omitempty" url:"api_id,omitempty"`
	AuthID       string `json:"auth_id,omitempty" url:"auth_id,omitempty"`             // The auth id of the account.
	AutoRecharge bool   `json:"auto_recharge,omitempty" url:"auto_recharge,omitempty"` // Auto recharge settings associated with the account. If this value is true, we will recharge your account if the credits fall below a certain threshold.
	BillingMode  string `json:"billing_mode,omitempty" url:"billing_mode,omitempty"`   // The billing mode of the account. Can be prepaid or postpaid.
	CashCredits  string `json:"cash_credits,omitempty" url:"cash_credits,omitempty"`   // Credits of the account.
	City         string `json:"city,omitempty" url:"city,omitempty"`                   // The city of the account.
	Name         string `json:"name,omitempty" url:"name,omitempty"`                   // The name of the account holder.
	ResourceURI  string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
	State        string `json:"state,omitempty" url:"state,omitempty"`       // The state of the account holder.
	Timezone     string `json:"timezone,omitempty" url:"timezone,omitempty"` // The timezone of the account.
}

func (Account) ID

func (self Account) ID() string

type AccountService

type AccountService struct {
	// contains filtered or unexported fields
}

func (*AccountService) Get

func (service *AccountService) Get() (response *Account, err error)

func (*AccountService) Update

func (service *AccountService) Update(params AccountUpdateParams) (response *SubaccountUpdateResponse, err error)

type AccountUpdateParams

type AccountUpdateParams struct {
	Name    string `json:"name,omitempty" url:"name,omitempty"`       // Name of the account holder or business.
	Address string `json:"address,omitempty" url:"address,omitempty"` // City of the account holder.
	City    string `json:"city,omitempty" url:"city,omitempty"`       // Address of the account holder.
}

type Application

type Application struct {
	FallbackMethod      string `json:"fallback_method,omitempty" url:"fallback_method,omitempty"`
	DefaultApp          bool   `json:"default_app,omitempty" url:"default_app,omitempty"`
	AppName             string `json:"app_name,omitempty" url:"app_name,omitempty"`
	ProductionApp       bool   `json:"production_app,omitempty" url:"production_app,omitempty"`
	AppID               string `json:"app_id,omitempty" url:"app_id,omitempty"`
	HangupURL           string `json:"hangup_url,omitempty" url:"hangup_url,omitempty"`
	AnswerURL           string `json:"answer_url,omitempty" url:"answer_url,omitempty"`
	MessageURL          string `json:"message_url,omitempty" url:"message_url,omitempty"`
	ResourceURI         string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
	HangupMethod        string `json:"hangup_method,omitempty" url:"hangup_method,omitempty"`
	MessageMethod       string `json:"message_method,omitempty" url:"message_method,omitempty"`
	FallbackAnswerURL   string `json:"fallback_answer_url,omitempty" url:"fallback_answer_url,omitempty"`
	AnswerMethod        string `json:"answer_method,omitempty" url:"answer_method,omitempty"`
	ApiID               string `json:"api_id,omitempty" url:"api_id,omitempty"`
	LogIncomingMessages bool   `json:"log_incoming_messages,omitempty" url:"log_incoming_messages,omitempty"`

	// Additional fields for Modify calls
	DefaultNumberApp   bool `json:"default_number_app,omitempty" url:"default_number_app,omitempty"`
	DefaultEndpointApp bool `json:"default_endpoint_app,omitempty" url:"default_endpoint_app,omitempty"`
}

func (Application) ID

func (self Application) ID() string

type ApplicationCreateParams

type ApplicationCreateParams struct {
	FallbackMethod      string `json:"fallback_method,omitempty" url:"fallback_method,omitempty"`
	DefaultApp          bool   `json:"default_app,omitempty" url:"default_app,omitempty"`
	AppName             string `json:"app_name,omitempty" url:"app_name,omitempty"`
	ProductionApp       bool   `json:"production_app,omitempty" url:"production_app,omitempty"`
	AppID               string `json:"app_id,omitempty" url:"app_id,omitempty"`
	HangupURL           string `json:"hangup_url,omitempty" url:"hangup_url,omitempty"`
	AnswerURL           string `json:"answer_url,omitempty" url:"answer_url,omitempty"`
	MessageURL          string `json:"message_url,omitempty" url:"message_url,omitempty"`
	ResourceURI         string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
	HangupMethod        string `json:"hangup_method,omitempty" url:"hangup_method,omitempty"`
	MessageMethod       string `json:"message_method,omitempty" url:"message_method,omitempty"`
	FallbackAnswerURL   string `json:"fallback_answer_url,omitempty" url:"fallback_answer_url,omitempty"`
	AnswerMethod        string `json:"answer_method,omitempty" url:"answer_method,omitempty"`
	ApiID               string `json:"api_id,omitempty" url:"api_id,omitempty"`
	LogIncomingMessages bool   `json:"log_incoming_messages,omitempty" url:"log_incoming_messages,omitempty"`

	// Additional fields for Modify calls
	DefaultNumberApp   bool `json:"default_number_app,omitempty" url:"default_number_app,omitempty"`
	DefaultEndpointApp bool `json:"default_endpoint_app,omitempty" url:"default_endpoint_app,omitempty"`
}

TODO Verify against docs

type ApplicationCreateResponseBody

type ApplicationCreateResponseBody struct {
	Message string `json:"message" url:"message"`
	ApiID   string `json:"api_id" url:"api_id"`
	AppID   string `json:"app_id" url:"app_id"`
}

Stores response for Create call

type ApplicationList

type ApplicationList struct {
	BaseListResponse
	Objects []Application `json:"objects" url:"objects"`
}

type ApplicationListParams

type ApplicationListParams struct {
	Subaccount string `url:"subaccount,omitempty"`

	Limit  int `url:"limit,omitempty"`
	Offset int `url:"offset,omitempty"`
}

type ApplicationService

type ApplicationService struct {
	// contains filtered or unexported fields
}

func (*ApplicationService) Create

func (service *ApplicationService) Create(params ApplicationCreateParams) (response *ApplicationCreateResponseBody, err error)

func (*ApplicationService) Delete

func (service *ApplicationService) Delete(appId string) (err error)

func (*ApplicationService) Get

func (service *ApplicationService) Get(appId string) (response *Application, err error)

func (*ApplicationService) List

func (service *ApplicationService) List(params ApplicationListParams) (response *ApplicationList, err error)

func (*ApplicationService) Update

func (service *ApplicationService) Update(appId string, params ApplicationUpdateParams) (response *ApplicationUpdateResponse, err error)

type ApplicationUpdateParams

type ApplicationUpdateParams ApplicationCreateParams

TODO Check against docs

type ApplicationUpdateResponse

type ApplicationUpdateResponse BaseResponse

type BaseClient

type BaseClient struct {
	AuthId    string
	AuthToken string

	BaseUrl *url.URL

	RequestInterceptor  func(request *http.Request)
	ResponseInterceptor func(response *http.Response)
	// contains filtered or unexported fields
}

func (*BaseClient) ExecuteRequest

func (client *BaseClient) ExecuteRequest(request *http.Request, body interface{}) (err error)

func (*BaseClient) NewRequest

func (client *BaseClient) NewRequest(method string, params interface{}, baseRequestString string, formatString string,
	formatParams ...interface{}) (request *http.Request, err error)

type BaseListPPKResponse

type BaseListPPKResponse struct {
	ApiID string  `json:"api_id" url:"api_id"`
	Meta  PPKMeta `json:"meta" url:"meta"`
}

type BaseListResponse

type BaseListResponse struct {
	ApiID string `json:"api_id" url:"api_id"`
	Meta  Meta   `json:"meta" url:"meta"`
}

type BaseResource

type BaseResource struct {
	// contains filtered or unexported fields
}

type BaseResourceInterface

type BaseResourceInterface struct {
	// contains filtered or unexported fields
}

type BaseResponse

type BaseResponse struct {
	ApiId   string `json:"api_id" url:"api_id"`
	Message string `json:"message" url:"message"`
}

type BuyPhoneNumberParam

type BuyPhoneNumberParam struct {
	Number       string `json:"number,omitempty"`
	Country_iso2 string `json:"country_iso,omitempty"`
	Type         string `json:"type,omitempty"`
	Region       string `json:"region,omitempty"`
	Pattern      string `json:"pattern,omitempty"`
}

type Call

type Call struct {
	FromNumber      string `json:"from_number,omitempty" url:"from_number,omitempty"`
	ToNumber        string `json:"to_number,omitempty" url:"to_number,omitempty"`
	AnswerURL       string `json:"answer_url,omitempty" url:"answer_url,omitempty"`
	CallUUID        string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"`
	ParentCallUUID  string `json:"parent_call_uuid,omitempty" url:"parent_call_uuid,omitempty"`
	EndTime         string `json:"end_time,omitempty" url:"end_time,omitempty"`
	TotalAmount     string `json:"total_amount,omitempty" url:"total_amount,omitempty"`
	CallDirection   string `json:"call_direction,omitempty" url:"call_direction,omitempty"`
	CallDuration    int64  `json:"call_duration,omitempty" url:"call_duration,omitempty"`
	MessageURL      string `json:"message_url,omitempty" url:"message_url,omitempty"`
	ResourceURI     string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
	CallState       string `json:"call_state,omitempty" url:"call_state,omitempty"`
	HangupCauseCode int64  `json:"hangup_cause_code,omitempty" url:"hangup_cause_code,omitempty"`
	HangupCauseName string `json:"hangup_cause_name,omitempty" url:"hangup_cause_name,omitempty"`
	HangupSource    string `json:"hangup_source,omitempty" url:"hangup_source,omitempty"`
}

func (Call) ID

func (self Call) ID() string

type CallCreateParams

type CallCreateParams struct {
	// Required parameters.
	From      string `json:"from,omitempty" url:"from,omitempty"`
	To        string `json:"to,omitempty" url:"to,omitempty"`
	AnswerURL string `json:"answer_url,omitempty" url:"answer_url,omitempty"`
	// Optional parameters.
	AnswerMethod         string `json:"answer_method,omitempty" url:"answer_method,omitempty"`
	RingURL              string `json:"ring_url,omitempty" url:"ring_url,omitempty"`
	RingMethod           string `json:"ring_method,omitempty" url:"ring_method,omitempty"`
	HangupURL            string `json:"hangup_url,omitempty" url:"hangup_url,omitempty"`
	HangupMethod         string `json:"hangup_method,omitempty" url:"hangup_method,omitempty"`
	FallbackURL          string `json:"fallback_url,omitempty" url:"fallback_url,omitempty"`
	FallbackMethod       string `json:"fallback_method,omitempty" url:"fallback_method,omitempty"`
	CallerName           string `json:"caller_name,omitempty" url:"caller_name,omitempty"`
	SendDigits           string `json:"send_digits,omitempty" url:"send_digits,omitempty"`
	SendOnPreanswer      bool   `json:"send_on_preanswer,omitempty" url:"send_on_preanswer,omitempty"`
	TimeLimit            int64  `json:"time_limit,omitempty" url:"time_limit,omitempty"`
	HangupOnRing         int64  `json:"hangup_on_ring,omitempty" url:"hangup_on_ring,omitempty"`
	MachineDetection     string `json:"machine_detection,omitempty" url:"machine_detection,omitempty"`
	MachineDetectionTime int64  `json:"machine_detection_time,omitempty" url:"machine_detection_time,omitempty"`
	SipHeaders           string `json:"sip_headers,omitempty" url:"sip_headers,omitempty"`
	RingTimeout          int64  `json:"ring_timeout,omitempty" url:"ring_timeout,omitempty"`
}

type CallCreateResponse

type CallCreateResponse struct {
	Message     string `json:"message" url:"message"`
	ApiID       string `json:"api_id" url:"api_id"`
	AppID       string `json:"app_id" url:"app_id"`
	RequestUUID string `json:"request_uuid" url:"request_uuid"`
}

Stores response for making a call.

type CallDTMFParams

type CallDTMFParams struct {
	Digits string `json:"digits" url:"digits"`
	Legs   string `json:"legs,omitempty" url:"legs,omitempty"`
}

type CallDTMFResponseBody

type CallDTMFResponseBody struct {
	Message string `json:"message,omitempty" url:"message,omitempty"`
	ApiID   string `json:"api_id,omitempty" url:"api_id,omitempty"`
}

type CallListParams

type CallListParams struct {
	// Query parameters.
	Subaccount      string `json:"subaccount,omitempty" url:"subaccount,omitempty"`
	CallDirection   string `json:"call_direction,omitempty" url:"call_direction,omitempty"`
	FromNumber      string `json:"from_number,omitempty" url:"from_number,omitempty"`
	ToNumber        string `json:"to_number,omitempty" url:"to_number,omitempty"`
	ParentCallUUID  string `json:"parent_call_uuid,omitempty" url:"parent_call_uuid,omitempty"`
	EndTimeEquals   string `json:"end_time,omitempty" url:"end_time,omitempty"`
	HangupCauseCode int64  `json:"hangup_cause_code,omitempty" url:"hangup_cause_code,omitempty"`
	HangupSource    string `json:"hangup_source,omitempty" url:"hangup_source,omitempty"`

	EndTimeLessThan string `json:"end_time__lt,omitempty" url:"end_time__lt,omitempty"`

	EndTimeGreaterThan string `json:"end_time__gt,omitempty" url:"end_time__gt,omitempty"`

	EndTimeLessOrEqual string `json:"end_time__lte,omitempty" url:"end_time__lte,omitempty"`

	EndTimeGreaterOrEqual string `json:"end_time__gte,omitempty" url:"end_time__gte,omitempty"`

	BillDurationEquals string `json:"bill_duration,omitempty" url:"bill_duration,omitempty"`

	BillDurationLessThan string `json:"bill_duration__lt,omitempty" url:"bill_duration__lt,omitempty"`

	BillDurationGreaterThan string `json:"bill_duration__gt,omitempty" url:"bill_duration__gt,omitempty"`

	BillDurationLessOrEqual string `json:"bill_duration__lte,omitempty" url:"bill_duration__lte,omitempty"`

	BillDurationGreaterOrEqual string `json:"bill_duration__gte,omitempty" url:"bill_duration__gte,omitempty"`
	Limit                      int64  `json:"limit,omitempty" url:"limit,omitempty"`
	Offset                     int64  `json:"offset,omitempty" url:"offset,omitempty"`
}

type CallListResponse

type CallListResponse struct {
	ApiID   string  `json:"api_id" url:"api_id"`
	Meta    *Meta   `json:"meta" url:"meta"`
	Objects []*Call `json:"objects" url:"objects"`
}

type CallPlayParams

type CallPlayParams struct {
	URLs   string `json:"urls" url:"urls"`
	Length string `json:"length,omitempty" url:"length,omitempty"`
	Legs   string `json:"legs,omitempty" url:"legs,omitempty"`
	Loop   bool   `json:"loop,omitempty" url:"loop,omitempty"`
	Mix    bool   `json:"mix,omitempty" url:"mix,omitempty"`
}

type CallPlayResponse

type CallPlayResponse struct {
	Message string `json:"message,omitempty" url:"message,omitempty"`
	ApiID   string `json:"api_id,omitempty" url:"api_id,omitempty"`
}

type CallRecordParams

type CallRecordParams struct {
	TimeLimit           int64  `json:"time_limit,omitempty" url:"time_limit,omitempty"`
	FileFormat          string `json:"file_format,omitempty" url:"file_format,omitempty"`
	TranscriptionType   string `json:"transcription_type,omitempty" url:"transcription_type,omitempty"`
	TranscriptionURL    string `json:"transcription_url,omitempty" url:"transcription_url,omitempty"`
	TranscriptionMethod string `json:"transcription_method,omitempty" url:"transcription_method,omitempty"`
	CallbackURL         string `json:"callback_url,omitempty" url:"callback_url,omitempty"`
	CallbackMethod      string `json:"callback_method,omitempty" url:"callback_method,omitempty"`
}

type CallRecordResponse

type CallRecordResponse struct {
	Message     string `json:"message,omitempty" url:"message,omitempty"`
	URL         string `json:"url,omitempty" url:"url,omitempty"`
	APIID       string `json:"api_id,omitempty" url:"api_id,omitempty"`
	RecordingID string `json:"recording_id,omitempty" url:"recording_id,omitempty"`
}

type CallService

type CallService struct {
	// contains filtered or unexported fields
}

func (*CallService) CancelRequest

func (service *CallService) CancelRequest(requestId string) (err error)

func (*CallService) Create

func (service *CallService) Create(params CallCreateParams) (response *CallCreateResponse, err error)

func (*CallService) Delete

func (service *CallService) Delete(CallId string) (err error)

func (*CallService) Get

func (service *CallService) Get(CallId string) (response *Call, err error)

func (*CallService) List

func (service *CallService) List(params CallListParams) (response *CallListResponse, err error)

func (*CallService) Play

func (service *CallService) Play(callId string, params CallPlayParams) (response *CallPlayResponse, err error)

func (*CallService) Record

func (service *CallService) Record(callId string, params CallRecordParams) (response *CallRecordResponse, err error)

func (*CallService) SendDigits

func (service *CallService) SendDigits(callId string, params CallDTMFParams) (response *CallDTMFResponseBody, err error)

func (*CallService) Speak

func (service *CallService) Speak(callId string, params CallSpeakParams) (response *CallSpeakResponse, err error)

func (*CallService) StopPlaying

func (service *CallService) StopPlaying(callId string) (err error)

func (*CallService) StopRecording

func (service *CallService) StopRecording(callId string) (err error)

func (*CallService) StopSpeaking

func (service *CallService) StopSpeaking(callId string) (err error)

func (*CallService) Update

func (service *CallService) Update(CallId string, params CallUpdateParams) (response *CallUpdateResponse, err error)

type CallSpeakParams

type CallSpeakParams struct {
	Text     string `json:"text" url:"text"`
	Voice    string `json:"length,omitempty" url:"length,omitempty"`
	Language string `json:"language,omitempty" url:"language,omitempty"`
	Legs     string `json:"legs,omitempty" url:"legs,omitempty"`
	Loop     bool   `json:"loop,omitempty" url:"loop,omitempty"`
	Mix      bool   `json:"mix,omitempty" url:"mix,omitempty"`
}

type CallSpeakResponse

type CallSpeakResponse struct {
	Message string `json:"message,omitempty" url:"message,omitempty"`
	ApiID   string `json:"api_id,omitempty" url:"api_id,omitempty"`
}

type CallUpdateParams

type CallUpdateParams struct {
	Legs       string `json:"legs,omitempty" url:"legs,omitempty"`
	AlegURL    string `json:"aleg_url,omitempty" url:"aleg_url,omitempty"`
	AlegMethod string `json:"aleg_method,omitempty" url:"aleg_method,omitempty"`
	BlegURL    string `json:"bleg_url,omitempty" url:"bleg_url,omitempty"`
	BlegMethod string `json:"bleg_method,omitempty" url:"bleg_method,omitempty"`
}

type CallUpdateResponse

type CallUpdateResponse struct {
	ApiID   string `json:"api_id" url:"api_id"`
	Message string `json:"message" url:"message"`
}

type Client

type Client struct {
	BaseClient

	Messages            *MessageService
	Accounts            *AccountService
	Subaccounts         *SubaccountService
	Applications        *ApplicationService
	Endpoints           *EndpointService
	Numbers             *NumberService
	PhoneNumbers        *PhoneNumberService
	Pricing             *PricingService // TODO Rename?
	Recordings          *RecordingService
	Calls               *CallService
	LiveCalls           *LiveCallService
	QueuedCalls         *QueuedCallService
	Conferences         *ConferenceService
	Powerpack           *PowerpackService
	Addresses           *AddressService
	Identities          *IdentityService
	RequestInterceptor  func(request *http.Request)
	ResponseInterceptor func(response *http.Response)
}

func NewClient

func NewClient(authId, authToken string, options *ClientOptions) (client *Client, err error)

To set a proxy for all requests, configure the Transport for the HttpClient passed in:

	&http.Client{
 		Transport: &http.Transport{
 			Proxy: http.ProxyURL("http//your.proxy.here"),
 		},
 	}

Similarly, to configure the timeout, set it on the HttpClient passed in:

	&http.Client{
 		Timeout: time.Minute,
 	}

func (*Client) NewRequest

func (client *Client) NewRequest(method string, params interface{}, formatString string,
	formatParams ...interface{}) (*http.Request, error)

type ClientOptions

type ClientOptions struct {
	HttpClient *http.Client
}

type Conference

type Conference struct {
	ConferenceName        string   `json:"conference_name,omitempty" url:"conference_name,omitempty"`
	ConferenceRunTime     string   `json:"conference_run_time,omitempty" url:"conference_run_time,omitempty"`
	ConferenceMemberCount string   `json:"conference_member_count,omitempty" url:"conference_member_count,omitempty"`
	Members               []Member `json:"members,omitempty" url:"members,omitempty"`
}

func (Conference) ID

func (self Conference) ID() string

type ConferenceIDListResponseBody

type ConferenceIDListResponseBody struct {
	ApiID       string   `json:"api_id" url:"api_id"`
	Conferences []string `json:"conferences" url:"conferences"`
}

type ConferenceMemberActionResponse

type ConferenceMemberActionResponse struct {
	Message  string   `json:"message" url:"message"`
	APIID    string   `json:"api_id" url:"api_id"`
	MemberID []string `json:"member_id" url:"member_id"`
}

type ConferenceMemberSpeakParams

type ConferenceMemberSpeakParams struct {
	Text     string `json:"text" url:"text"`
	Voice    string `json:"voice,omitempty" url:"voice,omitempty"`
	Language string `json:"language,omitempty" url:"language,omitempty"`
}

type ConferenceRecordParams

type ConferenceRecordParams struct {
	TimeLimit           int64  `json:"time_limit,omitempty" url:"time_limit,omitempty"`
	FileFormat          string `json:"file_format,omitempty" url:"file_format,omitempty"`
	TranscriptionType   string `json:"transcription_type,omitempty" url:"transcription_type,omitempty"`
	TranscriptionUrl    string `json:"transcription_url,omitempty" url:"transcription_url,omitempty"`
	TranscriptionMethod string `json:"transcription_method,omitempty" url:"transcription_method,omitempty"`
	CallbackUrl         string `json:"callback_url,omitempty" url:"callback_url,omitempty"`
	CallbackMethod      string `json:"callback_method,omitempty" url:"callback_method,omitempty"`
}

type ConferenceRecordResponseBody

type ConferenceRecordResponseBody struct {
	Message string `json:"message,omitempty" url:"message,omitempty"`
	Url     string `json:"url,omitempty" url:"url,omitempty"`
}

type ConferenceService

type ConferenceService struct {
	// contains filtered or unexported fields
}

func (*ConferenceService) Delete

func (service *ConferenceService) Delete(ConferenceId string) (err error)

func (*ConferenceService) DeleteAll

func (service *ConferenceService) DeleteAll() (err error)

func (*ConferenceService) Get

func (service *ConferenceService) Get(ConferenceId string) (response *Conference, err error)

func (*ConferenceService) IDList

func (service *ConferenceService) IDList() (response *ConferenceIDListResponseBody, err error)

func (*ConferenceService) MemberDeaf

func (service *ConferenceService) MemberDeaf(conferenceId, memberId string) (response *ConferenceMemberActionResponse, err error)

func (*ConferenceService) MemberHangup

func (service *ConferenceService) MemberHangup(conferenceId, memberId string) (response *ConferenceMemberActionResponse, err error)

func (*ConferenceService) MemberKick

func (service *ConferenceService) MemberKick(conferenceId, memberId string) (response *ConferenceMemberActionResponse, err error)

func (*ConferenceService) MemberMute

func (service *ConferenceService) MemberMute(conferenceId, memberId string) (response *ConferenceMemberActionResponse, err error)

func (*ConferenceService) MemberPlay

func (service *ConferenceService) MemberPlay(conferenceId, memberId, url string) (response *ConferenceMemberActionResponse, err error)

func (*ConferenceService) MemberPlayStop

func (service *ConferenceService) MemberPlayStop(conferenceId, memberId string) (response *ConferenceMemberActionResponse, err error)

func (*ConferenceService) MemberSpeak

func (service *ConferenceService) MemberSpeak(conferenceId, memberId string, params ConferenceMemberSpeakParams) (response *ConferenceMemberActionResponse, err error)

func (*ConferenceService) MemberSpeakStop

func (service *ConferenceService) MemberSpeakStop(conferenceId, memberId string) (response *ConferenceMemberActionResponse, err error)

func (*ConferenceService) MemberUndeaf

func (service *ConferenceService) MemberUndeaf(conferenceId, memberId string) (response *ConferenceMemberActionResponse, err error)

func (*ConferenceService) MemberUnmute

func (service *ConferenceService) MemberUnmute(conferenceId, memberId string) (response *ConferenceMemberActionResponse, err error)

func (*ConferenceService) Record

func (service *ConferenceService) Record(ConferenceId string, Params ConferenceRecordParams) (response *ConferenceRecordResponseBody, err error)

func (*ConferenceService) RecordStop

func (service *ConferenceService) RecordStop(ConferenceId string) (err error)

type ConferenceSpeakParams

type ConferenceSpeakParams struct {
	Text     string `json:"text" url:"text"`
	Voice    string `json:"length,omitempty" url:"length,omitempty"`
	Language string `json:"language,omitempty" url:"language,omitempty"`
}

type ConferenceSpeakResponseBody

type ConferenceSpeakResponseBody struct {
	Message string `json:"message,omitempty" url:"message,omitempty"`
	ApiID   string `json:"api_id,omitempty" url:"api_id,omitempty"`
}

type Endpoint

type Endpoint struct {
	Alias       string `json:"alias,omitempty" url:"alias,omitempty"`
	EndpointID  string `json:"endpoint_id,omitempty" url:"endpoint_id,omitempty"`
	Password    string `json:"password,omitempty" url:"password,omitempty"`
	ResourceURI string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
	SIPURI      string `json:"sip_uri,omitempty" url:"sip_uri,omitempty"`
	Username    string `json:"username,omitempty" url:"username,omitempty"`
	// Optional field for Create call.
	AppID string `json:"app_id,omitempty" url:"app_id,omitempty"`
}

func (Endpoint) ID

func (self Endpoint) ID() string

type EndpointCreateParams

type EndpointCreateParams struct {
	Alias    string `json:"alias,omitempty" url:"alias,omitempty"`
	Password string `json:"password,omitempty" url:"password,omitempty"`
	AppID    string `json:"app_id,omitempty" url:"app_id,omitempty"`
	Username string `json:"username,omitempty" url:"username,omitempty"`
}

type EndpointCreateResponse

type EndpointCreateResponse struct {
	BaseResponse
	Alias      string `json:"alias,omitempty" url:"alias,omitempty"`
	EndpointID string `json:"endpoint_id,omitempty" url:"endpoint_id,omitempty"`
	Username   string `json:"username,omitempty" url:"username,omitempty"`
}

type EndpointListParams

type EndpointListParams struct {
	Limit  int `url:"limit,omitempty"`
	Offset int `url:"offset,omitempty"`
}

type EndpointListResponse

type EndpointListResponse struct {
	BaseListResponse
	Objects []*Endpoint `json:"objects" url:"objects"`
}

type EndpointService

type EndpointService struct {
	// contains filtered or unexported fields
}

func (*EndpointService) Create

func (service *EndpointService) Create(params EndpointCreateParams) (response *EndpointCreateResponse, err error)

func (*EndpointService) Delete

func (service *EndpointService) Delete(endpointId string) (err error)

func (*EndpointService) Get

func (service *EndpointService) Get(endpointId string) (response *Endpoint, err error)

func (*EndpointService) List

func (service *EndpointService) List(params EndpointListParams) (response *EndpointListResponse, err error)

func (*EndpointService) Update

func (service *EndpointService) Update(endpointId string, params EndpointUpdateParams) (response *EndpointUpdateResponse, err error)

type EndpointUpdateParams

type EndpointUpdateParams struct {
	Alias    string `json:"alias,omitempty" url:"alias,omitempty"`
	Password string `json:"password,omitempty" url:"password,omitempty"`
	AppID    string `json:"app_id,omitempty" url:"app_id,omitempty"`
}

type EndpointUpdateResponse

type EndpointUpdateResponse BaseResponse

type FindShortCodeResponse

type FindShortCodeResponse struct {
	ApiID string `json:"api_id,omitempty"`
	ShortCode
	Error string `json:"error,omitempty"`
}

type LiveCall

type LiveCall struct {
	From           string `json:"from,omitempty" url:"from,omitempty"`
	To             string `json:"to,omitempty" url:"to,omitempty"`
	AnswerURL      string `json:"answer_url,omitempty" url:"answer_url,omitempty"`
	CallUUID       string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"`
	CallerName     string `json:"caller_name,omitempty" url:"caller_name,omitempty"`
	ParentCallUUID string `json:"parent_call_uuid,omitempty" url:"parent_call_uuid,omitempty"`
	SessionStart   string `json:"session_start,omitempty" url:"session_start,omitempty"`
	CallStatus     string `json:"call_status,omitempty" url:"call_status,omitempty"`
}

func (LiveCall) ID

func (self LiveCall) ID() string

type LiveCallFilters

type LiveCallFilters struct {
	CallDirection string `json:"call_direction,omitempty" url:"call_direction,omitempty"`
	FromNumber    string `json:"from_number,omitempty" url:"from_number,omitempty"`
	ToNumber      string `json:"to_number,omitempty" url:"to_number,omitempty"`
	Status        string `json:"status,omitempty" url:"status,omitempty" default:"live"`
}

type LiveCallIDListResponse

type LiveCallIDListResponse struct {
	APIID string   `json:"api_id" url:"api_id"`
	Calls []string `json:"calls" url:"calls"`
}

type LiveCallService

type LiveCallService struct {
	// contains filtered or unexported fields
}

func (*LiveCallService) Get

func (service *LiveCallService) Get(LiveCallId string) (response *LiveCall, err error)

func (*LiveCallService) IDList

func (service *LiveCallService) IDList(data ...LiveCallFilters) (response *LiveCallIDListResponse, err error)

type MMSMedia

type MMSMedia struct {
	ApiID       string `json:"api_id,omitempty"`
	ContentType string `json:"content_type,omitempty"`
	MediaID     string `json:"media_id,omitempty"`
	MediaURL    string `json:"media_url,omitempty"`
	MessageUUID string `json:"message_uuid,omitempty"`
	Size        int64  `json:"size,omitempty"`
}

type MediaDeleteResponse

type MediaDeleteResponse struct {
	Error string `json:"error,omitempty"`
}

type MediaListResponseBody

type MediaListResponseBody struct {
	Objects []MMSMedia `json:"objects" url:"objects"`
}

type Member

type Member struct {
	Muted      bool   `json:"muted,omitempty" url:"muted,omitempty"`
	MemberID   string `json:"member_id,omitempty" url:"member_id,omitempty"`
	Deaf       bool   `json:"deaf,omitempty" url:"deaf,omitempty"`
	From       string `json:"from,omitempty" url:"from,omitempty"`
	To         string `json:"to,omitempty" url:"to,omitempty"`
	CallerName string `json:"caller_name,omitempty" url:"caller_name,omitempty"`
	Direction  string `json:"direction,omitempty" url:"direction,omitempty"`
	CallUUID   string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"`
	JoinTime   string `json:"join_time,omitempty" url:"join_time,omitempty"`
}

type Message

type Message struct {
	ToNumber         string `json:"to_number,omitempty" url:"to_number,omitempty"`
	FromNumber       string `json:"from_number,omitempty" url:"from_number,omitempty"`
	CloudRate        string `json:"cloud_rate,omitempty" url:"cloud_rate,omitempty"`
	MessageType      string `json:"message_type,omitempty" url:"message_type,omitempty"`
	ResourceURI      string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
	CarrierRate      string `json:"carrier_rate,omitempty" url:"carrier_rate,omitempty"`
	MessageDirection string `json:"message_direction,omitempty" url:"message_direction,omitempty"`
	MessageState     string `json:"message_state,omitempty" url:"message_state,omitempty"`
	TotalAmount      string `json:"total_amount,omitempty" url:"total_amount,omitempty"`
	MessageUUID      string `json:"message_uuid,omitempty" url:"message_uuid,omitempty"`
	MessageTime      string `json:"message_time,omitempty" url:"message_time,omitempty"`
}

func (Message) ID

func (self Message) ID() string

type MessageCreateParams

type MessageCreateParams struct {
	Src  string `json:"src,omitempty" url:"src,omitempty"`
	Dst  string `json:"dst,omitempty" url:"dst,omitempty"`
	Text string `json:"text,omitempty" url:"text,omitempty"`
	// Optional parameters.
	Type      string      `json:"type,omitempty" url:"type,omitempty"`
	URL       string      `json:"url,omitempty" url:"url,omitempty"`
	Method    string      `json:"method,omitempty" url:"method,omitempty"`
	Trackable bool        `json:"trackable,omitempty" url:"trackable,omitempty"`
	Log       interface{} `json:"log,omitempty" url:"log,omitempty"`
	MediaUrls []string    `json:"media_urls" url:"media_urls,omitempty"`
	// Either one of src and powerpackuuid should be given
	PowerpackUUID string `json:"powerpack_uuid,omitempty" url:"powerpack_uuid,omitempty"`
}

type MessageCreateResponseBody

type MessageCreateResponseBody struct {
	Message     string   `json:"message" url:"message"`
	ApiID       string   `json:"api_id" url:"api_id"`
	MessageUUID []string `json:"message_uuid" url:"message_uuid"`
	Error       string   `json:"error" url:"error"`
}

Stores response for ending a message.

type MessageList

type MessageList struct {
	BaseListResponse
	Objects []Message `json:"objects" url:"objects"`
}

type MessageListParams

type MessageListParams struct {
	Limit  int `url:"limit,omitempty"`
	Offset int `url:"offset,omitempty"`
}

type MessageService

type MessageService struct {
	Message
	// contains filtered or unexported fields
}

func (*MessageService) Create

func (service *MessageService) Create(params MessageCreateParams) (response *MessageCreateResponseBody, err error)

func (*MessageService) DeleteMedia

func (service *MessageService) DeleteMedia(messageUuid string) (response *MediaDeleteResponse, err error)

func (*MessageService) Get

func (service *MessageService) Get(messageUuid string) (response *Message, err error)

func (*MessageService) List

func (service *MessageService) List(params MessageListParams) (response *MessageList, err error)

func (*MessageService) ListMedia

func (service *MessageService) ListMedia(messageUuid string) (response *MediaListResponseBody, err error)

type Meta

type Meta struct {
	Previous *string
	Next     *string

	TotalCount int64
	Offset     int64
	Limit      int64
}

type MultiPartyCall

type MultiPartyCall struct {
	Node
	BaseResource
}

func (*MultiPartyCall) Call

func (*MultiPartyCall) ColdTransfer

func (self *MultiPartyCall) ColdTransfer(params MultiPartyCallActionPayload) (response *NodeActionResponse,
	err error)

func (*MultiPartyCall) Member

func (self *MultiPartyCall) Member(memberID string) (response *MultiPartyCallMember)

func (*MultiPartyCall) WarmTransfer

func (self *MultiPartyCall) WarmTransfer(params MultiPartyCallActionPayload) (response *NodeActionResponse,
	err error)

type MultiPartyCallActionPayload

type MultiPartyCallActionPayload struct {
	Action        string `json:"action" url:"action"`
	To            string `json:"to" url:"to"`
	Role          string `json:"role" url:"role"`
	TriggerSource string `json:"trigger_source" url:"trigger_source"`
}

type MultiPartyCallMember

type MultiPartyCallMember struct {
	NodeID        string `json:"node_id" url:"node_id"`
	PhloID        string `json:"phlo_id" url:"phlo_id"`
	NodeType      string `json:"node_type" url:"node_type"`
	MemberAddress string `json:"member_address" url:"member_address"`
	BaseResource
}

func (*MultiPartyCallMember) AbortTransfer

func (self *MultiPartyCallMember) AbortTransfer() (*NodeActionResponse, error)

func (*MultiPartyCallMember) HangUp

func (service *MultiPartyCallMember) HangUp() (*NodeActionResponse, error)

func (*MultiPartyCallMember) Hold

func (service *MultiPartyCallMember) Hold() (*NodeActionResponse, error)

func (*MultiPartyCallMember) ResumeCall

func (service *MultiPartyCallMember) ResumeCall() (*NodeActionResponse, error)

func (*MultiPartyCallMember) UnHold

func (service *MultiPartyCallMember) UnHold() (*NodeActionResponse, error)

func (*MultiPartyCallMember) VoiceMailDrop

func (service *MultiPartyCallMember) VoiceMailDrop() (*NodeActionResponse, error)

type MultiPartyCallMemberActionPayload

type MultiPartyCallMemberActionPayload struct {
	Action string `json:"action" url:"action"`
}

type Node

type Node struct {
	ApiID     string `json:"api_id" url:"api_id"`
	NodeID    string `json:"node_id" url:"node_id"`
	PhloID    string `json:"phlo_id" url:"phlo_id"`
	Name      string `json:"name" url:"name"`
	NodeType  string `json:"node_type" url:"node_type"`
	CreatedOn string `json:"created_on" url:"created_on"`
}

type NodeActionResponse

type NodeActionResponse struct {
	ApiID string `json:"api_id" url:"api_id"`
	Error string `json:"error" url:"error"`
}

type Number

type Number struct {
	Alias             string `json:"alias,omitempty" url:"alias,omitempty"`
	VoiceEnabled      bool   `json:"voice_enabled,omitempty" url:"voice_enabled,omitempty"`
	SMSEnabled        bool   `json:"sms_enabled,omitempty" url:"sms_enabled,omitempty"`
	Description       string `json:"description,omitempty" url:"description,omitempty"`
	PlivoNumber       bool   `json:"plivo_number,omitempty" url:"plivo_number,omitempty"`
	Carrier           string `json:"carrier,omitempty" url:"carrier,omitempty"`
	Number            string `json:"number,omitempty" url:"number,omitempty"`
	NumberType        string `json:"number_type,omitempty" url:"number_type,omitempty"`
	MonthlyRentalRate string `json:"monthly_rental_rate,omitempty" url:"monthly_rental_rate,omitempty"`
	Application       string `json:"application,omitempty" url:"application,omitempty"`
	AddedOn           string `json:"added_on,omitempty" url:"added_on,omitempty"`
	ResourceURI       string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
	VoiceRate         string `json:"voice_rate,omitempty" url:"voice_rate,omitempty"`
	SMSRate           string `json:"sms_rate,omitempty" url:"sms_rate,omitempty"`
}

func (Number) ID

func (self Number) ID() string

type NumberCreateParams

type NumberCreateParams struct {
	Numbers    string `json:"numbers,omitempty" url:"numbers,omitempty"`
	Carrier    string `json:"carrier,omitempty" url:"carrier,omitempty"`
	Region     string `json:"region,omitempty" url:"region,omitempty"`
	NumberType string `json:"number_type,omitempty" url:"number_type,omitempty"`
	AppID      string `json:"app_id,omitempty" url:"app_id,omitempty"`
	Subaccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"`
}

type NumberCreateResponse

type NumberCreateResponse BaseResponse

type NumberDeleteResponse

type NumberDeleteResponse struct {
	PowerpackDeleteResponse
}

type NumberListParams

type NumberListParams struct {
	NumberType       string `json:"number_type,omitempty" url:"number_type,omitempty"`
	NumberStartsWith string `json:"number_startswith,omitempty" url:"number_startswith,omitempty"`
	Subaccount       string `json:"subaccount,omitempty" url:"subaccount,omitempty"`
	Services         string `json:"services,omitempty" url:"services,omitempty"`
	Alias            string `json:"alias,omitempty" url:"alias,omitempty"`

	Limit  int64 `json:"limit:omitempty" url:"limit:omitempty"`
	Offset int64 `json:"offset:omitempty" url:"offset:omitempty"`
}

type NumberListResponse

type NumberListResponse struct {
	ApiID   string    `json:"api_id" url:"api_id"`
	Meta    *Meta     `json:"meta" url:"meta"`
	Objects []*Number `json:"objects" url:"objects"`
}

type NumberPoolResponse

type NumberPoolResponse struct {
	Number_pool_uuid              string `json:"number_pool_uuid,omitempty"`
	Number                        string `json:"number,omitempty"`
	Type                          string `json:"Type,omitempty"`
	Country_iso2                  string `json:"country_iso2,omitempty"`
	Added_on                      string `json:"added_on,omitempty"`
	Account_phone_number_resource string `json:"account_phone_number_resource,omitempty"`
}

type NumberRemoveParams

type NumberRemoveParams struct {
	Unrent bool `json:"unrent,omitempty"`
}

type NumberResponse

type NumberResponse struct {
	ApiID string `json:"api_id,omitempty"`
	NumberPoolResponse
	Error string `json:"error,omitempty"`
}

type NumberService

type NumberService struct {
	// contains filtered or unexported fields
}

func (*NumberService) Create

func (service *NumberService) Create(params NumberCreateParams) (response *NumberCreateResponse, err error)

func (*NumberService) Delete

func (service *NumberService) Delete(NumberId string) (err error)

func (*NumberService) Get

func (service *NumberService) Get(NumberId string) (response *Number, err error)

func (*NumberService) List

func (service *NumberService) List(params NumberListParams) (response *NumberListResponse, err error)

func (*NumberService) Update

func (service *NumberService) Update(NumberId string, params NumberUpdateParams) (response *NumberUpdateResponse, err error)

type NumberUpdateParams

type NumberUpdateParams struct {
	AppID      string `json:"app_id,omitempty" url:"app_id,omitempty"`
	Subaccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"`
	Alias      string `json:"alias,omitempty" url:"alias,omitempty"`
}

type NumberUpdateResponse

type NumberUpdateResponse BaseResponse

type PPKMeta

type PPKMeta struct {
	Previous   *string
	Next       *string
	TotalCount int `json:"total_count" url:"api_id"`
	Offset     int
	Limit      int
}

type Phlo

type Phlo struct {
	BaseResource
	ApiId     string `json:"api_id" url:"api_id"`
	PhloId    string `json:"phlo_id" url:"phlo_id"`
	Name      string `json:"name" url:"name"`
	CreatedOn string `json:"created_on" url:"created_on"`
}

func (*Phlo) MultiPartyCall

func (self *Phlo) MultiPartyCall(nodeId string) (response *MultiPartyCall, err error)

func (*Phlo) Node

func (self *Phlo) Node(nodeId string) (response *Node, err error)

func (*Phlo) Run

func (self *Phlo) Run(data map[string]interface{}) (response *PhloRun, err error)

type PhloClient

type PhloClient struct {
	BaseClient

	Phlos *Phlos
}

func NewPhloClient

func NewPhloClient(authId, authToken string, options *ClientOptions) (client *PhloClient, err error)

To set a proxy for all requests, configure the Transport for the HttpClient passed in:

	&http.Client{
 		Transport: &http.Transport{
 			Proxy: http.ProxyURL("http//your.proxy.here"),
 		},
 	}

Similarly, to configure the timeout, set it on the HttpClient passed in:

	&http.Client{
 		Timeout: time.Minute,
 	}

func (*PhloClient) NewRequest

func (client *PhloClient) NewRequest(method string, params interface{}, formatString string,
	formatParams ...interface{}) (*http.Request, error)

type PhloRun

type PhloRun struct {
	ApiID     string `json:"api_id" url:"api_id"`
	PhloRunID string `json:"phlo_run_id" url:"phlo_run_id"`
	PhloID    string `json:"phlo_id" url:"phlo_id"`
	Message   string `json:"message" url:"message"`
}

type Phlos

type Phlos struct {
	BaseResourceInterface
}

func NewPhlos

func NewPhlos(client *PhloClient) (phlos *Phlos)

func (*Phlos) Get

func (self *Phlos) Get(phloId string) (response *Phlo, err error)

type PhoneNumber

type PhoneNumber struct {
	Country           string `json:"country" url:"country"`
	Lata              int    `json:"lata" url:"lata"`
	MonthlyRentalRate string `json:"monthly_rental_rate" url:"monthly_rental_rate"`
	Number            string `json:"number" url:"number"`
	Type              string `json:"type" url:"type"`
	Prefix            string `json:"prefix" url:"prefix"`
	RateCenter        string `json:"rate_center" url:"rate_center"`
	Region            string `json:"region" url:"region"`
	ResourceURI       string `json:"resource_uri" url:"resource_uri"`
	Restriction       string `json:"restriction" url:"restriction"`
	RestrictionText   string `json:"restriction_text" url:"restriction_text"`
	SetupRate         string `json:"setup_rate" url:"setup_rate"`
	SmsEnabled        bool   `json:"sms_enabled" url:"sms_enabled"`
	SmsRate           string `json:"sms_rate" url:"sms_rate"`
	VoiceEnabled      bool   `json:"voice_enabled" url:"voice_enabled"`
	VoiceRate         string `json:"voice_rate" url:"voice_rate"`
}

func (PhoneNumber) ID

func (self PhoneNumber) ID() string

type PhoneNumberCreateParams

type PhoneNumberCreateParams struct {
	AppID string `json:"app_id,omitempty" url:"app_id,omitempty"`
}

type PhoneNumberCreateResponse

type PhoneNumberCreateResponse struct {
	APIID   string `json:"api_id" url:"api_id"`
	Message string `json:"message" url:"message"`
	Numbers []struct {
		Number string `json:"number" url:"number"`
		Status string `json:"status" url:"status"`
	} `json:"numbers" url:"numbers"`
	Status string `json:"status" url:"status"`
}

type PhoneNumberListParams

type PhoneNumberListParams struct {
	CountryISO string `json:"country_iso,omitempty" url:"country_iso,omitempty"`
	Type       string `json:"type,omitempty" url:"type,omitempty"`
	Pattern    string `json:"pattern,omitempty" url:"pattern,omitempty"`
	Region     string `json:"region,omitempty" url:"region,omitempty"`
	Services   string `json:"services,omitempty" url:"services,omitempty"`
	LATA       string `json:"lata,omitempty" url:"lata,omitempty"`
	RateCenter string `json:"rate_center,omitempty" url:"rate_center,omitempty"`
	Limit      int    `json:"limit,omitempty" url:"limit,omitempty"`
	Offset     int    `json:"offset,omitempty" url:"offset,omitempty"`
}

type PhoneNumberListResponse

type PhoneNumberListResponse struct {
	ApiID   string         `json:"api_id" url:"api_id"`
	Meta    *Meta          `json:"meta" url:"meta"`
	Objects []*PhoneNumber `json:"objects" url:"objects"`
}

type PhoneNumberService

type PhoneNumberService struct {
	// contains filtered or unexported fields
}

func (*PhoneNumberService) Create

func (service *PhoneNumberService) Create(number string, params PhoneNumberCreateParams) (response *PhoneNumberCreateResponse, err error)

func (*PhoneNumberService) List

func (service *PhoneNumberService) List(params PhoneNumberListParams) (response *PhoneNumberListResponse, err error)

type Plan

type Plan struct {
	VoiceRate           string `json:"voice_rate,omitempty" url:"voice_rate,omitempty"`
	MessagingRate       string `json:"messaging_rate,omitempty" url:"messaging_rate,omitempty"`
	Name                string `json:"name_rate,omitempty" url:"name_rate,omitempty"`
	MonthlyCloudCredits string `json:"monthly_cloud_credits,omitempty" url:"monthly_cloud_credits,omitempty"`
}

type PowerackCreateParams

type PowerackCreateParams struct {
	Name string `json:"name,omitempty"`
	// Optional parameters.
	StickySender    string `json:"sticky_sender,omitempty"`
	LocalConnect    string `json:"local_connect,omitempty"`
	ApplicationType string `json:"application_type,omitempty"`
	ApplicationID   string `json:"application_id,omitempty"`
}

type PowerackUpdateParams

type PowerackUpdateParams struct {
	// Optional parameters.
	Name            string `json:"name,omitempty"`
	StickySender    string `json:"sticky_sender,omitempty"`
	LocalConnect    string `json:"local_connect,omitempty"`
	ApplicationType string `json:"application_type,omitempty"`
	ApplicationID   string `json:"application_id,omitempty"`
}

type Powerpack

type Powerpack struct {
	UUID            string `json:"uuid,omitempty"`
	Name            string `json:"name,omitempty"`
	StickySender    bool   `json:"sticky_sender,omitempty"`
	LocalConnect    bool   `json:"local_connect,omitempty"`
	ApplicationType string `json:"application_type,omitempty"`
	ApplicationID   string `json:"application_id,omitempty"`
	NumberPoolUUID  string `json:"number_pool,omitempty"`
	CreatedOn       string `json:"created_on,omitempty"`
}

type PowerpackCreateResponseBody

type PowerpackCreateResponseBody struct {
	ApiID string  `json:"api_id,omitempty"`
	Error *string `json:"error,omitempty" url:"error"`
	Powerpack
}

type PowerpackDeleteParams

type PowerpackDeleteParams struct {
	UnrentNumbers bool `json:"unrent_numbers,omitempty"`
}

type PowerpackDeleteResponse

type PowerpackDeleteResponse struct {
	ApiID    string `json:"api_id,omitempty"`
	Response string `json:"response,omitempty"`
	Error    string `json:"error,omitempty"`
}

type PowerpackList

type PowerpackList struct {
	BaseListPPKResponse
	Objects []Powerpack `json:"objects" url:"objects"`
}

powerpack list

type PowerpackListParams

type PowerpackListParams struct {
	Limit  int `url:"limit,omitempty"`
	Offset int `url:"offset,omitempty"`
}

type PowerpackPhoneResponseBody

type PowerpackPhoneResponseBody struct {
	BaseListPPKResponse
	Objects []NumberPoolResponse `json:"objects" url:"objects"`
}

type PowerpackResponse

type PowerpackResponse struct {
	CreatedOn            string `json:"created_on,omitempty"`
	LocalConnect         bool   `json:"local_connect,omitempty"`
	Name                 string `json:"name,omitempty"`
	NumberPoolUUID       string `json:"number_pool,omitempty"`
	PowerpackResourceURI string `json:"powerpack_resource_uri,omitempty"`
	StickySender         bool   `json:"sticky_sender,omitempty"`
	UUID                 string `json:"uuid,omitempty"`
}

type PowerpackSearchParam

type PowerpackSearchParam struct {
	Starts_with  string `json:"starts_with,omitempty" url:"starts_with,omitempty"`
	Country_iso2 string `json:"country_iso2,omitempty" url:"country_iso2,omitempty"`
	Type         string `json:"type,omitempty" url:"type,omitempty"`
	Limit        string `json:"limit,omitempty" url:"limit,omitempty"`
	Offset       string `json:"offset,omitempty" url:"offset,omitempty"`
}

type PowerpackService

type PowerpackService struct {
	Powerpack
	// contains filtered or unexported fields
}

func (*PowerpackService) Add_number

func (service *PowerpackService) Add_number(number string) (response *NumberResponse, err error)

func (*PowerpackService) Buy_add_number

func (service *PowerpackService) Buy_add_number(phoneParam BuyPhoneNumberParam) (response *NumberResponse, err error)

func (*PowerpackService) Count_numbers

func (service *PowerpackService) Count_numbers(params PowerpackSearchParam) (count int, err error)

func (*PowerpackService) Create

func (service *PowerpackService) Create(params PowerackCreateParams) (response *PowerpackCreateResponseBody, err error)

func (*PowerpackService) Delete

func (service *PowerpackService) Delete(params PowerpackDeleteParams) (response *PowerpackDeleteResponse, err error)

func (*PowerpackService) Find_numbers

func (service *PowerpackService) Find_numbers(number string) (response *NumberResponse, err error)

func (*PowerpackService) Find_shortcode

func (service *PowerpackService) Find_shortcode(shortcode string) (response *FindShortCodeResponse, err error)

func (*PowerpackService) Get

func (service *PowerpackService) Get(powerpackUUID string) (response *PowerpackService, err error)

func (*PowerpackService) List

func (service *PowerpackService) List(params PowerpackListParams) (response *PowerpackList, err error)

returns the List.. of all powerpack

func (*PowerpackService) List_numbers

func (service *PowerpackService) List_numbers(params PowerpackSearchParam) (response *PowerpackPhoneResponseBody, err error)

func (*PowerpackService) List_shortcodes

func (service *PowerpackService) List_shortcodes() (response *ShortCodeResponse, err error)

func (*PowerpackService) Remove_number

func (service *PowerpackService) Remove_number(number string, param NumberRemoveParams) (response *NumberDeleteResponse, err error)

func (*PowerpackService) Update

func (service *PowerpackService) Update(params PowerackUpdateParams) (response *PowerpackUpdateResponse, err error)

type PowerpackUpdateResponse

type PowerpackUpdateResponse struct {
	PowerpackCreateResponseBody
}

type Pricing

type Pricing struct {
	APIID       string `json:"api_id" url:"api_id"`
	Country     string `json:"country" url:"country"`
	CountryCode int    `json:"country_code" url:"country_code"`
	CountryISO  string `json:"country_iso" url:"country_iso"`
	Message     struct {
		Inbound struct {
			Rate string `json:"rate" url:"rate"`
		} `json:"inbound" url:"inbound"`
		Outbound struct {
			Rate string `json:"rate" url:"rate"`
		} `json:"outbound" url:"outbound"`
		OutboundNetworksList []struct {
			GroupName string `json:"group_name" url:"group_name"`
			Rate      string `json:"rate" url:"rate"`
		} `json:"outbound_networks_list" url:"outbound_networks_list"`
	} `json:"message" url:"message"`
	PhoneNumbers struct {
		Local struct {
			Rate string `json:"rate" url:"rate"`
		} `json:"local" url:"local"`
		Tollfree struct {
			Rate string `json:"rate" url:"rate"`
		} `json:"tollfree" url:"tollfree"`
	} `json:"phone_numbers" url:"phone_numbers"`
	Voice struct {
		Inbound struct {
			IP struct {
				Rate string `json:"rate" url:"rate"`
			} `json:"ip" url:"ip"`
			Local struct {
				Rate string `json:"rate" url:"rate"`
			} `json:"local" url:"local"`
			Tollfree struct {
				Rate string `json:"rate" url:"rate"`
			} `json:"tollfree" url:"tollfree"`
		} `json:"inbound" url:"inbound"`
		Outbound struct {
			IP struct {
				Rate string `json:"rate" url:"rate"`
			} `json:"ip" url:"ip"`
			Local struct {
				Rate string `json:"rate" url:"rate"`
			} `json:"local" url:"local"`
			Rates []struct {
				Prefix []string `json:"prefix" url:"prefix"`
				Rate   string   `json:"rate" url:"rate"`
			} `json:"rates" url:"rates"`
			Tollfree struct {
				Rate string `json:"rate" url:"rate"`
			} `json:"tollfree" url:"tollfree"`
		} `json:"outbound" url:"outbound"`
	} `json:"voice" url:"voice"`
}

func (Pricing) ID

func (self Pricing) ID() string

type PricingGetParams

type PricingGetParams struct {
	CountryISO string `json:"country_iso" url:"country_iso"`
}

type PricingService

type PricingService struct {
	// contains filtered or unexported fields
}

func (*PricingService) Get

func (service *PricingService) Get(countryISO string) (response *Pricing, err error)

type QueuedCall

type QueuedCall struct {
	From        string `json:"from,omitempty" url:"from,omitempty"`
	To          string `json:"to,omitempty" url:"to,omitempty"`
	Status      string `json:"call_status,omitempty" url:"call_status,omitempty"`
	CallUUID    string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"`
	CallerName  string `json:"caller_name,omitempty" url:"caller_name,omitempty"`
	APIID       string `json:"api_id,omitempty" url:"api_id,omitempty"`
	Direction   string `json:"direction,omitempty" url:"direction,omitempty"`
	RequestUUID string `json:"request_uuid,omitempty" url:"request_uuid,omitempty"`
}

type QueuedCallIDListResponse

type QueuedCallIDListResponse struct {
	APIID string   `json:"api_id" url:"api_id"`
	Calls []string `json:"calls" url:"calls"`
}

type QueuedCallService

type QueuedCallService struct {
	// contains filtered or unexported fields
}

func (*QueuedCallService) Get

func (service *QueuedCallService) Get(QueuedCallId string) (response *QueuedCall, err error)

func (*QueuedCallService) IDList

func (service *QueuedCallService) IDList() (response *QueuedCallIDListResponse, err error)

type Recording

type Recording struct {
	AddTime             string `json:"add_time,omitempty" url:"add_time,omitempty"`
	CallUUID            string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"`
	RecordingID         string `json:"recording_id,omitempty" url:"recording_id,omitempty"`
	RecordingType       string `json:"recording_type,omitempty" url:"recording_type,omitempty"`
	RecordingFormat     string `json:"recording_format,omitempty" url:"recording_format,omitempty"`
	ConferenceName      string `json:"conference_name,omitempty" url:"conference_name,omitempty"`
	RecordingURL        string `json:"recording_url,omitempty" url:"recording_url,omitempty"`
	ResourceURI         string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
	RecordingStartMS    string `json:"recording_start_ms,omitempty" url:"recording_start_ms,omitempty"`
	RecordingEndMS      string `json:"recording_end_ms,omitempty" url:"recording_end_ms,omitempty"`
	RecordingDurationMS string `json:"recording_duration_ms,omitempty" url:"recording_duration_ms,omitempty"`
}

func (Recording) ID

func (self Recording) ID() string

type RecordingListParams

type RecordingListParams struct {
	// Query parameters.
	Subaccount    string `json:"subaccount,omitempty" url:"subaccount,omitempty"`
	CallUUID      string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"`
	AddTimeEquals string `json:"add_time,omitempty" url:"add_time,omitempty"`

	AddTimeLessThan string `json:"add_time__lt,omitempty" url:"add_time__lt,omitempty"`

	AddTimeGreaterThan string `json:"add_time__gt,omitempty" url:"add_time__gt,omitempty"`

	AddTimeLessOrEqual string `json:"add_time__lte,omitempty" url:"add_time__lte,omitempty"`

	AddTimeGreaterOrEqual string `json:"add_time__gte,omitempty" url:"add_time__gte,omitempty"`
	Limit                 int64  `json:"limit:omitempty" url:"limit:omitempty"`
	Offset                int64  `json:"offset:omitempty" url:"offset:omitempty"`
}

type RecordingListResponse

type RecordingListResponse struct {
	ApiID   string       `json:"api_id" url:"api_id"`
	Meta    *Meta        `json:"meta" url:"meta"`
	Objects []*Recording `json:"objects" url:"objects"`
}

type RecordingService

type RecordingService struct {
	// contains filtered or unexported fields
}

func (*RecordingService) Delete

func (service *RecordingService) Delete(RecordingId string) (err error)

func (*RecordingService) Get

func (service *RecordingService) Get(RecordingId string) (response *Recording, err error)

func (*RecordingService) List

func (service *RecordingService) List(params RecordingListParams) (response *RecordingListResponse, err error)

type RentNumber

type RentNumber struct {
	Rent string `json:"rent,omitempty"`
}

type ShortCode

type ShortCode struct {
	Number_pool_uuid string `json:"number_pool_uuid,omitempty"`
	Shortcode        string `json:"shortcode,omitempty"`
	Country_iso2     string `json:"country_iso2,omitempty"`
	Added_on         string `json:"added_on,omitempty"`
}

type ShortCodeResponse

type ShortCodeResponse struct {
	BaseListPPKResponse
	Objects []ShortCode `json:"objects" url:"objects"`
}

type Subaccount

type Subaccount struct {
	Account     string `json:"account,omitempty" url:"account,omitempty"`
	ApiID       string `json:"api_id,omitempty" url:"api_id,omitempty"`
	AuthID      string `json:"auth_id,omitempty" url:"auth_id,omitempty"`
	AuthToken   string `json:"auth_token,omitempty" url:"auth_token,omitempty"`
	Created     string `json:"created,omitempty" url:"created,omitempty"`
	Modified    string `json:"modified,omitempty" url:"modified,omitempty"`
	Name        string `json:"name,omitempty" url:"name,omitempty"`
	Enabled     bool   `json:"enabled,omitempty" url:"enabled,omitempty"`
	ResourceURI string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
}

func (Subaccount) ID

func (self Subaccount) ID() string

type SubaccountCreateParams

type SubaccountCreateParams struct {
	Name    string `json:"name,omitempty" url:"name,omitempty"`       // Name of the subaccount
	Enabled bool   `json:"enabled,omitempty" url:"enabled,omitempty"` // Specify if the subaccount should be enabled or not. Takes a value of True or False. Defaults to False
}

type SubaccountCreateResponse

type SubaccountCreateResponse struct {
	BaseResponse
	AuthId    string `json:"auth_id" url:"auth_id"`
	AuthToken string `json:"auth_token" url:"auth_token"`
}

type SubaccountDeleteParams

type SubaccountDeleteParams struct {
	Cascade bool `json:"cascade,omitempty" url:"cascade,omitempty"` // Specify if the sub account should be cascade deleted or not. Takes a value of True or False. Defaults to False
}

type SubaccountList

type SubaccountList struct {
	BaseListResponse
	Objects []Subaccount
}

type SubaccountListParams

type SubaccountListParams struct {
	Limit  int `json:"limit,omitempty" url:"limit,omitempty"`
	Offset int `json:"offset,omitempty" url:"offset,omitempty"`
}

type SubaccountService

type SubaccountService struct {
	// contains filtered or unexported fields
}

func (*SubaccountService) Create

func (service *SubaccountService) Create(params SubaccountCreateParams) (response *SubaccountCreateResponse, err error)

func (*SubaccountService) Delete

func (service *SubaccountService) Delete(subauthId string, data ...SubaccountDeleteParams) (err error)

func (*SubaccountService) Get

func (service *SubaccountService) Get(subauthId string) (response *Subaccount, err error)

func (*SubaccountService) List

func (service *SubaccountService) List(params SubaccountListParams) (response *SubaccountList, err error)

func (*SubaccountService) Update

func (service *SubaccountService) Update(subauthId string, params SubaccountUpdateParams) (response *SubaccountUpdateResponse, err error)

type SubaccountUpdateParams

type SubaccountUpdateParams SubaccountCreateParams

type SubaccountUpdateResponse

type SubaccountUpdateResponse BaseResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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