private string BuildRequest(string verb, string appID, DateTime startDate, DateTime endDate, int top, int skip, AggregationLevel aggregationLevel, List <OrderBy> orderBy)
        {
            // Get app acquisitions
            //string requestURI = string.Format(
            //    "https://manage.devcenter.microsoft.com/v1.0/my/analytics/{5}?applicationId={0}&startDate={1}&endDate={2}&top={3}&skip={4}",
            //    appID, startDate, endDate, 1000, 0, verb);

            string requestURI = string.Format("https://manage.devcenter.microsoft.com/v1.0/my/analytics/{0}?applicationId={1}&startDate={2}&endDate={3}&top={4}&skip={5}",
                                              verb, appID, startDate, endDate, top, skip);

            if (aggregationLevel != AggregationLevel.None && aggregationLevel != AggregationLevel.Day)
            {
                requestURI += "&aggregationLevel=" + aggregationLevel.ToString().ToLower();
            }

            if (orderBy.Any())
            {
                requestURI += "&orderby=";
                foreach (OrderBy ob in orderBy)
                {
                    requestURI += ob.ToString().ToLower() + ",";
                }

                requestURI = requestURI.Remove(requestURI.Length - 1);
            }

            return(requestURI);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Represent the equivalence of AggregationLevel enumeration used solely when communicating with exchange server.
 /// </summary>
 public static string ToParamValue(this AggregationLevel level)
 {
     return(level.ToString().ToLower());
 }