/// <summary>
        /// Get items with a item request
        /// </summary>
        /// <param name="itemsRequest"></param>
        /// <returns></returns>
        public async Task <GetItemsResponse> GetItemsAsync(ItemsRequest itemsRequest)
        {
            if (!this._amazonResourceValidator.IsResourcesValid(itemsRequest.Resources, "GetItems"))
            {
                return(new GetItemsResponse {
                    Successful = false, ErrorMessage = "Resources has wrong values"
                });
            }

            var request = new GetItemsRequest
            {
                ItemIds     = itemsRequest.ItemIds,
                Resources   = itemsRequest.Resources,
                Merchant    = itemsRequest.Merchant,
                PartnerTag  = this._partnerTag,
                PartnerType = "Associates",
                Marketplace = $"www.{this._amazonEndpointConfig.Host}",
            };

            var json = JsonConvert.SerializeObject(request, this._jsonSerializerSettingsRequest);

            if (string.IsNullOrEmpty(json))
            {
                return(new GetItemsResponse {
                    Successful = false, ErrorMessage = "Cannot serialize object"
                });
            }

            var response = await this.RequestAsync("GetItems", json);

            return(this.DeserializeObject <GetItemsResponse>(response));
        }
Exemple #2
0
        public HttpResponseMessage SelectAll([FromUri] ItemsRequest <int> model)
        {
            ItemsResponse <Faq> response = new ItemsResponse <Faq>();

            response.Items = _faqService.SelectAll();
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
Exemple #3
0
        /// <summary>
        /// Get items via id
        /// </summary>
        /// <param name="itemIds"></param>
        /// <returns></returns>
        public async Task <GetItemsResponse> GetItemsAsync(params string[] itemIds)
        {
            var request = new ItemsRequest
            {
                ItemIds   = itemIds,
                Resources = new[]
                {
                    "BrowseNodeInfo.BrowseNodes",
                    "BrowseNodeInfo.BrowseNodes.Ancestor",
                    "BrowseNodeInfo.BrowseNodes.SalesRank",
                    "BrowseNodeInfo.WebsiteSalesRank",

                    "Images.Primary.Small",
                    "Images.Primary.Medium",
                    "Images.Primary.Large",

                    "Images.Variants.Small",
                    "Images.Variants.Medium",
                    "Images.Variants.Large",

                    "ItemInfo.ByLineInfo",
                    "ItemInfo.Classifications",
                    "ItemInfo.ContentInfo",
                    "ItemInfo.ContentRating",
                    "ItemInfo.ExternalIds",
                    "ItemInfo.Features",
                    "ItemInfo.ManufactureInfo",
                    "ItemInfo.ProductInfo",
                    "ItemInfo.TechnicalInfo",
                    "ItemInfo.Title",
                    "ItemInfo.TradeInInfo",

                    "Offers.Listings.Availability.MinOrderQuantity",
                    "Offers.Listings.Availability.MaxOrderQuantity",
                    "Offers.Listings.Availability.Message",
                    "Offers.Listings.Availability.Type",
                    "Offers.Listings.Condition",
                    "Offers.Listings.Condition.SubCondition",
                    "Offers.Listings.DeliveryInfo.IsAmazonFulfilled",
                    "Offers.Listings.DeliveryInfo.IsFreeShippingEligible",
                    "Offers.Listings.DeliveryInfo.IsPrimeEligible",
                    "Offers.Listings.LoyaltyPoints.Points",
                    "Offers.Listings.MerchantInfo",
                    "Offers.Listings.Price",
                    "Offers.Listings.ProgramEligibility.IsPrimeExclusive",
                    "Offers.Listings.ProgramEligibility.IsPrimePantry",
                    "Offers.Listings.Promotions",
                    "Offers.Listings.SavingBasis",
                    "Offers.Summaries.HighestPrice",
                    "Offers.Summaries.LowestPrice",
                    "Offers.Summaries.OfferCount",

                    "ParentASIN",
                }
            };

            return(await this.GetItemsAsync(request));
        }
Exemple #4
0
        public void Execute()
        {
            // act
            var response = new ItemsRequest().Execute();

            // assert
            Assert.IsTrue(response.Items.Count > 1);
            Assert.IsTrue(response.Items.Contains(30698)); // The Bifrost
        }
Exemple #5
0
        public ActionResult <ArrayPathCalculationResult> CalculateArrayPath([FromBody] ItemsRequest itemsRequest)
        {
            if (itemsRequest?.Items == null)
            {
                return(BadRequest(new { Reason = "BadRequest", Message = "Items cannot be empty." }));
            }

            ArrayPathCalculationResult result = _service.CalculatePath(itemsRequest.Items);

            return(Ok(result));
        }
Exemple #6
0
        public ItemsRessponse GetItems(ItemsRequest request)
        {
            WebClient webc = new WebClient();

            webc.Headers["Content-Type"]  = "application/json";
            webc.Headers["Authorization"] = "Token " + _token;
            string url          = @"https://trackapi.thailandpost.co.th/post/api/v1/track";
            string jsonRequest  = JsonConvert.SerializeObject(request);
            string jsonResult   = webc.UploadString(url, "POST", jsonRequest);
            var    itemResponse = MapItems(jsonResult, request.barcode);

            return(itemResponse);
        }
Exemple #7
0
        public HttpResponseMessage GetEmps([FromUri] ItemsRequest <int> model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            ItemsResponse <TestEmployee> response = new ItemsResponse <TestEmployee>();

            response.Items = TestService.GetEmployees(model.Items);

            return(Request.CreateResponse(response));
        }
        public async Task <ActionResult <ItemsResult> > GetItems([FromQuery] ItemsRequest request)
        {
            if (!await _authManager.HasSitePermissionsAsync(request.SiteId,
                                                            Types.SitePermissions.SettingsStyleRelatedField))
            {
                return(Unauthorized());
            }

            var tree = await _relatedFieldItemRepository.GetCascadesAsync(request.SiteId, request.RelatedFieldId,
                                                                          0);

            return(new ItemsResult
            {
                Tree = tree
            });
        }
        public async Task GetItemsWithConditionTest()
        {
            var request = new ItemsRequest
            {
                ItemIds   = new string[] { "B000NM8SEA" },
                Condition = Condition.Used,
                Resources = new string[] {
                    "Offers.Listings.Condition",
                    "Offers.Listings.Price"
                }
            };

            var response = await this._client.GetItemsAsync(request);

            Assert.IsTrue(response.Successful);
            Assert.AreEqual(Condition.Used.ToString(), response.ItemsResult.Items[0].Offers.Listings[0].Condition.Value);
        }
        public IEnumerable <ItemDTO> GetItems(ItemsRequest request = null)
        {
            Expression <Func <ItemDTO, bool> > finalExpression;

            if (request == null || request.Name == null)
            {
                finalExpression = null;
            }
            else
            {
                finalExpression = x => x.Name == request.Name;
            }

            using (var unitOfWork = _factory.GetInstance())
            {
                return(unitOfWork.GetItems(finalExpression));
            }
        }
        public ItemsRessponse GetItems([FromBody] ItemsRequest request)
        {
            var response = new ThaiPostServices().GetItems(request);

            return(response);
        }