pub use crate::operation::chat::_chat_input::ChatInputBuilder;
pub use crate::operation::chat::_chat_output::ChatOutputBuilder;
impl crate::operation::chat::builders::ChatInputBuilder {
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::chat::ChatOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::chat::ChatError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.chat();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct ChatFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::chat::builders::ChatInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl crate::client::customize::internal::CustomizableSend<crate::operation::chat::ChatOutput, crate::operation::chat::ChatError>
for ChatFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<crate::operation::chat::ChatOutput, crate::operation::chat::ChatError>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl ChatFluentBuilder {
pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: ::std::default::Default::default(),
config_override: ::std::option::Option::None,
}
}
pub fn as_input(&self) -> &crate::operation::chat::builders::ChatInputBuilder {
&self.inner
}
pub async fn send(
self,
) -> ::std::result::Result<
crate::operation::chat::ChatOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::chat::ChatError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let input = self
.inner
.build()
.map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
let runtime_plugins =
crate::operation::chat::Chat::operation_runtime_plugins(self.handle.runtime_plugins.clone(), &self.handle.conf, self.config_override);
let mut output = crate::operation::chat::Chat::orchestrate(&runtime_plugins, input).await?;
fn response_error(
err: impl ::std::convert::Into<::aws_smithy_runtime_api::box_error::BoxError>,
) -> ::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::chat::ChatError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
> {
::aws_smithy_runtime_api::client::result::SdkError::response_error(
err,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse::new(
::aws_smithy_runtime_api::http::StatusCode::try_from(200).expect("valid successful code"),
::aws_smithy_types::body::SdkBody::empty(),
),
)
}
let message = output.event_stream.try_recv_initial_response().await.map_err(response_error)?;
match message {
::std::option::Option::Some(_message) => {
let mut builder = output.into_builder();
builder = crate::protocol_serde::shape_chat::de_chat(_message.payload(), builder).map_err(response_error)?;
let output = builder.build().map_err(response_error)?;
::std::result::Result::Ok(output)
}
::std::option::Option::None => ::std::result::Result::Ok(output),
}
}
pub fn customize(
self,
) -> crate::client::customize::CustomizableOperation<crate::operation::chat::ChatOutput, crate::operation::chat::ChatError, Self> {
crate::client::customize::CustomizableOperation::new(self)
}
pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
self.set_config_override(::std::option::Option::Some(config_override.into()));
self
}
pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
self.config_override = config_override;
self
}
pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.message(input.into());
self
}
pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_message(input);
self
}
pub fn get_message(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_message()
}
pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.session_id(input.into());
self
}
pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_session_id(input);
self
}
pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_session_id()
}
pub fn environment_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.environment_arn(input.into());
self
}
pub fn set_environment_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_environment_arn(input);
self
}
pub fn get_environment_arn(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_environment_arn()
}
pub fn expected_sequence_number(mut self, input: i64) -> Self {
self.inner = self.inner.expected_sequence_number(input);
self
}
pub fn set_expected_sequence_number(mut self, input: ::std::option::Option<i64>) -> Self {
self.inner = self.inner.set_expected_sequence_number(input);
self
}
pub fn get_expected_sequence_number(&self) -> &::std::option::Option<i64> {
self.inner.get_expected_sequence_number()
}
}