public void TestBrowse()
        {
            ListResultsRequest listResultsRequest = new ListResultsRequest();
            listResultsRequest.Type = EnumTypes.ListType.DEFAULT;
            listResultsRequest.CategoryId = "3135";
            listResultsRequest.IncludeAttributes = true;
            listResultsRequest.Offset = 10;
            listResultsRequest.Limit = 10;
            listResultsRequest.DataOutputs = new EnumTypes.DataOutputType[] {
                    EnumTypes.DataOutputType.PRODUCTS,
                    EnumTypes.DataOutputType.CATEGORIES,
                    EnumTypes.DataOutputType.REFINEMENTS
                };
            listResultsRequest.Offers = new EnumTypes.OfferType[] {
                    EnumTypes.OfferType.ALL
                };

            ListResults listResults = client.Browse(listResultsRequest);
            Assert.IsTrue(listResults.TotalResultSize > 0);
            Assert.IsNotNull(listResults.Categories);
            Assert.IsTrue(listResults.Categories.Count > 0);
            Assert.IsNotNull(listResults.Products);
            Assert.IsTrue(listResults.Products.Count > 0);
            Assert.IsNotNull(listResults.RefinementGroups);
            Assert.IsTrue(listResults.RefinementGroups.Count > 0);
        }
        public ListResults Browse(ListResultsRequest listResultsRequest)
        {
            HttpWebRequest request = CatalogRequestBuilder.ConstructListRequest(apiKey, listResultsRequest);
            ListResults listResults = ProcessBodylessRequest(request).ToObject<ListResults>();

            return listResults;
        }
        public static HttpWebRequest ConstructListRequest(string apiKey, ListResultsRequest listResultsRequest)
        {
            NameValueCollection queryParams = new NameValueCollection();
            queryParams.Add("apikey", apiKey);

            if (listResultsRequest.Type != null)
            {
                queryParams.Add("type", EnumUtils.StringValueOf(listResultsRequest.Type));
            }
            if (listResultsRequest.CategoryId != null || listResultsRequest.RefinementIds != null)
            {
                string ids = FormatterUtils.CombineCategoryAndRefinementIds(listResultsRequest.CategoryId, listResultsRequest.RefinementIds);
                queryParams.Add("ids", ids);
            }
            if (listResultsRequest.ListId != null)
            {
                queryParams.Add("listid", listResultsRequest.ListId);
            }
            if (listResultsRequest.IncludeAttributes != null)
            {
                queryParams.Add("includeattributes", listResultsRequest.IncludeAttributes.ToString().ToLower());
            }
            if (listResultsRequest.DataOutputs != null)
            {
                queryParams.Add("dataoutput", FormatterUtils.FormatDataOutput(listResultsRequest.DataOutputs));
            }
            if (listResultsRequest.Offers != null)
            {
                queryParams.Add("offer", FormatterUtils.FormatOffer(listResultsRequest.Offers));
            }
            if (listResultsRequest.Sort != null)
            {
                queryParams.Add("sort", EnumUtils.StringValueOf(listResultsRequest.Sort));
            }
            if (listResultsRequest.Offset != null)
            {
                queryParams.Add("offset", listResultsRequest.Offset.ToString().ToLower());
            }
            if (listResultsRequest.Limit != null)
            {
                queryParams.Add("limit", listResultsRequest.Limit.ToString().ToLower());
            }

            string queryString = HttpUtils.ToQueryString(queryParams);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Constants.URL_PREFIX + "/catalog/v4/lists/" + queryString);
            request.Method = "GET";
            request.Accept = "application/json";

            return request;
        }