コード例 #1
0
        //"B076GZ3JFC"
        public static List <PriceSourceItemOld> Search(string term, AmazonSearchIndex amazonSearchIndex = AmazonSearchIndex.All, AmazonEndpoint?endpoint = null)
        {
            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);
                string searchTerm = "ASUS DUAL-RX580-O8G Radeon RX 580 8 GB GDDR5";
                //string searchTerm = //"B076GZ3JFC";
                AmazonItemResponse result = wrapper.Search(term, AmazonSearchIndex.All);
                results.AddRange(result.ToPriceSourceItems());
            }

            return(results);
        }
コード例 #2
0
        public AmazonItemSearchOperation ItemSearchOperation(string search, AmazonSearchIndex amazonSearchIndex = AmazonSearchIndex.All, AmazonResponseGroup amazonResponseGroup = AmazonResponseGroup.Large)
        {
            var operation = new AmazonItemSearchOperation();

            operation.ResponseGroup(amazonResponseGroup);
            operation.Keywords(search);
            operation.SearchIndex(amazonSearchIndex);
            operation.AssociateTag(this._associateTag);
            return(operation);
        }
コード例 #3
0
        public void SearchIndex(AmazonSearchIndex searchIndex)
        {
            if (this.ParameterDictionary.ContainsKey("SearchIndex"))
            {
                this.ParameterDictionary["SearchIndex"] = searchIndex.ToString();
                return;
            }

            this.ParameterDictionary.Add("SearchIndex", searchIndex.ToString());
        }
コード例 #4
0
        public AmazonItemResponse Search(string search, AmazonSearchIndex searchIndex = AmazonSearchIndex.All, AmazonResponseGroup responseGroup = AmazonResponseGroup.Large)
        {
            var operation = this.ItemSearchOperation(search, searchIndex, responseGroup);

            var webResponse = this.Request(operation);

            if (webResponse.StatusCode == HttpStatusCode.OK)
            {
                return(XmlHelper.ParseXml <ItemSearchResponse>(webResponse.Content));
            }
            else
            {
                var errorResponse = XmlHelper.ParseXml <ItemSearchErrorResponse>(webResponse.Content);
                this.ErrorReceived?.Invoke(errorResponse);
            }

            return(null);
        }
コード例 #5
0
        public async Task <AmazonItemResponse> SearchAsync(string search, AmazonSearchIndex searchIndex = AmazonSearchIndex.All, AmazonResponseGroup responseGroup = AmazonResponseGroup.Large)
        {
            var requestParams = ItemSearchOperation(search, searchIndex, responseGroup);

            var webResponse = await this.RequestAsync(requestParams);

            if (webResponse.StatusCode == HttpStatusCode.OK)
            {
                return(XmlHelper.ParseXml <ItemSearchResponse>(webResponse.Content));
            }
            else
            {
                var errorResponse = XmlHelper.ParseXml <ItemSearchErrorResponse>(webResponse.Content);
                this.ErrorReceived?.Invoke(errorResponse);
            }

            return(null);
        }
コード例 #6
0
        public virtual PartialViewResult Search(String searchTerms, AmazonSearchIndex category)
        {
            var results = _amazonService.Search(searchTerms, category);

            return(PartialView("_SearchResults", results));
        }
コード例 #7
0
 public void SearchIndex(AmazonSearchIndex searchIndex)
 {
     this.AddOrReplace("SearchIndex", searchIndex.ToString());
 }
コード例 #8
0
 public AmazonItemResponse Search(String searchTerms, AmazonSearchIndex indexToSearch, AmazonResponseGroup responseGroup = AmazonResponseGroup.Large)
 {
     return(_requestWrapper.Search(searchTerms, indexToSearch, responseGroup));
 }