C# Class Twilio.TwilioRestClient

Show file Open project: twilio/twilio-csharp Class Usage Examples

Public Methods

Method Description
DeleteCall ( string callSid ) : DeleteStatus

Deletes the single Call resource identified by {callSid}.

DeleteCall ( string callSid, Action callback ) : void

Deletes a single Call resource identified by {CallSid}.

GetCall ( string callSid ) : Call

Returns the single Call resource identified by {CallSid} Makes a GET request to a Call Instance resource.

GetCall ( string callSid, Action callback ) : void

Returns the single Call resource identified by {CallSid}

GetCallAsync ( string callSid ) : IAsyncOperation

Returns the single Call resource identified by {CallSid} Makes a GET request to a Call Instance resource.

HangupCall ( string callSid, HangupStyle style ) : Call

Hangs up a call in progress. Makes a POST request to a Call Instance resource.

HangupCall ( string callSid, HangupStyle style, Action callback ) : void

Hangs up a call in progress.

HangupCallAsync ( string callSid, HangupStyle style ) : IAsyncOperation

Hangs up a call in progress. Makes a POST request to a Call Instance resource.

InitiateOutboundCall ( CallOptions options ) : Call

Initiates a new phone call. Makes a POST request to the Calls List resource.

InitiateOutboundCall ( string from, string to, string url ) : Call

Initiates a new phone call. Makes a POST request to the Calls List resource.

InitiateOutboundCall ( string from, string to, string url, string statusCallback ) : Call

Initiates a new phone call. Makes a POST request to the Calls List resource.

InitiateOutboundCall ( CallOptions options, Action callback ) : void

Initiates a new phone call.

InitiateOutboundCall ( string from, string to, string url, Action callback ) : void

Initiates a new phone call.

InitiateOutboundCall ( string from, string to, string url, string statusCallback, Action callback ) : void

Initiates a new phone call.

InitiateOutboundCallAsync ( CallOptions options ) : IAsyncOperation

Initiates a new phone call. Makes a POST request to the Calls List resource.

InitiateOutboundCallAsync ( string from, string to, string url ) : IAsyncOperation

Initiates a new phone call. Makes a POST request to the Calls List resource.

InitiateOutboundCallAsync ( string from, string to, string url, string statusCallback ) : IAsyncOperation

Initiates a new phone call. Makes a POST request to the Calls List resource.

ListCalls ( ) : CallResult

Returns a paged list of phone calls made to and from the account. Makes a GET request to the Calls List resource.

ListCalls ( CallListRequest options ) : CallResult

Returns a paged list of phone calls made to and from the account. Makes a GET request to the Calls List resource.

ListCalls ( string To ) : CallResult

Returns a paged list of phone calls made to and from the account. Makes a GET request to the Calls List resource.

ListCalls ( Action callback ) : void

Returns a paged list of phone calls made to and from the account. Sorted by DateUpdated with most-recent calls first.

ListCalls ( CallListRequest options, Action callback ) : void

Returns a paged list of phone calls made to and from the account. Sorted by DateUpdated with most-recent calls first.

ListCallsAsync ( ) : IAsyncOperation

Returns a paged list of phone calls made to and from the account. Sorted by DateUpdated with most-recent calls first. Makes a GET request to the Calls List resource.

ListCallsAsync ( CallListRequest options ) : IAsyncOperation

Returns a paged list of phone calls made to and from the account. Sorted by DateUpdated with most-recent calls first. Makes a GET request to the Calls List resource.

RedirectCall ( string callSid, CallOptions options ) : Call

Redirect a call in progress to a new TwiML URL. Makes a POST request to a Call Instance resource.

RedirectCall ( string callSid, string redirectUrl, string redirectMethod ) : Call

Redirect a call in progress to a new TwiML URL. Makes a POST request to a Call Instance resource.

RedirectCall ( string callSid, CallOptions options, Action callback ) : void

Redirect a call in progress to a new TwiML URL. Makes a POST request to a Call Instance resource.

RedirectCall ( string callSid, string redirectUrl, string redirectMethod, Action callback ) : void

