Exemplo n.º 1
0
 private static Request BuildReadRequest(ReadUsageRecordOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Supersim,
                "/v1/UsageRecords",
                queryParams: options.GetParams()
                ));
 }
Exemplo n.º 2
0
        /// <summary>
        /// List UsageRecords
        /// </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));
        }
Exemplo n.º 3
0
        /// <summary>
        /// List UsageRecords
        /// </summary>
        /// <param name="sim"> SID of a Sim resource. Only show UsageRecords representing usage incurred by this Super SIM.
        ///           </param>
        /// <param name="granularity"> Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or
        ///                   `all`. Default is `all`. </param>
        /// <param name="startTime"> Only include usage that occurred at or after this time. </param>
        /// <param name="endTime"> Only include usage that occurred before this time. </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(string sim = null,
                                                                                                       UsageRecordResource.GranularityEnum granularity = null,
                                                                                                       DateTime?startTime       = null,
                                                                                                       DateTime?endTime         = null,
                                                                                                       int?pageSize             = null,
                                                                                                       long?limit               = null,
                                                                                                       ITwilioRestClient client = null)
        {
            var options = new ReadUsageRecordOptions()
            {
                Sim = sim, Granularity = granularity, StartTime = startTime, EndTime = endTime, PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
Exemplo n.º 4
0
        /// <summary>
        /// List UsageRecords
        /// </summary>
        /// <param name="sim"> SID or unique name of a Sim resource. Only show UsageRecords representing usage incurred by this
        ///           Super SIM. </param>
        /// <param name="fleet"> SID or unique name of a Fleet resource. Only show UsageRecords representing usage for Super
        ///             SIMs belonging to this Fleet resource at the time the usage occurred. </param>
        /// <param name="network"> SID of a Network resource. Only show UsageRecords representing usage on this network.
        ///               </param>
        /// <param name="isoCountry"> Alpha-2 ISO Country Code. Only show UsageRecords representing usage in this country.
        ///                  </param>
        /// <param name="group"> Dimension over which to aggregate usage records. </param>
        /// <param name="granularity"> Time-based grouping that UsageRecords should be aggregated by. Can be: `hour`, `day`, or
        ///                   `all`. Default is `all`. </param>
        /// <param name="startTime"> Only include usage that occurred at or after this time. </param>
        /// <param name="endTime"> Only include usage that occurred before this time. </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(string sim        = null,
                                                             string fleet      = null,
                                                             string network    = null,
                                                             string isoCountry = null,
                                                             UsageRecordResource.GroupEnum group             = null,
                                                             UsageRecordResource.GranularityEnum granularity = null,
                                                             DateTime?startTime       = null,
                                                             DateTime?endTime         = null,
                                                             int?pageSize             = null,
                                                             long?limit               = null,
                                                             ITwilioRestClient client = null)
        {
            var options = new ReadUsageRecordOptions()
            {
                Sim = sim, Fleet = fleet, Network = network, IsoCountry = isoCountry, Group = group, Granularity = granularity, StartTime = startTime, EndTime = endTime, PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
Exemplo n.º 5
0
        /// <summary>
        /// List UsageRecords
        /// </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));
        }