/** * Helper method that will get the intent name from a provided Intent object. If a name does not * exist then this method will return null. * @param intent intent object provided from a skill request. * @return intent name or null. */ private String getIntentName(Intent intent) { return (intent != null) ? intent.getName() : null; }
@Override public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) { IntentRequest request = requestEnvelope.getRequest(); Session session = requestEnvelope.getSession(); log.info("onIntent requestId={}, sessionId={}", request.getRequestId(), session.getSessionId()); initializeComponents(); Intent intent = request.getIntent(); if ("NewGameIntent".equals(intent.getName())) { return scoreKeeperManager.getNewGameIntentResponse(session, skillContext); } else if ("AddPlayerIntent".equals(intent.getName())) { return scoreKeeperManager.getAddPlayerIntentResponse(intent, session, skillContext); } else if ("AddScoreIntent".equals(intent.getName())) { return scoreKeeperManager.getAddScoreIntentResponse(intent, session, skillContext); } else if ("TellScoresIntent".equals(intent.getName())) { return scoreKeeperManager.getTellScoresIntentResponse(intent, session); } else if ("ResetPlayersIntent".equals(intent.getName())) { return scoreKeeperManager.getResetPlayersIntentResponse(intent, session); } else if ("AMAZON.HelpIntent".equals(intent.getName())) { return scoreKeeperManager.getHelpIntentResponse(intent, session, skillContext); } else if ("AMAZON.CancelIntent".equals(intent.getName())) { return scoreKeeperManager.getExitIntentResponse(intent, session, skillContext); } else if ("AMAZON.StopIntent".equals(intent.getName())) { return scoreKeeperManager.getExitIntentResponse(intent, session, skillContext); } else { throw new IllegalArgumentException("Unrecognized intent: " + intent.getName()); } }
@Override public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) { IntentRequest request = requestEnvelope.getRequest(); Session session = requestEnvelope.getSession(); log.info("onIntent requestId={}, sessionId={}", request.getRequestId(), session.getSessionId()); initializeComponents(); Intent intent = request.getIntent(); if ("NewGameIntent".equals(intent.getName())) { return scoreKeeperManager.getNewGameIntentResponse(session, skillContext); } else if ("AddPlayerIntent".equals(intent.getName())) { return scoreKeeperManager.getAddPlayerIntentResponse(intent, session, skillContext); } else if ("AddScoreIntent".equals(intent.getName())) { return scoreKeeperManager.getAddScoreIntentResponse(intent, session, skillContext); } else if ("TellScoresIntent".equals(intent.getName())) { return scoreKeeperManager.getTellScoresIntentResponse(intent, session); } else if ("ResetPlayersIntent".equals(intent.getName())) { return scoreKeeperManager.getResetPlayersIntentResponse(intent, session); } else if ("AMAZON.HelpIntent".equals(intent.getName())) { return scoreKeeperManager.getHelpIntentResponse(intent, session, skillContext); } else if ("AMAZON.CancelIntent".equals(intent.getName())) { return scoreKeeperManager.getExitIntentResponse(intent, session, skillContext); } else if ("AMAZON.StopIntent".equals(intent.getName())) { return scoreKeeperManager.getExitIntentResponse(intent, session, skillContext); } else { throw new IllegalArgumentException("Unrecognized intent: " + intent.getName()); } }
@Override public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) { IntentRequest request = requestEnvelope.getRequest(); log.info("onIntent requestId={}, sessionId={}", request.getRequestId(), requestEnvelope.getSession().getSessionId()); Intent intent = request.getIntent(); String intentName = (intent != null) ? intent.getName() : null; if ("HelloWorldIntent".equals(intentName)) { return getHelloResponse(); } else if ("AMAZON.HelpIntent".equals(intentName)) { return getHelpResponse(); } else { return getAskResponse("HelloWorld", "This is unsupported. Please try something else."); } }
@Override public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) { IntentRequest request = requestEnvelope.getRequest(); log.info("onIntent requestId={}, sessionId={}", request.getRequestId(), requestEnvelope.getSession().getSessionId()); Intent intent = request.getIntent(); String intentName = (intent != null) ? intent.getName() : null; if ("HelloWorldIntent".equals(intentName)) { return getHelloResponse(); } else if ("AMAZON.HelpIntent".equals(intentName)) { return getHelpResponse(); } else { return getAskResponse("HelloWorld", "This is unsupported. Please try something else."); } }
@Override public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) { IntentRequest request = requestEnvelope.getRequest(); Session session = requestEnvelope.getSession(); log.info("onIntent requestId={}, sessionId={}", request.getRequestId(), session); // Get intent from the request object. Intent intent = request.getIntent(); String intentName = (intent != null) ? intent.getName() : null; // Note: If the session is started with an intent, no welcome message will be rendered; // rather, the intent specific response will be returned. if ("MyColorIsIntent".equals(intentName)) { return setColorInSession(intent, session); } else if ("WhatsMyColorIntent".equals(intentName)) { return getColorFromSession(intent, session); } else { String errorSpeech = "This is unsupported. Please try something else."; return getSpeechletResponse(errorSpeech, errorSpeech, true); } }
@Override public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) { IntentRequest request = requestEnvelope.getRequest(); Session session = requestEnvelope.getSession(); log.info("onIntent requestId={}, sessionId={}", request.getRequestId(), session); // Get intent from the request object. Intent intent = request.getIntent(); String intentName = (intent != null) ? intent.getName() : null; // Note: If the session is started with an intent, no welcome message will be rendered; // rather, the intent specific response will be returned. if ("MyColorIsIntent".equals(intentName)) { return setColorInSession(intent, session); } else if ("WhatsMyColorIntent".equals(intentName)) { return getColorFromSession(intent, session); } else { String errorSpeech = "This is unsupported. Please try something else."; return getSpeechletResponse(errorSpeech, errorSpeech, true); } }
@Override public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) { IntentRequest request = requestEnvelope.getRequest(); log.info("onIntent requestId={}, sessionId={}", request.getRequestId(), requestEnvelope.getSession().getSessionId()); Intent intent = request.getIntent(); String intentName = (intent != null) ? intent.getName() : null; if ("RecipeIntent".equals(intentName)) { return getRecipe(intent); } else if ("AMAZON.HelpIntent".equals(intentName)) { return getHelp(); } else if ("AMAZON.StopIntent".equals(intentName)) { PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech(); outputSpeech.setText("Goodbye"); return SpeechletResponse.newTellResponse(outputSpeech); } else if ("AMAZON.CancelIntent".equals(intentName)) { PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech(); outputSpeech.setText("Goodbye"); return SpeechletResponse.newTellResponse(outputSpeech); } else { String errorSpeech = "This is unsupported. Please try something else."; return newAskResponse(errorSpeech, errorSpeech); } }
@Override public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) { IntentRequest request = requestEnvelope.getRequest(); log.info("onIntent requestId={}, sessionId={}", request.getRequestId(), requestEnvelope.getSession().getSessionId()); Intent intent = request.getIntent(); String intentName = (intent != null) ? intent.getName() : null; if ("GetNewFactIntent".equals(intentName)) { return getNewFactResponse(); } else if ("AMAZON.HelpIntent".equals(intentName)) { return getHelpResponse(); } else if ("AMAZON.StopIntent".equals(intentName)) { PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech(); outputSpeech.setText("Goodbye"); return SpeechletResponse.newTellResponse(outputSpeech); } else if ("AMAZON.CancelIntent".equals(intentName)) { PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech(); outputSpeech.setText("Goodbye"); return SpeechletResponse.newTellResponse(outputSpeech); } else { return getAskResponse("SpaceGeek", "This is unsupported. Please try something else."); } }
@Override public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) { IntentRequest request = requestEnvelope.getRequest(); log.info("onIntent requestId={}, sessionId={}", request.getRequestId(), requestEnvelope.getSession().getSessionId()); Intent intent = request.getIntent(); String intentName = (intent != null) ? intent.getName() : null; if ("GetNewFactIntent".equals(intentName)) { return getNewFactResponse(); } else if ("AMAZON.HelpIntent".equals(intentName)) { return getHelpResponse(); } else if ("AMAZON.StopIntent".equals(intentName)) { PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech(); outputSpeech.setText("Goodbye"); return SpeechletResponse.newTellResponse(outputSpeech); } else if ("AMAZON.CancelIntent".equals(intentName)) { PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech(); outputSpeech.setText("Goodbye"); return SpeechletResponse.newTellResponse(outputSpeech); } else { return getAskResponse("SpaceGeek", "This is unsupported. Please try something else."); } }
@Override public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) { IntentRequest request = requestEnvelope.getRequest(); log.info("onIntent requestId={}, sessionId={}", request.getRequestId(), requestEnvelope.getSession().getSessionId()); Intent intent = request.getIntent(); String intentName = (intent != null) ? intent.getName() : null; if ("RecipeIntent".equals(intentName)) { return getRecipe(intent); } else if ("AMAZON.HelpIntent".equals(intentName)) { return getHelp(); } else if ("AMAZON.StopIntent".equals(intentName)) { PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech(); outputSpeech.setText("Goodbye"); return SpeechletResponse.newTellResponse(outputSpeech); } else if ("AMAZON.CancelIntent".equals(intentName)) { PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech(); outputSpeech.setText("Goodbye"); return SpeechletResponse.newTellResponse(outputSpeech); } else { String errorSpeech = "This is unsupported. Please try something else."; return newAskResponse(errorSpeech, errorSpeech); } }
String intentName = (intent != null) ? intent.getName() : null;
String intentName = (intent != null) ? intent.getName() : null;
requestEnvelope.getSession().getSessionId()); String intentName = requestEnvelope.getRequest().getIntent().getName();
@Override public SkillRequestInformation parseRequestEnvelope(SpeechletRequestEnvelope envelope) { IntentRequest request = (IntentRequest) envelope.getRequest(); Intent intent = request.getIntent(); SkillRequestInformation skillRequestInformation = new SkillRequestInformation(); skillRequestInformation.setRequestType(SkillRequestInformation.RequestType.INTENT_REQUEST); skillRequestInformation.setIntentName(intent.getName()); skillRequestInformation.setSlots(intent.getSlots()); skillRequestInformation.setToken(getDisplayStateToken(envelope)); return skillRequestInformation; }
String intentName = intent.getName();
String intentName = (intent != null) ? intent.getName() : null;
@Override public SkillRequestInformation parseRequestEnvelope(SpeechletRequestEnvelope envelope) { IntentRequest request = (IntentRequest) envelope.getRequest(); Intent intent = request.getIntent(); SkillRequestInformation skillRequestInformation = new SkillRequestInformation(); skillRequestInformation.setRequestType(SkillRequestInformation.RequestType.INTENT_REQUEST); skillRequestInformation.setIntentName(intent.getName()); skillRequestInformation.setSlots(intent.getSlots()); skillRequestInformation.setToken(getDisplayStateToken(envelope)); return skillRequestInformation; }
String intentName = intent.getName();
String intentName = intent.getName();