Redirect a call in progress to a new TwiML URL. Makes a POST request to a Call Instance resource.

RedirectCallAsync ( string callSid, string redirectUrl, string redirectMethod ) : IAsyncOperation

Redirect a call in progress to a new TwiML URL. Makes a POST request to a Call Instance resource.

Private Methods

Method Description
AddCallListOptions ( Twilio.CallListRequest options, RestRequest request ) : void
AddCallOptions ( CallOptions options, RestRequest request ) : void
GetCallAsyncInternal ( string callSid ) : Task
HangupCallAsyncInternal ( string callSid, HangupStyle style ) : Task
InitiateOutboundCallAsyncInternal ( CallOptions options ) : Task
ListCallsAsyncInternal ( ) : Task
ListCallsAsyncInternal ( CallListRequest options ) : Task
RedirectCallAsyncInternal ( string callSid, string redirectUrl, string redirectMethod ) : Task

Method Details

DeleteCall() public method

Deletes the single Call resource identified by {callSid}.
public DeleteCall ( string callSid ) : DeleteStatus
callSid string The Sid of the Call resource to delete.
return DeleteStatus

DeleteCall() public method

Deletes a single Call resource identified by {CallSid}.
public DeleteCall ( string callSid, Action callback ) : void
callSid string The Sid of the Call resource to delete.
callback Action Method to call upon completion.
return void

GetCall() public method

Returns the single Call resource identified by {CallSid} Makes a GET request to a Call Instance resource.
public GetCall ( string callSid ) : Call
callSid string The Sid of the Call resource to retrieve
return Call

GetCall() public method

Returns the single Call resource identified by {CallSid}
public GetCall ( string callSid, Action callback ) : void
callSid string The Sid of the Call resource to retrieve
callback Action Method to call upon successful completion
return void

GetCallAsync() public method

Returns the single Call resource identified by {CallSid} Makes a GET request to a Call Instance resource.
public GetCallAsync ( string callSid ) : IAsyncOperation
callSid string The Sid of the Call resource to retrieve
return IAsyncOperation

HangupCall() public method

Hangs up a call in progress. Makes a POST request to a Call Instance resource.
public HangupCall ( string callSid, HangupStyle style ) : Call
callSid string The Sid of the call to hang up.
style HangupStyle 'Canceled' will attempt to hangup calls that are queued or ringing but not affect calls already in progress. 'Completed' will attempt to hang up a call even if it's already in progress.
return Call

HangupCall() public method

Hangs up a call in progress.
public HangupCall ( string callSid, HangupStyle style, Action callback ) : void
callSid string The Sid of the call to hang up.
style HangupStyle 'Canceled' will attempt to hangup calls that are queued or ringing but not affect calls already in progress. 'Completed' will attempt to hang up a call even if it's already in progress.
callback Action Method to call upon successful completion
return void

HangupCallAsync() public method

Hangs up a call in progress. Makes a POST request to a Call Instance resource.
public HangupCallAsync ( string callSid, HangupStyle style ) : IAsyncOperation
callSid string The Sid of the call to hang up.
style HangupStyle 'Canceled' will attempt to hangup calls that are queued or ringing but not affect calls already in progress. 'Completed' will attempt to hang up a call even if it's already in progress.
return IAsyncOperation

InitiateOutboundCall() public method

Initiates a new phone call. Makes a POST request to the Calls List resource.
public InitiateOutboundCall ( CallOptions options ) : Call
options CallOptions Call settings. Only properties with values set will be used.
return Call

InitiateOutboundCall() public method

Initiates a new phone call. Makes a POST request to the Calls List resource.
public InitiateOutboundCall ( string from, string to, string url ) : Call
from string The phone number to use as the caller id. Format with a '+' and country code e.g., +16175551212 (E.164 format). Must be a Twilio number or a valid outgoing caller id for your account.
to string The number to call formatted with a '+' and country code e.g., +16175551212 (E.164 format). Twilio will also accept unformatted US numbers e.g., (415) 555-1212, 415-555-1212.
url string The fully qualified URL that should be consulted when the call connects. Just like when you set a URL for your inbound calls. URL should return TwiML.
return Call

