Ejemplo n.º 1
0
 private static Request BuildReadRequest(ReadUsageRecordOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Wireless,
                "/v1/UsageRecords",
                queryParams: options.GetParams()
                ));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// read
        /// </summary>
        /// <param name="options"> Read UsageRecord parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of UsageRecord </returns>
        public static ResourceSet <UsageRecordResource> Read(ReadUsageRecordOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <UsageRecordResource> .FromJson("usage_records", response.Content);

            return(new ResourceSet <UsageRecordResource>(page, options, client));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// read
        /// </summary>
        /// <param name="end"> Only include usage that has occurred on or before this date </param>
        /// <param name="start"> Only include usage that has occurred on or after this date </param>
        /// <param name="granularity"> The time-based grouping that results are aggregated by </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 UsageRecord </returns>
        public static ResourceSet <UsageRecordResource> Read(DateTime?end   = null,
                                                             DateTime?start = null,
                                                             UsageRecordResource.GranularityEnum granularity = null,
                                                             int?pageSize             = null,
                                                             long?limit               = null,
                                                             ITwilioRestClient client = null)
        {
            var options = new ReadUsageRecordOptions()
            {
                End = end, Start = start, Granularity = granularity, PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// read
        /// </summary>
        /// <param name="end"> Only include usage that has occurred on or before this date </param>
        /// <param name="start"> Only include usage that has occurred on or after this date </param>
        /// <param name="granularity"> The time-based grouping that results are aggregated by </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 UsageRecord </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <UsageRecordResource> > ReadAsync(DateTime?end   = null,
                                                                                                       DateTime?start = null,
                                                                                                       UsageRecordResource.GranularityEnum granularity = null,
                                                                                                       int?pageSize             = null,
                                                                                                       long?limit               = null,
                                                                                                       ITwilioRestClient client = null)
        {
            var options = new ReadUsageRecordOptions()
            {
                End = end, Start = start, Granularity = granularity, PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// read
        /// </summary>
        /// <param name="options"> Read UsageRecord parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of UsageRecord </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <UsageRecordResource> > ReadAsync(ReadUsageRecordOptions options,
                                                                                                       ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <UsageRecordResource> .FromJson("usage_records", response.Content);

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