Example #1
0
        /// <summary>
        /// Fetch an instance of a result payload
        /// </summary>
        ///
        /// <param name="options"> Fetch Payload parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Payload </returns>
        public static PayloadResource Fetch(FetchPayloadOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
Example #2
0
        /// <summary>
        /// Fetch an instance of a result payload
        /// </summary>
        ///
        /// <param name="options"> Fetch 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 <PayloadResource> FetchAsync(FetchPayloadOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
Example #3
0
        /// <summary>
        /// Fetch an instance of a result payload
        /// </summary>
        ///
        /// <param name="pathReferenceSid"> The reference_sid </param>
        /// <param name="pathAddOnResultSid"> The add_on_result_sid </param>
        /// <param name="pathSid"> Fetch 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 <PayloadResource> FetchAsync(string pathReferenceSid, string pathAddOnResultSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new FetchPayloadOptions(pathReferenceSid, pathAddOnResultSid, pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(await FetchAsync(options, client));
        }
Example #4
0
        /// <summary>
        /// Fetch an instance of a result payload
        /// </summary>
        ///
        /// <param name="pathReferenceSid"> The reference_sid </param>
        /// <param name="pathAddOnResultSid"> The add_on_result_sid </param>
        /// <param name="pathSid"> Fetch 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 PayloadResource Fetch(string pathReferenceSid, string pathAddOnResultSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new FetchPayloadOptions(pathReferenceSid, pathAddOnResultSid, pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(Fetch(options, client));
        }
 private static Request BuildFetchRequest(FetchPayloadOptions 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/" + options.PathSid + ".json",
                queryParams: options.GetParams()
                ));
 }