InitiateOutboundCall() public method

Initiates a new phone call. Makes a POST request to the Calls List resource.
public InitiateOutboundCall ( string from, string to, string url, string statusCallback ) : Call
from string The phone number to use as the caller id. Format with a '+' and country code e.g., +16175551212 (E.164 format). Must be a Twilio number or a valid outgoing caller id for your account.
to string The number to call formatted with a '+' and country code e.g., +16175551212 (E.164 format). Twilio will also accept unformatted US numbers e.g., (415) 555-1212, 415-555-1212.
url string The fully qualified URL that should be consulted when the call connects. Just like when you set a URL for your inbound calls. URL should return TwiML.
statusCallback string A URL that Twilio will request when the call ends to notify your app.
return Call

InitiateOutboundCall() public method

Initiates a new phone call.
public InitiateOutboundCall ( CallOptions options, Action callback ) : void
options CallOptions Call settings. Only properties with values set will be used.
callback Action Method to call upon successful completion
return void

InitiateOutboundCall() public method

Initiates a new phone call.
public InitiateOutboundCall ( string from, string to, string url, Action callback ) : void
from string The phone number to use as the caller id. Format with a '+' and country code e.g., +16175551212 (E.164 format). Must be a Twilio number or a valid outgoing caller id for your account.
to string The number to call formatted with a '+' and country code e.g., +16175551212 (E.164 format). Twilio will also accept unformatted US numbers e.g., (415) 555-1212, 415-555-1212.
url string The fully qualified URL that should be consulted when the call connects. Just like when you set a URL for your inbound calls. URL should return TwiML.
callback Action Method to call upon successful completion
return void

InitiateOutboundCall() public method

Initiates a new phone call.
public InitiateOutboundCall ( string from, string to, string url, string statusCallback, Action callback ) : void
from string The phone number to use as the caller id. Format with a '+' and country code e.g., +16175551212 (E.164 format). Must be a Twilio number or a valid outgoing caller id for your account.
to string The number to call formatted with a '+' and country code e.g., +16175551212 (E.164 format). Twilio will also accept unformatted US numbers e.g., (415) 555-1212, 415-555-1212.
url string The fully qualified URL that should be consulted when the call connects. Just like when you set a URL for your inbound calls. URL should return TwiML.
statusCallback string A URL that Twilio will request when the call ends to notify your app.
callback Action Method to call upon successful completion
return void

InitiateOutboundCallAsync() public method

Initiates a new phone call. Makes a POST request to the Calls List resource.
public InitiateOutboundCallAsync ( CallOptions options ) : IAsyncOperation
options CallOptions Call settings. Only properties with values set will be used.
return IAsyncOperation

InitiateOutboundCallAsync() public method

Initiates a new phone call. Makes a POST request to the Calls List resource.
public InitiateOutboundCallAsync ( string from, string to, string url ) : IAsyncOperation
from string The phone number to use as the caller id. Format with a '+' and country code e.g., +16175551212 (E.164 format). Must be a Twilio number or a valid outgoing caller id for your account.
to string The number to call formatted with a '+' and country code e.g., +16175551212 (E.164 format). Twilio will also accept unformatted US numbers e.g., (415) 555-1212, 415-555-1212.
url string The fully qualified URL that should be consulted when the call connects. Just like when you set a URL for your inbound calls. URL should return TwiML.
return IAsyncOperation

InitiateOutboundCallAsync() public method

Initiates a new phone call. Makes a POST request to the Calls List resource.
public InitiateOutboundCallAsync ( string from, string to, string url, string statusCallback ) : IAsyncOperation
from string The phone number to use as the caller id. Format with a '+' and country code e.g., +16175551212 (E.164 format). Must be a Twilio number or a valid outgoing caller id for your account.
to string The number to call formatted with a '+' and country code e.g., +16175551212 (E.164 format). Twilio will also accept unformatted US numbers e.g., (415) 555-1212, 415-555-1212.
url string The fully qualified URL that should be consulted when the call connects. Just like when you set a URL for your inbound calls. URL should return TwiML.
statusCallback string A URL that Twilio will request when the call ends to notify your app.
return IAsyncOperation

