/* public override ValidationResponse OnRequestValidation(ValidationRequest request) { var response = new ValidationResponse { ValidationResult = SpeechletRequestValidationResult.OK, Success = true }; var alexaBytes = AsyncHelpers.RunSync<byte[]>(() => request.HttpRequest.Content.ReadAsByteArrayAsync()); Debug.WriteLine(request.HttpRequest.ToLogString()); GetRequest(alexaBytes, ref response); return response; } */ /** * Creates and returns the visual and spoken response with shouldEndSession flag * * @param title * title for the companion application home card * @param output * output content for speech and companion application home card * @param shouldEndSession * should the session be closed * @return SpeechletResponse spoken and visual response for the given input */ private SpeechletResponse BuildSpeechletResponse(string title, string output, bool shouldEndSession) { // Create the Simple card content. SimpleCard card = new SimpleCard(); card.Title = String.Format("SessionSpeechlet - {0}", title); card.Subtitle = String.Format("SessionSpeechlet - Sub Title"); card.Content = String.Format("SessionSpeechlet - {0}", output); // Create the plain text output. PlainTextOutputSpeech speech = new PlainTextOutputSpeech(); speech.Text = output; // Create the speechlet response. SpeechletResponse response = new SpeechletResponse(); response.ShouldEndSession = shouldEndSession; response.OutputSpeech = speech; response.Card = card; return response; }
/** * Creates and returns the visual and spoken response with shouldEndSession flag * * @param title * title for the companion application home card * @param output * output content for speech and companion application home card * @param shouldEndSession * should the session be closed * @return SpeechletResponse spoken and visual response for the given input */ private SpeechletResponse BuildSpeechletResponse(string title, string output, bool shouldEndSession) { // Create the Simple card content. var card = new SimpleCard { Title = $"SessionSpeechlet - {title}", Content = $"SessionSpeechlet - {output}" }; // Create the plain text output. var speech = new PlainTextOutputSpeech { Text = output }; // Create the speechlet response. var response = new SpeechletResponse { ShouldEndSession = shouldEndSession, OutputSpeech = speech, Card = card }; return response; }