Пример #1
0
 private static Request BuildReadRequest(ReadMediaOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Api,
                "/2010-04-01/Accounts/" + (options.PathAccountSid ?? client.AccountSid) + "/Messages/" + options.PathMessageSid + "/Media.json",
                queryParams: options.GetParams()
                ));
 }
Пример #2
0
        /// <summary>
        /// Retrieve a list of Media resources belonging to the account used to make the request
        /// </summary>
        /// <param name="options"> Read Media parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Media </returns>
        public static ResourceSet <MediaResource> Read(ReadMediaOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <MediaResource> .FromJson("media_list", response.Content);

            return(new ResourceSet <MediaResource>(page, options, client));
        }
Пример #3
0
        /// <summary>
        /// Retrieve a list of medias belonging to the account used to make the request
        /// </summary>
        ///
        /// <param name="pathMessageSid"> The message_sid </param>
        /// <param name="pathAccountSid"> The account_sid </param>
        /// <param name="dateCreatedBefore"> Filter by date created </param>
        /// <param name="dateCreated"> Filter by date created </param>
        /// <param name="dateCreatedAfter"> Filter by date created </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 Media </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <MediaResource> > ReadAsync(string pathMessageSid, string pathAccountSid = null, DateTime?dateCreatedBefore = null, DateTime?dateCreated = null, DateTime?dateCreatedAfter = null, int?pageSize = null, long?limit = null, ITwilioRestClient client = null)
        {
            var options = new ReadMediaOptions(pathMessageSid)
            {
                PathAccountSid = pathAccountSid, DateCreatedBefore = dateCreatedBefore, DateCreated = dateCreated, DateCreatedAfter = dateCreatedAfter, PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
Пример #4
0
        /// <summary>
        /// Retrieve a list of Media resources belonging to the account used to make the request
        /// </summary>
        /// <param name="options"> Read 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 <ResourceSet <MediaResource> > ReadAsync(ReadMediaOptions options,
                                                                                                 ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <MediaResource> .FromJson("media_list", response.Content);

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