当前位置: 首页>>代码示例>>Java>>正文


Java LaunchRequest类代码示例

本文整理汇总了Java中com.amazon.speech.speechlet.LaunchRequest的典型用法代码示例。如果您正苦于以下问题:Java LaunchRequest类的具体用法?Java LaunchRequest怎么用?Java LaunchRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LaunchRequest类属于com.amazon.speech.speechlet包,在下文中一共展示了LaunchRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLaunch

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Test
public void onLaunch() throws Exception {
    IntrospectionData data = registry.getDataForPath("/invoked").orElseThrow(RuntimeException::new);

    final ArrayListMultimap<String, InvokableMethod> methods = ArrayListMultimap.create();
    data.getMethods().forEach(m->methods.put(m.getName(), m));

    InvokedTestSkill skill = new InvokedTestSkill();
    DynamicSpeechlet speechlet = new DynamicSpeechlet(methods, data, new FormatterMappings(),
            registry, skill, new DefaultTypeFactory());
    LaunchRequest request = LaunchRequest.builder()
            .withRequestId("id")
            .withTimestamp(new Date()).build();
    SpeechletResponse response = speechlet.onLaunch(request, session);
    assertTrue(skill.onLaunch.get());
    assertEquals("launch", ((PlainTextOutputSpeech) response.getOutputSpeech()).getText());
}
 
开发者ID:kebernet,项目名称:skillz,代码行数:18,代码来源:SimpleSpeechletInvocationTests.java

示例2: onLaunch

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
        throws SpeechletException {
    log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());
    return getWelcomeResponse();
}
 
开发者ID:arun-gupta,项目名称:alexa-skill-java,代码行数:8,代码来源:HelloWorldSpeechlet.java

示例3: onLaunch

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
public SpeechletResponse onLaunch(LaunchRequest request, Session session) throws SpeechletException {
    LOGGER.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),  session.getSessionId());

    RequestHandlerFactory factory = GetRequestHandlerFactory.FUNCTION.apply(LAUNCH_HANDLER);

    if (factory != null) {
        return factory.create(context).onRequest(request, session);
    } else {
        throw new SpeechletException("Could not find RequestHandler for: "+LOGGER);
    }

}
 
开发者ID:fabric8io,项目名称:kubernetes-alexa,代码行数:13,代码来源:RequestDispatcher.java

