go-plivo: github.com/micrypt/go-plivo/plivo Index | Files

package plivo

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

Package plivo is a client for the Plivo.com API. It is documented at:

http://godoc.org/github.com/micrypt/go-plivo/plivo

A short example of retrieving account details:

func main() {
  client := plivo.NewClient(nil, authID, authToken)
  acc, _, err := client.Account.Get()
  if err != nil {
    log.Fatalf("AccountGet failed: %v", err)
  } else {
    log.Printf("Account: %v\n", acc)
  }
}

Index

Package Files

account.go application.go call.go conference.go doc.go endpoint.go incoming_carrier.go message.go number.go outgoing_carrier.go plivo.go pricing.go recording.go

type Account Uses

type Account struct {
    Address         string `json:"address,omitempty"`
    ApiID           string `json:"api_id,omitempty"`
    AuthID          string `json:"auth_id,omitempty"`
    AutoRecharge    bool   `json:"auto_recharge,omitempty"`
    BillingMode     string `json:"billing_mode,omitempty"`
    CashCredits     string `json:"cash_credits,omitempty"`
    CloudCredits    string `json:"cloud_credits,omitempty"`
    City            string `json:"city,omitempty"`
    CpsAllowed      string `json:"cps_allowed,omitempty"`
    Created         string `json:"created,omitempty"`
    Enabled         bool   `json:"enabled,omitempty"`
    GwType          string `json:"gw_type,omitempty"`
    Modified        string `json:"modified,omitempty"`
    Name            string `json:"name,omitempty"`
    Plan            Plan   `json:"plan,omitempty"`
    RechargeChoices string `json:"recharge_choices,omitempty"`
    ResourceURI     string `json:"resource_uri,omitempty"`
    State           string `json:"state,omitempty"`
    Timezone        string `json:"timezone,omitempty"`
}

type AccountService Uses

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

func (*AccountService) CreateSubaccount Uses

func (s *AccountService) CreateSubaccount(sacc *Subaccount) (*Response, error)

CreateSubaccount creates a subaccount.

func (*AccountService) DeleteSubaccount Uses

func (s *AccountService) DeleteSubaccount(subAuthID string) (*Response, error)

DeleteSubaccount deletes a subaccount.

func (*AccountService) Get Uses

func (s *AccountService) Get() (*Account, *Response, error)

Get fetches an account.

func (*AccountService) GetSubaccount Uses

func (s *AccountService) GetSubaccount(subAuthID string) (*Subaccount, *Response, error)

GetSubaccount fetches a subaccount.

func (*AccountService) GetSubaccounts Uses

func (s *AccountService) GetSubaccounts(limit, offset int64) ([]*Subaccount, *Response, error)

GetSubaccount fetches all subaccounts.

func (*AccountService) Modify Uses

func (s *AccountService) Modify(acc *Account) (*Account, *Response, error)

Modify edits an account

func (*AccountService) ModifySubaccount Uses

func (s *AccountService) ModifySubaccount(sacc *Subaccount) (*Subaccount, *Response, error)

ModifySubaccount edits a subaccount.

type Application Uses

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

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

type ApplicationCreateResponseBody Uses

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

Stores response for Create call

type ApplicationService Uses

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

func (*ApplicationService) Create Uses

func (s *ApplicationService) Create(app *Application) (*Application, *Response, error)

CreateApplication creates an application.

func (*ApplicationService) Delete Uses

func (s *ApplicationService) Delete(subAuthID string) (*Response, error)

Delete deletes a subaccount.

func (*ApplicationService) Get Uses

func (s *ApplicationService) Get(appID string) (*Application, *Response, error)

Get fetches a specified application.

func (*ApplicationService) GetApplications Uses

func (s *ApplicationService) GetApplications(limit, offset int64) ([]*Application, *Response, error)

GetApplication fetches all subaccounts.

func (*ApplicationService) Modify Uses

