/// <summary>
        /// Delete a payload from the result along with all associated Data
        /// </summary>
        ///
        /// <param name="options"> Delete Payload parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Payload </returns>
        public static bool Delete(DeletePayloadOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildDeleteRequest(options, client));

            return(response.StatusCode == System.Net.HttpStatusCode.NoContent);
        }
        /// <summary>
        /// Delete a payload from the result along with all associated Data
        /// </summary>
        ///
        /// <param name="options"> Delete Payload parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Payload </returns>
        public static async System.Threading.Tasks.Task <bool> DeleteAsync(DeletePayloadOptions 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 payload from the result along with all associated Data
        /// </summary>
        ///
        /// <param name="pathReferenceSid"> The reference_sid </param>
        /// <param name="pathAddOnResultSid"> The add_on_result_sid </param>
        /// <param name="pathSid"> Delete by unique payload 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 Payload </returns>
        public static async System.Threading.Tasks.Task <bool> DeleteAsync(string pathReferenceSid, string pathAddOnResultSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new DeletePayloadOptions(pathReferenceSid, pathAddOnResultSid, pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(await DeleteAsync(options, client));
        }
        /// <summary>
        /// Delete a payload from the result along with all associated Data
        /// </summary>
        ///
        /// <param name="pathReferenceSid"> The reference_sid </param>
        /// <param name="pathAddOnResultSid"> The add_on_result_sid </param>
        /// <param name="pathSid"> Delete by unique payload Sid </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Payload </returns>
        public static bool Delete(string pathReferenceSid, string pathAddOnResultSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new DeletePayloadOptions(pathReferenceSid, pathAddOnResultSid, pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(Delete(options, client));
        }
 private static Request BuildDeleteRequest(DeletePayloadOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Delete,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Recordings/" + options.PathReferenceSid + "/AddOnResults/" + options.PathAddOnResultSid + "/Payloads/" + options.PathSid + ".json",
                queryParams: options.GetParams()
                ));
 }