aws_sdk_lexruntime/operation/post_text/
_post_text_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct PostTextOutput {
6    /// <p>The current user intent that Amazon Lex is aware of.</p>
7    pub intent_name: ::std::option::Option<::std::string::String>,
8    /// <p>Provides a score that indicates how confident Amazon Lex is that the returned intent is the one that matches the user's intent. The score is between 0.0 and 1.0. For more information, see <a href="https://docs.aws.amazon.com/lex/latest/dg/confidence-scores.html">Confidence Scores</a>.</p>
9    /// <p>The score is a relative score, not an absolute score. The score may change based on improvements to Amazon Lex.</p>
10    pub nlu_intent_confidence: ::std::option::Option<crate::types::IntentConfidence>,
11    /// <p>One to four alternative intents that may be applicable to the user's intent.</p>
12    /// <p>Each alternative includes a score that indicates how confident Amazon Lex is that the intent matches the user's intent. The intents are sorted by the confidence score.</p>
13    pub alternative_intents: ::std::option::Option<::std::vec::Vec<crate::types::PredictedIntent>>,
14    /// <p>The intent slots that Amazon Lex detected from the user input in the conversation.</p>
15    /// <p>Amazon Lex creates a resolution list containing likely values for a slot. The value that it returns is determined by the <code>valueSelectionStrategy</code> selected when the slot type was created or updated. If <code>valueSelectionStrategy</code> is set to <code>ORIGINAL_VALUE</code>, the value provided by the user is returned, if the user value is similar to the slot values. If <code>valueSelectionStrategy</code> is set to <code>TOP_RESOLUTION</code> Amazon Lex returns the first value in the resolution list or, if there is no resolution list, null. If you don't specify a <code>valueSelectionStrategy</code>, the default is <code>ORIGINAL_VALUE</code>.</p>
16    pub slots: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
17    /// <p>A map of key-value pairs representing the session-specific context information.</p>
18    pub session_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
19    /// <p>The message to convey to the user. The message can come from the bot's configuration or from a Lambda function.</p>
20    /// <p>If the intent is not configured with a Lambda function, or if the Lambda function returned <code>Delegate</code> as the <code>dialogAction.type</code> its response, Amazon Lex decides on the next course of action and selects an appropriate message from the bot's configuration based on the current interaction context. For example, if Amazon Lex isn't able to understand user input, it uses a clarification prompt message.</p>
21    /// <p>When you create an intent you can assign messages to groups. When messages are assigned to groups Amazon Lex returns one message from each group in the response. The message field is an escaped JSON string containing the messages. For more information about the structure of the JSON string returned, see <code>msg-prompts-formats</code>.</p>
22    /// <p>If the Lambda function returns a message, Amazon Lex passes it to the client in its response.</p>
23    pub message: ::std::option::Option<::std::string::String>,
24    /// <p>The sentiment expressed in and utterance.</p>
25    /// <p>When the bot is configured to send utterances to Amazon Comprehend for sentiment analysis, this field contains the result of the analysis.</p>
26    pub sentiment_response: ::std::option::Option<crate::types::SentimentResponse>,
27    /// <p>The format of the response message. One of the following values:</p>
28    /// <ul>
29    /// <li>
30    /// <p><code>PlainText</code> - The message contains plain UTF-8 text.</p></li>
31    /// <li>
32    /// <p><code>CustomPayload</code> - The message is a custom format defined by the Lambda function.</p></li>
33    /// <li>
34    /// <p><code>SSML</code> - The message contains text formatted for voice output.</p></li>
35    /// <li>
36    /// <p><code>Composite</code> - The message contains an escaped JSON object containing one or more messages from the groups that messages were assigned to when the intent was created.</p></li>
37    /// </ul>
38    pub message_format: ::std::option::Option<crate::types::MessageFormatType>,
39    /// <p>Identifies the current state of the user interaction. Amazon Lex returns one of the following values as <code>dialogState</code>. The client can optionally use this information to customize the user interface.</p>
40    /// <ul>
41    /// <li>
42    /// <p><code>ElicitIntent</code> - Amazon Lex wants to elicit user intent.</p>
43    /// <p>For example, a user might utter an intent ("I want to order a pizza"). If Amazon Lex cannot infer the user intent from this utterance, it will return this dialogState.</p></li>
44    /// <li>
45    /// <p><code>ConfirmIntent</code> - Amazon Lex is expecting a "yes" or "no" response.</p>
46    /// <p>For example, Amazon Lex wants user confirmation before fulfilling an intent.</p>
47    /// <p>Instead of a simple "yes" or "no," a user might respond with additional information. For example, "yes, but make it thick crust pizza" or "no, I want to order a drink". Amazon Lex can process such additional information (in these examples, update the crust type slot value, or change intent from OrderPizza to OrderDrink).</p></li>
48    /// <li>
49    /// <p><code>ElicitSlot</code> - Amazon Lex is expecting a slot value for the current intent.</p>
50    /// <p>For example, suppose that in the response Amazon Lex sends this message: "What size pizza would you like?". A user might reply with the slot value (e.g., "medium"). The user might also provide additional information in the response (e.g., "medium thick crust pizza"). Amazon Lex can process such additional information appropriately.</p></li>
51    /// <li>
52    /// <p><code>Fulfilled</code> - Conveys that the Lambda function configured for the intent has successfully fulfilled the intent.</p></li>
53    /// <li>
54    /// <p><code>ReadyForFulfillment</code> - Conveys that the client has to fulfill the intent.</p></li>
55    /// <li>
56    /// <p><code>Failed</code> - Conveys that the conversation with the user failed.</p>
57    /// <p>This can happen for various reasons including that the user did not provide an appropriate response to prompts from the service (you can configure how many times Amazon Lex can prompt a user for specific information), or the Lambda function failed to fulfill the intent.</p></li>
58    /// </ul>
59    pub dialog_state: ::std::option::Option<crate::types::DialogState>,
60    /// <p>If the <code>dialogState</code> value is <code>ElicitSlot</code>, returns the name of the slot for which Amazon Lex is eliciting a value.</p>
61    pub slot_to_elicit: ::std::option::Option<::std::string::String>,
62    /// <p>Represents the options that the user has to respond to the current prompt. Response Card can come from the bot configuration (in the Amazon Lex console, choose the settings button next to a slot) or from a code hook (Lambda function).</p>
63    pub response_card: ::std::option::Option<crate::types::ResponseCard>,
64    /// <p>A unique identifier for the session.</p>
65    pub session_id: ::std::option::Option<::std::string::String>,
66    /// <p>The version of the bot that responded to the conversation. You can use this information to help determine if one version of a bot is performing better than another version.</p>
67    pub bot_version: ::std::option::Option<::std::string::String>,
68    /// <p>A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the <code>PostContent</code>, <code>PostText</code>, or <code>PutSession</code> operation.</p>
69    /// <p>You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.</p>
70    pub active_contexts: ::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>>,
71    _request_id: Option<String>,
72}
73impl PostTextOutput {
74    /// <p>The current user intent that Amazon Lex is aware of.</p>
75    pub fn intent_name(&self) -> ::std::option::Option<&str> {
76        self.intent_name.as_deref()
77    }
78    /// <p>Provides a score that indicates how confident Amazon Lex is that the returned intent is the one that matches the user's intent. The score is between 0.0 and 1.0. For more information, see <a href="https://docs.aws.amazon.com/lex/latest/dg/confidence-scores.html">Confidence Scores</a>.</p>
79    /// <p>The score is a relative score, not an absolute score. The score may change based on improvements to Amazon Lex.</p>
80    pub fn nlu_intent_confidence(&self) -> ::std::option::Option<&crate::types::IntentConfidence> {
81        self.nlu_intent_confidence.as_ref()
82    }
83    /// <p>One to four alternative intents that may be applicable to the user's intent.</p>
84    /// <p>Each alternative includes a score that indicates how confident Amazon Lex is that the intent matches the user's intent. The intents are sorted by the confidence score.</p>
85    ///
86    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.alternative_intents.is_none()`.
87    pub fn alternative_intents(&self) -> &[crate::types::PredictedIntent] {
88        self.alternative_intents.as_deref().unwrap_or_default()
89    }
90    /// <p>The intent slots that Amazon Lex detected from the user input in the conversation.</p>
91    /// <p>Amazon Lex creates a resolution list containing likely values for a slot. The value that it returns is determined by the <code>valueSelectionStrategy</code> selected when the slot type was created or updated. If <code>valueSelectionStrategy</code> is set to <code>ORIGINAL_VALUE</code>, the value provided by the user is returned, if the user value is similar to the slot values. If <code>valueSelectionStrategy</code> is set to <code>TOP_RESOLUTION</code> Amazon Lex returns the first value in the resolution list or, if there is no resolution list, null. If you don't specify a <code>valueSelectionStrategy</code>, the default is <code>ORIGINAL_VALUE</code>.</p>
92    pub fn slots(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
93        self.slots.as_ref()
94    }
95    /// <p>A map of key-value pairs representing the session-specific context information.</p>
96    pub fn session_attributes(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
97        self.session_attributes.as_ref()
98    }
99    /// <p>The message to convey to the user. The message can come from the bot's configuration or from a Lambda function.</p>
100    /// <p>If the intent is not configured with a Lambda function, or if the Lambda function returned <code>Delegate</code> as the <code>dialogAction.type</code> its response, Amazon Lex decides on the next course of action and selects an appropriate message from the bot's configuration based on the current interaction context. For example, if Amazon Lex isn't able to understand user input, it uses a clarification prompt message.</p>
101    /// <p>When you create an intent you can assign messages to groups. When messages are assigned to groups Amazon Lex returns one message from each group in the response. The message field is an escaped JSON string containing the messages. For more information about the structure of the JSON string returned, see <code>msg-prompts-formats</code>.</p>
102    /// <p>If the Lambda function returns a message, Amazon Lex passes it to the client in its response.</p>
103    pub fn message(&self) -> ::std::option::Option<&str> {
104        self.message.as_deref()
105    }
106    /// <p>The sentiment expressed in and utterance.</p>
107    /// <p>When the bot is configured to send utterances to Amazon Comprehend for sentiment analysis, this field contains the result of the analysis.</p>
108    pub fn sentiment_response(&self) -> ::std::option::Option<&crate::types::SentimentResponse> {
109        self.sentiment_response.as_ref()
110    }
111    /// <p>The format of the response message. One of the following values:</p>
112    /// <ul>
113    /// <li>
114    /// <p><code>PlainText</code> - The message contains plain UTF-8 text.</p></li>
115    /// <li>
116    /// <p><code>CustomPayload</code> - The message is a custom format defined by the Lambda function.</p></li>
117    /// <li>
118    /// <p><code>SSML</code> - The message contains text formatted for voice output.</p></li>
119    /// <li>
120    /// <p><code>Composite</code> - The message contains an escaped JSON object containing one or more messages from the groups that messages were assigned to when the intent was created.</p></li>
121    /// </ul>
122    pub fn message_format(&self) -> ::std::option::Option<&crate::types::MessageFormatType> {
123        self.message_format.as_ref()
124    }
125    /// <p>Identifies the current state of the user interaction. Amazon Lex returns one of the following values as <code>dialogState</code>. The client can optionally use this information to customize the user interface.</p>
126    /// <ul>
127    /// <li>
128    /// <p><code>ElicitIntent</code> - Amazon Lex wants to elicit user intent.</p>
129    /// <p>For example, a user might utter an intent ("I want to order a pizza"). If Amazon Lex cannot infer the user intent from this utterance, it will return this dialogState.</p></li>
130    /// <li>
131    /// <p><code>ConfirmIntent</code> - Amazon Lex is expecting a "yes" or "no" response.</p>
132    /// <p>For example, Amazon Lex wants user confirmation before fulfilling an intent.</p>
133    /// <p>Instead of a simple "yes" or "no," a user might respond with additional information. For example, "yes, but make it thick crust pizza" or "no, I want to order a drink". Amazon Lex can process such additional information (in these examples, update the crust type slot value, or change intent from OrderPizza to OrderDrink).</p></li>
134    /// <li>
135    /// <p><code>ElicitSlot</code> - Amazon Lex is expecting a slot value for the current intent.</p>
136    /// <p>For example, suppose that in the response Amazon Lex sends this message: "What size pizza would you like?". A user might reply with the slot value (e.g., "medium"). The user might also provide additional information in the response (e.g., "medium thick crust pizza"). Amazon Lex can process such additional information appropriately.</p></li>
137    /// <li>
138    /// <p><code>Fulfilled</code> - Conveys that the Lambda function configured for the intent has successfully fulfilled the intent.</p></li>
139    /// <li>
140    /// <p><code>ReadyForFulfillment</code> - Conveys that the client has to fulfill the intent.</p></li>
141    /// <li>
142    /// <p><code>Failed</code> - Conveys that the conversation with the user failed.</p>
143    /// <p>This can happen for various reasons including that the user did not provide an appropriate response to prompts from the service (you can configure how many times Amazon Lex can prompt a user for specific information), or the Lambda function failed to fulfill the intent.</p></li>
144    /// </ul>
145    pub fn dialog_state(&self) -> ::std::option::Option<&crate::types::DialogState> {
146        self.dialog_state.as_ref()
147    }
148    /// <p>If the <code>dialogState</code> value is <code>ElicitSlot</code>, returns the name of the slot for which Amazon Lex is eliciting a value.</p>
149    pub fn slot_to_elicit(&self) -> ::std::option::Option<&str> {
150        self.slot_to_elicit.as_deref()
151    }
152    /// <p>Represents the options that the user has to respond to the current prompt. Response Card can come from the bot configuration (in the Amazon Lex console, choose the settings button next to a slot) or from a code hook (Lambda function).</p>
153    pub fn response_card(&self) -> ::std::option::Option<&crate::types::ResponseCard> {
154        self.response_card.as_ref()
155    }
156    /// <p>A unique identifier for the session.</p>
157    pub fn session_id(&self) -> ::std::option::Option<&str> {
158        self.session_id.as_deref()
159    }
160    /// <p>The version of the bot that responded to the conversation. You can use this information to help determine if one version of a bot is performing better than another version.</p>
161    pub fn bot_version(&self) -> ::std::option::Option<&str> {
162        self.bot_version.as_deref()
163    }
164    /// <p>A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the <code>PostContent</code>, <code>PostText</code>, or <code>PutSession</code> operation.</p>
165    /// <p>You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.</p>
166    ///
167    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.active_contexts.is_none()`.
168    pub fn active_contexts(&self) -> &[crate::types::ActiveContext] {
169        self.active_contexts.as_deref().unwrap_or_default()
170    }
171}
172impl ::std::fmt::Debug for PostTextOutput {
173    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
174        let mut formatter = f.debug_struct("PostTextOutput");
175        formatter.field("intent_name", &self.intent_name);
176        formatter.field("nlu_intent_confidence", &self.nlu_intent_confidence);
177        formatter.field("alternative_intents", &self.alternative_intents);
178        formatter.field("slots", &"*** Sensitive Data Redacted ***");
179        formatter.field("session_attributes", &"*** Sensitive Data Redacted ***");
180        formatter.field("message", &"*** Sensitive Data Redacted ***");
181        formatter.field("sentiment_response", &self.sentiment_response);
182        formatter.field("message_format", &self.message_format);
183        formatter.field("dialog_state", &self.dialog_state);
184        formatter.field("slot_to_elicit", &self.slot_to_elicit);
185        formatter.field("response_card", &self.response_card);
186        formatter.field("session_id", &self.session_id);
187        formatter.field("bot_version", &self.bot_version);
188        formatter.field("active_contexts", &"*** Sensitive Data Redacted ***");
189        formatter.field("_request_id", &self._request_id);
190        formatter.finish()
191    }
192}
193impl ::aws_types::request_id::RequestId for PostTextOutput {
194    fn request_id(&self) -> Option<&str> {
195        self._request_id.as_deref()
196    }
197}
198impl PostTextOutput {
199    /// Creates a new builder-style object to manufacture [`PostTextOutput`](crate::operation::post_text::PostTextOutput).
200    pub fn builder() -> crate::operation::post_text::builders::PostTextOutputBuilder {
201        crate::operation::post_text::builders::PostTextOutputBuilder::default()
202    }
203}
204
205/// A builder for [`PostTextOutput`](crate::operation::post_text::PostTextOutput).
206#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
207#[non_exhaustive]
208pub struct PostTextOutputBuilder {
209    pub(crate) intent_name: ::std::option::Option<::std::string::String>,
210    pub(crate) nlu_intent_confidence: ::std::option::Option<crate::types::IntentConfidence>,
211    pub(crate) alternative_intents: ::std::option::Option<::std::vec::Vec<crate::types::PredictedIntent>>,
212    pub(crate) slots: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
213    pub(crate) session_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
214    pub(crate) message: ::std::option::Option<::std::string::String>,
215    pub(crate) sentiment_response: ::std::option::Option<crate::types::SentimentResponse>,
216    pub(crate) message_format: ::std::option::Option<crate::types::MessageFormatType>,
217    pub(crate) dialog_state: ::std::option::Option<crate::types::DialogState>,
218    pub(crate) slot_to_elicit: ::std::option::Option<::std::string::String>,
219    pub(crate) response_card: ::std::option::Option<crate::types::ResponseCard>,
220    pub(crate) session_id: ::std::option::Option<::std::string::String>,
221    pub(crate) bot_version: ::std::option::Option<::std::string::String>,
222    pub(crate) active_contexts: ::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>>,
223    _request_id: Option<String>,
224}
225impl PostTextOutputBuilder {
226    /// <p>The current user intent that Amazon Lex is aware of.</p>
227    pub fn intent_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
228        self.intent_name = ::std::option::Option::Some(input.into());
229        self
230    }
231    /// <p>The current user intent that Amazon Lex is aware of.</p>
232    pub fn set_intent_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
233        self.intent_name = input;
234        self
235    }
236    /// <p>The current user intent that Amazon Lex is aware of.</p>
237    pub fn get_intent_name(&self) -> &::std::option::Option<::std::string::String> {
238        &self.intent_name
239    }
240    /// <p>Provides a score that indicates how confident Amazon Lex is that the returned intent is the one that matches the user's intent. The score is between 0.0 and 1.0. For more information, see <a href="https://docs.aws.amazon.com/lex/latest/dg/confidence-scores.html">Confidence Scores</a>.</p>
241    /// <p>The score is a relative score, not an absolute score. The score may change based on improvements to Amazon Lex.</p>
242    pub fn nlu_intent_confidence(mut self, input: crate::types::IntentConfidence) -> Self {
243        self.nlu_intent_confidence = ::std::option::Option::Some(input);
244        self
245    }
246    /// <p>Provides a score that indicates how confident Amazon Lex is that the returned intent is the one that matches the user's intent. The score is between 0.0 and 1.0. For more information, see <a href="https://docs.aws.amazon.com/lex/latest/dg/confidence-scores.html">Confidence Scores</a>.</p>
247    /// <p>The score is a relative score, not an absolute score. The score may change based on improvements to Amazon Lex.</p>
248    pub fn set_nlu_intent_confidence(mut self, input: ::std::option::Option<crate::types::IntentConfidence>) -> Self {
249        self.nlu_intent_confidence = input;
250        self
251    }
252    /// <p>Provides a score that indicates how confident Amazon Lex is that the returned intent is the one that matches the user's intent. The score is between 0.0 and 1.0. For more information, see <a href="https://docs.aws.amazon.com/lex/latest/dg/confidence-scores.html">Confidence Scores</a>.</p>
253    /// <p>The score is a relative score, not an absolute score. The score may change based on improvements to Amazon Lex.</p>
254    pub fn get_nlu_intent_confidence(&self) -> &::std::option::Option<crate::types::IntentConfidence> {
255        &self.nlu_intent_confidence
256    }
257    /// Appends an item to `alternative_intents`.
258    ///
259    /// To override the contents of this collection use [`set_alternative_intents`](Self::set_alternative_intents).
260    ///
261    /// <p>One to four alternative intents that may be applicable to the user's intent.</p>
262    /// <p>Each alternative includes a score that indicates how confident Amazon Lex is that the intent matches the user's intent. The intents are sorted by the confidence score.</p>
263    pub fn alternative_intents(mut self, input: crate::types::PredictedIntent) -> Self {
264        let mut v = self.alternative_intents.unwrap_or_default();
265        v.push(input);
266        self.alternative_intents = ::std::option::Option::Some(v);
267        self
268    }
269    /// <p>One to four alternative intents that may be applicable to the user's intent.</p>
270    /// <p>Each alternative includes a score that indicates how confident Amazon Lex is that the intent matches the user's intent. The intents are sorted by the confidence score.</p>
271    pub fn set_alternative_intents(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::PredictedIntent>>) -> Self {
272        self.alternative_intents = input;
273        self
274    }
275    /// <p>One to four alternative intents that may be applicable to the user's intent.</p>
276    /// <p>Each alternative includes a score that indicates how confident Amazon Lex is that the intent matches the user's intent. The intents are sorted by the confidence score.</p>
277    pub fn get_alternative_intents(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::PredictedIntent>> {
278        &self.alternative_intents
279    }
280    /// Adds a key-value pair to `slots`.
281    ///
282    /// To override the contents of this collection use [`set_slots`](Self::set_slots).
283    ///
284    /// <p>The intent slots that Amazon Lex detected from the user input in the conversation.</p>
285    /// <p>Amazon Lex creates a resolution list containing likely values for a slot. The value that it returns is determined by the <code>valueSelectionStrategy</code> selected when the slot type was created or updated. If <code>valueSelectionStrategy</code> is set to <code>ORIGINAL_VALUE</code>, the value provided by the user is returned, if the user value is similar to the slot values. If <code>valueSelectionStrategy</code> is set to <code>TOP_RESOLUTION</code> Amazon Lex returns the first value in the resolution list or, if there is no resolution list, null. If you don't specify a <code>valueSelectionStrategy</code>, the default is <code>ORIGINAL_VALUE</code>.</p>
286    pub fn slots(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
287        let mut hash_map = self.slots.unwrap_or_default();
288        hash_map.insert(k.into(), v.into());
289        self.slots = ::std::option::Option::Some(hash_map);
290        self
291    }
292    /// <p>The intent slots that Amazon Lex detected from the user input in the conversation.</p>
293    /// <p>Amazon Lex creates a resolution list containing likely values for a slot. The value that it returns is determined by the <code>valueSelectionStrategy</code> selected when the slot type was created or updated. If <code>valueSelectionStrategy</code> is set to <code>ORIGINAL_VALUE</code>, the value provided by the user is returned, if the user value is similar to the slot values. If <code>valueSelectionStrategy</code> is set to <code>TOP_RESOLUTION</code> Amazon Lex returns the first value in the resolution list or, if there is no resolution list, null. If you don't specify a <code>valueSelectionStrategy</code>, the default is <code>ORIGINAL_VALUE</code>.</p>
294    pub fn set_slots(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
295        self.slots = input;
296        self
297    }
298    /// <p>The intent slots that Amazon Lex detected from the user input in the conversation.</p>
299    /// <p>Amazon Lex creates a resolution list containing likely values for a slot. The value that it returns is determined by the <code>valueSelectionStrategy</code> selected when the slot type was created or updated. If <code>valueSelectionStrategy</code> is set to <code>ORIGINAL_VALUE</code>, the value provided by the user is returned, if the user value is similar to the slot values. If <code>valueSelectionStrategy</code> is set to <code>TOP_RESOLUTION</code> Amazon Lex returns the first value in the resolution list or, if there is no resolution list, null. If you don't specify a <code>valueSelectionStrategy</code>, the default is <code>ORIGINAL_VALUE</code>.</p>
300    pub fn get_slots(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
301        &self.slots
302    }
303    /// Adds a key-value pair to `session_attributes`.
304    ///
305    /// To override the contents of this collection use [`set_session_attributes`](Self::set_session_attributes).
306    ///
307    /// <p>A map of key-value pairs representing the session-specific context information.</p>
308    pub fn session_attributes(
309        mut self,
310        k: impl ::std::convert::Into<::std::string::String>,
311        v: impl ::std::convert::Into<::std::string::String>,
312    ) -> Self {
313        let mut hash_map = self.session_attributes.unwrap_or_default();
314        hash_map.insert(k.into(), v.into());
315        self.session_attributes = ::std::option::Option::Some(hash_map);
316        self
317    }
318    /// <p>A map of key-value pairs representing the session-specific context information.</p>
319    pub fn set_session_attributes(
320        mut self,
321        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
322    ) -> Self {
323        self.session_attributes = input;
324        self
325    }
326    /// <p>A map of key-value pairs representing the session-specific context information.</p>
327    pub fn get_session_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
328        &self.session_attributes
329    }
330    /// <p>The message to convey to the user. The message can come from the bot's configuration or from a Lambda function.</p>
331    /// <p>If the intent is not configured with a Lambda function, or if the Lambda function returned <code>Delegate</code> as the <code>dialogAction.type</code> its response, Amazon Lex decides on the next course of action and selects an appropriate message from the bot's configuration based on the current interaction context. For example, if Amazon Lex isn't able to understand user input, it uses a clarification prompt message.</p>
332    /// <p>When you create an intent you can assign messages to groups. When messages are assigned to groups Amazon Lex returns one message from each group in the response. The message field is an escaped JSON string containing the messages. For more information about the structure of the JSON string returned, see <code>msg-prompts-formats</code>.</p>
333    /// <p>If the Lambda function returns a message, Amazon Lex passes it to the client in its response.</p>
334    pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
335        self.message = ::std::option::Option::Some(input.into());
336        self
337    }
338    /// <p>The message to convey to the user. The message can come from the bot's configuration or from a Lambda function.</p>
339    /// <p>If the intent is not configured with a Lambda function, or if the Lambda function returned <code>Delegate</code> as the <code>dialogAction.type</code> its response, Amazon Lex decides on the next course of action and selects an appropriate message from the bot's configuration based on the current interaction context. For example, if Amazon Lex isn't able to understand user input, it uses a clarification prompt message.</p>
340    /// <p>When you create an intent you can assign messages to groups. When messages are assigned to groups Amazon Lex returns one message from each group in the response. The message field is an escaped JSON string containing the messages. For more information about the structure of the JSON string returned, see <code>msg-prompts-formats</code>.</p>
341    /// <p>If the Lambda function returns a message, Amazon Lex passes it to the client in its response.</p>
342    pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
343        self.message = input;
344        self
345    }
346    /// <p>The message to convey to the user. The message can come from the bot's configuration or from a Lambda function.</p>
347    /// <p>If the intent is not configured with a Lambda function, or if the Lambda function returned <code>Delegate</code> as the <code>dialogAction.type</code> its response, Amazon Lex decides on the next course of action and selects an appropriate message from the bot's configuration based on the current interaction context. For example, if Amazon Lex isn't able to understand user input, it uses a clarification prompt message.</p>
348    /// <p>When you create an intent you can assign messages to groups. When messages are assigned to groups Amazon Lex returns one message from each group in the response. The message field is an escaped JSON string containing the messages. For more information about the structure of the JSON string returned, see <code>msg-prompts-formats</code>.</p>
349    /// <p>If the Lambda function returns a message, Amazon Lex passes it to the client in its response.</p>
350    pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
351        &self.message
352    }
353    /// <p>The sentiment expressed in and utterance.</p>
354    /// <p>When the bot is configured to send utterances to Amazon Comprehend for sentiment analysis, this field contains the result of the analysis.</p>
355    pub fn sentiment_response(mut self, input: crate::types::SentimentResponse) -> Self {
356        self.sentiment_response = ::std::option::Option::Some(input);
357        self
358    }
359    /// <p>The sentiment expressed in and utterance.</p>
360    /// <p>When the bot is configured to send utterances to Amazon Comprehend for sentiment analysis, this field contains the result of the analysis.</p>
361    pub fn set_sentiment_response(mut self, input: ::std::option::Option<crate::types::SentimentResponse>) -> Self {
362        self.sentiment_response = input;
363        self
364    }
365    /// <p>The sentiment expressed in and utterance.</p>
366    /// <p>When the bot is configured to send utterances to Amazon Comprehend for sentiment analysis, this field contains the result of the analysis.</p>
367    pub fn get_sentiment_response(&self) -> &::std::option::Option<crate::types::SentimentResponse> {
368        &self.sentiment_response
369    }
370    /// <p>The format of the response message. One of the following values:</p>
371    /// <ul>
372    /// <li>
373    /// <p><code>PlainText</code> - The message contains plain UTF-8 text.</p></li>
374    /// <li>
375    /// <p><code>CustomPayload</code> - The message is a custom format defined by the Lambda function.</p></li>
376    /// <li>
377    /// <p><code>SSML</code> - The message contains text formatted for voice output.</p></li>
378    /// <li>
379    /// <p><code>Composite</code> - The message contains an escaped JSON object containing one or more messages from the groups that messages were assigned to when the intent was created.</p></li>
380    /// </ul>
381    pub fn message_format(mut self, input: crate::types::MessageFormatType) -> Self {
382        self.message_format = ::std::option::Option::Some(input);
383        self
384    }
385    /// <p>The format of the response message. One of the following values:</p>
386    /// <ul>
387    /// <li>
388    /// <p><code>PlainText</code> - The message contains plain UTF-8 text.</p></li>
389    /// <li>
390    /// <p><code>CustomPayload</code> - The message is a custom format defined by the Lambda function.</p></li>
391    /// <li>
392    /// <p><code>SSML</code> - The message contains text formatted for voice output.</p></li>
393    /// <li>
394    /// <p><code>Composite</code> - The message contains an escaped JSON object containing one or more messages from the groups that messages were assigned to when the intent was created.</p></li>
395    /// </ul>
396    pub fn set_message_format(mut self, input: ::std::option::Option<crate::types::MessageFormatType>) -> Self {
397        self.message_format = input;
398        self
399    }
400    /// <p>The format of the response message. One of the following values:</p>
401    /// <ul>
402    /// <li>
403    /// <p><code>PlainText</code> - The message contains plain UTF-8 text.</p></li>
404    /// <li>
405    /// <p><code>CustomPayload</code> - The message is a custom format defined by the Lambda function.</p></li>
406    /// <li>
407    /// <p><code>SSML</code> - The message contains text formatted for voice output.</p></li>
408    /// <li>
409    /// <p><code>Composite</code> - The message contains an escaped JSON object containing one or more messages from the groups that messages were assigned to when the intent was created.</p></li>
410    /// </ul>
411    pub fn get_message_format(&self) -> &::std::option::Option<crate::types::MessageFormatType> {
412        &self.message_format
413    }
414    /// <p>Identifies the current state of the user interaction. Amazon Lex returns one of the following values as <code>dialogState</code>. The client can optionally use this information to customize the user interface.</p>
415    /// <ul>
416    /// <li>
417    /// <p><code>ElicitIntent</code> - Amazon Lex wants to elicit user intent.</p>
418    /// <p>For example, a user might utter an intent ("I want to order a pizza"). If Amazon Lex cannot infer the user intent from this utterance, it will return this dialogState.</p></li>
419    /// <li>
420    /// <p><code>ConfirmIntent</code> - Amazon Lex is expecting a "yes" or "no" response.</p>
421    /// <p>For example, Amazon Lex wants user confirmation before fulfilling an intent.</p>
422    /// <p>Instead of a simple "yes" or "no," a user might respond with additional information. For example, "yes, but make it thick crust pizza" or "no, I want to order a drink". Amazon Lex can process such additional information (in these examples, update the crust type slot value, or change intent from OrderPizza to OrderDrink).</p></li>
423    /// <li>
424    /// <p><code>ElicitSlot</code> - Amazon Lex is expecting a slot value for the current intent.</p>
425    /// <p>For example, suppose that in the response Amazon Lex sends this message: "What size pizza would you like?". A user might reply with the slot value (e.g., "medium"). The user might also provide additional information in the response (e.g., "medium thick crust pizza"). Amazon Lex can process such additional information appropriately.</p></li>
426    /// <li>
427    /// <p><code>Fulfilled</code> - Conveys that the Lambda function configured for the intent has successfully fulfilled the intent.</p></li>
428    /// <li>
429    /// <p><code>ReadyForFulfillment</code> - Conveys that the client has to fulfill the intent.</p></li>
430    /// <li>
431    /// <p><code>Failed</code> - Conveys that the conversation with the user failed.</p>
432    /// <p>This can happen for various reasons including that the user did not provide an appropriate response to prompts from the service (you can configure how many times Amazon Lex can prompt a user for specific information), or the Lambda function failed to fulfill the intent.</p></li>
433    /// </ul>
434    pub fn dialog_state(mut self, input: crate::types::DialogState) -> Self {
435        self.dialog_state = ::std::option::Option::Some(input);
436        self
437    }
438    /// <p>Identifies the current state of the user interaction. Amazon Lex returns one of the following values as <code>dialogState</code>. The client can optionally use this information to customize the user interface.</p>
439    /// <ul>
440    /// <li>
441    /// <p><code>ElicitIntent</code> - Amazon Lex wants to elicit user intent.</p>
442    /// <p>For example, a user might utter an intent ("I want to order a pizza"). If Amazon Lex cannot infer the user intent from this utterance, it will return this dialogState.</p></li>
443    /// <li>
444    /// <p><code>ConfirmIntent</code> - Amazon Lex is expecting a "yes" or "no" response.</p>
445    /// <p>For example, Amazon Lex wants user confirmation before fulfilling an intent.</p>
446    /// <p>Instead of a simple "yes" or "no," a user might respond with additional information. For example, "yes, but make it thick crust pizza" or "no, I want to order a drink". Amazon Lex can process such additional information (in these examples, update the crust type slot value, or change intent from OrderPizza to OrderDrink).</p></li>
447    /// <li>
448    /// <p><code>ElicitSlot</code> - Amazon Lex is expecting a slot value for the current intent.</p>
449    /// <p>For example, suppose that in the response Amazon Lex sends this message: "What size pizza would you like?". A user might reply with the slot value (e.g., "medium"). The user might also provide additional information in the response (e.g., "medium thick crust pizza"). Amazon Lex can process such additional information appropriately.</p></li>
450    /// <li>
451    /// <p><code>Fulfilled</code> - Conveys that the Lambda function configured for the intent has successfully fulfilled the intent.</p></li>
452    /// <li>
453    /// <p><code>ReadyForFulfillment</code> - Conveys that the client has to fulfill the intent.</p></li>
454    /// <li>
455    /// <p><code>Failed</code> - Conveys that the conversation with the user failed.</p>
456    /// <p>This can happen for various reasons including that the user did not provide an appropriate response to prompts from the service (you can configure how many times Amazon Lex can prompt a user for specific information), or the Lambda function failed to fulfill the intent.</p></li>
457    /// </ul>
458    pub fn set_dialog_state(mut self, input: ::std::option::Option<crate::types::DialogState>) -> Self {
459        self.dialog_state = input;
460        self
461    }
462    /// <p>Identifies the current state of the user interaction. Amazon Lex returns one of the following values as <code>dialogState</code>. The client can optionally use this information to customize the user interface.</p>
463    /// <ul>
464    /// <li>
465    /// <p><code>ElicitIntent</code> - Amazon Lex wants to elicit user intent.</p>
466    /// <p>For example, a user might utter an intent ("I want to order a pizza"). If Amazon Lex cannot infer the user intent from this utterance, it will return this dialogState.</p></li>
467    /// <li>
468    /// <p><code>ConfirmIntent</code> - Amazon Lex is expecting a "yes" or "no" response.</p>
469    /// <p>For example, Amazon Lex wants user confirmation before fulfilling an intent.</p>
470    /// <p>Instead of a simple "yes" or "no," a user might respond with additional information. For example, "yes, but make it thick crust pizza" or "no, I want to order a drink". Amazon Lex can process such additional information (in these examples, update the crust type slot value, or change intent from OrderPizza to OrderDrink).</p></li>
471    /// <li>
472    /// <p><code>ElicitSlot</code> - Amazon Lex is expecting a slot value for the current intent.</p>
473    /// <p>For example, suppose that in the response Amazon Lex sends this message: "What size pizza would you like?". A user might reply with the slot value (e.g., "medium"). The user might also provide additional information in the response (e.g., "medium thick crust pizza"). Amazon Lex can process such additional information appropriately.</p></li>
474    /// <li>
475    /// <p><code>Fulfilled</code> - Conveys that the Lambda function configured for the intent has successfully fulfilled the intent.</p></li>
476    /// <li>
477    /// <p><code>ReadyForFulfillment</code> - Conveys that the client has to fulfill the intent.</p></li>
478    /// <li>
479    /// <p><code>Failed</code> - Conveys that the conversation with the user failed.</p>
480    /// <p>This can happen for various reasons including that the user did not provide an appropriate response to prompts from the service (you can configure how many times Amazon Lex can prompt a user for specific information), or the Lambda function failed to fulfill the intent.</p></li>
481    /// </ul>
482    pub fn get_dialog_state(&self) -> &::std::option::Option<crate::types::DialogState> {
483        &self.dialog_state
484    }
485    /// <p>If the <code>dialogState</code> value is <code>ElicitSlot</code>, returns the name of the slot for which Amazon Lex is eliciting a value.</p>
486    pub fn slot_to_elicit(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
487        self.slot_to_elicit = ::std::option::Option::Some(input.into());
488        self
489    }
490    /// <p>If the <code>dialogState</code> value is <code>ElicitSlot</code>, returns the name of the slot for which Amazon Lex is eliciting a value.</p>
491    pub fn set_slot_to_elicit(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
492        self.slot_to_elicit = input;
493        self
494    }
495    /// <p>If the <code>dialogState</code> value is <code>ElicitSlot</code>, returns the name of the slot for which Amazon Lex is eliciting a value.</p>
496    pub fn get_slot_to_elicit(&self) -> &::std::option::Option<::std::string::String> {
497        &self.slot_to_elicit
498    }
499    /// <p>Represents the options that the user has to respond to the current prompt. Response Card can come from the bot configuration (in the Amazon Lex console, choose the settings button next to a slot) or from a code hook (Lambda function).</p>
500    pub fn response_card(mut self, input: crate::types::ResponseCard) -> Self {
501        self.response_card = ::std::option::Option::Some(input);
502        self
503    }
504    /// <p>Represents the options that the user has to respond to the current prompt. Response Card can come from the bot configuration (in the Amazon Lex console, choose the settings button next to a slot) or from a code hook (Lambda function).</p>
505    pub fn set_response_card(mut self, input: ::std::option::Option<crate::types::ResponseCard>) -> Self {
506        self.response_card = input;
507        self
508    }
509    /// <p>Represents the options that the user has to respond to the current prompt. Response Card can come from the bot configuration (in the Amazon Lex console, choose the settings button next to a slot) or from a code hook (Lambda function).</p>
510    pub fn get_response_card(&self) -> &::std::option::Option<crate::types::ResponseCard> {
511        &self.response_card
512    }
513    /// <p>A unique identifier for the session.</p>
514    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
515        self.session_id = ::std::option::Option::Some(input.into());
516        self
517    }
518    /// <p>A unique identifier for the session.</p>
519    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
520        self.session_id = input;
521        self
522    }
523    /// <p>A unique identifier for the session.</p>
524    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
525        &self.session_id
526    }
527    /// <p>The version of the bot that responded to the conversation. You can use this information to help determine if one version of a bot is performing better than another version.</p>
528    pub fn bot_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
529        self.bot_version = ::std::option::Option::Some(input.into());
530        self
531    }
532    /// <p>The version of the bot that responded to the conversation. You can use this information to help determine if one version of a bot is performing better than another version.</p>
533    pub fn set_bot_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
534        self.bot_version = input;
535        self
536    }
537    /// <p>The version of the bot that responded to the conversation. You can use this information to help determine if one version of a bot is performing better than another version.</p>
538    pub fn get_bot_version(&self) -> &::std::option::Option<::std::string::String> {
539        &self.bot_version
540    }
541    /// Appends an item to `active_contexts`.
542    ///
543    /// To override the contents of this collection use [`set_active_contexts`](Self::set_active_contexts).
544    ///
545    /// <p>A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the <code>PostContent</code>, <code>PostText</code>, or <code>PutSession</code> operation.</p>
546    /// <p>You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.</p>
547    pub fn active_contexts(mut self, input: crate::types::ActiveContext) -> Self {
548        let mut v = self.active_contexts.unwrap_or_default();
549        v.push(input);
550        self.active_contexts = ::std::option::Option::Some(v);
551        self
552    }
553    /// <p>A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the <code>PostContent</code>, <code>PostText</code>, or <code>PutSession</code> operation.</p>
554    /// <p>You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.</p>
555    pub fn set_active_contexts(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>>) -> Self {
556        self.active_contexts = input;
557        self
558    }
559    /// <p>A list of active contexts for the session. A context can be set when an intent is fulfilled or by calling the <code>PostContent</code>, <code>PostText</code>, or <code>PutSession</code> operation.</p>
560    /// <p>You can use a context to control the intents that can follow up an intent, or to modify the operation of your application.</p>
561    pub fn get_active_contexts(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>> {
562        &self.active_contexts
563    }
564    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
565        self._request_id = Some(request_id.into());
566        self
567    }
568
569    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
570        self._request_id = request_id;
571        self
572    }
573    /// Consumes the builder and constructs a [`PostTextOutput`](crate::operation::post_text::PostTextOutput).
574    pub fn build(self) -> crate::operation::post_text::PostTextOutput {
575        crate::operation::post_text::PostTextOutput {
576            intent_name: self.intent_name,
577            nlu_intent_confidence: self.nlu_intent_confidence,
578            alternative_intents: self.alternative_intents,
579            slots: self.slots,
580            session_attributes: self.session_attributes,
581            message: self.message,
582            sentiment_response: self.sentiment_response,
583            message_format: self.message_format,
584            dialog_state: self.dialog_state,
585            slot_to_elicit: self.slot_to_elicit,
586            response_card: self.response_card,
587            session_id: self.session_id,
588            bot_version: self.bot_version,
589            active_contexts: self.active_contexts,
590            _request_id: self._request_id,
591        }
592    }
593}
594impl ::std::fmt::Debug for PostTextOutputBuilder {
595    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
596        let mut formatter = f.debug_struct("PostTextOutputBuilder");
597        formatter.field("intent_name", &self.intent_name);
598        formatter.field("nlu_intent_confidence", &self.nlu_intent_confidence);
599        formatter.field("alternative_intents", &self.alternative_intents);
600        formatter.field("slots", &"*** Sensitive Data Redacted ***");
601        formatter.field("session_attributes", &"*** Sensitive Data Redacted ***");
602        formatter.field("message", &"*** Sensitive Data Redacted ***");
603        formatter.field("sentiment_response", &self.sentiment_response);
604        formatter.field("message_format", &self.message_format);
605        formatter.field("dialog_state", &self.dialog_state);
606        formatter.field("slot_to_elicit", &self.slot_to_elicit);
607        formatter.field("response_card", &self.response_card);
608        formatter.field("session_id", &self.session_id);
609        formatter.field("bot_version", &self.bot_version);
610        formatter.field("active_contexts", &"*** Sensitive Data Redacted ***");
611        formatter.field("_request_id", &self._request_id);
612        formatter.finish()
613    }
614}