func (s *ApplicationService) Modify(app *Application) (*Application, *Response, error)

Modify edits an application

type ApplicationsResponseBody Uses

type ApplicationsResponseBody struct {
    ApiID   string         `json:"api_id"`
    Meta    *Meta          `json:"meta"`
    Objects []*Application `json:"objects"`
}

type Call Uses

type Call struct {
    FromNumber     string `json:"from_number,omitempty"`
    ToNumber       string `json:"to_number,omitempty"`
    AnswerURL      string `json:"answer_url,omitempty"`
    CallUUID       string `json:"call_uuid,omitempty"`
    ParentCallUUID string `json:"parent_call_uuid,omitempty"`
    EndTime        string `json:"end_time,omitempty"`
    TotalAmount    string `json:"total_amount,omitempty"`
    CallDirection  string `json:"call_direction,omitempty"`
    CallDuration   int64  `json:"call_duration,omitempty"`
    MessageURL     string `json:"message_url,omitempty"`
    ResourceURI    string `json:"resource_uri,omitempty"`
}

type CallDTMFParams Uses

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

type CallDTMFResponseBody Uses

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

type CallGetAllParams Uses

type CallGetAllParams struct {
    // Query parameters.
    Subaccount    string `json:"subaccount,omitempty"`
    CallDirection string `json:"call_direction,omitempty"`
    FromNumber    string `json:"from_number,omitempty"`
    ToNumber      string `json:"to_number,omitempty"`
    EndTime       string `json:"end_time,omitempty"`
    BillDuration  string `json:"bill_duration,omitempty"`
    Limit         int64  `json:"limit:omitempty"`
    Offset        int64  `json:"offset:omitempty"`
}

type CallGetAllResponseBody Uses

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

type CallMakeParams Uses

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

type CallMakeResponseBody Uses

type CallMakeResponseBody struct {
    Message  string `json:"message"`
    ApiID    string `json:"api_id"`
    AppID    string `json:"app_id"`
    CallUUID string `json:"call_uuid"`
}

Stores response for making a call.

type CallPlayParams Uses

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

type CallPlayResponseBody Uses

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

type CallRecordParams Uses

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

type CallRecordResponseBody Uses

type CallRecordResponseBody struct {
    Message string `json:"message,omitempty"`
    URL     string `json:"url,omitempty"`
}

type CallService Uses

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

func (*CallService) Cancel Uses

func (c *CallService) Cancel(request_uuid string) (*Response, error)

Cancel hangups a call request.

func (*CallService) DTMF Uses

func (c *CallService) DTMF(uuid string, cp *CallDTMFParams) (*Response, error)

DTMF send digits on a call.

func (*CallService) Get Uses

func (s *CallService) Get(callID string) (*Call, *Response, error)

Get fetches a specified call.

func (*CallService) GetAll Uses

func (s *CallService) GetAll(p *CallGetAllParams) ([]*Call, *Response, error)

GetAll fetches all calls.

func (*CallService) GetAllLive Uses

func (s *CallService) GetAllLive() ([]*Call, *Response, error)

GetCallLive fetches all live calls.

func (*CallService) GetLive Uses

func (s *CallService) GetLive(uuid string) (*LiveCall, *Response, error)

GetLive fetches details of a specified call.

func (*CallService) Hangup Uses

func (s *CallService) Hangup(uuid string) (*Response, error)

Hangup terminates a specified call.

func (*CallService) Make Uses

func (c *CallService) Make(cp *CallMakeParams) (*Response, error)

Make creates a call.

func (*CallService) Play Uses

func (c *CallService) Play(uuid string, cp *CallPlayParams) (*Response, error)

Play plays and controls sounds during a call.

func (*CallService) Record Uses

func (c *CallService) Record(uuid string, cp *CallRecordParams) (*Response, error)

Record records a call.

func (*CallService) Remove Uses

func (s *CallService) Remove(carrierID string) (*Response, error)

