public class SpeechletResponse extends Object
SpeechletV2 invocation. Defines text to speak to the user, content to
display in the companion application, and whether or not the current SpeechletV2 session
should end.| Constructor and Description |
|---|
SpeechletResponse()
Default public constructor
|
| Modifier and Type | Method and Description |
|---|---|
Card |
getCard()
Returns the UI card associated with this response.
|
List<Directive> |
getDirectives()
Returns the directives associated with this response.
|
Boolean |
getNullableShouldEndSession()
Returns value of shouldEndSession attribute
|
OutputSpeech |
getOutputSpeech()
Returns the speech associated with this response.
|
Reprompt |
getReprompt()
Returns the reprompt associated with this response.
|
boolean |
getShouldEndSession()
Deprecated.
with version 1.4.0 replaced with
getNullableShouldEndSession() |
static SpeechletResponse |
newAskResponse(OutputSpeech outputSpeech,
Reprompt reprompt)
Creates and returns a response intended to ask the user a question.
|
static SpeechletResponse |
newAskResponse(OutputSpeech outputSpeech,
Reprompt reprompt,
Card card)
Creates and returns a response intended to ask the user a question, both in speech and with a
graphical card displayed in the companion app.
|
static SpeechletResponse |
newTellResponse(OutputSpeech outputSpeech)
Creates and returns a response intended to tell the user something.
|
static SpeechletResponse |
newTellResponse(OutputSpeech outputSpeech,
Card card)
Creates and returns a response intended to tell the user something, both in speech and with a
graphical card in the companion app.
|
void |
setCard(Card card)
Sets the UI card associated with this response.
|
void |
setDirectives(List<Directive> directives)
Sets the directives for this response.
|
void |
setNullableShouldEndSession(Boolean shouldEndSession)
Sets value of shouldEndSession attribute
|
void |
setOutputSpeech(OutputSpeech outputSpeech)
Sets the speech associated with this response.
|
void |
setReprompt(Reprompt reprompt)
Sets the reprompt associated with this response.
|
void |
setShouldEndSession(boolean shouldEndSession)
Deprecated.
with version 1.4.0
null value is allowed.
See setNullableShouldEndSession(Boolean) |
public OutputSpeech getOutputSpeech()
public void setOutputSpeech(OutputSpeech outputSpeech)
outputSpeech - the speech to set@Deprecated public boolean getShouldEndSession()
getNullableShouldEndSession()null value returns false@Deprecated public void setShouldEndSession(boolean shouldEndSession)
null value is allowed.
See setNullableShouldEndSession(Boolean)shouldEndSession - true if the session should end with this responsepublic Boolean getNullableShouldEndSession()
false means session should be kept open and voice command is expected
true means session should be terminated
null for non-display cases defaults to true and for display template
scenarios keeps session open without expecting voice command
Refer to online documentation for more information
public void setNullableShouldEndSession(Boolean shouldEndSession)
Set it to true to end session
Set it to false to keep session open and wait for a voice command or response
Set it to null to keep session open without waiting for a voice command when
displaying template. If no template is displayed it will default to
previous behavior and end session.
Refer to online documentation for more details.
shouldEndSession - new value of shouldEndSession attributepublic Card getCard()
public void setCard(Card card)
card - the UI card to setpublic List<Directive> getDirectives()
public void setDirectives(List<Directive> directives)
directives - the directivespublic Reprompt getReprompt()
public void setReprompt(Reprompt reprompt)
reprompt - the repromptpublic static SpeechletResponse newTellResponse(OutputSpeech outputSpeech)
All arguments in this method are required and cannot be null.
outputSpeech - output speech content for the tell voice responsepublic static SpeechletResponse newTellResponse(OutputSpeech outputSpeech, Card card)
All arguments in this method are required and cannot be null.
outputSpeech - output speech content for the tell voice responsecard - card to display in the companion applicationpublic static SpeechletResponse newAskResponse(OutputSpeech outputSpeech, Reprompt reprompt)
All arguments in this method are required and cannot be null.
outputSpeech - output speech content for the ask voice responsereprompt - reprompt speech for the ask voice response. This speech is played if the user does
not reply to the question or replies with something that is not understood.public static SpeechletResponse newAskResponse(OutputSpeech outputSpeech, Reprompt reprompt, Card card)
All arguments in this method are required and cannot be null.
outputSpeech - output speech content for the ask voice responsereprompt - reprompt speech for the ask voice response. This speech is played if the user does
not reply to the question or replies with something that is not understood.card - card to display in the companion applicationCopyright © 2017. All rights reserved.