aws_sdk_qbusiness/operation/chat/
builders.rs1pub use crate::operation::chat::_chat_output::ChatOutputBuilder;
3
4pub use crate::operation::chat::_chat_input::ChatInputBuilder;
5
6impl crate::operation::chat::builders::ChatInputBuilder {
7 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::chat::ChatOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::chat::ChatError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.chat();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23#[derive(::std::fmt::Debug)]
27pub struct ChatFluentBuilder {
28 handle: ::std::sync::Arc<crate::client::Handle>,
29 inner: crate::operation::chat::builders::ChatInputBuilder,
30 config_override: ::std::option::Option<crate::config::Builder>,
31}
32impl crate::client::customize::internal::CustomizableSend<crate::operation::chat::ChatOutput, crate::operation::chat::ChatError>
33 for ChatFluentBuilder
34{
35 fn send(
36 self,
37 config_override: crate::config::Builder,
38 ) -> crate::client::customize::internal::BoxFuture<
39 crate::client::customize::internal::SendResult<crate::operation::chat::ChatOutput, crate::operation::chat::ChatError>,
40 > {
41 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
42 }
43}
44impl ChatFluentBuilder {
45 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
47 Self {
48 handle,
49 inner: ::std::default::Default::default(),
50 config_override: ::std::option::Option::None,
51 }
52 }
53 pub fn as_input(&self) -> &crate::operation::chat::builders::ChatInputBuilder {
55 &self.inner
56 }
57 pub async fn send(
66 self,
67 ) -> ::std::result::Result<
68 crate::operation::chat::ChatOutput,
69 ::aws_smithy_runtime_api::client::result::SdkError<
70 crate::operation::chat::ChatError,
71 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
72 >,
73 > {
74 let input = self
75 .inner
76 .build()
77 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
78 let runtime_plugins =
79 crate::operation::chat::Chat::operation_runtime_plugins(self.handle.runtime_plugins.clone(), &self.handle.conf, self.config_override);
80 let mut output = crate::operation::chat::Chat::orchestrate(&runtime_plugins, input).await?;
81
82 fn response_error(
91 err: impl ::std::convert::Into<::aws_smithy_runtime_api::box_error::BoxError>,
92 ) -> ::aws_smithy_runtime_api::client::result::SdkError<
93 crate::operation::chat::ChatError,
94 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
95 > {
96 ::aws_smithy_runtime_api::client::result::SdkError::response_error(
97 err,
98 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse::new(
99 ::aws_smithy_runtime_api::http::StatusCode::try_from(200).expect("valid successful code"),
100 ::aws_smithy_types::body::SdkBody::empty(),
101 ),
102 )
103 }
104
105 let message = output.output_stream.try_recv_initial_response().await.map_err(response_error)?;
106
107 match message {
108 ::std::option::Option::Some(_message) => ::std::result::Result::Ok(output),
109 ::std::option::Option::None => ::std::result::Result::Ok(output),
110 }
111 }
112
113 pub fn customize(
115 self,
116 ) -> crate::client::customize::CustomizableOperation<crate::operation::chat::ChatOutput, crate::operation::chat::ChatError, Self> {
117 crate::client::customize::CustomizableOperation::new(self)
118 }
119 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
120 self.set_config_override(::std::option::Option::Some(config_override.into()));
121 self
122 }
123
124 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
125 self.config_override = config_override;
126 self
127 }
128 pub fn application_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130 self.inner = self.inner.application_id(input.into());
131 self
132 }
133 pub fn set_application_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135 self.inner = self.inner.set_application_id(input);
136 self
137 }
138 pub fn get_application_id(&self) -> &::std::option::Option<::std::string::String> {
140 self.inner.get_application_id()
141 }
142 pub fn user_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144 self.inner = self.inner.user_id(input.into());
145 self
146 }
147 pub fn set_user_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
149 self.inner = self.inner.set_user_id(input);
150 self
151 }
152 pub fn get_user_id(&self) -> &::std::option::Option<::std::string::String> {
154 self.inner.get_user_id()
155 }
156 pub fn user_groups(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163 self.inner = self.inner.user_groups(input.into());
164 self
165 }
166 pub fn set_user_groups(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
168 self.inner = self.inner.set_user_groups(input);
169 self
170 }
171 pub fn get_user_groups(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
173 self.inner.get_user_groups()
174 }
175 pub fn conversation_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
177 self.inner = self.inner.conversation_id(input.into());
178 self
179 }
180 pub fn set_conversation_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
182 self.inner = self.inner.set_conversation_id(input);
183 self
184 }
185 pub fn get_conversation_id(&self) -> &::std::option::Option<::std::string::String> {
187 self.inner.get_conversation_id()
188 }
189 pub fn parent_message_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
191 self.inner = self.inner.parent_message_id(input.into());
192 self
193 }
194 pub fn set_parent_message_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
196 self.inner = self.inner.set_parent_message_id(input);
197 self
198 }
199 pub fn get_parent_message_id(&self) -> &::std::option::Option<::std::string::String> {
201 self.inner.get_parent_message_id()
202 }
203 pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205 self.inner = self.inner.client_token(input.into());
206 self
207 }
208 pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210 self.inner = self.inner.set_client_token(input);
211 self
212 }
213 pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
215 self.inner.get_client_token()
216 }
217 pub fn input_stream(
219 mut self,
220 input: ::aws_smithy_http::event_stream::EventStreamSender<crate::types::ChatInputStream, crate::types::error::ChatInputStreamError>,
221 ) -> Self {
222 self.inner = self.inner.input_stream(input);
223 self
224 }
225 pub fn set_input_stream(
227 mut self,
228 input: ::std::option::Option<
229 ::aws_smithy_http::event_stream::EventStreamSender<crate::types::ChatInputStream, crate::types::error::ChatInputStreamError>,
230 >,
231 ) -> Self {
232 self.inner = self.inner.set_input_stream(input);
233 self
234 }
235 pub fn get_input_stream(
237 &self,
238 ) -> &::std::option::Option<
239 ::aws_smithy_http::event_stream::EventStreamSender<crate::types::ChatInputStream, crate::types::error::ChatInputStreamError>,
240 > {
241 self.inner.get_input_stream()
242 }
243}