Remove removes a carrier, and deletes all numbers associated with the carrier.

func (*CallService) Speak Uses

func (c *CallService) Speak(uuid string, cp *CallSpeakParams) (*Response, error)

Speak plays text during a call (text to speech).

func (*CallService) StopPlaying Uses

func (c *CallService) StopPlaying(uuid string) (*Response, error)

StopPlaying stops playing sounds during a call.

func (*CallService) StopRecording Uses

func (c *CallService) StopRecording(uuid, url string) (*Response, error)

StopRecording cancels a call recording.

func (*CallService) StopSpeaking Uses

func (c *CallService) StopSpeaking(uuid string) (*Response, error)

StopSpeaking stops playing text during a call.

func (*CallService) Transfer Uses

func (c *CallService) Transfer(cp *CallTransferParams) (*Response, error)

Transfer transfers a call.

type CallSpeakParams Uses

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

type CallSpeakResponseBody Uses

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

type CallTransferParams Uses

type CallTransferParams struct {
    AlegURL    string `json:"aleg_url,omitempty"`
    AlegMethod string `json:"aleg_method,omitempty"`
    BlegURL    string `json:"bleg_url,omitempty"`
    BlegMethod string `json:"bleg_method,omitempty"`
    // contains filtered or unexported fields
}

type CallTransferResponseBody Uses

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

type Client Uses

type Client struct {

    // Base URL for API requests. This should always be specified with the trailing slash.
    BaseURL *url.URL

    // User agent used when communicating the API.
    UserAgent string

    // Services used for talking to different parts of the API.
    Account     *AccountService
    Application *ApplicationService
    Call        *CallService
    Message     *MessageService
    Number      *NumberService
    Endpoint    *EndpointService
    Conference  *ConferenceService
    // contains filtered or unexported fields
}

A client manages communication with the API.

func NewClient Uses

func NewClient(client *http.Client, authID, authToken string) *Client

NewClient returns a new Plivo API client. If client is nil, http.DefaultClient will be used.

func (*Client) Do Uses

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response. The response is returned as an error if one occurs or an attempt is made to decode it into v and the result of this operation returned if it fails.

func (*Client) NewRequest Uses

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request

type Conference Uses

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

type ConferenceGetAllAllResponseBody Uses

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

type ConferenceRecordParams Uses

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

type ConferenceRecordResponseBody Uses

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

type ConferenceService Uses

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

func (*ConferenceService) DisableHearingMembers Uses

func (s *ConferenceService) DisableHearingMembers(name, members string) (*Response, error)

DisableHearingMembers makes member(s) deaf.

func (*ConferenceService) EnableHearingMembers Uses

func (s *ConferenceService) EnableHearingMembers(name, members string) (*Response, error)

EnableHearingMembers enables hearing for member(s).

func (*ConferenceService) Get Uses

func (s *ConferenceService) Get(name string) (*Conference, *Response, error)

Get retrieves details of a particular conference.

func (*ConferenceService) GetAll Uses

func (s *ConferenceService) GetAll() ([]string, *Response, error)

GetAll retrieves list of all conferences.

func (*ConferenceService) Hangup Uses

func (s *ConferenceService) Hangup(name string) (*Response, error)

Hangup hangs up a particular conference.

func (*ConferenceService) HangupAll Uses

func (s *ConferenceService) HangupAll() (*Response, error)

HangupAll hangs up all conferences.

func (*ConferenceService) HangupMember Uses

func (s *ConferenceService) HangupMember(name, member string) (*Response, error)

HangupMember hangs up member(s).

func (*ConferenceService) KickMembers Uses

func (s *ConferenceService) KickMembers(name, members string) (*Response, error)

KickMembers kicks member(s).

func (*ConferenceService) MuteMembers Uses

func (s *ConferenceService) MuteMembers(name, members string) (*Response, error)

MuteMembers mutes member(s).

func (*ConferenceService) Play Uses

func (s *ConferenceService) Play(name, members, url string) (*Response, error)

Play starts playing sound to member(s).

func (*ConferenceService) Record Uses

func (c *ConferenceService) Record(id string, cp *ConferenceRecordParams) (*Response, error)

Record records a conference.

func (*ConferenceService) Speak Uses

func (c *ConferenceService) Speak(name, members string, cp *ConferenceSpeakParams) (*Response, error)

Speak makes member(s) listen to a speech.

func (*ConferenceService) StopPlaying Uses

func (s *ConferenceService) StopPlaying(name, members string) (*Response, error)

StopPlaying stops playing sound to member(s).

func (*ConferenceService) StopRecording Uses

func (c *ConferenceService) StopRecording(id string) (*Response, error)

StopRecording cancels a conference recording.

func (*ConferenceService) UnmuteMembers Uses

func (s *ConferenceService) UnmuteMembers(name, members string) (*Response, error)

UnmuteMembers unmutes member(s).

type ConferenceSpeakParams Uses

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

type ConferenceSpeakResponseBody Uses

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

type CreateResponseBody Uses

type CreateResponseBody struct {
    AuthToken string `json:"auth_token"`
    Message   string `json:"message"`
    ApiID     string `json:"api_id"`
    AuthID    string `json:"auth_id"`
}

Stores response for CreateSubaccount call.

type Endpoint Uses

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

type EndpointCreateResponseBody Uses

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

Stores response for Create call

type EndpointService Uses

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

func (*EndpointService) Create Uses

func (s *EndpointService) Create(ep *Endpoint) (*Endpoint, *Response, error)

Create creates an endpoint.

func (*EndpointService) Delete Uses

func (s *EndpointService) Delete(id string) (*Response, error)

Delete deletes an endpoint.

func (*EndpointService) Get Uses

func (s *EndpointService) Get(id string) (*Endpoint, *Response, error)

Get fetches a particular endpoint.

func (*EndpointService) GetEndpoints Uses

func (s *EndpointService) GetEndpoints(limit, offset int64) ([]*Endpoint, *Response, error)

GetEndpoints retrieves a list of all endpoints.

func (*EndpointService) Modify Uses

func (s *EndpointService) Modify(ep *Endpoint) (*Endpoint, *Response, error)

Modify edits an endpoint.

type EndpointsResponseBody Uses

type EndpointsResponseBody struct {
    ApiID   string      `json:"api_id"`
    Meta    *Meta       `json:"meta"`
    Objects []*Endpoint `json:"objects"`
}

type Error Uses

type Error struct {
    Resource string `json:"resource"` // Resource on which the error was generated.
    Field    string `json:"field"`    // Field on which the error occurred.
    Code     string `json:"code"`     // Validation error code.
}

Error type contains more details about the error.

func (*Error) Error Uses

func (e *Error) Error() string

Error returns the string representation of an Error.

type ErrorResponse Uses

type ErrorResponse struct {
    Response *http.Response
    Message  string  `json:"message"`
    Errors   []Error `json:"errors"`
}

Errors returned by the Plivo API.

func (*ErrorResponse) Error Uses

func (r *ErrorResponse) Error() string

Fetches the string representation of an ErrorResponse.

type IncomingCarrier Uses

type IncomingCarrier struct {
    CarrierID   string
    IPSet       string
    Name        string
    ResourceURI string
    SMS         bool
    Voice       bool
}

type IncomingCarrierAddParams Uses

type IncomingCarrierAddParams struct {
    Name  string `json:"name"`
    IPSet string `json:"ip_set"`
}

type IncomingCarrierGetAllParams Uses

type IncomingCarrierGetAllParams struct {
    // Query parameters.
    Name   string `json:"name,omitempty"`
    Limit  int64  `json:"limit:omitempty"`
    Offset int64  `json:"offset:omitempty"`
}

