/// <summary>
        /// Delete a specific Phone Number from the Service.
        /// </summary>
        /// <param name="options"> Delete PhoneNumber parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of PhoneNumber </returns>
        public static bool Delete(DeletePhoneNumberOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildDeleteRequest(options, client));

            return(response.StatusCode == System.Net.HttpStatusCode.NoContent);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Delete a specific Phone Number.
        /// </summary>
        ///
        /// <param name="options"> Delete PhoneNumber parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of PhoneNumber </returns>
        public static async System.Threading.Tasks.Task <bool> DeleteAsync(DeletePhoneNumberOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildDeleteRequest(options, client));

            return(response.StatusCode == System.Net.HttpStatusCode.NoContent);
        }
        /// <summary>
        /// Delete a specific Phone Number from the Service.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathSid"> A string that uniquely identifies this Phone Number. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of PhoneNumber </returns>
        public static async System.Threading.Tasks.Task <bool> DeleteAsync(string pathServiceSid,
                                                                           string pathSid,
                                                                           ITwilioRestClient client = null)
        {
            var options = new DeletePhoneNumberOptions(pathServiceSid, pathSid);

            return(await DeleteAsync(options, client));
        }
 private static Request BuildDeleteRequest(DeletePhoneNumberOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Delete,
                Rest.Domain.Proxy,
                "/v1/Services/" + options.PathServiceSid + "/PhoneNumbers/" + options.PathSid + "",
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Delete a specific Phone Number from the Service.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathSid"> A string that uniquely identifies this Phone Number. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of PhoneNumber </returns>
        public static bool Delete(string pathServiceSid, string pathSid, ITwilioRestClient client = null)
        {
            var options = new DeletePhoneNumberOptions(pathServiceSid, pathSid);

            return(Delete(options, client));
        }