/// <summary> /// List addresses on the current account, with filters. /// </summary> /// <param name="options">Filters to pass into the list request</param> /// <param name="callback">Method to call upon successful completion</param> public virtual void ListAddresses(AddressListRequest options, Action<AddressResult> callback) { var request = new RestRequest(); request.Resource = "Accounts/{AccountSid}/Addresses.json"; AddAddressListOptions(options, request); ExecuteAsync<AddressResult>(request, (response) => { callback(response); }); }
/// <summary> /// List addresses on the current account, with filters. /// </summary> /// <param name="options">Filters to pass into the list request</param> /// <param name="callback">Method to call upon successful completion</param> public virtual void ListAddresses(AddressListRequest options, Action <AddressResult> callback) { var request = new RestRequest(); request.Resource = "Accounts/{AccountSid}/Addresses.json"; AddAddressListOptions(options, request); ExecuteAsync <AddressResult>(request, (response) => { callback(response); }); }
/// <summary> /// List Addresses on the current account, with filters. /// </summary> /// <param name="options">Filters to be applied to the request.</param> public virtual async Task<AddressResult> ListAddressesAsync(AddressListRequest options) { var request = new RestRequest(); request.Resource = "Accounts/{AccountSid}/Addresses.json"; AddAddressListOptions(options, request); return await Execute<AddressResult>(request); }
/// <summary> /// List Addresses on the current account, with filters. /// </summary> /// <param name="options">Filters to be applied to the request.</param> public virtual AddressResult ListAddresses(AddressListRequest options) { var request = new RestRequest(); request.Resource = "Accounts/{AccountSid}/Addresses.json"; AddAddressListOptions(options, request); return(Execute <AddressResult>(request)); }
static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/user/account string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; string AuthToken = "your_auth_token"; var twilio = new TwilioRestClient(AccountSid, AuthToken); var options = new AddressListRequest(); options.CustomerName = "Customer 123"; var addresses = twilio.ListAddresses(options); foreach (var address in addresses.Addresses) { Console.WriteLine(address.FriendlyName); } }
private void AddAddressListOptions(AddressListRequest options, RestRequest request) { if (options.CustomerName.HasValue()) { request.AddParameter("CustomerName", options.CustomerName); } if (options.FriendlyName.HasValue()) { request.AddParameter("FriendlyName", options.FriendlyName); } if (options.IsoCountry.HasValue()) { request.AddParameter("IsoCountry", options.IsoCountry); } if (options.Page.HasValue) { request.AddParameter("Page", options.Page); } if (options.PageSize.HasValue) { request.AddParameter("PageSize", options.PageSize); } }
private void AddAddressListOptions(AddressListRequest options, RestRequest request) { if (options.CustomerName.HasValue()) request.AddParameter("CustomerName", options.CustomerName); if (options.FriendlyName.HasValue()) request.AddParameter("FriendlyName", options.FriendlyName); if (options.IsoCountry.HasValue()) request.AddParameter("IsoCountry", options.IsoCountry); if (options.Page.HasValue) request.AddParameter("Page", options.Page); if (options.PageSize.HasValue) request.AddParameter("PageSize", options.PageSize); }
public ActionResult ListAddress() { var twilio = new TwilioRestClient(AccountSid, AuthToken); var options = new AddressListRequest(); var listAddress = twilio.ListAddresses(options); return View(listAddress); }