Ejemplo n.º 1
0
        /// <summary>
        /// Update an Address. All attributes of the address except for the IsoCountry can be updated.
        /// </summary>
        /// <returns>Updated Address object.</returns>
        /// <param name="addressSid">The sid of the Address to update.</param>
        /// <param name="options">Which properties to update. Only properties with values set will be updated.</param>
        public virtual Address UpdateAddress(string addressSid, AddressOptions options)
        {
            Require.Argument("AddressSid", addressSid);
            var request = new RestRequest(Method.POST);

            request.Resource = "Accounts/{AccountSid}/Addresses/{AddressSid}.json";
            request.AddUrlSegment("AddressSid", addressSid);

            if (options.FriendlyName.HasValue())
            {
                request.AddParameter("FriendlyName", options.FriendlyName);
            }
            if (options.CustomerName.HasValue())
            {
                request.AddParameter("CustomerName", options.CustomerName);
            }
            if (options.Street.HasValue())
            {
                request.AddParameter("Street", options.Street);
            }
            if (options.City.HasValue())
            {
                request.AddParameter("City", options.City);
            }
            if (options.Region.HasValue())
            {
                request.AddParameter("Region", options.Region);
            }
            if (options.PostalCode.HasValue())
            {
                request.AddParameter("PostalCode", options.PostalCode);
            }

            return(Execute <Address>(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 AddressOptions();
        options.CustomerName = "Customer 456";
        options.Street = "2 Hasselhoff Lane";

        twilio.UpdateAddress("AD2a0747eba6abf96b7e3c3ff0b4530f6e", options);
    }
    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 AddressOptions();
        options.CustomerName = "Customer 456";
        options.Street = "2 Hasselhoff Lane";

        var address = twilio.AddAddress("Billing - Customer 123", "Customer 123", "2 Hasselhoff Lane", "Berlin", "Berlin", "10785", "DE");

        Console.WriteLine(address.Sid);
    }
Ejemplo n.º 4
0
        public ActionResult EditAddress(Twilio.Address _address)
        {
            var twilio = new TwilioRestClient(AccountSid, AuthToken);
              var options = new AddressOptions();

              options.City = _address.City;
              options.CustomerName = _address.CustomerName;
              options.FriendlyName = _address.FriendlyName;
              options.PostalCode = _address.PostalCode;
              options.Region = _address.Region;
              options.Street = _address.Street;

              var response = twilio.UpdateAddress(_address.Sid, options);

              return RedirectToAction("ListAddress");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Update an Address. All attributes of the address except for the IsoCountry can be updated.
        /// </summary>
        /// <returns>Updated Address object.</returns>
        /// <param name="addressSid">The sid of the Address to update.</param>
        /// <param name="options">Which properties to update. Only properties with values set will be updated.</param>
        public virtual Address UpdateAddress(string addressSid, AddressOptions options)
        {
            Require.Argument("AddressSid", addressSid);
            var request = new RestRequest(Method.POST);
            request.Resource = "Accounts/{AccountSid}/Addresses/{AddressSid}.json";
            request.AddUrlSegment("AddressSid", addressSid);

            if (options.FriendlyName.HasValue())
                request.AddParameter("FriendlyName", options.FriendlyName);
            if (options.CustomerName.HasValue())
                request.AddParameter("CustomerName", options.CustomerName);
            if (options.Street.HasValue())
                request.AddParameter("Street", options.Street);
            if (options.City.HasValue())
                request.AddParameter("City", options.City);
            if (options.Region.HasValue())
                request.AddParameter("Region", options.Region);
            if (options.PostalCode.HasValue())
                request.AddParameter("PostalCode", options.PostalCode);

            return Execute<Address>(request);
        }