type IncomingCarrierGetAllResponseBody Uses

type IncomingCarrierGetAllResponseBody struct {
    ApiID   string             `json:"api_id"`
    Meta    *Meta              `json:"meta"`
    Objects []*IncomingCarrier `json:"objects"`
}

type IncomingCarrierModifyParams Uses

type IncomingCarrierModifyParams struct {
    Name  string `json:"name,omitempty"`
    IPSet string `json:"ip_set,omitempty"`
}

type IncomingCarrierResponseBody Uses

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

Stores response for making a call.

type IncomingCarrierService Uses

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

func (*IncomingCarrierService) Add Uses

func (s *IncomingCarrierService) Add(p *IncomingCarrierAddParams) (*Response, error)

Add adds an incoming carrier.

func (*IncomingCarrierService) Get Uses

func (s *IncomingCarrierService) Get(carrierID string) (*IncomingCarrier, *Response, error)

Get fetches a specified carrier.

func (*IncomingCarrierService) GetAll Uses

func (s *IncomingCarrierService) GetAll(p *IncomingCarrierGetAllParams) ([]*IncomingCarrier, *Response, error)

func (*IncomingCarrierService) Modify Uses

func (s *IncomingCarrierService) Modify(p *IncomingCarrierModifyParams) (*Response, error)

Modify updates an incoming carrier.

type LiveCall Uses

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

type Member Uses

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

type Message Uses

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

type MessageGetAllParams Uses

type MessageGetAllParams struct {
    Limit  int64 `json:"limit:omitempty"`
    Offset int64 `json:"offset:omitempty"`
}

type MessageGetAllResponseBody Uses

type MessageGetAllResponseBody struct {
    ApiID   string     `json:"api_id"`
    Meta    *Meta      `json:"meta"`
    Objects []*Message `json:"objects"`
}

type MessageSendParams Uses

type MessageSendParams struct {
    Src  string `json:"src,omitempty"`
    Dst  string `json:"dst,omitempty"`
    Text string `json:"text,omitempty"`
    // Optional parameters.
    Type   string `json:"type,omitempty"`
    URL    string `json:"url,omitempty"`
    Method string `json:"method,omitempty"`
}

type MessageSendResponseBody Uses

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

Stores response for ending a message.

type MessageService Uses

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

func (*MessageService) Get Uses

func (s *MessageService) Get(id string) (*Message, *Response, error)

Get fetches a specified message.

func (*MessageService) GetAll Uses

func (s *MessageService) GetAll(p *MessageGetAllParams) ([]*Message, *Response, error)

GetAll fetches all messages.

func (*MessageService) Send Uses

func (c *MessageService) Send(mp *MessageSendParams) (*MessageSendResponseBody, *Response, error)

Make creates a call.

type Meta Uses

type Meta struct {
    Previous string
    Next     string

    TotalCount int64
    Offset     int64
    Limit      int64
}

Meta contains response metadata. This is usually pagination information.

type ModifyResponseBody Uses

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

Stores response for Modify call.

type Number Uses

type Number struct {
    VoiceEnabled bool   `json:"voice_enabled,omitempty"`
    SMSEnabled   bool   `json:"sms_enabled,omitempty"`
    Description  string `json:"description,omitempty"`
    PlivoNumber  bool   `json:"plivo_number,omitempty"`
    Number       string `json:"number,omitempty"`
    NumberType   string `json:"number_type,omitempty"`
    Application  string `json:"application,omitempty"`
    AddedOn      string `json:"added_on,omitempty"`
    ResourceURI  string `json:"resource_uri,omitempty"`
    // Rental-related fields
    GroupID    string `json:"group_id,omitempty"`
    Prefix     string `json:"string,omitempty"`
    SetupRate  string `json:"setup_rate,omitempty"`
    RentalRate string `json:"rental_rate,omitempty"`
    Stock      int64  `json:"stock,omitempty"`
    VoiceRate  string `json:"voice_rate,omitempty"`
    SMSRate    string `json:"sms_rate,omitempty"`
}

