Beispiel #1
0
        /// <summary>
        /// Delete media from your account. Once delete, you will no longer be billed
        /// </summary>
        /// <param name="options"> Delete Media parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Media </returns>
        public static bool Delete(DeleteMediaOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildDeleteRequest(options, client));

            return(response.StatusCode == System.Net.HttpStatusCode.NoContent);
        }
        /// <summary>
        /// Delete media from your account. Once delete, you will no longer be billed
        /// </summary>
        ///
        /// <param name="options"> Delete Media parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Media </returns>
        public static async System.Threading.Tasks.Task <bool> DeleteAsync(DeleteMediaOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildDeleteRequest(options, client));

            return(response.StatusCode == System.Net.HttpStatusCode.NoContent);
        }
Beispiel #3
0
 private static Request BuildDeleteRequest(DeleteMediaOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Delete,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Messages/" + options.PathMessageSid + "/Media/" + options.PathSid + ".json",
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Delete media from your account. Once delete, you will no longer be billed
        /// </summary>
        ///
        /// <param name="pathMessageSid"> The message_sid </param>
        /// <param name="pathSid"> Delete by unique media Sid </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Media </returns>
        public static async System.Threading.Tasks.Task <bool> DeleteAsync(string pathMessageSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new DeleteMediaOptions(pathMessageSid, pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(await DeleteAsync(options, client));
        }
        /// <summary>
        /// Delete media from your account. Once delete, you will no longer be billed
        /// </summary>
        ///
        /// <param name="pathMessageSid"> The message_sid </param>
        /// <param name="pathSid"> Delete by unique media Sid </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Media </returns>
        public static bool Delete(string pathMessageSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new DeleteMediaOptions(pathMessageSid, pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(Delete(options, client));
        }