aws_sdk_lexruntimev2/operation/recognize_text/_recognize_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, ::std::fmt::Debug)]
5pub struct RecognizeTextOutput {
6 /// <p>A list of messages last sent to the user. The messages are ordered based on the order that you returned the messages from your Lambda function or the order that the messages are defined in the bot.</p>
7 pub messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
8 /// <p>Represents the current state of the dialog between the user and the bot.</p>
9 /// <p>Use this to determine the progress of the conversation and what the next action may be.</p>
10 pub session_state: ::std::option::Option<crate::types::SessionState>,
11 /// <p>A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.</p>
12 /// <p>Each interpretation includes the intent, a score that indicates now confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.</p>
13 pub interpretations: ::std::option::Option<::std::vec::Vec<crate::types::Interpretation>>,
14 /// <p>The attributes sent in the request.</p>
15 pub request_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
16 /// <p>The identifier of the session in use.</p>
17 pub session_id: ::std::option::Option<::std::string::String>,
18 /// <p>The bot member that recognized the text.</p>
19 pub recognized_bot_member: ::std::option::Option<crate::types::RecognizedBotMember>,
20 _request_id: Option<String>,
21}
22impl RecognizeTextOutput {
23 /// <p>A list of messages last sent to the user. The messages are ordered based on the order that you returned the messages from your Lambda function or the order that the messages are defined in the bot.</p>
24 ///
25 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.messages.is_none()`.
26 pub fn messages(&self) -> &[crate::types::Message] {
27 self.messages.as_deref().unwrap_or_default()
28 }
29 /// <p>Represents the current state of the dialog between the user and the bot.</p>
30 /// <p>Use this to determine the progress of the conversation and what the next action may be.</p>
31 pub fn session_state(&self) -> ::std::option::Option<&crate::types::SessionState> {
32 self.session_state.as_ref()
33 }
34 /// <p>A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.</p>
35 /// <p>Each interpretation includes the intent, a score that indicates now confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.</p>
36 ///
37 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.interpretations.is_none()`.
38 pub fn interpretations(&self) -> &[crate::types::Interpretation] {
39 self.interpretations.as_deref().unwrap_or_default()
40 }
41 /// <p>The attributes sent in the request.</p>
42 pub fn request_attributes(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
43 self.request_attributes.as_ref()
44 }
45 /// <p>The identifier of the session in use.</p>
46 pub fn session_id(&self) -> ::std::option::Option<&str> {
47 self.session_id.as_deref()
48 }
49 /// <p>The bot member that recognized the text.</p>
50 pub fn recognized_bot_member(&self) -> ::std::option::Option<&crate::types::RecognizedBotMember> {
51 self.recognized_bot_member.as_ref()
52 }
53}
54impl ::aws_types::request_id::RequestId for RecognizeTextOutput {
55 fn request_id(&self) -> Option<&str> {
56 self._request_id.as_deref()
57 }
58}
59impl RecognizeTextOutput {
60 /// Creates a new builder-style object to manufacture [`RecognizeTextOutput`](crate::operation::recognize_text::RecognizeTextOutput).
61 pub fn builder() -> crate::operation::recognize_text::builders::RecognizeTextOutputBuilder {
62 crate::operation::recognize_text::builders::RecognizeTextOutputBuilder::default()
63 }
64}
65
66/// A builder for [`RecognizeTextOutput`](crate::operation::recognize_text::RecognizeTextOutput).
67#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
68#[non_exhaustive]
69pub struct RecognizeTextOutputBuilder {
70 pub(crate) messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
71 pub(crate) session_state: ::std::option::Option<crate::types::SessionState>,
72 pub(crate) interpretations: ::std::option::Option<::std::vec::Vec<crate::types::Interpretation>>,
73 pub(crate) request_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
74 pub(crate) session_id: ::std::option::Option<::std::string::String>,
75 pub(crate) recognized_bot_member: ::std::option::Option<crate::types::RecognizedBotMember>,
76 _request_id: Option<String>,
77}
78impl RecognizeTextOutputBuilder {
79 /// Appends an item to `messages`.
80 ///
81 /// To override the contents of this collection use [`set_messages`](Self::set_messages).
82 ///
83 /// <p>A list of messages last sent to the user. The messages are ordered based on the order that you returned the messages from your Lambda function or the order that the messages are defined in the bot.</p>
84 pub fn messages(mut self, input: crate::types::Message) -> Self {
85 let mut v = self.messages.unwrap_or_default();
86 v.push(input);
87 self.messages = ::std::option::Option::Some(v);
88 self
89 }
90 /// <p>A list of messages last sent to the user. The messages are ordered based on the order that you returned the messages from your Lambda function or the order that the messages are defined in the bot.</p>
91 pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
92 self.messages = input;
93 self
94 }
95 /// <p>A list of messages last sent to the user. The messages are ordered based on the order that you returned the messages from your Lambda function or the order that the messages are defined in the bot.</p>
96 pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
97 &self.messages
98 }
99 /// <p>Represents the current state of the dialog between the user and the bot.</p>
100 /// <p>Use this to determine the progress of the conversation and what the next action may be.</p>
101 pub fn session_state(mut self, input: crate::types::SessionState) -> Self {
102 self.session_state = ::std::option::Option::Some(input);
103 self
104 }
105 /// <p>Represents the current state of the dialog between the user and the bot.</p>
106 /// <p>Use this to determine the progress of the conversation and what the next action may be.</p>
107 pub fn set_session_state(mut self, input: ::std::option::Option<crate::types::SessionState>) -> Self {
108 self.session_state = input;
109 self
110 }
111 /// <p>Represents the current state of the dialog between the user and the bot.</p>
112 /// <p>Use this to determine the progress of the conversation and what the next action may be.</p>
113 pub fn get_session_state(&self) -> &::std::option::Option<crate::types::SessionState> {
114 &self.session_state
115 }
116 /// Appends an item to `interpretations`.
117 ///
118 /// To override the contents of this collection use [`set_interpretations`](Self::set_interpretations).
119 ///
120 /// <p>A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.</p>
121 /// <p>Each interpretation includes the intent, a score that indicates now confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.</p>
122 pub fn interpretations(mut self, input: crate::types::Interpretation) -> Self {
123 let mut v = self.interpretations.unwrap_or_default();
124 v.push(input);
125 self.interpretations = ::std::option::Option::Some(v);
126 self
127 }
128 /// <p>A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.</p>
129 /// <p>Each interpretation includes the intent, a score that indicates now confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.</p>
130 pub fn set_interpretations(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Interpretation>>) -> Self {
131 self.interpretations = input;
132 self
133 }
134 /// <p>A list of intents that Amazon Lex V2 determined might satisfy the user's utterance.</p>
135 /// <p>Each interpretation includes the intent, a score that indicates now confident Amazon Lex V2 is that the interpretation is the correct one, and an optional sentiment response that indicates the sentiment expressed in the utterance.</p>
136 pub fn get_interpretations(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Interpretation>> {
137 &self.interpretations
138 }
139 /// Adds a key-value pair to `request_attributes`.
140 ///
141 /// To override the contents of this collection use [`set_request_attributes`](Self::set_request_attributes).
142 ///
143 /// <p>The attributes sent in the request.</p>
144 pub fn request_attributes(
145 mut self,
146 k: impl ::std::convert::Into<::std::string::String>,
147 v: impl ::std::convert::Into<::std::string::String>,
148 ) -> Self {
149 let mut hash_map = self.request_attributes.unwrap_or_default();
150 hash_map.insert(k.into(), v.into());
151 self.request_attributes = ::std::option::Option::Some(hash_map);
152 self
153 }
154 /// <p>The attributes sent in the request.</p>
155 pub fn set_request_attributes(
156 mut self,
157 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
158 ) -> Self {
159 self.request_attributes = input;
160 self
161 }
162 /// <p>The attributes sent in the request.</p>
163 pub fn get_request_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
164 &self.request_attributes
165 }
166 /// <p>The identifier of the session in use.</p>
167 pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
168 self.session_id = ::std::option::Option::Some(input.into());
169 self
170 }
171 /// <p>The identifier of the session in use.</p>
172 pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
173 self.session_id = input;
174 self
175 }
176 /// <p>The identifier of the session in use.</p>
177 pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
178 &self.session_id
179 }
180 /// <p>The bot member that recognized the text.</p>
181 pub fn recognized_bot_member(mut self, input: crate::types::RecognizedBotMember) -> Self {
182 self.recognized_bot_member = ::std::option::Option::Some(input);
183 self
184 }
185 /// <p>The bot member that recognized the text.</p>
186 pub fn set_recognized_bot_member(mut self, input: ::std::option::Option<crate::types::RecognizedBotMember>) -> Self {
187 self.recognized_bot_member = input;
188 self
189 }
190 /// <p>The bot member that recognized the text.</p>
191 pub fn get_recognized_bot_member(&self) -> &::std::option::Option<crate::types::RecognizedBotMember> {
192 &self.recognized_bot_member
193 }
194 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
195 self._request_id = Some(request_id.into());
196 self
197 }
198
199 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
200 self._request_id = request_id;
201 self
202 }
203 /// Consumes the builder and constructs a [`RecognizeTextOutput`](crate::operation::recognize_text::RecognizeTextOutput).
204 pub fn build(self) -> crate::operation::recognize_text::RecognizeTextOutput {
205 crate::operation::recognize_text::RecognizeTextOutput {
206 messages: self.messages,
207 session_state: self.session_state,
208 interpretations: self.interpretations,
209 request_attributes: self.request_attributes,
210 session_id: self.session_id,
211 recognized_bot_member: self.recognized_bot_member,
212 _request_id: self._request_id,
213 }
214 }
215}