type NumberAddParams Uses

type NumberAddParams struct {
    Numbers string `json:"numbers"`
    Carrier string `json:"carrier"`
    Region  string `json:"region"`
    // Optional parameters.
    NumberType string `json:"number_type,omitempty"`
    AppID      string `json:"app_id,omitempty"`
    Subaccount string `json:"subaccount,omitempty"`
}

type NumberEditParams Uses

type NumberEditParams struct {
    AppID      string `json:"app_id,omitempty"`
    Subaccount string `json:"subaccount,omitempty"`
}

type NumberGetAllParams Uses

type NumberGetAllParams struct {
    NumberType       string `json:"number_type,omitempty"`
    NumberStartswith string `json:"number_startswith,omitempty"`
    Subaccount       string `json:"subaccount,omitempty"`
    Services         string `json:"services,omitempty"`
    Limit            int64  `json:"limit:omitempty"`
    Offset           int64  `json:"offset:omitempty"`
}

type NumberRental Uses

type NumberRental struct {
    Number string `json:"number"`
}

type NumberRentalParams Uses

type NumberRentalParams struct {
    Quantity int64  `json:"quantity:omitempty"`
    AppID    string `json:"app_id,omitempty"`
}

type NumberRentalResponseBody Uses

type NumberRentalResponseBody struct {
    Numbers []*NumberRental `json:"numbers"`
    Status  string          `json:"objects,omitempty"`
    Message string          `json:"message,omitempty"`
    Details string          `json:"details,omitempty"`
}

type NumberSearchParams Uses

type NumberSearchParams struct {
    CountryISO string `url:"country_iso"`
    NumberType string `url:"number_type,omitempty"`
    Prefix     string `url:"prefix,omitempty"`
    Region     string `url:"region,omitempty"`
    Services   string `url:"services,omitempty"`
    Limit      int64  `url:"limit:omitempty"`
    Offset     int64  `url:"offset:omitempty"`
}

type NumberService Uses

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

func (*NumberService) Add Uses

func (c *NumberService) Add(np *NumberAddParams) (*Response, error)

Add adds a number from your own carrier.

func (*NumberService) Edit Uses

func (c *NumberService) Edit(number string, np *NumberEditParams) (*Response, error)

Edit edits a number.

func (*NumberService) Get Uses

func (s *NumberService) Get(number string) (*Number, *Response, error)

Get gets details of a rented number.

func (*NumberService) GetAll Uses

func (s *NumberService) GetAll(p *NumberGetAllParams) ([]*Number, *Response, error)

GetAll fetches all calls.

func (*NumberService) Rent Uses

func (c *NumberService) Rent(gid string, np *NumberRentalParams) ([]*NumberRental, *Response, error)

Rent rents a number.

func (*NumberService) Search Uses

func (s *NumberService) Search(sp *NumberSearchParams) ([]*Number, *Response, error)

func (*NumberService) Unrent Uses

func (s *NumberService) Unrent(number string) (*Response, error)

Unrent unrents a number.

type NumbersResponseBody Uses

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

type OutgoingCarrier Uses

type OutgoingCarrier struct {
    CarrierID   string
    IPSet       string
    Name        string
    ResourceURI string
}

type OutgoingCarrierAddParams Uses

type OutgoingCarrierAddParams struct {
    Name            string `json:"name"`
    Address         string `json:"address"`
    FailoverAddress string `json:"failover_address,omitempty"`
    Prefix          string `json:"prefix,omitempty"`
    FailoverPrefix  string `json:"failover_prefix,omitempty"`
    Suffix          string `json:"suffix,omitempty"`
    Retries         int64  `json:"retries,omitempty"`
    RetrySeconds    int64  `json:"retry_seconds,omitempty"`
}

type OutgoingCarrierGetAllParams Uses