ListCalls() public method

Returns a paged list of phone calls made to and from the account. Makes a GET request to the Calls List resource.
public ListCalls ( ) : CallResult
return CallResult

ListCalls() public method

Returns a paged list of phone calls made to and from the account. Makes a GET request to the Calls List resource.
public ListCalls ( CallListRequest options ) : CallResult
options CallListRequest List filter options. If an property is set the list will be filtered by that value.
return CallResult

ListCalls() public method

Returns a paged list of phone calls made to and from the account. Makes a GET request to the Calls List resource.
public ListCalls ( string To ) : CallResult
To string
return CallResult

ListCalls() public method

Returns a paged list of phone calls made to and from the account. Sorted by DateUpdated with most-recent calls first.
public ListCalls ( Action callback ) : void
callback Action Method to call upon successful completion
return void

ListCalls() public method

Returns a paged list of phone calls made to and from the account. Sorted by DateUpdated with most-recent calls first.
public ListCalls ( CallListRequest options, Action callback ) : void
options CallListRequest List filter options. If an property is set the list will be filtered by that value.
callback Action Method to call upon successful completion
return void

ListCallsAsync() public method

Returns a paged list of phone calls made to and from the account. Sorted by DateUpdated with most-recent calls first. Makes a GET request to the Calls List resource.
public ListCallsAsync ( ) : IAsyncOperation
return IAsyncOperation

ListCallsAsync() public method

Returns a paged list of phone calls made to and from the account. Sorted by DateUpdated with most-recent calls first. Makes a GET request to the Calls List resource.
public ListCallsAsync ( CallListRequest options ) : IAsyncOperation
options CallListRequest List filter options. If an property is set the list will be filtered by that value.
return IAsyncOperation

RedirectCall() public method

Redirect a call in progress to a new TwiML URL. Makes a POST request to a Call Instance resource.
public RedirectCall ( string callSid, CallOptions options ) : Call
callSid string The Sid of the call to redirect
options CallOptions Call settings. Only Url, Method, FallbackUrl, FallbackMethod, StatusCallback and StatusCallbackMethod properties with values set will be used.
return Call

RedirectCall() public method

Redirect a call in progress to a new TwiML URL. Makes a POST request to a Call Instance resource.
public RedirectCall ( string callSid, string redirectUrl, string redirectMethod ) : Call
callSid string The Sid of the call to redirect
redirectUrl string The URL to redirect the call to.
redirectMethod string The HTTP method to use when requesting the redirectUrl
return Call

RedirectCall() public method

Redirect a call in progress to a new TwiML URL. Makes a POST request to a Call Instance resource.
public RedirectCall ( string callSid, CallOptions options, Action callback ) : void
callSid string The Sid of the call to redirect
options CallOptions Call settings. Only Url, Method, FallbackUrl, FallbackMethod, StatusCallback and StatusCallbackMethod properties with values set will be used.
callback Action Method to call upon successful completion
return void

RedirectCall() public method

Redirect a call in progress to a new TwiML URL. Makes a POST request to a Call Instance resource.
public RedirectCall ( string callSid, string redirectUrl, string redirectMethod, Action callback ) : void
callSid string The Sid of the call to redirect
redirectUrl string The URL to redirect the call to.
redirectMethod string The HTTP method to use when requesting the redirectUrl
callback Action Method to call upon successful completion
return void

RedirectCallAsync() public method

Redirect a call in progress to a new TwiML URL. Makes a POST request to a Call Instance resource.
public RedirectCallAsync ( string callSid, string redirectUrl, string redirectMethod ) : IAsyncOperation
callSid string The Sid of the call to redirect
redirectUrl string The URL to redirect the call to.
redirectMethod string The HTTP method to use when requesting the redirectUrl
return IAsyncOperation