コード例 #1
0
        private static FulfillmentResponse BuildMultipleClientsFound(string clientName, ClientCollection clientCollection)
        {
            var chipSuggestionMessage = GoogleChipMessage.From(clientCollection.Clients.Select(c => c.Name));

            return(FulfillmentResponseBuilder.Create()
                   .Speech($"There a few people who have a smiliar name to {clientName}, can you be a bit more specific?")
                   .WithContext(ContextBuilder.For(Constants.Contexts.CreateJobClientRequested))
                   .WithMessage(chipSuggestionMessage)
                   .Build());
        }
コード例 #2
0
        public async Task <FulfillmentResponse> FulfillAsync(FulfillmentRequest fulfillmentRequest, IJobberClient jobberClient)
        {
            var userId         = fulfillmentRequest.GetCurrentUserId();
            var userCollection = await jobberClient.GetUserAsync(userId);

            var user = userCollection.Users;
            var chipSuggestionMessage = GoogleChipMessage.From(user.PossibleActions().Values.ToList());

            return(FulfillmentResponseBuilder.Create()
                   .Speech("I have listed some functionalities as suggestions")
                   .WithMessage(chipSuggestionMessage)
                   .Build());
        }
        private static FulfillmentResponse BuildResponseForMultipleMatchesForDeviceWithScreen(
            IEnumerable <Quote> matchingQuotes)
        {
            var quoteSuggestions = matchingQuotes.Select(q => q.QuoteNumber.ToString()).ToList();

            quoteSuggestions.Add("Cancel");

            var suggestionChips = GoogleChipMessage.From(quoteSuggestions);

            return(FulfillmentResponseBuilder.Create()
                   .Speech("A few quotes matched what you said. Here are some of the quote numbers that matched:")
                   .WithContext(ContextBuilder.For(Constants.Contexts.QuoteNumberRequested))
                   .WithMessage(suggestionChips)
                   .Build());
        }