type OutgoingCarrierGetAllParams struct {
    // Query parameters.
    Name   string `json:"name,omitempty"`
    Limit  int64  `json:"limit:omitempty"`
    Offset int64  `json:"offset:omitempty"`
}

type OutgoingCarrierGetAllResponseBody Uses

type OutgoingCarrierGetAllResponseBody struct {
    ApiID   string             `json:"api_id"`
    Meta    *Meta              `json:"meta"`
    Objects []*OutgoingCarrier `json:"objects"`
}

type OutgoingCarrierModifyParams Uses

type OutgoingCarrierModifyParams struct {
    Name  string `json:"name,omitempty"`
    IPSet string `json:"ip_set,omitempty"`
}

type OutgoingCarrierResponseBody Uses

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

Stores response for making a call.

type OutgoingCarrierService Uses

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

func (*OutgoingCarrierService) Add Uses

func (s *OutgoingCarrierService) Add(p *OutgoingCarrierAddParams) (*Response, error)

Add adds an outgoing carrier.

func (*OutgoingCarrierService) Get Uses

func (s *OutgoingCarrierService) Get(carrierID string) (*OutgoingCarrier, *Response, error)

Get fetches a specified carrier.

func (*OutgoingCarrierService) GetAll Uses

func (s *OutgoingCarrierService) GetAll(p *OutgoingCarrierGetAllParams) ([]*OutgoingCarrier, *Response, error)

func (*OutgoingCarrierService) Modify Uses

func (s *OutgoingCarrierService) Modify(p *OutgoingCarrierModifyParams) (*Response, error)

Modify updates an outgoing carrier.

func (*OutgoingCarrierService) Remove Uses

func (s *OutgoingCarrierService) Remove(carrierID string) (*Response, error)

Remove removes a carrier, and deletes all numbers associated with the carrier.

type Plan Uses

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

type Pricing Uses

type Pricing struct {
    ApiID       string        `json:"api_id,omitempty"`
    Country     string        `json:"country,omitempty"`
    CountryCode string        `json:"country_code,omitempty"`
    CountryISO  string        `json:"country_iso,omitempty"`
    Message     []RateMessage `json:"message,omitempty"`
}

type PricingGetParams Uses

type PricingGetParams struct {
    CountryISO string
}

type PricingService Uses

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

func (*PricingService) Get Uses

func (s *PricingService) Get(p *PricingGetParams) (*Pricing, *Response, error)

Get fetches the pricing for a specified country

type RateMessage Uses

type RateMessage map[string][]string

type Recording Uses

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

type RecordingGetAllParams Uses

type RecordingGetAllParams struct {
    // Query parameters.
    Subaccount string `json:"subaccount,omitempty"`
    CallUUID   string `json:"call_uuid,omitempty"`
    AddTime    string `json:"add_time,omitempty"`
    Limit      int64  `json:"limit:omitempty"`
    Offset     int64  `json:"offset:omitempty"`
}

type RecordingGetAllResponseBody Uses

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

type RecordingService Uses

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

func (*RecordingService) Get Uses

func (s *RecordingService) Get(recordingID string) (*Recording, *Response, error)

Get fetches a specified recording.

func (*RecordingService) GetAll Uses

func (s *RecordingService) GetAll(p *RecordingGetAllParams) ([]*Recording, *Response, error)

GetAll fetches all recordings.

type Response Uses

type Response struct {
    *http.Response

    *Meta
}

Response is a Plivo API response. This wraps the standard http.Response returned from Plivo while providing convenient access to pagination.

type Subaccount Uses

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

type SubaccountsResponseBody Uses

type SubaccountsResponseBody struct {
    ApiID   string        `json:"api_id"`
    Meta    *Meta         `json:"meta"`
    Objects []*Subaccount `json:"objects"`
}

Package plivo imports 7 packages (graph) and is imported by 1 packages. Updated 2016-07-21. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).