示例4: getWelcomeResponse

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
/**
 * Creates and returns a {@code SpeechletResponse} with a welcome message.
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
@OnLaunch
public SpeechletResponse getWelcomeResponse(final LaunchRequest request) {
  final OutputSpeech speech = speechService.speechWelcomeMessage(request.getLocale());

  return SpeechletResponse.newAskResponse(speech, new Reprompt());
}
 
开发者ID:rainu,项目名称:alexa-skill,代码行数:12,代码来源:BasicSpeechlet.java

示例5: onLaunch

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
        throws SpeechletException {
    log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());

    String welcomeStr = "Welcome to Template test skill. Try asking me things.";
    PlainTextOutputSpeech outputSpeech = new PlainTextOutputSpeech();
    outputSpeech.setText(welcomeStr);
    
    return SpeechletResponse.newTellResponse(outputSpeech);
}
 
开发者ID:jneong,项目名称:CS370_Echo_Demo,代码行数:13,代码来源:TemplateBaseSkillSpeechlet.java

示例6: constructLaunchInputAndGetMembers

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Test
public void constructLaunchInputAndGetMembers() throws Exception {
    final LaunchRequest request = ModelFactory.givenLaunchRequest();
    final Session session = ModelFactory.givenSession();
    final Context context = ModelFactory.givenAlexaContext();
    final AlexaInput input = new AlexaInput(request, session, LOCALE, context);

    Assert.assertEquals(request, input.getRequest());
    Assert.assertNotNull(input.getSessionStateHandler());
    Assert.assertEquals(session, input.getSessionStateHandler().getSession());
}
 
开发者ID:KayLerch,项目名称:alexa-skills-kit-tellask-java,代码行数:12,代码来源:AlexaInputTest.java

示例7: testGetIntentName

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Test
public void testGetIntentName() throws Exception {
    final IntentRequest request = ModelFactory.givenIntentRequest("intentName");
    final Session session = ModelFactory.givenSession();
    final Context context = ModelFactory.givenAlexaContext();

    final AlexaInput input = new AlexaInput(request, session, LOCALE, context);
    Assert.assertEquals("intentName", input.getIntentName());

    final LaunchRequest launchRequest = ModelFactory.givenLaunchRequest();
    final AlexaInput input2 = new AlexaInput(launchRequest, session, LOCALE, context);
    Assert.assertNull(input2.getIntentName());
}
 
开发者ID:KayLerch,项目名称:alexa-skills-kit-tellask-java,代码行数:14,代码来源:AlexaInputTest.java

示例8: getSpeechletRequest

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletRequest getSpeechletRequest() {
    return LaunchRequest.builder()
            .withLocale(session.getClient().getLocale())
            .withRequestId(generateRequestId())
            .withTimestamp(session.getClient().getCurrentTimestamp())
            .build();
}
 
开发者ID:KayLerch,项目名称:alexa-skills-kit-tester-java,代码行数:9,代码来源:AlexaLaunchRequest.java

示例9: onLaunch

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
        throws SpeechletException {

    provideSessionForRequest(session);
    return dispatchIntent("CommonIntentsWelcomeIntent", null, session);
}
 
开发者ID:rs22,项目名称:alexa-routing,代码行数:8,代码来源:RoutingSpeechlet.java

示例10: onLaunch

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
		throws SpeechletException {
	log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
			session.getSessionId());
	return getWelcomeResponse();
}
 
开发者ID:bellissimo,项目名称:AlexaSky,代码行数:8,代码来源:SkySpeechlet.java

示例11: onLaunch

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
        throws SpeechletException {
    log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
            session.getSessionId());

    // Here we are setting shouldEndSession to false to not end the session and
    // prompt the user for input
    return buildSpeechletResponse("Welcome", introSpeechOutput, false);
}
 
开发者ID:parisbutterfield,项目名称:alexa-stocks,代码行数:11,代码来源:StockSpeechlet.java

示例12: onLaunch

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
  public SpeechletResponse onLaunch(final LaunchRequest request, final Session session)
          throws SpeechletException {
      log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
              session.getSessionId());

      String speechOutput =
"The house is here to help. What can I help you with?";
      // If the user either does not reply to the welcome message or says
      // something that is not understood, they will be prompted again with this text.
      String repromptText = "For instructions on what you can say, please say help me.";

      // Here we are prompting the user for input
      return newAskResponse(speechOutput, repromptText);
  }
 
开发者ID:beckdac,项目名称:alexa_domoticz_bridge,代码行数:16,代码来源:DomoticzSpeechlet.java

示例13: onLaunch

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(
    final LaunchRequest request, final Session session)
    throws SpeechletException {
  log.info("onLaunch requestId={}, sessionId={}", request.getRequestId(),
      session.getSessionId());

  return Response.welcome(session);
}
 
开发者ID:vqtran,项目名称:EchoQuery,代码行数:10,代码来源:EchoQuerySpeechlet.java

示例14: onRequest

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onRequest(LaunchRequest request, Session session) throws SpeechletException {
    return getWelcomeResponse();
}
 
开发者ID:fabric8io,项目名称:kubernetes-alexa,代码行数:5,代码来源:Launch.java

示例15: onLaunch

import com.amazon.speech.speechlet.LaunchRequest; //导入依赖的package包/类
@Override
public SpeechletResponse onLaunch(final LaunchRequest request, final Session session) throws SpeechletException {
  logger.info("onLaunch requestId={}, sessionId={}", request.getRequestId(), session.getSessionId());
  return getWelcomeResponse();
}
 
开发者ID:comtel2000,项目名称:fritz-home-skill,代码行数:6,代码来源:FritzHomeSpeechlet.java


注:本文中的com.amazon.speech.speechlet.LaunchRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。