Beispiel #1
0
        public static HttpWebRequest ConstructSellerListRequest(string apiKey, SellerListRequest sellerListRequest)
        {
            NameValueCollection queryParams = new NameValueCollection();

            queryParams.Add("apikey", apiKey);

            if (sellerListRequest.IncludeAttributes != null)
            {
                queryParams.Add("includeattributes", sellerListRequest.IncludeAttributes.ToString().ToLower());
            }
            if (sellerListRequest.Sort != null)
            {
                queryParams.Add("sort", EnumUtils.StringValueOf(sellerListRequest.Sort));
            }
            if (sellerListRequest.Offset != null)
            {
                queryParams.Add("offset", sellerListRequest.Offset.ToString().ToLower());
            }
            if (sellerListRequest.Limit != null)
            {
                queryParams.Add("limit", sellerListRequest.Limit.ToString().ToLower());
            }

            string queryString = HttpUtils.ToQueryString(queryParams);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Constants.URL_PREFIX + "/catalog/v4/sellerlists/" + sellerListRequest.Id + "/" + queryString);

            request.Method = "GET";
            request.Accept = "application/json";

            return(request);
        }
Beispiel #2
0
        public SellerList GetSellerList(SellerListRequest sellerListRequest)
        {
            HttpWebRequest request    = CatalogRequestBuilder.ConstructSellerListRequest(apiKey, sellerListRequest);
            SellerList     sellerList = ProcessBodylessRequest(request).ToObject <SellerList>();

            return(sellerList);
        }
Beispiel #3
0
        public void TestGetSellerList()
        {
            SellerListRequest sellerListRequest = new SellerListRequest();

            sellerListRequest.Id = "656476";
            sellerListRequest.IncludeAttributes = true;
            sellerListRequest.Offset            = 0;
            sellerListRequest.Limit             = 10;
            sellerListRequest.Sort = EnumTypes.SortingMethod.DATE_DESC;

            SellerList sellerList = client.GetSellerList(sellerListRequest);

            Assert.IsNotNull(sellerList.Products);
            Assert.IsTrue(sellerList.Products.Count > 0);
        }