aws_sdk_lexruntimev2/operation/put_session/_put_session_input.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 PutSessionInput {
6 /// <p>The identifier of the bot that receives the session data.</p>
7 pub bot_id: ::std::option::Option<::std::string::String>,
8 /// <p>The alias identifier of the bot that receives the session data.</p>
9 pub bot_alias_id: ::std::option::Option<::std::string::String>,
10 /// <p>The locale where the session is in use.</p>
11 pub locale_id: ::std::option::Option<::std::string::String>,
12 /// <p>The identifier of the session that receives the session data.</p>
13 pub session_id: ::std::option::Option<::std::string::String>,
14 /// <p>A list of messages to send to the user. Messages are sent in the order that they are defined in the list.</p>
15 pub messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
16 /// <p>Sets the state of the session with the user. You can use this to set the current intent, attributes, context, and dialog action. Use the dialog action to determine the next step that Amazon Lex V2 should use in the conversation with the user.</p>
17 pub session_state: ::std::option::Option<crate::types::SessionState>,
18 /// <p>Request-specific information passed between Amazon Lex V2 and the client application.</p>
19 /// <p>The namespace <code>x-amz-lex:</code> is reserved for special attributes. Don't create any request attributes with the prefix <code>x-amz-lex:</code>.</p>
20 pub request_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
21 /// <p>The message that Amazon Lex V2 returns in the response can be either text or speech depending on the value of this parameter.</p>
22 /// <ul>
23 /// <li>
24 /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex V2 returns text in the response.</p></li>
25 /// </ul>
26 pub response_content_type: ::std::option::Option<::std::string::String>,
27}
28impl PutSessionInput {
29 /// <p>The identifier of the bot that receives the session data.</p>
30 pub fn bot_id(&self) -> ::std::option::Option<&str> {
31 self.bot_id.as_deref()
32 }
33 /// <p>The alias identifier of the bot that receives the session data.</p>
34 pub fn bot_alias_id(&self) -> ::std::option::Option<&str> {
35 self.bot_alias_id.as_deref()
36 }
37 /// <p>The locale where the session is in use.</p>
38 pub fn locale_id(&self) -> ::std::option::Option<&str> {
39 self.locale_id.as_deref()
40 }
41 /// <p>The identifier of the session that receives the session data.</p>
42 pub fn session_id(&self) -> ::std::option::Option<&str> {
43 self.session_id.as_deref()
44 }
45 /// <p>A list of messages to send to the user. Messages are sent in the order that they are defined in the list.</p>
46 ///
47 /// 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()`.
48 pub fn messages(&self) -> &[crate::types::Message] {
49 self.messages.as_deref().unwrap_or_default()
50 }
51 /// <p>Sets the state of the session with the user. You can use this to set the current intent, attributes, context, and dialog action. Use the dialog action to determine the next step that Amazon Lex V2 should use in the conversation with the user.</p>
52 pub fn session_state(&self) -> ::std::option::Option<&crate::types::SessionState> {
53 self.session_state.as_ref()
54 }
55 /// <p>Request-specific information passed between Amazon Lex V2 and the client application.</p>
56 /// <p>The namespace <code>x-amz-lex:</code> is reserved for special attributes. Don't create any request attributes with the prefix <code>x-amz-lex:</code>.</p>
57 pub fn request_attributes(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
58 self.request_attributes.as_ref()
59 }
60 /// <p>The message that Amazon Lex V2 returns in the response can be either text or speech depending on the value of this parameter.</p>
61 /// <ul>
62 /// <li>
63 /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex V2 returns text in the response.</p></li>
64 /// </ul>
65 pub fn response_content_type(&self) -> ::std::option::Option<&str> {
66 self.response_content_type.as_deref()
67 }
68}
69impl PutSessionInput {
70 /// Creates a new builder-style object to manufacture [`PutSessionInput`](crate::operation::put_session::PutSessionInput).
71 pub fn builder() -> crate::operation::put_session::builders::PutSessionInputBuilder {
72 crate::operation::put_session::builders::PutSessionInputBuilder::default()
73 }
74}
75
76/// A builder for [`PutSessionInput`](crate::operation::put_session::PutSessionInput).
77#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
78#[non_exhaustive]
79pub struct PutSessionInputBuilder {
80 pub(crate) bot_id: ::std::option::Option<::std::string::String>,
81 pub(crate) bot_alias_id: ::std::option::Option<::std::string::String>,
82 pub(crate) locale_id: ::std::option::Option<::std::string::String>,
83 pub(crate) session_id: ::std::option::Option<::std::string::String>,
84 pub(crate) messages: ::std::option::Option<::std::vec::Vec<crate::types::Message>>,
85 pub(crate) session_state: ::std::option::Option<crate::types::SessionState>,
86 pub(crate) request_attributes: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
87 pub(crate) response_content_type: ::std::option::Option<::std::string::String>,
88}
89impl PutSessionInputBuilder {
90 /// <p>The identifier of the bot that receives the session data.</p>
91 /// This field is required.
92 pub fn bot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
93 self.bot_id = ::std::option::Option::Some(input.into());
94 self
95 }
96 /// <p>The identifier of the bot that receives the session data.</p>
97 pub fn set_bot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
98 self.bot_id = input;
99 self
100 }
101 /// <p>The identifier of the bot that receives the session data.</p>
102 pub fn get_bot_id(&self) -> &::std::option::Option<::std::string::String> {
103 &self.bot_id
104 }
105 /// <p>The alias identifier of the bot that receives the session data.</p>
106 /// This field is required.
107 pub fn bot_alias_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
108 self.bot_alias_id = ::std::option::Option::Some(input.into());
109 self
110 }
111 /// <p>The alias identifier of the bot that receives the session data.</p>
112 pub fn set_bot_alias_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
113 self.bot_alias_id = input;
114 self
115 }
116 /// <p>The alias identifier of the bot that receives the session data.</p>
117 pub fn get_bot_alias_id(&self) -> &::std::option::Option<::std::string::String> {
118 &self.bot_alias_id
119 }
120 /// <p>The locale where the session is in use.</p>
121 /// This field is required.
122 pub fn locale_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
123 self.locale_id = ::std::option::Option::Some(input.into());
124 self
125 }
126 /// <p>The locale where the session is in use.</p>
127 pub fn set_locale_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
128 self.locale_id = input;
129 self
130 }
131 /// <p>The locale where the session is in use.</p>
132 pub fn get_locale_id(&self) -> &::std::option::Option<::std::string::String> {
133 &self.locale_id
134 }
135 /// <p>The identifier of the session that receives the session data.</p>
136 /// This field is required.
137 pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
138 self.session_id = ::std::option::Option::Some(input.into());
139 self
140 }
141 /// <p>The identifier of the session that receives the session data.</p>
142 pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
143 self.session_id = input;
144 self
145 }
146 /// <p>The identifier of the session that receives the session data.</p>
147 pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
148 &self.session_id
149 }
150 /// Appends an item to `messages`.
151 ///
152 /// To override the contents of this collection use [`set_messages`](Self::set_messages).
153 ///
154 /// <p>A list of messages to send to the user. Messages are sent in the order that they are defined in the list.</p>
155 pub fn messages(mut self, input: crate::types::Message) -> Self {
156 let mut v = self.messages.unwrap_or_default();
157 v.push(input);
158 self.messages = ::std::option::Option::Some(v);
159 self
160 }
161 /// <p>A list of messages to send to the user. Messages are sent in the order that they are defined in the list.</p>
162 pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
163 self.messages = input;
164 self
165 }
166 /// <p>A list of messages to send to the user. Messages are sent in the order that they are defined in the list.</p>
167 pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
168 &self.messages
169 }
170 /// <p>Sets the state of the session with the user. You can use this to set the current intent, attributes, context, and dialog action. Use the dialog action to determine the next step that Amazon Lex V2 should use in the conversation with the user.</p>
171 /// This field is required.
172 pub fn session_state(mut self, input: crate::types::SessionState) -> Self {
173 self.session_state = ::std::option::Option::Some(input);
174 self
175 }
176 /// <p>Sets the state of the session with the user. You can use this to set the current intent, attributes, context, and dialog action. Use the dialog action to determine the next step that Amazon Lex V2 should use in the conversation with the user.</p>
177 pub fn set_session_state(mut self, input: ::std::option::Option<crate::types::SessionState>) -> Self {
178 self.session_state = input;
179 self
180 }
181 /// <p>Sets the state of the session with the user. You can use this to set the current intent, attributes, context, and dialog action. Use the dialog action to determine the next step that Amazon Lex V2 should use in the conversation with the user.</p>
182 pub fn get_session_state(&self) -> &::std::option::Option<crate::types::SessionState> {
183 &self.session_state
184 }
185 /// Adds a key-value pair to `request_attributes`.
186 ///
187 /// To override the contents of this collection use [`set_request_attributes`](Self::set_request_attributes).
188 ///
189 /// <p>Request-specific information passed between Amazon Lex V2 and the client application.</p>
190 /// <p>The namespace <code>x-amz-lex:</code> is reserved for special attributes. Don't create any request attributes with the prefix <code>x-amz-lex:</code>.</p>
191 pub fn request_attributes(
192 mut self,
193 k: impl ::std::convert::Into<::std::string::String>,
194 v: impl ::std::convert::Into<::std::string::String>,
195 ) -> Self {
196 let mut hash_map = self.request_attributes.unwrap_or_default();
197 hash_map.insert(k.into(), v.into());
198 self.request_attributes = ::std::option::Option::Some(hash_map);
199 self
200 }
201 /// <p>Request-specific information passed between Amazon Lex V2 and the client application.</p>
202 /// <p>The namespace <code>x-amz-lex:</code> is reserved for special attributes. Don't create any request attributes with the prefix <code>x-amz-lex:</code>.</p>
203 pub fn set_request_attributes(
204 mut self,
205 input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
206 ) -> Self {
207 self.request_attributes = input;
208 self
209 }
210 /// <p>Request-specific information passed between Amazon Lex V2 and the client application.</p>
211 /// <p>The namespace <code>x-amz-lex:</code> is reserved for special attributes. Don't create any request attributes with the prefix <code>x-amz-lex:</code>.</p>
212 pub fn get_request_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
213 &self.request_attributes
214 }
215 /// <p>The message that Amazon Lex V2 returns in the response can be either text or speech depending on the value of this parameter.</p>
216 /// <ul>
217 /// <li>
218 /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex V2 returns text in the response.</p></li>
219 /// </ul>
220 pub fn response_content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
221 self.response_content_type = ::std::option::Option::Some(input.into());
222 self
223 }
224 /// <p>The message that Amazon Lex V2 returns in the response can be either text or speech depending on the value of this parameter.</p>
225 /// <ul>
226 /// <li>
227 /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex V2 returns text in the response.</p></li>
228 /// </ul>
229 pub fn set_response_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
230 self.response_content_type = input;
231 self
232 }
233 /// <p>The message that Amazon Lex V2 returns in the response can be either text or speech depending on the value of this parameter.</p>
234 /// <ul>
235 /// <li>
236 /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex V2 returns text in the response.</p></li>
237 /// </ul>
238 pub fn get_response_content_type(&self) -> &::std::option::Option<::std::string::String> {
239 &self.response_content_type
240 }
241 /// Consumes the builder and constructs a [`PutSessionInput`](crate::operation::put_session::PutSessionInput).
242 pub fn build(self) -> ::std::result::Result<crate::operation::put_session::PutSessionInput, ::aws_smithy_types::error::operation::BuildError> {
243 ::std::result::Result::Ok(crate::operation::put_session::PutSessionInput {
244 bot_id: self.bot_id,
245 bot_alias_id: self.bot_alias_id,
246 locale_id: self.locale_id,
247 session_id: self.session_id,
248 messages: self.messages,
249 session_state: self.session_state,
250 request_attributes: self.request_attributes,
251 response_content_type: self.response_content_type,
252 })
253 }
254}