/// <summary>
        /// Retrieve a list of payloads belonging to the Add-on result
        /// </summary>
        ///
        /// <param name="pathReferenceSid"> The reference_sid </param>
        /// <param name="pathAddOnResultSid"> The add_on_result_sid </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="pageSize"> Page size </param>
        /// <param name="limit"> Record limit </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 <ResourceSet <PayloadResource> > ReadAsync(string pathReferenceSid, string pathAddOnResultSid, string pathAccountSid = null, int?pageSize = null, long?limit = null, ITwilioRestClient client = null)
        {
            var options = new ReadPayloadOptions(pathReferenceSid, pathAddOnResultSid)
            {
                PathAccountSid = pathAccountSid, PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
        /// <summary>
        /// Retrieve a list of payloads belonging to the Add-on result
        /// </summary>
        ///
        /// <param name="pathReferenceSid"> The reference_sid </param>
        /// <param name="pathAddOnResultSid"> The add_on_result_sid </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="pageSize"> Page size </param>
        /// <param name="limit"> Record limit </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Payload </returns>
        public static ResourceSet <PayloadResource> Read(string pathReferenceSid, string pathAddOnResultSid, string pathAccountSid = null, int?pageSize = null, long?limit = null, ITwilioRestClient client = null)
        {
            var options = new ReadPayloadOptions(pathReferenceSid, pathAddOnResultSid)
            {
                PathAccountSid = pathAccountSid, PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
        /// <summary>
        /// Retrieve a list of payloads belonging to the Add-on result
        /// </summary>
        ///
        /// <param name="options"> Read Payload parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Payload </returns>
        public static ResourceSet <PayloadResource> Read(ReadPayloadOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <PayloadResource> .FromJson("payloads", response.Content);

            return(new ResourceSet <PayloadResource>(page, options, client));
        }
 private static Request BuildReadRequest(ReadPayloadOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Recordings/" + options.PathReferenceSid + "/AddOnResults/" + options.PathAddOnResultSid + "/Payloads.json",
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Retrieve a list of payloads belonging to the Add-on result
        /// </summary>
        ///
        /// <param name="options"> Read 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 <ResourceSet <PayloadResource> > ReadAsync(ReadPayloadOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <PayloadResource> .FromJson("payloads", response.Content);

            return(new ResourceSet <PayloadResource>(page, options, client));
        }