aws_sdk_lexruntimev2/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_output::PutSessionOutputBuilder;
3
4pub use crate::operation::put_session::_put_session_input::PutSessionInputBuilder;
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 V2 bot. Use this operation to enable your application to set the state of the bot.</p>
26#[derive(::std::clone::Clone, ::std::fmt::Debug)]
27pub struct PutSessionFluentBuilder {
28    handle: ::std::sync::Arc<crate::client::Handle>,
29    inner: crate::operation::put_session::builders::PutSessionInputBuilder,
30    config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl
33    crate::client::customize::internal::CustomizableSend<
34        crate::operation::put_session::PutSessionOutput,
35        crate::operation::put_session::PutSessionError,
36    > for PutSessionFluentBuilder
37{
38    fn send(
39        self,
40        config_override: crate::config::Builder,
41    ) -> crate::client::customize::internal::BoxFuture<
42        crate::client::customize::internal::SendResult<
43            crate::operation::put_session::PutSessionOutput,
44            crate::operation::put_session::PutSessionError,
45        >,
46    > {
47        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
48    }
49}
50impl PutSessionFluentBuilder {
51    /// Creates a new `PutSessionFluentBuilder`.
52    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
53        Self {
54            handle,
55            inner: ::std::default::Default::default(),
56            config_override: ::std::option::Option::None,
57        }
58    }
59    /// Access the PutSession as a reference.
60    pub fn as_input(&self) -> &crate::operation::put_session::builders::PutSessionInputBuilder {
61        &self.inner
62    }
63    /// Sends the request and returns the response.
64    ///
65    /// If an error occurs, an `SdkError` will be returned with additional details that
66    /// can be matched against.
67    ///
68    /// By default, any retryable failures will be retried twice. Retry behavior
69    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
70    /// set when configuring the client.
71    pub async fn send(
72        self,
73    ) -> ::std::result::Result<
74        crate::operation::put_session::PutSessionOutput,
75        ::aws_smithy_runtime_api::client::result::SdkError<
76            crate::operation::put_session::PutSessionError,
77            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
78        >,
79    > {
80        let input = self
81            .inner
82            .build()
83            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
84        let runtime_plugins = crate::operation::put_session::PutSession::operation_runtime_plugins(
85            self.handle.runtime_plugins.clone(),
86            &self.handle.conf,
87            self.config_override,
88        );
89        crate::operation::put_session::PutSession::orchestrate(&runtime_plugins, input).await
90    }
91
92    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
93    pub fn customize(
94        self,
95    ) -> crate::client::customize::CustomizableOperation<
96        crate::operation::put_session::PutSessionOutput,
97        crate::operation::put_session::PutSessionError,
98        Self,
99    > {
100        crate::client::customize::CustomizableOperation::new(self)
101    }
102    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
103        self.set_config_override(::std::option::Option::Some(config_override.into()));
104        self
105    }
106
107    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
108        self.config_override = config_override;
109        self
110    }
111    /// <p>The identifier of the bot that receives the session data.</p>
112    pub fn bot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.inner = self.inner.bot_id(input.into());
114        self
115    }
116    /// <p>The identifier of the bot that receives the session data.</p>
117    pub fn set_bot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.inner = self.inner.set_bot_id(input);
119        self
120    }
121    /// <p>The identifier of the bot that receives the session data.</p>
122    pub fn get_bot_id(&self) -> &::std::option::Option<::std::string::String> {
123        self.inner.get_bot_id()
124    }
125    /// <p>The alias identifier of the bot that receives the session data.</p>
126    pub fn bot_alias_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
127        self.inner = self.inner.bot_alias_id(input.into());
128        self
129    }
130    /// <p>The alias identifier of the bot that receives the session data.</p>
131    pub fn set_bot_alias_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_bot_alias_id(input);
133        self
134    }
135    /// <p>The alias identifier of the bot that receives the session data.</p>
136    pub fn get_bot_alias_id(&self) -> &::std::option::Option<::std::string::String> {
137        self.inner.get_bot_alias_id()
138    }
139    /// <p>The locale where the session is in use.</p>
140    pub fn locale_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
141        self.inner = self.inner.locale_id(input.into());
142        self
143    }
144    /// <p>The locale where the session is in use.</p>
145    pub fn set_locale_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
146        self.inner = self.inner.set_locale_id(input);
147        self
148    }
149    /// <p>The locale where the session is in use.</p>
150    pub fn get_locale_id(&self) -> &::std::option::Option<::std::string::String> {
151        self.inner.get_locale_id()
152    }
153    /// <p>The identifier of the session that receives the session data.</p>
154    pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
155        self.inner = self.inner.session_id(input.into());
156        self
157    }
158    /// <p>The identifier of the session that receives the session data.</p>
159    pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
160        self.inner = self.inner.set_session_id(input);
161        self
162    }
163    /// <p>The identifier of the session that receives the session data.</p>
164    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
165        self.inner.get_session_id()
166    }
167    ///
168    /// Appends an item to `messages`.
169    ///
170    /// To override the contents of this collection use [`set_messages`](Self::set_messages).
171    ///
172    /// <p>A list of messages to send to the user. Messages are sent in the order that they are defined in the list.</p>
173    pub fn messages(mut self, input: crate::types::Message) -> Self {
174        self.inner = self.inner.messages(input);
175        self
176    }
177    /// <p>A list of messages to send to the user. Messages are sent in the order that they are defined in the list.</p>
178    pub fn set_messages(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Message>>) -> Self {
179        self.inner = self.inner.set_messages(input);
180        self
181    }
182    /// <p>A list of messages to send to the user. Messages are sent in the order that they are defined in the list.</p>
183    pub fn get_messages(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Message>> {
184        self.inner.get_messages()
185    }
186    /// <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>
187    pub fn session_state(mut self, input: crate::types::SessionState) -> Self {
188        self.inner = self.inner.session_state(input);
189        self
190    }
191    /// <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>
192    pub fn set_session_state(mut self, input: ::std::option::Option<crate::types::SessionState>) -> Self {
193        self.inner = self.inner.set_session_state(input);
194        self
195    }
196    /// <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>
197    pub fn get_session_state(&self) -> &::std::option::Option<crate::types::SessionState> {
198        self.inner.get_session_state()
199    }
200    ///
201    /// Adds a key-value pair to `requestAttributes`.
202    ///
203    /// To override the contents of this collection use [`set_request_attributes`](Self::set_request_attributes).
204    ///
205    /// <p>Request-specific information passed between Amazon Lex V2 and the client application.</p>
206    /// <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>
207    pub fn request_attributes(
208        mut self,
209        k: impl ::std::convert::Into<::std::string::String>,
210        v: impl ::std::convert::Into<::std::string::String>,
211    ) -> Self {
212        self.inner = self.inner.request_attributes(k.into(), v.into());
213        self
214    }
215    /// <p>Request-specific information passed between Amazon Lex V2 and the client application.</p>
216    /// <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>
217    pub fn set_request_attributes(
218        mut self,
219        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
220    ) -> Self {
221        self.inner = self.inner.set_request_attributes(input);
222        self
223    }
224    /// <p>Request-specific information passed between Amazon Lex V2 and the client application.</p>
225    /// <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>
226    pub fn get_request_attributes(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
227        self.inner.get_request_attributes()
228    }
229    /// <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>
230    /// <ul>
231    /// <li>
232    /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex V2 returns text in the response.</p></li>
233    /// </ul>
234    pub fn response_content_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
235        self.inner = self.inner.response_content_type(input.into());
236        self
237    }
238    /// <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>
239    /// <ul>
240    /// <li>
241    /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex V2 returns text in the response.</p></li>
242    /// </ul>
243    pub fn set_response_content_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
244        self.inner = self.inner.set_response_content_type(input);
245        self
246    }
247    /// <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>
248    /// <ul>
249    /// <li>
250    /// <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex V2 returns text in the response.</p></li>
251    /// </ul>
252    pub fn get_response_content_type(&self) -> &::std::option::Option<::std::string::String> {
253        self.inner.get_response_content_type()
254    }
255}