Skip to main content

aws_sdk_lexruntime/operation/put_session/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::put_session::_put_session_input::PutSessionInputBuilder;
3
4pub use crate::operation::put_session::_put_session_output::PutSessionOutputBuilder;
5
6impl crate::operation::put_session::builders::PutSessionInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::put_session::PutSessionOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::put_session::PutSessionError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.put_session();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `PutSession`.
24///
25/// <p>Creates a new session or modifies an existing session with an Amazon Lex bot. Use this operation to enable your application to set the state of the bot.</p>
26/// <p>For more information, see <a href="https://docs.aws.amazon.com/lex/latest/dg/how-session-api.html">Managing Sessions</a>.</p>
27#[derive(::std::clone::Clone, ::std::fmt::Debug)]
28pub struct PutSessionFluentBuilder {
29    handle: ::std::sync::Arc<crate::client::Handle>,
30    inner: crate::operation::put_session::builders::PutSessionInputBuilder,
31    config_override: ::std::option::Option<crate::config::Builder>,
32}
33impl
34    crate::client::customize::internal::CustomizableSend<
35        crate::operation::put_session::PutSessionOutput,
36        crate::operation::put_session::PutSessionError,
37    > for PutSessionFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<
44            crate::operation::put_session::PutSessionOutput,
45            crate::operation::put_session::PutSessionError,
46        >,
47    > {
48        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
49    }
50}
51impl PutSessionFluentBuilder {
52    /// Creates a new `PutSessionFluentBuilder`.
53    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
54        Self {
55            handle,
56            inner: ::std::default::Default::default(),
57            config_override: ::std::option::Option::None,
58        }
59    }
60    /// Access the PutSession as a reference.
61    pub fn as_input(&self) -> &crate::operation::put_session::builders::PutSessionInputBuilder {
62        &self.inner
63    }
64    /// Sends the request and returns the response.
65    ///
66    /// If an error occurs, an `SdkError` will be returned with additional details that
67    /// can be matched against.
68    ///
69    /// By default, any retryable failures will be retried twice. Retry behavior
70    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
71    /// set when configuring the client.
72    pub async fn send(
73        self,
74    ) -> ::std::result::Result<
75        crate::operation::put_session::PutSessionOutput,
76        ::aws_smithy_runtime_api::client::result::SdkError<
77            crate::operation::put_session::PutSessionError,
78            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
79        >,
80    > {
81        let input = self
82            .inner
83            .build()
84            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
85        let runtime_plugins = crate::operation::put_session::PutSession::operation_runtime_plugins(
86            self.handle.runtime_plugins.clone(),
87            &self.handle.conf,
88            self.config_override,
89        );
90        crate::operation::put_session::PutSession::orchestrate(&runtime_plugins, input).await
91    }
92
93    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
94    pub fn customize(
95        self,
96    ) -> crate::client::customize::CustomizableOperation<
97        crate::operation::put_session::PutSessionOutput,
98        crate::operation::put_session::PutSessionError,
99        Self,
100    > {
101        crate::client::customize::CustomizableOperation::new(self)
102    }
103    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
104        self.set_config_override(::std::option::Option::Some(config_override.into()));
105        self
106    }
107
108    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
109        self.config_override = config_override;
110        self
111    }
112    /// <p>The name of the bot that contains the session data.</p>
113    pub fn bot_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
114        self.inner = self.inner.bot_name(input.into());
115        self
116    }
117    /// <p>The name of the bot that contains the session data.</p>
118    pub fn set_bot_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
119        self.inner = self.inner.set_bot_name(input);
120        self
121    }
122    /// <p>The name of the bot that contains the session data.</p>
123    pub fn get_bot_name(&self) -> &::std::option::Option<::std::string::String> {
124        self.inner.get_bot_name()
125    }
126    /// <p>The alias in use for the bot that contains the session data.</p>
127    pub fn bot_alias(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
128        self.inner = self.inner.bot_alias(input.into());
129        self
130    }
131    /// <p>The alias in use for the bot that contains the session data.</p>
132    pub fn set_bot_alias(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
133        self.inner = self.inner.set_bot_alias(input);
134        self
135    }
136    /// <p>The alias in use for the bot that contains the session data.</p>
137    pub fn get_bot_alias(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_bot_alias()
139    }
140    /// <p>The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.</p>
141    pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
142        self.inner = self.inner.user_id(input.into());
143        self
144    }
145    /// <p>The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.</p>
146    pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
147        self.inner = self.inner.set_user_id(input);
148        self
149    }
150    /// <p>The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.</p>
151    pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
152        self.inner.get_user_id()
153    }
154    ///
155    /// Adds a key-value pair to `sessionAttributes`.
156    ///
157    /// To override the contents of this collection use [`set_session_attributes`](Self::set_session_attributes).
158    ///
159    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
160    pub fn session_attributes(
161        mut self,
162        k: impl ::std::convert::Into<::std::string::String>,
163        v: impl ::std::convert::Into<::std::string::String>,
164    ) -> Self {
165        self.inner = self.inner.session_attributes(k.into(), v.into());
166        self
167    }
168    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
169    pub fn set_session_attributes(
170        mut self,
171        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
172    ) -> Self {
173        self.inner = self.inner.set_session_attributes(input);
174        self
175    }
176    /// <p>Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.</p>
177    pub fn get_session_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
178        self.inner.get_session_attributes()
179    }
180    /// <p>Sets the next action that the bot should take to fulfill the conversation.</p>
181    pub fn dialog_action(mut self, input: crate::types::DialogAction) -> Self {
182        self.inner = self.inner.dialog_action(input);
183        self
184    }
185    /// <p>Sets the next action that the bot should take to fulfill the conversation.</p>
186    pub fn set_dialog_action(mut self, input: ::std::option::Option<crate::types::DialogAction>) -> Self {
187        self.inner = self.inner.set_dialog_action(input);
188        self
189    }
190    /// <p>Sets the next action that the bot should take to fulfill the conversation.</p>
191    pub fn get_dialog_action(&self) -> &::std::option::Option<crate::types::DialogAction> {
192        self.inner.get_dialog_action()
193    }
194    ///
195    /// Appends an item to `recentIntentSummaryView`.
196    ///
197    /// To override the contents of this collection use [`set_recent_intent_summary_view`](Self::set_recent_intent_summary_view).
198    ///
199    /// <p>A summary of the recent intents for the bot. You can use the intent summary view to set a checkpoint label on an intent and modify attributes of intents. You can also use it to remove or add intent summary objects to the list.</p>
200    /// <p>An intent that you modify or add to the list must make sense for the bot. For example, the intent name must be valid for the bot. You must provide valid values for:</p>
201    /// <ul>
202    /// <li>
203    /// <p><code>intentName</code></p></li>
204    /// <li>
205    /// <p>slot names</p></li>
206    /// <li>
207    /// <p><code>slotToElict</code></p></li>
208    /// </ul>
209    /// <p>If you send the <code>recentIntentSummaryView</code> parameter in a <code>PutSession</code> request, the contents of the new summary view replaces the old summary view. For example, if a <code>GetSession</code> request returns three intents in the summary view and you call <code>PutSession</code> with one intent in the summary view, the next call to <code>GetSession</code> will only return one intent.</p>
210    pub fn recent_intent_summary_view(mut self, input: crate::types::IntentSummary) -> Self {
211        self.inner = self.inner.recent_intent_summary_view(input);
212        self
213    }
214    /// <p>A summary of the recent intents for the bot. You can use the intent summary view to set a checkpoint label on an intent and modify attributes of intents. You can also use it to remove or add intent summary objects to the list.</p>
215    /// <p>An intent that you modify or add to the list must make sense for the bot. For example, the intent name must be valid for the bot. You must provide valid values for:</p>
216    /// <ul>
217    /// <li>
218    /// <p><code>intentName</code></p></li>
219    /// <li>
220    /// <p>slot names</p></li>
221    /// <li>
222    /// <p><code>slotToElict</code></p></li>
223    /// </ul>
224    /// <p>If you send the <code>recentIntentSummaryView</code> parameter in a <code>PutSession</code> request, the contents of the new summary view replaces the old summary view. For example, if a <code>GetSession</code> request returns three intents in the summary view and you call <code>PutSession</code> with one intent in the summary view, the next call to <code>GetSession</code> will only return one intent.</p>
225    pub fn set_recent_intent_summary_view(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::IntentSummary>>) -> Self {
226        self.inner = self.inner.set_recent_intent_summary_view(input);
227        self
228    }
229    /// <p>A summary of the recent intents for the bot. You can use the intent summary view to set a checkpoint label on an intent and modify attributes of intents. You can also use it to remove or add intent summary objects to the list.</p>
230    /// <p>An intent that you modify or add to the list must make sense for the bot. For example, the intent name must be valid for the bot. You must provide valid values for:</p>
231    /// <ul>
232    /// <li>
233    /// <p><code>intentName</code></p></li>
234    /// <li>
235    /// <p>slot names</p></li>
236    /// <li>
237    /// <p><code>slotToElict</code></p></li>
238    /// </ul>
239    /// <p>If you send the <code>recentIntentSummaryView</code> parameter in a <code>PutSession</code> request, the contents of the new summary view replaces the old summary view. For example, if a <code>GetSession</code> request returns three intents in the summary view and you call <code>PutSession</code> with one intent in the summary view, the next call to <code>GetSession</code> will only return one intent.</p>
240    pub fn get_recent_intent_summary_view(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::IntentSummary>> {
241        self.inner.get_recent_intent_summary_view()
242    }
243    /// <p>The message that Amazon Lex returns in the response can be either text or speech based depending on the value of this field.</p>
244    /// <ul>
245    /// <li>
246    /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex returns text in the response.</p></li>
247    /// <li>
248    /// <p>If the value begins with <code>audio/</code>, Amazon Lex returns speech in the response. Amazon Lex uses Amazon Polly to generate the speech in the configuration that you specify. For example, if you specify <code>audio/mpeg</code> as the value, Amazon Lex returns speech in the MPEG format.</p></li>
249    /// <li>
250    /// <p>If the value is <code>audio/pcm</code>, the speech is returned as <code>audio/pcm</code> in 16-bit, little endian format.</p></li>
251    /// <li>
252    /// <p>The following are the accepted values:</p>
253    /// <ul>
254    /// <li>
255    /// <p><code>audio/mpeg</code></p></li>
256    /// <li>
257    /// <p><code>audio/ogg</code></p></li>
258    /// <li>
259    /// <p><code>audio/pcm</code></p></li>
260    /// <li>
261    /// <p><code>audio/*</code> (defaults to mpeg)</p></li>
262    /// <li>
263    /// <p><code>text/plain; charset=utf-8</code></p></li>
264    /// </ul></li>
265    /// </ul>
266    pub fn accept(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
267        self.inner = self.inner.accept(input.into());
268        self
269    }
270    /// <p>The message that Amazon Lex returns in the response can be either text or speech based depending on the value of this field.</p>
271    /// <ul>
272    /// <li>
273    /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex returns text in the response.</p></li>
274    /// <li>
275    /// <p>If the value begins with <code>audio/</code>, Amazon Lex returns speech in the response. Amazon Lex uses Amazon Polly to generate the speech in the configuration that you specify. For example, if you specify <code>audio/mpeg</code> as the value, Amazon Lex returns speech in the MPEG format.</p></li>
276    /// <li>
277    /// <p>If the value is <code>audio/pcm</code>, the speech is returned as <code>audio/pcm</code> in 16-bit, little endian format.</p></li>
278    /// <li>
279    /// <p>The following are the accepted values:</p>
280    /// <ul>
281    /// <li>
282    /// <p><code>audio/mpeg</code></p></li>
283    /// <li>
284    /// <p><code>audio/ogg</code></p></li>
285    /// <li>
286    /// <p><code>audio/pcm</code></p></li>
287    /// <li>
288    /// <p><code>audio/*</code> (defaults to mpeg)</p></li>
289    /// <li>
290    /// <p><code>text/plain; charset=utf-8</code></p></li>
291    /// </ul></li>
292    /// </ul>
293    pub fn set_accept(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
294        self.inner = self.inner.set_accept(input);
295        self
296    }
297    /// <p>The message that Amazon Lex returns in the response can be either text or speech based depending on the value of this field.</p>
298    /// <ul>
299    /// <li>
300    /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex returns text in the response.</p></li>
301    /// <li>
302    /// <p>If the value begins with <code>audio/</code>, Amazon Lex returns speech in the response. Amazon Lex uses Amazon Polly to generate the speech in the configuration that you specify. For example, if you specify <code>audio/mpeg</code> as the value, Amazon Lex returns speech in the MPEG format.</p></li>
303    /// <li>
304    /// <p>If the value is <code>audio/pcm</code>, the speech is returned as <code>audio/pcm</code> in 16-bit, little endian format.</p></li>
305    /// <li>
306    /// <p>The following are the accepted values:</p>
307    /// <ul>
308    /// <li>
309    /// <p><code>audio/mpeg</code></p></li>
310    /// <li>
311    /// <p><code>audio/ogg</code></p></li>
312    /// <li>
313    /// <p><code>audio/pcm</code></p></li>
314    /// <li>
315    /// <p><code>audio/*</code> (defaults to mpeg)</p></li>
316    /// <li>
317    /// <p><code>text/plain; charset=utf-8</code></p></li>
318    /// </ul></li>
319    /// </ul>
320    pub fn get_accept(&self) -> &::std::option::Option<::std::string::String> {
321        self.inner.get_accept()
322    }
323    ///
324    /// Appends an item to `activeContexts`.
325    ///
326    /// To override the contents of this collection use [`set_active_contexts`](Self::set_active_contexts).
327    ///
328    /// <p>A list of contexts active for the request. A context can be activated when a previous intent is fulfilled, or by including the context in the request,</p>
329    /// <p>If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session. If you specify an empty list, all contexts for the session are cleared.</p>
330    pub fn active_contexts(mut self, input: crate::types::ActiveContext) -> Self {
331        self.inner = self.inner.active_contexts(input);
332        self
333    }
334    /// <p>A list of contexts active for the request. A context can be activated when a previous intent is fulfilled, or by including the context in the request,</p>
335    /// <p>If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session. If you specify an empty list, all contexts for the session are cleared.</p>
336    pub fn set_active_contexts(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>>) -> Self {
337        self.inner = self.inner.set_active_contexts(input);
338        self
339    }
340    /// <p>A list of contexts active for the request. A context can be activated when a previous intent is fulfilled, or by including the context in the request,</p>
341    /// <p>If you don't specify a list of contexts, Amazon Lex will use the current list of contexts for the session. If you specify an empty list, all contexts for the session are cleared.</p>
342    pub fn get_active_contexts(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ActiveContext>> {
343        self.inner.get_active_contexts()
344    }
345}