Exemple #1
0
        /// <summary>
        /// Fetch a single media instance belonging to the account used to make the request
        /// </summary>
        /// <param name="options"> Fetch Media parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Media </returns>
        public static MediaResource Fetch(FetchMediaOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
        /// <summary>
        /// Fetch a single media instance belonging to the account used to make the request
        /// </summary>
        ///
        /// <param name="options"> Fetch 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 <MediaResource> FetchAsync(FetchMediaOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildFetchRequest(options, client));

            return(FromJson(response.Content));
        }
Exemple #3
0
 private static Request BuildFetchRequest(FetchMediaOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Messages/" + options.PathMessageSid + "/Media/" + options.PathSid + ".json",
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Fetch a single media instance belonging to the account used to make the request
        /// </summary>
        ///
        /// <param name="pathMessageSid"> The message_sid </param>
        /// <param name="pathSid"> Fetch 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 <MediaResource> FetchAsync(string pathMessageSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new FetchMediaOptions(pathMessageSid, pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(await FetchAsync(options, client));
        }
        /// <summary>
        /// Fetch a single media instance belonging to the account used to make the request
        /// </summary>
        ///
        /// <param name="pathMessageSid"> The message_sid </param>
        /// <param name="pathSid"> Fetch 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 MediaResource Fetch(string pathMessageSid, string pathSid, string pathAccountSid = null, ITwilioRestClient client = null)
        {
            var options = new FetchMediaOptions(pathMessageSid, pathSid)
            {
                PathAccountSid = pathAccountSid
            };

            return(Fetch(options, client));
        }