Clova v0.2.1 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.Dispatcher plug 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 Japanese text or a URL. When passing a URL, set the type argument 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

Link to this function add_reprompt(resp, speech, type \\ :text) View Source

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.

speech can be Japanese text or a URL. When passing a URL, set the type argument to :url.

Link to this function add_speech(resp, speech, type \\ :text) View Source

Appends the specified speech to the response. speech can be Japanese text or a URL. When passing a URL, set the type argument 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, and only one utterance is provided, a SimpleSpeech response is created.

Sets the shouldEndSession flag of response to true.

Link to this function put_session_attributes(resp, session_attributes) View Source

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.