Documentation ¶
Overview ¶
Package gotwilio is a library for interacting with http://www.twilio.com/ API.
Package gotwilio is a library for interacting with http://www.twilio.com/ API.
Package gotwilio is a library for interacting with http://www.twilio.com/ API.
Package gotwilio is a library for interacting with http://www.twilio.com/ API.
Index ¶
- Constants
- Variables
- func DecodeWebhook(data url.Values, out interface{}) error
- func NewBoolean(value bool) *bool
- type AccessToken
- type AvailablePhoneNumber
- type AvailablePhoneNumbersOptions
- type CallbackParameters
- type Conference
- type ConferenceOptions
- type ConferenceParticipant
- type ConferenceParticipantOptions
- type Exception
- type ExceptionCode
- type FaxBase
- type FaxMediaResource
- type FaxResource
- type FaxResourcesList
- type GetIncomingPhoneNumbersRequest
- type Grant
- type IncomingPhoneNumber
- type Interaction
- type InteractionData
- type InteractionList
- type ListResources
- type ListVideoReponse
- type ListVideoRoomOptions
- type Lookup
- type LookupReq
- type MediaRegion
- type Meta
- type Option
- type Participant
- type ParticipantList
- type ParticipantRequest
- type PhoneNumberType
- type ProxyCallbackWebhook
- type ProxyInterceptCallbackWebhook
- type ProxyMessage
- type ProxyOutOfSessionCallbackWebhook
- type ProxyService
- type ProxyServiceRequest
- type ProxySession
- func (session *ProxySession) AddParticipant(req ParticipantRequest) (response Participant, exception *Exception, err error)
- func (session *ProxySession) CreateInteraction(participantSid string, msg ProxyMessage) (response Interaction, exception *Exception, err error)
- func (session *ProxySession) DeleteParticipant(participantID string) (exception *Exception, err error)
- func (session *ProxySession) GetInteractions() (response InteractionList, exception *Exception, err error)
- func (session *ProxySession) GetParticipant(participantID string) (response Participant, exception *Exception, err error)
- func (session *ProxySession) ListParticipants() (response []Participant, exception *Exception, err error)
- type ProxySessionRequest
- type QueueResponse
- type SMSWebhook
- type SmsResponse
- type Twilio
- func (twilio *Twilio) AddConferenceParticipant(conferenceSid string, participant *ConferenceParticipantOptions) (*ConferenceParticipant, *Exception, error)
- func (twilio *Twilio) CallUpdate(callSid string, formValues url.Values) (*VoiceResponse, *Exception, error)
- func (twilio *Twilio) CallWithApplicationCallbacks(from, to, applicationSid string) (*VoiceResponse, *Exception, error)
- func (twilio *Twilio) CallWithUrlCallbacks(from, to string, callbackParameters *CallbackParameters) (*VoiceResponse, *Exception, error)
- func (t *Twilio) CancelFax(faxSid string) (*Exception, error)
- func (twilio *Twilio) CheckRequestSignature(r *http.Request, baseURL string) (bool, error)
- func (twilio *Twilio) CreateIncomingPhoneNumber(options IncomingPhoneNumber) (*IncomingPhoneNumber, *Exception, error)
- func (twilio *Twilio) CreateQueue(friendlyName string) (*QueueResponse, *Exception, error)
- func (twilio *Twilio) CreateVideoRoom(options *createRoomOptions) (videoResponse *VideoResponse, exception *Exception, err error)
- func (twilio *Twilio) DeleteConferenceParticipant(conferenceSid string, callSid string) (*Exception, error)
- func (t *Twilio) DeleteFax(faxSid string) (*Exception, error)
- func (twilio *Twilio) DeleteIncomingPhoneNumber(sid string) (*Exception, error)
- func (twilio *Twilio) DeleteProxyService(sid string) (exception *Exception, err error)
- func (twilio *Twilio) DeleteProxySession(serviceID, sessionID string) (exception *Exception, err error)
- func (twilio *Twilio) EndVideoRoom(nameOrSid string) (videoResponse *VideoResponse, exception *Exception, err error)
- func (twilio *Twilio) GenerateSignature(url string, form url.Values) ([]byte, error)
- func (twilio *Twilio) GetAvailablePhoneNumbers(numberType PhoneNumberType, country string, ...) ([]*AvailablePhoneNumber, *Exception, error)
- func (twilio *Twilio) GetCall(sid string) (*VoiceResponse, *Exception, error)
- func (twilio *Twilio) GetConference(conferenceSid string) (*Conference, *Exception, error)
- func (twilio *Twilio) GetConferenceParticipant(conferenceSid, callSid string) (*ConferenceParticipant, *Exception, error)
- func (twilio *Twilio) GetConferenceParticipants(conferenceSid string) ([]*ConferenceParticipant, *Exception, error)
- func (t *Twilio) GetFax(faxSid string) (*FaxResource, *Exception, error)
- func (t *Twilio) GetFaxes(to, from, createdOnOrBefore, createdAfter string) ([]*FaxResource, *Exception, error)
- func (twilio *Twilio) GetIncomingPhoneNumbers(request GetIncomingPhoneNumbersRequest) ([]*IncomingPhoneNumber, *Exception, error)
- func (twilio *Twilio) GetProxyService(sid string) (response *ProxyService, exception *Exception, err error)
- func (twilio *Twilio) GetProxySession(serviceID, sessionID string) (response *ProxySession, exception *Exception, err error)
- func (twilio *Twilio) GetSMS(sid string) (smsResponse *SmsResponse, exception *Exception, err error)
- func (twilio *Twilio) GetUsage(category, startDate, endDate string, includeSubaccounts bool) (*UsageResponse, *Exception, error)
- func (twilio *Twilio) GetVideoRoom(nameOrSid string) (videoResponse *VideoResponse, exception *Exception, err error)
- func (twilio *Twilio) ListVideoRooms(options *ListVideoRoomOptions) (videoResponse *ListVideoReponse, exception *Exception, err error)
- func (twilio *Twilio) LookupNoCarrier(phoneNumber string) (Lookup, error)
- func (twilio *Twilio) NewAccessToken() *AccessToken
- func (twilio *Twilio) NewProxyService(service ProxyServiceRequest) (response *ProxyService, exception *Exception, err error)
- func (twilio *Twilio) NewProxySession(serviceID string, req ProxySessionRequest) (response *ProxySession, exception *Exception, err error)
- func (t *Twilio) SendFax(to, from, mediaUrl, quality, statusCallback string, storeMedia bool) (*FaxResource, *Exception, error)
- func (twilio *Twilio) SendMMS(from, to, body string, mediaUrl []string, ...) (smsResponse *SmsResponse, exception *Exception, err error)
- func (twilio *Twilio) SendMMSWithCopilot(messagingServiceSid, to, body string, mediaUrl []string, ...) (smsResponse *SmsResponse, exception *Exception, err error)
- func (twilio *Twilio) SendSMS(from, to, body, statusCallback, applicationSid string, opts ...*Option) (smsResponse *SmsResponse, exception *Exception, err error)
- func (twilio *Twilio) SendSMSWithCopilot(messagingServiceSid, to, body, statusCallback, applicationSid string) (smsResponse *SmsResponse, exception *Exception, err error)
- func (twilio *Twilio) SendWhatsApp(from, to, body, statusCallback, applicationSid string) (smsResponse *SmsResponse, exception *Exception, err error)
- func (twilio *Twilio) SendWhatsAppMedia(from, to, body string, mediaURL []string, ...) (smsResponse *SmsResponse, exception *Exception, err error)
- func (twilio *Twilio) SubmitLookup(req LookupReq) (Lookup, error)
- func (twilio *Twilio) UpdateConference(conferenceSid string, options *ConferenceOptions) (*Conference, *Exception, error)
- func (twilio *Twilio) UpdateConferenceParticipant(conferenceSid string, callSid string, ...) (*ConferenceParticipant, *Exception, error)
- func (twilio *Twilio) UpdateIncomingPhoneNumber(sid string, options IncomingPhoneNumber) (*IncomingPhoneNumber, *Exception, error)
- func (twilio *Twilio) UpdateProxyService(sid string, service ProxyServiceRequest) (response *ProxyService, exception *Exception, err error)
- func (twilio *Twilio) UpdateProxySession(serviceID, sessionID string, req ProxySessionRequest) (response *ProxySession, exception *Exception, err error)
- func (twilio *Twilio) WithAPIKey(apiKeySid string, apiKeySecret string) *Twilio
- type UsageParameters
- type UsageRecord
- type UsageResponse
- type VideoCodecs
- type VideoGrant
- type VideoResponse
- type VideoRoomType
- type VideoStatus
- type VoiceGrant
- type VoiceGrantIncoming
- type VoiceGrantOutgoing
- type VoiceResponse
Constants ¶
const ( // LookupTypeString format for single request type LookupTypeString = "Type" // LookupTypesString format for multiple request types LookupTypesString = "Types" )
const ProxyBaseUrl = "https://proxy.twilio.com/v1"
Variables ¶
var ( // Settings for what Twilio should do with addresses in message logs SmsAddressRetentionObfuscate = &Option{"AddressRetention", "obfuscate"} SmsAddressRetentionRetain = &Option{"AddressRetention", "retain"} // Settings for what Twilio should do with message content in message logs SmsContentRetentionDiscard = &Option{"ContentRetention", "discard"} SmsContentRetentionRetain = &Option{"ContentRetention", "retain"} )
Optional SMS parameters
var DefaultVideoRoomOptions = &createRoomOptions{ EnableTurn: true, MaxParticipants: 10, MediaRegion: USEastCoast, RecordParticipantsOnConnect: false, StatusCallback: "", StatusCallbackMethod: http.MethodPost, Type: Group, UniqueName: "", VideoCodecs: []VideoCodecs{H264, VP8}, }
DefaultVideoRoomOptions are the default options for creating a room.
Functions ¶
func DecodeWebhook ¶
func NewBoolean ¶
NewBoolean returns a boolean pointer value for a given boolean literal. This is important because for the Twilio API, booleans are really a ternary type, supporting true, false, or nil/null.
Types ¶
type AccessToken ¶
type AccessToken struct { AccountSid string APIKeySid string APIKeySecret string NotBefore time.Time ExpiresAt time.Time Grants []Grant Identity string }
AccessToken holds everything required to create authenticate the client SDKs. See https://www.twilio.com/docs/iam/access-tokens for further details.
func (*AccessToken) AddGrant ¶
func (a *AccessToken) AddGrant(grant Grant) *AccessToken
AddGrant adds a given Grant to the Access Token.
func (*AccessToken) ToJWT ¶
func (a *AccessToken) ToJWT() (string, error)
ToJWT creates a JSON Web Token from the Access Token to use in the Client SDKs. See https://en.wikipedia.org/wiki/JSON_Web_Token for the standard format.
type AvailablePhoneNumber ¶
type AvailablePhoneNumber struct { FriendlyName string `json:"friendly_name"` PhoneNumber string `json:"phone_number"` LATA string `json:"lata"` RateCenter string `json:"rate_center"` Region string `json:"region"` Locality string `json:"locality"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` PostalCode string `json:"postal_code"` Beta bool `json:"beta"` Capabilities struct { MMS bool `json:"mms"` SMS bool `json:"sms"` Voice bool `json:"voice"` } `json:"capabilities"` }
AvailablePhoneNumber represents a Twilio phone number available for purchase https://www.twilio.com/docs/phone-numbers/api/availablephonenumber-resource
type AvailablePhoneNumbersOptions ¶
type AvailablePhoneNumbersOptions struct { AreaCode string `url:",omitempty"` Contains string `url:",omitempty"` SMSEnabled *bool `url:"SmsEnabled,omitempty"` MMSEnabled *bool `url:"MmsEnabled,omitempty"` VoiceEnabled *bool `url:",omitempty"` FaxEnabled *bool `url:",omitempty"` ExcludeAllAddressRequired *bool `url:",omitempty"` ExcludeLocalAddressRequired *bool `url:",omitempty"` ExcludeForeignAddressRequired *bool `url:",omitempty"` Beta *bool `url:",omitempty"` NearNumber string `url:",omitempty"` NearLatLong string `url:",omitempty"` Distance int `url:",omitempty"` InPostalCode string `url:",omitempty"` InRegion string `url:",omitempty"` InRateCenter string `url:",omitempty"` InLATA string `url:"InLata,omitempty"` InLocality string `url:",omitempty"` }
AvailablePhoneNumbersOptions are all of the options that can be passed to an GetAvailablePhoneNumber query.
func (AvailablePhoneNumbersOptions) ToQueryString ¶
func (o AvailablePhoneNumbersOptions) ToQueryString() (url.Values, error)
ToQueryString converts the provided options to a query string to be used in the outbound HTTP request.
type CallbackParameters ¶
type CallbackParameters struct { Url string // Required Method string // Optional FallbackUrl string // Optional FallbackMethod string // Optional StatusCallback string // Optional StatusCallbackMethod string // Optional StatusCallbackEvent []string // Optional SendDigits string // Optional Timeout int // Optional Record bool // Optional RecordingChannels string // Optional RecordingStatusCallback string // Optional RecordingStatusCallbackMethod string // Optional MachineDetection string // Optional MachineDetectionTimeout int // Optional MachineDetectionSpeechThreshold int // Optional MachineDetectionSpeechEndThreshold int // Optional MachineDetectionSilenceTimeout int // Optional AsyncAmd bool // Optional AsyncAmdStatusCallback string // Optional AsyncAmdStatusCallbackMethod string // Optional }
These are the paramters to use when you want Twilio to use callback urls. See http://www.twilio.com/docs/api/rest/making-calls for more info.
func NewCallbackParameters ¶
func NewCallbackParameters(url string) *CallbackParameters
NewCallbackParameters returns a CallbackParameters type with the specified url and CallbackParameters.Timeout set to 60.
type Conference ¶
type Conference struct { Sid string `json:"sid"` FriendlyName string `json:"friendly_name"` Status string `json:"status"` Region string `json:"region"` }
Conference represents a Twilio Voice conference call
type ConferenceOptions ¶
type ConferenceOptions struct { Status string `url:"Status,omitempty"` AnnounceURL string `url:"AnnounceUrl,omitempty"` AnnounceMethod string `url:"AnnounceMethod,omitempty"` }
ConferenceOptions are used for updating Conferences
type ConferenceParticipant ¶
type ConferenceParticipant struct { CallSid string `json:"call_sid"` ConferenceSid string `json:"conference_sid"` Muted bool `json:"muted"` Hold bool `json:"hold"` Status string `json:"status"` StartConferenceOnEnter bool `json:"start_conference_on_enter"` EndConferenceOnExit bool `json:"end_conference_on_exit"` Coaching bool `json:"coaching"` CallSidToCoach string `json:"call_sid_to_coach"` }
ConferenceParticipant represents a Participant in responses from the Twilio API
type ConferenceParticipantOptions ¶
type ConferenceParticipantOptions struct { From string `url:"From,omitempty"` To string `url:"To,omitempty"` StatusCallback string `url:"StatusCallback,omitempty"` StatusCallbackMethod string `url:"StatusCallbackMethod,omitempty"` StatusCallbackEvent []string `url:"StatusCallbackEvent,omitempty"` Timeout int `url:"Timeout"` Record *bool `url:"Record,omitempty"` Beep *bool `url:"Beep,omitempty"` Muted *bool `url:"Muted,omitempty"` Hold *bool `url:"Hold,omitempty"` HoldURL *string `url:"HoldURL,omitempty"` HoldMethod *string `url:"HoldMethod,omitempty"` AnnounceURL *string `url:"AnnounceURL,omitempty"` AnnounceMethod *string `url:"AnnounceMethod,omitempty"` StartConferenceOnEnter *bool `url:"StartConferenceOnEnter,omitempty"` EndConferenceOnExit *bool `url:"EndConferenceOnExit,omitempty"` WaitURL string `url:"WaitURL,omitempty"` WaitMethod string `url:"WaitMethod,omitempty"` EarlyMedia *bool `url:"EarlyMedia,omitempty"` MaxParticipants int `url:"MaxParticipants"` ConferenceRecord string `url:"ConferenceRecord,omitempty"` ConferenceTrim string `url:"ConferenceTrim,omitempty"` ConferenceStatusCallback string `url:"ConferenceStatusCallback,omitempty"` ConferenceStatusCallbackMethod string `url:"ConferenceStatusCallbackMethod,omitempty"` ConferenceStatusCallbackEvent []string `url:"ConferenceStatusCallbackEvent,omitempty"` RecordingChannels string `url:"RecordingChannels,omitempty"` RecordingStatusCallback string `url:"RecordingStatusCallback,omitempty"` RecordingStatusCallbackMethod string `url:"RecordingStatusCallbackMethod,omitempty"` RecordingStatusCallbackEvent string `url:"RecordingStatusCallbackEvent,omitempty"` SipAuthUsername string `url:"SipAuthUsername,omitempty"` SipAuthPassword string `url:"SipAuthPassword,omitempty"` Region string `url:"Region,omitempty"` ConferenceRecordingStatusCallback string `url:"ConferenceRecordingStatusCallback,omitempty"` ConferenceRecordingStatusCallbackMethod string `url:"ConferenceRecordingStatusCallbackMethod,omitempty"` Coaching *bool `url:"Coaching,omitempty"` CallSidToCoach string `url:"CallSidToCoach,omitempty"` }
ConferenceParticipantOptions are used for creating and updating Conference Participants.
type Exception ¶
type Exception struct { Status int `json:"status"` // HTTP specific error code Message string `json:"message"` // HTTP error message Code ExceptionCode `json:"code"` // Twilio specific error code MoreInfo string `json:"more_info"` // Additional info from Twilio }
Exception is a representation of a twilio exception.
type FaxBase ¶
type FaxBase struct { Sid string `json:"sid"` AccountSid string `json:"account_sid"` DateCreated string `json:"date_created"` DateUpdated string `json:"date_updated"` }
func (*FaxBase) DateCreatedAsTime ¶
DateCreatedAsTime returns FaxBase.DateCreated as a time.Time object instead of a string.
type FaxMediaResource ¶
type FaxResource ¶
type FaxResource struct { FaxBase From string `json:"from"` To string `json:"to"` Direction string `json:"direction"` NumPages uint `json:"num_pages"` Duration uint `json:"duration"` MediaSid string `json:"media_sid"` MediaUrl string `json:"media_url"` Status string `json:"status"` Quality string `json:"quality"` ApiVersion string `json:"api_version"` Price *string `json:"price,omitempty"` PriceUnit *string `json:"price_unit,omitempty"` }
type FaxResourcesList ¶
type FaxResourcesList struct { ListResources Faxes []*FaxResource `json:"faxes"` }
type Grant ¶
type Grant interface {
GrantName() string
}
Grant is a perimssion given to the Access Token. Types include Chat, Video etc.
type IncomingPhoneNumber ¶
type IncomingPhoneNumber struct { SID string `json:"sid"` PhoneNumber string `url:",omitempty" json:"phone_number"` AreaCode string `url:",omitempty"` FriendlyName string `url:",omitempty" json:"friendly_name"` SMSApplicationSID string `url:"SmsApplicationSid,omitempty" json:"sms_application_sid"` SMSMethod string `url:"SmsMethod,omitempty" json:"sms_method"` SMSURL string `url:"SmsUrl,omitempty" json:"sms_url"` SMSFallbackMethod string `url:"SmsFallbackMethod,omitempty" json:"sms_fallback_method"` SMSFallbackURL string `url:"SmsFallbackUrl,omitempty" json:"sms_fallback_url"` StatusCallback string `url:",omitempty" json:"status_callback"` StatusCallbackMethod string `url:",omitempty" json:"status_callback_method"` VoiceApplicationSID string `url:"VoiceApplicationSid,omitempty"` VoiceMethod string `url:",omitempty"` VoiceURL string `url:"VoiceUrl,omitempty"` VoiceFallbackMethod string `url:",omitempty"` VoiceFallbackURL string `url:"VoiceFallbackUrl,omitempty"` VoiceCallerIDLookup *bool `url:",omitempty"` // Either "Active" or "Inactive" EmergencyStatus string `url:",omitempty"` EmergencyStatusSID string `url:"EmergencyStatusSid,omitempty"` TrunkSID string `url:"TrunkSid,omitempty"` IdentitySID string `url:"IdentitySid,omitempty"` AddressSID string `url:"AddressSid,omitempty"` // Either "fax" or "voice". Defaults to "voice" VoiceReceiveMode string `url:",omitempty"` }
IncomingPhoneNumber represents a phone number resource owned by the calling account in Twilio
type Interaction ¶
type Interaction struct { InboundResourceStatus string `json:"inbound_resource_status"` InboundResourceSid string `json:"inbound_resource_sid"` OutboundResourceStatus string `json:"outbound_resource_status"` OutboundResourceSid string `json:"outbound_resource_sid"` InboundResourceURL string `json:"inbound_resource_url"` Type string `json:"type"` AccountSid string `json:"account_sid"` OutboundResourceType string `json:"outbound_resource_type"` DateCreated time.Time `json:"date_created"` InboundResourceType string `json:"inbound_resource_type"` URL string `json:"url"` DateUpdated time.Time `json:"date_updated"` Sid string `json:"sid"` OutboundParticipantSid string `json:"outbound_participant_sid"` OutboundResourceURL string `json:"outbound_resource_url"` SessionSid string `json:"session_sid"` ServiceSid string `json:"service_sid"` Data string `json:"data"` InboundParticipantSid string `json:"inbound_participant_sid"` }
type InteractionData ¶
type InteractionData struct {
Body string `json:"body"`
}
type InteractionList ¶
type InteractionList struct { Meta Meta `json:"meta"` Interactions []Interaction `json:"interactions"` }
type ListResources ¶
type ListResources struct { Uri string `json:"uri"` FirstPageUri string `json:"first_page_uri"` NextPageUri string `json:"next_page_uri"` PreviousPageUri string `json:"previous_page_uri"` Page uint `json:"page"` PageSize uint `json:"page_size"` Faxes []*FaxResource `json:"faxes"` Messages []*SmsResponse `json:"messages"` // contains filtered or unexported fields }
ListResources contains Twilio paging information. See https://www.twilio.com/docs/usage/twilios-response#response-formats-list-paging-information
type ListVideoReponse ¶
type ListVideoReponse struct { Rooms []*VideoResponse `json:"rooms"` Meta struct { Page int64 `json:"page"` PageSize int64 `json:"page_size"` FirstPageUrl string `json:"first_page_url"` PreviousPageUrl string `json:"previous_page_url"` NextPageUrl string `json:"next_page_url"` Url string `json:"url"` Key string `json:"key"` } `json:"meta"` }
ListVideoResponse is returned when listing rooms
type ListVideoRoomOptions ¶
type ListVideoRoomOptions struct { DateCreatedAfter time.Time `json:"DateCreatedAfter"` DateCreatedBefore time.Time `json:"DateCreatedBefore"` Status VideoStatus `json:"Status"` UniqueName string `json:"EnableUniqueNameTurn"` }
ListVideoRoomOptions are the options to query for a list of video rooms.
type Lookup ¶
type Lookup struct { CallerName *struct { ErrorCode *int `json:"error_code"` CallerName string `json:"caller_name"` CallerType string `json:"caller_type"` } `json:"caller_name"` Carrier *struct { ErrorCode *int `json:"error_code"` MobileCountryCode string `json:"mobile_country_code"` MobileNetworkCode string `json:"mobile_network_code"` Name string `json:"name"` Type string `json:"type"` } `json:"carrier"` CountryCode string `json:"country_code"` NationalFormat string `json:"national_format"` PhoneNumber string `json:"phone_number"` URL string `json:"url"` }
Lookup Go-representation of Twilio REST API's lookup. https://www.twilio.com/docs/api/rest/lookups
type LookupReq ¶
LookupReq Go-representation of Twilio REST API's lookup request. https://www.twilio.com/docs/api/rest/lookups#lookups-query-parameters
type MediaRegion ¶
type MediaRegion string
MediaRegion is the locations of Twilio's TURN servers
const ( Australia MediaRegion = "au1" Brazil MediaRegion = "br1" Germany MediaRegion = "de1" Ireland MediaRegion = "ie1" India MediaRegion = "in1" Japan MediaRegion = "jp1" Singapore MediaRegion = "sg1" USEastCoast MediaRegion = "us1" USWestCoast MediaRegion = "us2" )
type Participant ¶
type Participant struct { Sid string `json:"sid"` Identifier string `json:"identifier"` DateUpdated time.Time `json:"date_updated"` FriendlyName interface{} `json:"friendly_name"` DateDeleted interface{} `json:"date_deleted"` AccountSid string `json:"account_sid"` URL string `json:"url"` ProxyIdentifier string `json:"proxy_identifier"` ProxyIdentifierSid string `json:"proxy_identifier_sid"` DateCreated time.Time `json:"date_created"` ParticipantSid string `json:"Participant_sid"` ServiceSid string `json:"service_sid"` Links struct { MessageInteractions string `json:"message_interactions"` } `json:"links"` }
type ParticipantList ¶
type ParticipantList struct { Participants []Participant `json:"participants"` Meta Meta `json:"meta"` }
type ParticipantRequest ¶
type PhoneNumberType ¶
type PhoneNumberType int
PhoneNumberType defines whether a phone number is local, toll-free, or mobile.
const ( PhoneNumberLocal PhoneNumberType = iota PhoneNumberTollFree PhoneNumberMobile )
func (PhoneNumberType) String ¶
func (t PhoneNumberType) String() string
type ProxyCallbackWebhook ¶
type ProxyCallbackWebhook struct { OutboundResourceStatus string `form:"outboundResourceStatus"` OutboundResourceType string `form:"outboundResourceType"` InteractionDateUpdated time.Time `form:"interactionDateUpdated"` InteractionData string `form:"interactionData"` InteractionDateCreated time.Time `form:"interactionDateCreated"` InboundResourceURL string `form:"inboundResourceUrl"` InteractionServiceSid string `form:"interactionServiceSid"` OutboundParticipantSid string `form:"outboundParticipantSid"` InteractionType string `form:"interactionType"` InteractionAccountSid string `form:"interactionAccountSid"` InboundParticipantSid string `form:"inboundParticipantSid"` InboundResourceStatus string `form:"inboundResourceStatus"` OutboundResourceSid string `form:"outboundResourceSid"` OutboundResourceURL string `form:"outboundResourceUrl"` InboundResourceType string `form:"inboundResourceType"` InboundResourceSid string `form:"inboundResourceSid"` InteractionSessionSid string `form:"interactionSessionSid"` InteractionSid string `form:"interactionSid"` }
https://www.twilio.com/docs/proxy/api/proxy-webhooks#callbackurl These webhooks are fired for each new interaction and are informational only.
func (ProxyCallbackWebhook) GetInteractionData ¶
func (p ProxyCallbackWebhook) GetInteractionData() (InteractionData, error)
type ProxyInterceptCallbackWebhook ¶
type ProxyInterceptCallbackWebhook struct { InteractionDateUpdated time.Time `form:"interactionDateUpdated"` InteractionData string `form:"interactionData"` InteractionDateCreated time.Time `form:"interactionDateCreated"` InboundResourceURL string `form:"inboundResourceUrl"` InteractionServiceSid string `form:"interactionServiceSid"` InteractionType string `form:"interactionType"` InteractionAccountSid string `form:"interactionAccountSid"` InboundParticipantSid string `form:"inboundParticipantSid"` InboundResourceStatus string `form:"inboundResourceStatus"` InboundResourceType string `form:"inboundResourceType"` InboundResourceSid string `form:"inboundResourceSid"` InteractionSessionSid string `form:"interactionSessionSid"` InteractionSid string `form:"interactionSid"` }
https://www.twilio.com/docs/proxy/api/proxy-webhooks#interceptcallbackurl Fires on each interaction. If responded to with a 403 to this webhook we will abort/block the interaction. Any other status or timeout the interaction continues
func (ProxyInterceptCallbackWebhook) GetInteractionData ¶
func (p ProxyInterceptCallbackWebhook) GetInteractionData() (InteractionData, error)
type ProxyMessage ¶
type ProxyOutOfSessionCallbackWebhook ¶
type ProxyOutOfSessionCallbackWebhook struct { AccountSid string `form:"AccountSid"` SessionUniqueName string `form:"sessionUniqueName"` SessionAccountSid string `form:"sessionAccountSid"` SessionServiceSid string `form:"sessionServiceSid"` SessionSid string `form:"sessionSid"` SessionStatus string `form:"sessionStatus"` SessionMode string `form:"sessionMode"` SessionDateCreated time.Time `form:"sessionDateCreated"` SessionDateStarted time.Time `form:"sessionDateStarted"` SessionDateUpdated time.Time `form:"sessionDateUpdated"` SessionDateEnded time.Time `form:"sessionDateEnded"` SessionDateLastInteraction time.Time `form:"sessionDateLastInteraction"` SessionClosedReason string `form:"sessionClosedReason"` TTL string `form:"ttl"` // SMS Specific Body string `form:"Body"` SmsSid string `form:"SmsSid"` MessageSid string `form:"MessageSid"` NumMedia string `form:"NumMedia"` NumSegments string `form:"NumSegments"` SmsStatus string `form:"SmsStatus"` SmsMessageSid string `form:"SmsMessageSid"` To string `form:"To"` ToCity string `form:"ToCity"` ToState string `form:"ToState"` ToZip string `form:"ToZip"` ToCountry string `form:"ToCountry"` From string `form:"From"` FromCity string `form:"FromCity"` FromState string `form:"FromState"` FromZip string `form:"FromZip"` FromCountry string `form:"FromCountry"` InboundParticipantSid string `form:"inboundParticipantSid"` InboundParticipantIdentifier string `form:"inboundParticipantIdentifier"` InboundParticipantFriendlyName string `form:"inboundParticipantFriendlyName"` InboundParticipantProxyIdentifier string `form:"inboundParticipantProxyIdentifier"` InboundParticipantProxyIdentifierSid string `form:"inboundParticipantProxyIdentifierSid"` InboundParticipantAccountSid string `form:"inboundParticipantAccountSid"` InboundParticipantServiceSid string `form:"inboundParticipantServiceSid"` InboundParticipantSessionSid string `form:"inboundParticipantSessionSid"` InboundParticipantDateCreated time.Time `form:"inboundParticipantDateCreated"` InboundParticipantDateUpdated time.Time `form:"inboundParticipantDateUpdated"` OutboundParticipantSid string `form:"outboundParticipantSid"` OutboundParticipantIdentifier string `form:"outboundParticipantIdentifier"` OutboundParticipantFriendlyName string `form:"outboundParticipantFriendlyName"` OutboundParticipantProxyIdentifier string `form:"outboundParticipantProxyIdentifier"` OutboundParticipantProxyIdentifierSid string `form:"outboundParticipantProxyIdentifierSid"` OutboundParticipantAccountSid string `form:"outboundParticipantAccountSid"` OutboundParticipantServiceSid string `form:"outboundParticipantServiceSid"` OutboundParticipantSessionSid string `form:"outboundParticipantSessionSid"` OutboundParticipantDateCreated time.Time `form:"outboundParticipantDateCreated"` OutboundParticipantDateUpdated time.Time `form:"outboundParticipantDateUpdated"` CallSid string `form:"CallSid"` CallStatus string `form:"CallStatus"` Caller string `form:"Caller"` CallerCity string `form:"CallerCity"` CallerState string `form:"CallerState"` CallerZip string `form:"CallerZip"` CallerCountry string `form:"CallerCountry"` Called string `form:"Called"` CalledCity string `form:"CalledCity"` CalledState string `form:"CalledState"` CalledZip string `form:"CalledZip"` CalledCountry string `form:"CalledCountry"` Direction string `form:"Direction"` AddOns string `form:"AddOns"` APIVersion string `form:"ApiVersion"` }
https://www.twilio.com/docs/proxy/api/proxy-webhooks#outofsessioncallbackurl A URL to send webhooks to when an action (inbound call or SMS) occurs where there is no session or a closed session. If your server (or a Twilio function) responds with valid TwiML, this will be processed. This means it is possible to e.g. play a message for a call, send an automated text message response, or redirect a call to another number.
type ProxyService ¶
type ProxyService struct { Sid string `json:"sid"` UniqueName string `json:"unique_name"` AccountSid string `json:"account_sid"` CallbackURL string `json:"callback_url"` DefaultTTL int `json:"default_ttl"` NumberSelectionBehavior string `json:"number_selection_behavior"` GeoMatchLevel string `json:"geo_match_level"` InterceptCallbackURL interface{} `json:"intercept_callback_url"` OutOfSessionCallbackURL interface{} `json:"out_of_session_callback_url"` DateCreated time.Time `json:"date_created"` DateUpdated time.Time `json:"date_updated"` URL string `json:"url"` Links struct { PhoneNumbers string `json:"phone_numbers"` ShortCodes string `json:"short_codes"` Sessions string `json:"sessions"` } `json:"links"` }
type ProxyServiceRequest ¶
type ProxyServiceRequest struct { UniqueName string // optional CallbackURL string // optional OutOfSessionCallbackURL string // optional InterceptCallbackURL string // optional GeoMatchLevel string // Default: country Options: country, area-code, extended-area-code optional NumberSelectionBehavior string // Default: prefer-sticky Options: prefer-sticky, avoid-sticky optional DefaultTtl int // (seconds) Default: 0 optional }
type ProxySession ¶
type ProxySession struct { Sid string `json:"sid"` Status string `json:"status"` UniqueName string `json:"unique_name"` ClosedReason interface{} `json:"closed_reason"` DateEnded interface{} `json:"date_ended"` TTL int `json:"ttl"` DateExpiry interface{} `json:"date_expiry"` AccountSid string `json:"account_sid"` DateUpdated time.Time `json:"date_updated"` Mode string `json:"mode"` DateLastInteraction interface{} `json:"date_last_interaction"` URL string `json:"url"` DateCreated time.Time `json:"date_created"` DateStarted time.Time `json:"date_started"` ServiceSid string `json:"service_sid"` Links struct { Participants string `json:"participants"` Interactions string `json:"interactions"` } `json:"links"` // contains filtered or unexported fields }
func (*ProxySession) AddParticipant ¶
func (session *ProxySession) AddParticipant(req ParticipantRequest) (response Participant, exception *Exception, err error)
AddParticipant adds Participant to Session
func (*ProxySession) CreateInteraction ¶
func (session *ProxySession) CreateInteraction(participantSid string, msg ProxyMessage) (response Interaction, exception *Exception, err error)
func (*ProxySession) DeleteParticipant ¶
func (session *ProxySession) DeleteParticipant(participantID string) (exception *Exception, err error)
func (*ProxySession) GetInteractions ¶
func (session *ProxySession) GetInteractions() (response InteractionList, exception *Exception, err error)
func (*ProxySession) GetParticipant ¶
func (session *ProxySession) GetParticipant(participantID string) (response Participant, exception *Exception, err error)
func (*ProxySession) ListParticipants ¶
func (session *ProxySession) ListParticipants() (response []Participant, exception *Exception, err error)
type ProxySessionRequest ¶
type QueueResponse ¶
type SMSWebhook ¶
type SMSWebhook struct { AccountSid string `json:"AccountSid"` APIVersion string `json:"ApiVersion"` // SMS Specific Body string `json:"Body"` SmsSid string `json:"SmsSid"` MessageSid string `json:"MessageSid"` NumMedia string `json:"NumMedia"` NumSegments string `json:"NumSegments"` SmsStatus string `json:"SmsStatus"` SmsMessageSid string `json:"SmsMessageSid"` To string `json:"To"` ToCity string `json:"ToCity"` ToState string `json:"ToState"` ToZip string `json:"ToZip"` ToCountry string `json:"ToCountry"` From string `json:"From"` FromCity string `json:"FromCity"` FromState string `json:"FromState"` FromZip string `json:"FromZip"` FromCountry string `json:"FromCountry"` // The ContentTypes for the Media stored at MediaUrl{N}. // The order of MediaContentType{N} matches the order of MediaUrl{N} // Let's define 10 items to be safe MediaContentType0 string `json:"MediaContentType0"` MediaUrl0 string `json:"MediaUrl0"` MediaContentType1 string `json:"MediaContentType1"` MediaUrl1 string `json:"MediaUrl1"` MediaContentType2 string `json:"MediaContentType2"` MediaUrl2 string `json:"MediaUrl2"` MediaContentType3 string `json:"MediaContentType3"` MediaUrl3 string `json:"MediaUrl3"` MediaContentType4 string `json:"MediaContentType4"` MediaUrl4 string `json:"MediaUrl4"` MediaContentType5 string `json:"MediaContentType5"` MediaUrl5 string `json:"MediaUrl5"` MediaContentType6 string `json:"MediaContentType6"` MediaUrl6 string `json:"MediaUrl6"` MediaContentType7 string `json:"MediaContentType7"` MediaUrl7 string `json:"MediaUrl7"` MediaContentType8 string `json:"MediaContentType8"` MediaUrl8 string `json:"MediaUrl8"` MediaContentType9 string `json:"MediaContentType9"` MediaUrl9 string `json:"MediaUrl9"` MediaContentType10 string `json:"MediaContentType10"` MediaUrl10 string `json:"MediaUrl10"` }
https://www.twilio.com/docs/sms/twiml#request-parameters SMS webhooks received from inbound SMS messages. If your server (or a Twilio function) responds with valid TwiML, this will be processed. This means it is possible to send an automated text message response back.
type SmsResponse ¶
type SmsResponse struct { Sid string `json:"sid"` DateCreated string `json:"date_created"` DateUpdate string `json:"date_updated"` DateSent string `json:"date_sent"` AccountSid string `json:"account_sid"` To string `json:"to"` From string `json:"from"` NumMedia string `json:"num_media"` Body string `json:"body"` Status string `json:"status"` Direction string `json:"direction"` ApiVersion string `json:"api_version"` Price *string `json:"price,omitempty"` Url string `json:"uri"` }
SmsResponse is returned after a text/sms message is posted to Twilio
func (*SmsResponse) DateCreatedAsTime ¶
func (sms *SmsResponse) DateCreatedAsTime() (time.Time, error)
DateCreatedAsTime returns SmsResponse.DateCreated as a time.Time object instead of a string.
func (*SmsResponse) DateSentAsTime ¶
func (sms *SmsResponse) DateSentAsTime() (time.Time, error)
DateSentAsTime returns SmsResponse.DateSent as a time.Time object instead of a string.
func (*SmsResponse) DateUpdateAsTime ¶
func (sms *SmsResponse) DateUpdateAsTime() (time.Time, error)
DateUpdateAsTime returns SmsResponse.DateUpdate as a time.Time object instead of a string.
type Twilio ¶
type Twilio struct { AccountSid string AuthToken string BaseUrl string VideoUrl string LookupURL string HTTPClient *http.Client APIKeySid string APIKeySecret string }
Twilio stores basic information important for connecting to the twilio.com REST api such as AccountSid and AuthToken.
func NewTwilioClient ¶
Create a new Twilio struct.
func NewTwilioClientCustomHTTP ¶
Create a new Twilio client, optionally using a custom http.Client
func (*Twilio) AddConferenceParticipant ¶
func (twilio *Twilio) AddConferenceParticipant(conferenceSid string, participant *ConferenceParticipantOptions) (*ConferenceParticipant, *Exception, error)
AddConferenceParticipant adds a Participant to a conference by dialing out a new call https://www.twilio.com/docs/voice/api/conference-participant-resource#create-a-participant-agent-conference-only
func (*Twilio) CallUpdate ¶
func (twilio *Twilio) CallUpdate(callSid string, formValues url.Values) (*VoiceResponse, *Exception, error)
Update an existing call
func (*Twilio) CallWithApplicationCallbacks ¶
func (twilio *Twilio) CallWithApplicationCallbacks(from, to, applicationSid string) (*VoiceResponse, *Exception, error)
Place a voice call with an ApplicationSid specified.
func (*Twilio) CallWithUrlCallbacks ¶
func (twilio *Twilio) CallWithUrlCallbacks(from, to string, callbackParameters *CallbackParameters) (*VoiceResponse, *Exception, error)
Place a voice call with a list of callbacks specified.
func (*Twilio) CheckRequestSignature ¶
CheckRequestSignature checks that the X-Twilio-Signature header on a request matches the expected signature defined by the GenerateSignature function.
The baseUrl parameter will be prepended to the request URL. It is useful for specifying the protocol and host parts of the server URL hosting your endpoint.
Passing a non-POST request or a request without the X-Twilio-Signature header is an error.
func (*Twilio) CreateIncomingPhoneNumber ¶
func (twilio *Twilio) CreateIncomingPhoneNumber(options IncomingPhoneNumber) (*IncomingPhoneNumber, *Exception, error)
CreateIncomingPhoneNumber creates an IncomingPhoneNumber resource via the Twilio REST API. https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource#create-an-incomingphonenumber-resource
func (*Twilio) CreateQueue ¶
func (twilio *Twilio) CreateQueue(friendlyName string) (*QueueResponse, *Exception, error)
func (*Twilio) CreateVideoRoom ¶
func (twilio *Twilio) CreateVideoRoom(options *createRoomOptions) (videoResponse *VideoResponse, exception *Exception, err error)
CreateVideoRoom creates a video communication session for participants to connect to. See https://www.twilio.com/docs/video/api/rooms-resource for more information.
func (*Twilio) DeleteConferenceParticipant ¶
func (twilio *Twilio) DeleteConferenceParticipant(conferenceSid string, callSid string) (*Exception, error)
DeleteConferenceParticipant
func (*Twilio) DeleteIncomingPhoneNumber ¶
DeleteIncomingPhoneNumber deletes an IncomingPhoneNumber resource via the Twilio REST API. https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource#delete-an-incomingphonenumber-resource
func (*Twilio) DeleteProxyService ¶
func (*Twilio) DeleteProxySession ¶
func (*Twilio) EndVideoRoom ¶
func (twilio *Twilio) EndVideoRoom(nameOrSid string) (videoResponse *VideoResponse, exception *Exception, err error)
EndVideoRoom stops a single video session by name or by Sid, and disconnects all participants. See https://www.twilio.com/docs/video/api/rooms-resource for more information.
func (*Twilio) GenerateSignature ¶
GenerateSignature computes the Twilio signature for verifying the authenticity of a request. It is based on the specification at: https://www.twilio.com/docs/security#validating-requests
func (*Twilio) GetAvailablePhoneNumbers ¶
func (twilio *Twilio) GetAvailablePhoneNumbers(numberType PhoneNumberType, country string, options AvailablePhoneNumbersOptions) ([]*AvailablePhoneNumber, *Exception, error)
GetAvailablePhoneNumbers retrieves list of available phone numbers
func (*Twilio) GetCall ¶
func (twilio *Twilio) GetCall(sid string) (*VoiceResponse, *Exception, error)
GetCall uses Twilio to get information about a voice call. See https://www.twilio.com/docs/voice/api/call
func (*Twilio) GetConference ¶
func (twilio *Twilio) GetConference(conferenceSid string) (*Conference, *Exception, error)
GetConference fetches details for a single conference instance https://www.twilio.com/docs/voice/api/conference-resource#fetch-a-conference-resource
func (*Twilio) GetConferenceParticipant ¶
func (twilio *Twilio) GetConferenceParticipant(conferenceSid, callSid string) (*ConferenceParticipant, *Exception, error)
GetConferenceParticipant fetches details for a conference participant resource https://www.twilio.com/docs/voice/api/conference-participant-resource#fetch-a-participant-resource
func (*Twilio) GetConferenceParticipants ¶
func (twilio *Twilio) GetConferenceParticipants(conferenceSid string) ([]*ConferenceParticipant, *Exception, error)
GetConferenceParticipants fetches details for all conference participants resource https://www.twilio.com/docs/voice/api/conference-participant-resource#read-multiple-participant-resources
func (*Twilio) GetFaxes ¶
func (t *Twilio) GetFaxes(to, from, createdOnOrBefore, createdAfter string) ([]*FaxResource, *Exception, error)
GetFaxes gets faxes for a Twilio account. See https://www.twilio.com/docs/fax/api/faxes#fax-list-resource
func (*Twilio) GetIncomingPhoneNumbers ¶
func (twilio *Twilio) GetIncomingPhoneNumbers(request GetIncomingPhoneNumbersRequest) ([]*IncomingPhoneNumber, *Exception, error)
GetIncomingPhoneNumbers reads multiple IncomingPhoneNumbers from the Twilio REST API, with optional filtering https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource#read-multiple-incomingphonenumber-resources
func (*Twilio) GetProxyService ¶
func (twilio *Twilio) GetProxyService(sid string) (response *ProxyService, exception *Exception, err error)
func (*Twilio) GetProxySession ¶
func (twilio *Twilio) GetProxySession(serviceID, sessionID string) (response *ProxySession, exception *Exception, err error)
func (*Twilio) GetSMS ¶
func (twilio *Twilio) GetSMS(sid string) (smsResponse *SmsResponse, exception *Exception, err error)
GetSMS uses Twilio to get information about a text message. See https://www.twilio.com/docs/api/rest/sms for more information.
func (*Twilio) GetVideoRoom ¶
func (twilio *Twilio) GetVideoRoom(nameOrSid string) (videoResponse *VideoResponse, exception *Exception, err error)
GetVideoRoom retrievs a single video session by name or by Sid. See https://www.twilio.com/docs/video/api/rooms-resource for more information.
func (*Twilio) ListVideoRooms ¶
func (twilio *Twilio) ListVideoRooms(options *ListVideoRoomOptions) (videoResponse *ListVideoReponse, exception *Exception, err error)
ListVideoRooms returns a list of all video rooms. See https://www.twilio.com/docs/video/api/rooms-resource for more information.
func (*Twilio) LookupNoCarrier ¶
LookupNoCarrier looks up a phone number's details without the carrier
func (*Twilio) NewAccessToken ¶
func (twilio *Twilio) NewAccessToken() *AccessToken
NewAccessToken creates a new Access Token which can be used to authenticate Twilio Client SDKs for a short period of time.
func (*Twilio) NewProxyService ¶
func (twilio *Twilio) NewProxyService(service ProxyServiceRequest) (response *ProxyService, exception *Exception, err error)
Create a new Twilio Service
func (*Twilio) NewProxySession ¶
func (twilio *Twilio) NewProxySession(serviceID string, req ProxySessionRequest) (response *ProxySession, exception *Exception, err error)
Create a new Twilio Service
func (*Twilio) SendFax ¶
func (t *Twilio) SendFax(to, from, mediaUrl, quality, statusCallback string, storeMedia bool) (*FaxResource, *Exception, error)
SendFax uses Twilio to send a fax. See https://www.twilio.com/docs/fax/api/faxes#list-post for more information.
func (*Twilio) SendMMS ¶
func (twilio *Twilio) SendMMS(from, to, body string, mediaUrl []string, statusCallback, applicationSid string) (smsResponse *SmsResponse, exception *Exception, err error)
SendMMS uses Twilio to send a multimedia message.
func (*Twilio) SendMMSWithCopilot ¶
func (twilio *Twilio) SendMMSWithCopilot(messagingServiceSid, to, body string, mediaUrl []string, statusCallback, applicationSid string) (smsResponse *SmsResponse, exception *Exception, err error)
SendMMSWithCopilot uses Twilio Copilot to send a multimedia message. See https://www.twilio.com/docs/api/rest/sending-messages-copilot
func (*Twilio) SendSMS ¶
func (twilio *Twilio) SendSMS(from, to, body, statusCallback, applicationSid string, opts ...*Option) (smsResponse *SmsResponse, exception *Exception, err error)
SendSMS uses Twilio to send a text message. See http://www.twilio.com/docs/api/rest/sending-sms for more information.
func (*Twilio) SendSMSWithCopilot ¶
func (twilio *Twilio) SendSMSWithCopilot(messagingServiceSid, to, body, statusCallback, applicationSid string) (smsResponse *SmsResponse, exception *Exception, err error)
SendSMSWithCopilot uses Twilio Copilot to send a text message. See https://www.twilio.com/docs/api/rest/sending-messages-copilot
func (*Twilio) SendWhatsApp ¶
func (twilio *Twilio) SendWhatsApp(from, to, body, statusCallback, applicationSid string) (smsResponse *SmsResponse, exception *Exception, err error)
SendWhatsApp uses Twilio to send a WhatsApp message. See https://www.twilio.com/docs/sms/whatsapp/tutorial/send-and-receive-media-messages-whatsapp-python
func (*Twilio) SendWhatsAppMedia ¶
func (twilio *Twilio) SendWhatsAppMedia(from, to, body string, mediaURL []string, statusCallback, applicationSid string) (smsResponse *SmsResponse, exception *Exception, err error)
SendWhatsAppMedia uses Twilio to send a WhatsApp message with Media enabled. See https://www.twilio.com/docs/sms/whatsapp/tutorial/send-and-receive-media-messages-whatsapp-python
func (*Twilio) SubmitLookup ¶
SubmitLookup sends a lookup request populating form fields only if they contain a non-zero value.
func (*Twilio) UpdateConference ¶
func (twilio *Twilio) UpdateConference(conferenceSid string, options *ConferenceOptions) (*Conference, *Exception, error)
UpdateConference to end it or play an announcement https://www.twilio.com/docs/voice/api/conference-resource#update-a-conference-resource
func (*Twilio) UpdateConferenceParticipant ¶
func (twilio *Twilio) UpdateConferenceParticipant(conferenceSid string, callSid string, participant *ConferenceParticipantOptions) (*ConferenceParticipant, *Exception, error)
UpdateConferenceParticipant https://www.twilio.com/docs/voice/api/conference-participant-resource#create-a-participant-agent-conference-only
func (*Twilio) UpdateIncomingPhoneNumber ¶
func (twilio *Twilio) UpdateIncomingPhoneNumber(sid string, options IncomingPhoneNumber) (*IncomingPhoneNumber, *Exception, error)
UpdateIncomingPhoneNumber updates an IncomingPhoneNumber resource via the Twilio REST API. https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource#update-an-incomingphonenumber-resource
func (*Twilio) UpdateProxyService ¶
func (twilio *Twilio) UpdateProxyService(sid string, service ProxyServiceRequest) (response *ProxyService, exception *Exception, err error)
func (*Twilio) UpdateProxySession ¶
func (twilio *Twilio) UpdateProxySession(serviceID, sessionID string, req ProxySessionRequest) (response *ProxySession, exception *Exception, err error)
type UsageParameters ¶
type UsageParameters struct { Category string // Optional StartDate string // Optional, in YYYY-MM-DD or as offset EndDate string // Optional, in YYYY-MM-DD or as offset IncludeSubaccounts bool // Optional }
These are the parameters to use when you are requesting account usage. See https://www.twilio.com/docs/usage/api/usage-record#read-multiple-usagerecord-resources for more info.
type UsageRecord ¶
type UsageRecord struct { AccountSid string `json:"account_sid"` Category string `json:"category"` Description string `json:"description"` StartDate string `json:"start_date"` EndDate string `json:"end_date"` Price string `json:"price"` PriceUnit string `json:"price_unit"` Count int `json:"count,string"` CountUnit string `json:"count_unit"` Usage int `json:"usage,string"` UsageUnit string `json:"usage_unit"` }
UsageRecord specifies the usage for a particular usage category. See https://www.twilio.com/docs/usage/api/usage-record#usagerecord-properties for more info.
type UsageResponse ¶
type UsageResponse struct { PageSize int `json:"page_size"` Page int `json:"page"` UsageRecords []UsageRecord `json:"usage_records"` }
UsageResponse contains information about account usage.
type VideoCodecs ¶
type VideoCodecs string
VideoCodecs are the supported codecs when publishing a track to the room.
const ( VP8 VideoCodecs = "VP8" H264 VideoCodecs = "H264" )
type VideoGrant ¶
type VideoGrant struct {
Room string `json:"room,omitempty"`
}
VideoGrant is the permission to use the Video API which can be given to an Access Token.
func (*VideoGrant) GrantName ¶
func (g *VideoGrant) GrantName() string
GrantName is the key to identify this as a Video grant.
type VideoResponse ¶
type VideoResponse struct { AccountSid string `json:"account_sid"` DateCreated time.Time `json:"date_created"` DateUpdated time.Time `json:"date_updated"` Duration time.Duration `json:"duration"` EnableTurn bool `json:"enable_turn"` EndTime time.Time `json:"end_time"` MaxParticipants int64 `json:"max_participants"` MediaRegion MediaRegion `json:"media_region"` RecordParticipantsOnConnect bool `json:"record_participants_on_connect"` Sid string `json:"sid"` Status VideoStatus `json:"status"` StatusCallback string `json:"status_callback"` StatusCallbackMethod string `json:"status_callback_method"` Type VideoRoomType `json:"type"` UniqueName string `json:"unique_name"` URL string `json:"url"` }
VideoResponse is returned for a single room
type VideoRoomType ¶
type VideoRoomType string
VideoRoomType is how the participants connect to each other, whether peer-to-peer of routed through a TURN server.
const ( Go VideoRoomType = "go" PeerToPeer VideoRoomType = "peer-to-peer" Group VideoRoomType = "group" GroupSmall VideoRoomType = "group-small" )
type VideoStatus ¶
type VideoStatus string
VideoStatus is the status of a video room
const ( InProgress VideoStatus = "in-progress" Failed VideoStatus = "failed" Completed VideoStatus = "completed" )
type VoiceGrant ¶
type VoiceGrant struct { Incoming VoiceGrantIncoming `json:"incoming,omitempty"` Outgoing VoiceGrantOutgoing `json:"outgoing,omitempty"` EndpointID string `json:"endpoint_id,omitempty"` PushCredentialSID string `json:"push_credential_sid,omitempty"` }
VoiceGrant is the permission to use the Voice API and act as a Twilio Client.
func (VoiceGrant) GrantName ¶
func (g VoiceGrant) GrantName() string
GrantName is the key to identify this as a Voice grant.
type VoiceGrantIncoming ¶
type VoiceGrantIncoming struct {
Allow bool `json:"allow"`
}
VoiceGrantIncoming represents the incoming options for a voice grant.
type VoiceGrantOutgoing ¶
type VoiceGrantOutgoing struct { ApplicationSID string `json:"application_sid,omitempty"` Params map[string]interface{} `json:"params,omitempty"` }
VoiceGrantOutgoing represents the outgoing options for a voice grant.
type VoiceResponse ¶
type VoiceResponse struct { Sid string `json:"sid"` DateCreated string `json:"date_created"` DateUpdated string `json:"date_updated"` ParentCallSid string `json:"parent_call_sid"` AccountSid string `json:"account_sid"` To string `json:"to"` ToFormatted string `json:"to_formatted"` From string `json:"from"` FromFormatted string `json:"from_formatted"` PhoneNumberSid string `json:"phone_number_sid"` Status string `json:"status"` StartTime string `json:"start_time"` EndTime string `json:"end_time"` Duration int `json:"duration,string"` PriceUnit string `json:"price_unit"` Price *string `json:"price,omitempty"` Direction string `json:"direction"` AnsweredBy string `json:"answered_by"` ApiVersion string `json:"api_version"` Annotation string `json:"annotation"` ForwardedFrom string `json:"forwarded_from"` GroupSid string `json:"group_sid"` CallerName string `json:"caller_name"` Uri string `json:"uri"` }
VoiceResponse contains the details about successful voice calls.
func (*VoiceResponse) DateCreatedAsTime ¶
func (vr *VoiceResponse) DateCreatedAsTime() (time.Time, error)
DateCreatedAsTime returns VoiceResponse.DateCreated as a time.Time object instead of a string.
func (*VoiceResponse) DateUpdatedAsTime ¶
func (vr *VoiceResponse) DateUpdatedAsTime() (time.Time, error)
DateUpdatedAsTime returns VoiceResponse.DateUpdated as a time.Time object instead of a string.
func (*VoiceResponse) EndTimeAsTime ¶
func (vr *VoiceResponse) EndTimeAsTime() (time.Time, error)
EndTimeAsTime returns VoiceResponse.EndTime as a time.Time object instead of a string.
func (*VoiceResponse) StartTimeAsTime ¶
func (vr *VoiceResponse) StartTimeAsTime() (time.Time, error)
StartTimeAsTime returns VoiceResponse.StartTime as a time.Time object instead of a string.