/// <summary>
        /// Update an incoming-phone-number instance
        /// </summary>
        ///
        /// <param name="options"> Update IncomingPhoneNumber parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of IncomingPhoneNumber </returns>
        public static IncomingPhoneNumberResource Update(UpdateIncomingPhoneNumberOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildUpdateRequest(options, client));

            return(FromJson(response.Content));
        }
        /// <summary>
        /// Update an incoming-phone-number instance
        /// </summary>
        ///
        /// <param name="pathSid"> The sid </param>
        /// <param name="pathAccountSid"> The new owner of the phone number </param>
        /// <param name="accountSid"> The new owner of the phone number </param>
        /// <param name="apiVersion"> The Twilio REST API version to use </param>
        /// <param name="friendlyName"> A human readable description of this resource </param>
        /// <param name="smsApplicationSid"> Unique string that identifies the application </param>
        /// <param name="smsFallbackMethod"> HTTP method used with sms fallback url </param>
        /// <param name="smsFallbackUrl"> URL Twilio will request if an error occurs in executing TwiML </param>
        /// <param name="smsMethod"> HTTP method to use with sms url </param>
        /// <param name="smsUrl"> URL Twilio will request when receiving an SMS </param>
        /// <param name="statusCallback"> URL Twilio will use to pass status parameters </param>
        /// <param name="statusCallbackMethod"> HTTP method twilio will use with status callback </param>
        /// <param name="voiceApplicationSid"> The unique sid of the application to handle this number </param>
        /// <param name="voiceCallerIdLookup"> Look up the caller's caller-ID </param>
        /// <param name="voiceFallbackMethod"> HTTP method used with fallback_url </param>
        /// <param name="voiceFallbackUrl"> URL Twilio will request when an error occurs in TwiML </param>
        /// <param name="voiceMethod"> HTTP method used with the voice url </param>
        /// <param name="voiceUrl"> URL Twilio will request when receiving a call </param>
        /// <param name="emergencyStatus"> The emergency_status </param>
        /// <param name="emergencyAddressSid"> The emergency_address_sid </param>
        /// <param name="trunkSid"> Unique string to identify the trunk </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of IncomingPhoneNumber </returns>
        public static async System.Threading.Tasks.Task <IncomingPhoneNumberResource> UpdateAsync(string pathSid, string pathAccountSid = null, string accountSid = null, string apiVersion = null, string friendlyName = null, string smsApplicationSid = null, Twilio.Http.HttpMethod smsFallbackMethod = null, Uri smsFallbackUrl = null, Twilio.Http.HttpMethod smsMethod = null, Uri smsUrl = null, Uri statusCallback = null, Twilio.Http.HttpMethod statusCallbackMethod = null, string voiceApplicationSid = null, bool?voiceCallerIdLookup = null, Twilio.Http.HttpMethod voiceFallbackMethod = null, Uri voiceFallbackUrl = null, Twilio.Http.HttpMethod voiceMethod = null, Uri voiceUrl = null, IncomingPhoneNumberResource.EmergencyStatusEnum emergencyStatus = null, string emergencyAddressSid = null, string trunkSid = null, ITwilioRestClient client = null)
        {
            var options = new UpdateIncomingPhoneNumberOptions(pathSid)
            {
                PathAccountSid = pathAccountSid, AccountSid = accountSid, ApiVersion = apiVersion, FriendlyName = friendlyName, SmsApplicationSid = smsApplicationSid, SmsFallbackMethod = smsFallbackMethod, SmsFallbackUrl = smsFallbackUrl, SmsMethod = smsMethod, SmsUrl = smsUrl, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, VoiceApplicationSid = voiceApplicationSid, VoiceCallerIdLookup = voiceCallerIdLookup, VoiceFallbackMethod = voiceFallbackMethod, VoiceFallbackUrl = voiceFallbackUrl, VoiceMethod = voiceMethod, VoiceUrl = voiceUrl, EmergencyStatus = emergencyStatus, EmergencyAddressSid = emergencyAddressSid, TrunkSid = trunkSid
            };

            return(await UpdateAsync(options, client));
        }
 private static Request BuildUpdateRequest(UpdateIncomingPhoneNumberOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/IncomingPhoneNumbers/" + options.PathSid + ".json",
                client.Region,
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Update an incoming-phone-number instance
        /// </summary>
        ///
        /// <param name="options"> Update IncomingPhoneNumber parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of IncomingPhoneNumber </returns>
        public static async System.Threading.Tasks.Task <IncomingPhoneNumberResource> UpdateAsync(UpdateIncomingPhoneNumberOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildUpdateRequest(options, client));

            return(FromJson(response.Content));
        }