Esempio n. 1
0
        private SpeechletResponse ProcessReviews(Intent intent)
        {
            // Get the slots from the intent.
            Dictionary <string, Slot> slots = intent.Slots;
            Slot productSlot = slots[Constants.ProductSlot];

            // Check for product and create output to user.
            if (productSlot != null && !string.IsNullOrEmpty(productSlot.Value))
            {
                string product = productSlot.Value;
                var    output  = string.Empty;
                var    data    = _walmartHelper.GetSearchData(product.Replace(" ", "+"));
                if (data != null && data.items.Any())
                {
                    var reviews = _walmartHelper.GetReviews(data.items[0].itemId);
                    //read first review and ask for more if needed
                    output = reviews[0].reviewText;
                }
                return(BuildSpeechletResponse("Reviews", output, true));
            }
            return(BuildSpeechletResponse("Reviews", Constants.Error, true));
        }
Esempio n. 2
0
        public IHttpActionResult Search(string query)
        {
            var result = _walmartHelper.GetSearchData(query.Replace(" ", "+"));

            return(Ok(result));
        }