Esempio n. 1
0
        public async Task <SkillResponse> GetStoreFrontSpeachResponse(int take = 5)
        {
            var storeFrontItems = await _storeFrontService.GetStorefront(take)
                                  .ConfigureAwait(false);

            var speechResponse = new SsmlOutputSpeech();

            var builder = new StringBuilder($"<speak>Today's top {take} deals on Jane are:");

            for (int i = 0; i < storeFrontItems.Count; i++)
            {
                StorefrontItem item     = storeFrontItems[i];
                string         andFinal = "";
                if (i == storeFrontItems.Count - 1)
                {
                    andFinal = "and ";
                }

                builder.Append($" {andFinal}{item.Title}<break time=\"{phraseBreaktime}\"/> ");
            }

            //close the speech
            builder.Append("</speak>");
            speechResponse.Ssml = builder.ToString();

            var response = ResponseBuilder.Tell(speechResponse);

            return(response);
        }
Esempio n. 2
0
        public Task <SkillResponse> GetStorefrontDealDetailsForDeal(int sortedDealKey)
        {
            StorefrontItem item = _memCache.Get <StorefrontItem>($"{sortedDealKey}");

            if (item == null)
            {
                throw new ValidationException();
            }

            string responseSsml   = $"<speak>{item.Title} is ${item.Price} and has {item.LikeCount} likes.</speak>";
            var    speechResponse = new SsmlOutputSpeech()
            {
                Ssml = responseSsml
            };

            return(Task.FromResult(ResponseBuilder.Tell(speechResponse)));
        }