Clova v0.5.0 Clova.Response View Source
Defines a struct that contains the data that should be encoded into JSON as a response to a clova request.
An intance of this struct is initialised by the Clova.DispatcherPlug
and passed to the
callbacks defined by the Clova
behaviour.
Link to this section Summary
Functions
Adds the specified speech
to the response’s reprompt
data. This is used by Clova to
reprompt the user for an utterance when clova is expecting a reply but none is detected
Appends the specified speech
to the response. speech
can be text or a URL. When
passing a URL, set the type:
option to :url
Sets the shouldEndSession
flag of response
to true
Places the supplied session_attributes
object into the response. The same data will be
included in any subsequent clova request during the session. Subsequent calls to this function
will overwrite the data from previous calls
Link to this section Functions
Adds the specified speech
to the response’s reprompt
data. This is used by Clova to
reprompt the user for an utterance when clova is expecting a reply but none is detected.
The behavior is otherwise the same as add_speech/3
.
Appends the specified speech
to the response. speech
can be text or a URL. When
passing a URL, set the type:
option to :url
.
This function automatically upgrades a SimpleSpeech
response to a SpeechList
response if the response already contained a non-nil SimpleSpeech
string. If the response was empty, a SimpleSpeech
response is created.
Options
type:
- Can be:text
or:url
. Defaults to:text
.lang:
- Should be a two-letter language code. Defaults to"ja"
. See theSpeechInfoObject
documentation for the currently supported languages. When thetype:
option is set to:url
, this option is ignored and the language is set to the empty string.
Sets the shouldEndSession
flag of response
to true
.
Places the supplied session_attributes
object into the response. The same data will be
included in any subsequent clova request during the session. Subsequent calls to this function
will overwrite the data from previous calls.
session_attributes
should be formatted as a key, value map.