Пример #1
0
        /// <summary>
        /// Given a start date and end date gets all of the usage inbetween
        /// </summary>
        public async Task <Usage> GetUsageByDate(UsageRequest usageRequest)
        {
            var    billingRequest = new UsageBillingRequest();
            var    usages         = new List <UsageAggregate>();
            string nextLink       = "dummy";

            while (!String.IsNullOrEmpty(nextLink))
            {
                var payload = await billingRequest.MakeObjectRequest <NextPayload>(usageRequest);

                if (payload.Payload != null)
                {
                    usages.AddRange(payload.Payload);
                }
                nextLink = payload.NextLink;
            }
            return(new Usage
            {
                Value = usages,
                ReportedStartDate = usageRequest.startTime,
                ReportedEndData = usageRequest.endTime
            });
        }