Esempio n. 1
0
        public void SearchTopSellerItems(string keywords, long searchNode, int minPrice, int maxPrice, bool searchSubNodes, Enums.SearchSort searchSort, Enums.SearchSortOrder searchSortOrder)
        {
            var authentication = new AmazonAuthentication();

            authentication.AccessKey = this._amazonAccessKey;
            authentication.SecretKey = this._amazonSecretKey;

            var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.IT, this._amazonPartnerId);

            wrapper.ErrorReceived += (errorResonse) => { _logger.LogError(errorResonse.Error.Message); };

            var searchNodeTopSeller = wrapper.BrowseNodeLookup(searchNode, AmazonResponseGroup.BrowseNodeInfo | AmazonResponseGroup.TopSellers);

            var test33 = wrapper.ItemLookupOperation(new List <string> {
                "B00PAZYAT2", "B007SGHF3Y"
            }, AmazonResponseGroup.Small | AmazonResponseGroup.BrowseNodes | AmazonResponseGroup.SalesRank | AmazonResponseGroup.ItemAttributes);

            test33.ParameterDictionary.Add("MerchantId", "Amazon");
            var xmlResponseTT = wrapper.Request(test33);
            var parsedTT      = XmlHelper.ParseXml <ItemLookupResponse>(xmlResponseTT.Content);
        }
Esempio n. 2
0
        public static List <PriceSourceItemOld> SearchItemLookupOperationOld(string term, AmazonEndpoint?endpoint)
        {
            term = term.Trim();
            List <PriceSourceItemOld> results           = new List <PriceSourceItemOld>();
            List <Endpoint>           endpointsToSearch = new List <Endpoint>();

            if (endpoint != null)
            {
                endpointsToSearch.Add(Endpoints.Get(endpoint.Value));
            }
            else
            {
                endpointsToSearch.AddRange(Endpoints.EndpointsList);
            }

            foreach (var endpointItem in endpointsToSearch)
            {
                var authentication = new AmazonAuthentication();
                authentication.AccessKey = endpointItem.accessKey;
                authentication.SecretKey = endpointItem.secreteKey;

                endpoint = (AmazonEndpoint)Enum.Parse(typeof(AmazonEndpoint), endpointItem.endpointCode);
                var wrapper         = new AmazonWrapper(authentication, endpoint.Value, endpointItem.merchantId);
                var searchOperation = wrapper.ItemLookupOperation(new List <string>()
                {
                    term
                });
                ExtendedWebResponse xmlResponse = wrapper.Request(searchOperation);
                var itemLookupResponse          = XmlHelper.ParseXml <ItemLookupResponse>(xmlResponse.Content);
                if (itemLookupResponse?.Items?.Item?.FirstOrDefault() != null)
                {
                    string itemJson = JsonConvert.SerializeObject(itemLookupResponse.Items.Item.FirstOrDefault());
                }
                results.AddRange(itemLookupResponse.ToPriceSourceItemsOld());
            }
            return(results);
        }