/// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Address parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Address </returns>
        public static AddressResource Create(CreateAddressOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Example #2
0
 private static Request BuildCreateRequest(CreateAddressOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Addresses.json",
                postParams: options.GetParams()
                ));
 }
Example #3
0
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="customerName"> The customer_name </param>
        /// <param name="street"> The street </param>
        /// <param name="city"> The city </param>
        /// <param name="region"> The region </param>
        /// <param name="postalCode"> The postal_code </param>
        /// <param name="isoCountry"> The iso_country </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="friendlyName"> The friendly_name </param>
        /// <param name="emergencyEnabled"> The emergency_enabled </param>
        /// <param name="autoCorrectAddress"> The auto_correct_address </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Address </returns>
        public static AddressResource Create(string customerName, string street, string city, string region, string postalCode, string isoCountry, string pathAccountSid = null, string friendlyName = null, bool?emergencyEnabled = null, bool?autoCorrectAddress = null, ITwilioRestClient client = null)
        {
            var options = new CreateAddressOptions(customerName, street, city, region, postalCode, isoCountry)
            {
                PathAccountSid = pathAccountSid, FriendlyName = friendlyName, EmergencyEnabled = emergencyEnabled, AutoCorrectAddress = autoCorrectAddress
            };

            return(Create(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        ///
        /// <param name="customerName"> The customer_name </param>
        /// <param name="street"> The street </param>
        /// <param name="city"> The city </param>
        /// <param name="region"> The region </param>
        /// <param name="postalCode"> The postal_code </param>
        /// <param name="isoCountry"> The iso_country </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="friendlyName"> The friendly_name </param>
        /// <param name="emergencyEnabled"> The emergency_enabled </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Address </returns>
        public static async System.Threading.Tasks.Task <AddressResource> CreateAsync(string customerName, string street, string city, string region, string postalCode, string isoCountry, string pathAccountSid = null, string friendlyName = null, bool?emergencyEnabled = null, ITwilioRestClient client = null)
        {
            var options = new CreateAddressOptions(customerName, street, city, region, postalCode, isoCountry)
            {
                PathAccountSid = pathAccountSid, FriendlyName = friendlyName, EmergencyEnabled = emergencyEnabled
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create Address parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Address </returns>
        public static async System.Threading.Tasks.Task <AddressResource> CreateAsync(CreateAddressOptions options,
                                                                                      ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }