aws_sdk_lexruntimev2/operation/start_conversation/
builders.rs1pub use crate::operation::start_conversation::_start_conversation_output::StartConversationOutputBuilder;
3
4pub use crate::operation::start_conversation::_start_conversation_input::StartConversationInputBuilder;
5
6impl crate::operation::start_conversation::builders::StartConversationInputBuilder {
7 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::start_conversation::StartConversationOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::start_conversation::StartConversationError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.start_conversation();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23#[derive(::std::fmt::Debug)]
49pub struct StartConversationFluentBuilder {
50 handle: ::std::sync::Arc<crate::client::Handle>,
51 inner: crate::operation::start_conversation::builders::StartConversationInputBuilder,
52 config_override: ::std::option::Option<crate::config::Builder>,
53}
54impl
55 crate::client::customize::internal::CustomizableSend<
56 crate::operation::start_conversation::StartConversationOutput,
57 crate::operation::start_conversation::StartConversationError,
58 > for StartConversationFluentBuilder
59{
60 fn send(
61 self,
62 config_override: crate::config::Builder,
63 ) -> crate::client::customize::internal::BoxFuture<
64 crate::client::customize::internal::SendResult<
65 crate::operation::start_conversation::StartConversationOutput,
66 crate::operation::start_conversation::StartConversationError,
67 >,
68 > {
69 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
70 }
71}
72impl StartConversationFluentBuilder {
73 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
75 Self {
76 handle,
77 inner: ::std::default::Default::default(),
78 config_override: ::std::option::Option::None,
79 }
80 }
81 pub fn as_input(&self) -> &crate::operation::start_conversation::builders::StartConversationInputBuilder {
83 &self.inner
84 }
85 pub async fn send(
94 self,
95 ) -> ::std::result::Result<
96 crate::operation::start_conversation::StartConversationOutput,
97 ::aws_smithy_runtime_api::client::result::SdkError<
98 crate::operation::start_conversation::StartConversationError,
99 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
100 >,
101 > {
102 let input = self
103 .inner
104 .build()
105 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
106 let runtime_plugins = crate::operation::start_conversation::StartConversation::operation_runtime_plugins(
107 self.handle.runtime_plugins.clone(),
108 &self.handle.conf,
109 self.config_override,
110 );
111 let mut output = crate::operation::start_conversation::StartConversation::orchestrate(&runtime_plugins, input).await?;
112
113 fn response_error(
122 err: impl ::std::convert::Into<::aws_smithy_runtime_api::box_error::BoxError>,
123 ) -> ::aws_smithy_runtime_api::client::result::SdkError<
124 crate::operation::start_conversation::StartConversationError,
125 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
126 > {
127 ::aws_smithy_runtime_api::client::result::SdkError::response_error(
128 err,
129 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse::new(
130 ::aws_smithy_runtime_api::http::StatusCode::try_from(200).expect("valid successful code"),
131 ::aws_smithy_types::body::SdkBody::empty(),
132 ),
133 )
134 }
135
136 let message = output.response_event_stream.try_recv_initial_response().await.map_err(response_error)?;
137
138 match message {
139 ::std::option::Option::Some(_message) => ::std::result::Result::Ok(output),
140 ::std::option::Option::None => ::std::result::Result::Ok(output),
141 }
142 }
143
144 pub fn customize(
146 self,
147 ) -> crate::client::customize::CustomizableOperation<
148 crate::operation::start_conversation::StartConversationOutput,
149 crate::operation::start_conversation::StartConversationError,
150 Self,
151 > {
152 crate::client::customize::CustomizableOperation::new(self)
153 }
154 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
155 self.set_config_override(::std::option::Option::Some(config_override.into()));
156 self
157 }
158
159 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
160 self.config_override = config_override;
161 self
162 }
163 pub fn bot_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
165 self.inner = self.inner.bot_id(input.into());
166 self
167 }
168 pub fn set_bot_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
170 self.inner = self.inner.set_bot_id(input);
171 self
172 }
173 pub fn get_bot_id(&self) -> &::std::option::Option<::std::string::String> {
175 self.inner.get_bot_id()
176 }
177 pub fn bot_alias_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
179 self.inner = self.inner.bot_alias_id(input.into());
180 self
181 }
182 pub fn set_bot_alias_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
184 self.inner = self.inner.set_bot_alias_id(input);
185 self
186 }
187 pub fn get_bot_alias_id(&self) -> &::std::option::Option<::std::string::String> {
189 self.inner.get_bot_alias_id()
190 }
191 pub fn locale_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
193 self.inner = self.inner.locale_id(input.into());
194 self
195 }
196 pub fn set_locale_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
198 self.inner = self.inner.set_locale_id(input);
199 self
200 }
201 pub fn get_locale_id(&self) -> &::std::option::Option<::std::string::String> {
203 self.inner.get_locale_id()
204 }
205 pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
207 self.inner = self.inner.session_id(input.into());
208 self
209 }
210 pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
212 self.inner = self.inner.set_session_id(input);
213 self
214 }
215 pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
217 self.inner.get_session_id()
218 }
219 pub fn conversation_mode(mut self, input: crate::types::ConversationMode) -> Self {
221 self.inner = self.inner.conversation_mode(input);
222 self
223 }
224 pub fn set_conversation_mode(mut self, input: ::std::option::Option<crate::types::ConversationMode>) -> Self {
226 self.inner = self.inner.set_conversation_mode(input);
227 self
228 }
229 pub fn get_conversation_mode(&self) -> &::std::option::Option<crate::types::ConversationMode> {
231 self.inner.get_conversation_mode()
232 }
233 pub fn request_event_stream(
235 mut self,
236 input: ::aws_smithy_http::event_stream::EventStreamSender<
237 crate::types::StartConversationRequestEventStream,
238 crate::types::error::StartConversationRequestEventStreamError,
239 >,
240 ) -> Self {
241 self.inner = self.inner.request_event_stream(input);
242 self
243 }
244 pub fn set_request_event_stream(
246 mut self,
247 input: ::std::option::Option<
248 ::aws_smithy_http::event_stream::EventStreamSender<
249 crate::types::StartConversationRequestEventStream,
250 crate::types::error::StartConversationRequestEventStreamError,
251 >,
252 >,
253 ) -> Self {
254 self.inner = self.inner.set_request_event_stream(input);
255 self
256 }
257 pub fn get_request_event_stream(
259 &self,
260 ) -> &::std::option::Option<
261 ::aws_smithy_http::event_stream::EventStreamSender<
262 crate::types::StartConversationRequestEventStream,
263 crate::types::error::StartConversationRequestEventStreamError,
264 >,
265 > {
266 self.inner.get_request_event_stream()
267 }
268}