use std::fmt::Write;
pub mod delete_session_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) bot_id: std::option::Option<std::string::String>,
pub(crate) bot_alias_id: std::option::Option<std::string::String>,
pub(crate) locale_id: std::option::Option<std::string::String>,
pub(crate) session_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn bot_id(mut self, input: impl Into<std::string::String>) -> Self {
self.bot_id = Some(input.into());
self
}
pub fn set_bot_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.bot_id = input;
self
}
pub fn bot_alias_id(mut self, input: impl Into<std::string::String>) -> Self {
self.bot_alias_id = Some(input.into());
self
}
pub fn set_bot_alias_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.bot_alias_id = input;
self
}
pub fn locale_id(mut self, input: impl Into<std::string::String>) -> Self {
self.locale_id = Some(input.into());
self
}
pub fn set_locale_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.locale_id = input;
self
}
pub fn session_id(mut self, input: impl Into<std::string::String>) -> Self {
self.session_id = Some(input.into());
self
}
pub fn set_session_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.session_id = input;
self
}
pub fn build(
self,
) -> Result<crate::input::DeleteSessionInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::DeleteSessionInput {
bot_id: self.bot_id,
bot_alias_id: self.bot_alias_id,
locale_id: self.locale_id,
session_id: self.session_id,
})
}
}
}
impl DeleteSessionInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::DeleteSession,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::DeleteSessionInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_1 = &_input.bot_id;
let input_1 = input_1.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_id",
"cannot be empty or unset",
)
})?;
let bot_id = aws_smithy_http::label::fmt_string(
input_1,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bot_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_id",
"cannot be empty or unset",
),
);
}
let input_2 = &_input.bot_alias_id;
let input_2 = input_2.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_alias_id",
"cannot be empty or unset",
)
})?;
let bot_alias_id = aws_smithy_http::label::fmt_string(
input_2,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bot_alias_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_alias_id",
"cannot be empty or unset",
),
);
}
let input_3 = &_input.locale_id;
let input_3 = input_3.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"locale_id",
"cannot be empty or unset",
)
})?;
let locale_id = aws_smithy_http::label::fmt_string(
input_3,
aws_smithy_http::label::EncodingStrategy::Default,
);
if locale_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"locale_id",
"cannot be empty or unset",
),
);
}
let input_4 = &_input.session_id;
let input_4 = input_4.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
)
})?;
let session_id = aws_smithy_http::label::fmt_string(
input_4,
aws_smithy_http::label::EncodingStrategy::Default,
);
if session_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
),
);
}
write!(output, "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}", botId = bot_id, botAliasId = bot_alias_id, localeId = locale_id, sessionId = session_id).expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::DeleteSessionInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("DELETE").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(vec![http::Version::HTTP_11, http::Version::HTTP_2]);
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::DeleteSession::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"DeleteSession",
"lexruntimev2",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::delete_session_input::Builder {
crate::input::delete_session_input::Builder::default()
}
}
pub mod get_session_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) bot_id: std::option::Option<std::string::String>,
pub(crate) bot_alias_id: std::option::Option<std::string::String>,
pub(crate) locale_id: std::option::Option<std::string::String>,
pub(crate) session_id: std::option::Option<std::string::String>,
}
impl Builder {
pub fn bot_id(mut self, input: impl Into<std::string::String>) -> Self {
self.bot_id = Some(input.into());
self
}
pub fn set_bot_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.bot_id = input;
self
}
pub fn bot_alias_id(mut self, input: impl Into<std::string::String>) -> Self {
self.bot_alias_id = Some(input.into());
self
}
pub fn set_bot_alias_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.bot_alias_id = input;
self
}
pub fn locale_id(mut self, input: impl Into<std::string::String>) -> Self {
self.locale_id = Some(input.into());
self
}
pub fn set_locale_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.locale_id = input;
self
}
pub fn session_id(mut self, input: impl Into<std::string::String>) -> Self {
self.session_id = Some(input.into());
self
}
pub fn set_session_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.session_id = input;
self
}
pub fn build(
self,
) -> Result<crate::input::GetSessionInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::GetSessionInput {
bot_id: self.bot_id,
bot_alias_id: self.bot_alias_id,
locale_id: self.locale_id,
session_id: self.session_id,
})
}
}
}
impl GetSessionInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::GetSession,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::GetSessionInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_5 = &_input.bot_id;
let input_5 = input_5.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_id",
"cannot be empty or unset",
)
})?;
let bot_id = aws_smithy_http::label::fmt_string(
input_5,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bot_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_id",
"cannot be empty or unset",
),
);
}
let input_6 = &_input.bot_alias_id;
let input_6 = input_6.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_alias_id",
"cannot be empty or unset",
)
})?;
let bot_alias_id = aws_smithy_http::label::fmt_string(
input_6,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bot_alias_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_alias_id",
"cannot be empty or unset",
),
);
}
let input_7 = &_input.locale_id;
let input_7 = input_7.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"locale_id",
"cannot be empty or unset",
)
})?;
let locale_id = aws_smithy_http::label::fmt_string(
input_7,
aws_smithy_http::label::EncodingStrategy::Default,
);
if locale_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"locale_id",
"cannot be empty or unset",
),
);
}
let input_8 = &_input.session_id;
let input_8 = input_8.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
)
})?;
let session_id = aws_smithy_http::label::fmt_string(
input_8,
aws_smithy_http::label::EncodingStrategy::Default,
);
if session_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
),
);
}
write!(output, "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}", botId = bot_id, botAliasId = bot_alias_id, localeId = locale_id, sessionId = session_id).expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::GetSessionInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("GET").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from("");
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(vec![http::Version::HTTP_11, http::Version::HTTP_2]);
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::GetSession::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"GetSession",
"lexruntimev2",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::get_session_input::Builder {
crate::input::get_session_input::Builder::default()
}
}
pub mod put_session_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct Builder {
pub(crate) bot_id: std::option::Option<std::string::String>,
pub(crate) bot_alias_id: std::option::Option<std::string::String>,
pub(crate) locale_id: std::option::Option<std::string::String>,
pub(crate) session_id: std::option::Option<std::string::String>,
pub(crate) messages: std::option::Option<std::vec::Vec<crate::model::Message>>,
pub(crate) session_state: std::option::Option<crate::model::SessionState>,
pub(crate) request_attributes: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
pub(crate) response_content_type: std::option::Option<std::string::String>,
}
impl Builder {
pub fn bot_id(mut self, input: impl Into<std::string::String>) -> Self {
self.bot_id = Some(input.into());
self
}
pub fn set_bot_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.bot_id = input;
self
}
pub fn bot_alias_id(mut self, input: impl Into<std::string::String>) -> Self {
self.bot_alias_id = Some(input.into());
self
}
pub fn set_bot_alias_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.bot_alias_id = input;
self
}
pub fn locale_id(mut self, input: impl Into<std::string::String>) -> Self {
self.locale_id = Some(input.into());
self
}
pub fn set_locale_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.locale_id = input;
self
}
pub fn session_id(mut self, input: impl Into<std::string::String>) -> Self {
self.session_id = Some(input.into());
self
}
pub fn set_session_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.session_id = input;
self
}
pub fn messages(mut self, input: crate::model::Message) -> Self {
let mut v = self.messages.unwrap_or_default();
v.push(input);
self.messages = Some(v);
self
}
pub fn set_messages(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Message>>,
) -> Self {
self.messages = input;
self
}
pub fn session_state(mut self, input: crate::model::SessionState) -> Self {
self.session_state = Some(input);
self
}
pub fn set_session_state(
mut self,
input: std::option::Option<crate::model::SessionState>,
) -> Self {
self.session_state = input;
self
}
pub fn request_attributes(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.request_attributes.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.request_attributes = Some(hash_map);
self
}
pub fn set_request_attributes(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.request_attributes = input;
self
}
pub fn response_content_type(mut self, input: impl Into<std::string::String>) -> Self {
self.response_content_type = Some(input.into());
self
}
pub fn set_response_content_type(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.response_content_type = input;
self
}
pub fn build(
self,
) -> Result<crate::input::PutSessionInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::PutSessionInput {
bot_id: self.bot_id,
bot_alias_id: self.bot_alias_id,
locale_id: self.locale_id,
session_id: self.session_id,
messages: self.messages,
session_state: self.session_state,
request_attributes: self.request_attributes,
response_content_type: self.response_content_type,
})
}
}
}
impl PutSessionInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::PutSession,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::PutSessionInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_9 = &_input.bot_id;
let input_9 = input_9.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_id",
"cannot be empty or unset",
)
})?;
let bot_id = aws_smithy_http::label::fmt_string(
input_9,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bot_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_id",
"cannot be empty or unset",
),
);
}
let input_10 = &_input.bot_alias_id;
let input_10 = input_10.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_alias_id",
"cannot be empty or unset",
)
})?;
let bot_alias_id = aws_smithy_http::label::fmt_string(
input_10,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bot_alias_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_alias_id",
"cannot be empty or unset",
),
);
}
let input_11 = &_input.locale_id;
let input_11 = input_11.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"locale_id",
"cannot be empty or unset",
)
})?;
let locale_id = aws_smithy_http::label::fmt_string(
input_11,
aws_smithy_http::label::EncodingStrategy::Default,
);
if locale_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"locale_id",
"cannot be empty or unset",
),
);
}
let input_12 = &_input.session_id;
let input_12 = input_12.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
)
})?;
let session_id = aws_smithy_http::label::fmt_string(
input_12,
aws_smithy_http::label::EncodingStrategy::Default,
);
if session_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
),
);
}
write!(output, "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}", botId = bot_id, botAliasId = bot_alias_id, localeId = locale_id, sessionId = session_id).expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::PutSessionInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
let builder = crate::http_serde::add_headers_put_session(input, builder)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_put_session(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(vec![http::Version::HTTP_11, http::Version::HTTP_2]);
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::PutSession::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"PutSession",
"lexruntimev2",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::put_session_input::Builder {
crate::input::put_session_input::Builder::default()
}
}
pub mod recognize_text_input {
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default)]
pub struct Builder {
pub(crate) bot_id: std::option::Option<std::string::String>,
pub(crate) bot_alias_id: std::option::Option<std::string::String>,
pub(crate) locale_id: std::option::Option<std::string::String>,
pub(crate) session_id: std::option::Option<std::string::String>,
pub(crate) text: std::option::Option<std::string::String>,
pub(crate) session_state: std::option::Option<crate::model::SessionState>,
pub(crate) request_attributes: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
}
impl Builder {
pub fn bot_id(mut self, input: impl Into<std::string::String>) -> Self {
self.bot_id = Some(input.into());
self
}
pub fn set_bot_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.bot_id = input;
self
}
pub fn bot_alias_id(mut self, input: impl Into<std::string::String>) -> Self {
self.bot_alias_id = Some(input.into());
self
}
pub fn set_bot_alias_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.bot_alias_id = input;
self
}
pub fn locale_id(mut self, input: impl Into<std::string::String>) -> Self {
self.locale_id = Some(input.into());
self
}
pub fn set_locale_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.locale_id = input;
self
}
pub fn session_id(mut self, input: impl Into<std::string::String>) -> Self {
self.session_id = Some(input.into());
self
}
pub fn set_session_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.session_id = input;
self
}
pub fn text(mut self, input: impl Into<std::string::String>) -> Self {
self.text = Some(input.into());
self
}
pub fn set_text(mut self, input: std::option::Option<std::string::String>) -> Self {
self.text = input;
self
}
pub fn session_state(mut self, input: crate::model::SessionState) -> Self {
self.session_state = Some(input);
self
}
pub fn set_session_state(
mut self,
input: std::option::Option<crate::model::SessionState>,
) -> Self {
self.session_state = input;
self
}
pub fn request_attributes(
mut self,
k: impl Into<std::string::String>,
v: impl Into<std::string::String>,
) -> Self {
let mut hash_map = self.request_attributes.unwrap_or_default();
hash_map.insert(k.into(), v.into());
self.request_attributes = Some(hash_map);
self
}
pub fn set_request_attributes(
mut self,
input: std::option::Option<
std::collections::HashMap<std::string::String, std::string::String>,
>,
) -> Self {
self.request_attributes = input;
self
}
pub fn build(
self,
) -> Result<crate::input::RecognizeTextInput, aws_smithy_http::operation::error::BuildError>
{
Ok(crate::input::RecognizeTextInput {
bot_id: self.bot_id,
bot_alias_id: self.bot_alias_id,
locale_id: self.locale_id,
session_id: self.session_id,
text: self.text,
session_state: self.session_state,
request_attributes: self.request_attributes,
})
}
}
impl std::fmt::Debug for Builder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("Builder");
formatter.field("bot_id", &self.bot_id);
formatter.field("bot_alias_id", &self.bot_alias_id);
formatter.field("locale_id", &self.locale_id);
formatter.field("session_id", &self.session_id);
formatter.field("text", &"*** Sensitive Data Redacted ***");
formatter.field("session_state", &self.session_state);
formatter.field("request_attributes", &self.request_attributes);
formatter.finish()
}
}
}
impl RecognizeTextInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
&self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::RecognizeText,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::RecognizeTextInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_13 = &_input.bot_id;
let input_13 = input_13.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_id",
"cannot be empty or unset",
)
})?;
let bot_id = aws_smithy_http::label::fmt_string(
input_13,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bot_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_id",
"cannot be empty or unset",
),
);
}
let input_14 = &_input.bot_alias_id;
let input_14 = input_14.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_alias_id",
"cannot be empty or unset",
)
})?;
let bot_alias_id = aws_smithy_http::label::fmt_string(
input_14,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bot_alias_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_alias_id",
"cannot be empty or unset",
),
);
}
let input_15 = &_input.locale_id;
let input_15 = input_15.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"locale_id",
"cannot be empty or unset",
)
})?;
let locale_id = aws_smithy_http::label::fmt_string(
input_15,
aws_smithy_http::label::EncodingStrategy::Default,
);
if locale_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"locale_id",
"cannot be empty or unset",
),
);
}
let input_16 = &_input.session_id;
let input_16 = input_16.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
)
})?;
let session_id = aws_smithy_http::label::fmt_string(
input_16,
aws_smithy_http::label::EncodingStrategy::Default,
);
if session_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
),
);
}
write!(output, "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/text", botId = bot_id, botAliasId = bot_alias_id, localeId = locale_id, sessionId = session_id).expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::RecognizeTextInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/json",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_operation_crate_operation_recognize_text(&self)?,
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(vec![http::Version::HTTP_11, http::Version::HTTP_2]);
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::RecognizeText::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"RecognizeText",
"lexruntimev2",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::recognize_text_input::Builder {
crate::input::recognize_text_input::Builder::default()
}
}
pub mod recognize_utterance_input {
#[derive(std::default::Default)]
pub struct Builder {
pub(crate) bot_id: std::option::Option<std::string::String>,
pub(crate) bot_alias_id: std::option::Option<std::string::String>,
pub(crate) locale_id: std::option::Option<std::string::String>,
pub(crate) session_id: std::option::Option<std::string::String>,
pub(crate) session_state: std::option::Option<std::string::String>,
pub(crate) request_attributes: std::option::Option<std::string::String>,
pub(crate) request_content_type: std::option::Option<std::string::String>,
pub(crate) response_content_type: std::option::Option<std::string::String>,
pub(crate) input_stream: std::option::Option<aws_smithy_http::byte_stream::ByteStream>,
}
impl Builder {
pub fn bot_id(mut self, input: impl Into<std::string::String>) -> Self {
self.bot_id = Some(input.into());
self
}
pub fn set_bot_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.bot_id = input;
self
}
pub fn bot_alias_id(mut self, input: impl Into<std::string::String>) -> Self {
self.bot_alias_id = Some(input.into());
self
}
pub fn set_bot_alias_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.bot_alias_id = input;
self
}
pub fn locale_id(mut self, input: impl Into<std::string::String>) -> Self {
self.locale_id = Some(input.into());
self
}
pub fn set_locale_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.locale_id = input;
self
}
pub fn session_id(mut self, input: impl Into<std::string::String>) -> Self {
self.session_id = Some(input.into());
self
}
pub fn set_session_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.session_id = input;
self
}
pub fn session_state(mut self, input: impl Into<std::string::String>) -> Self {
self.session_state = Some(input.into());
self
}
pub fn set_session_state(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.session_state = input;
self
}
pub fn request_attributes(mut self, input: impl Into<std::string::String>) -> Self {
self.request_attributes = Some(input.into());
self
}
pub fn set_request_attributes(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.request_attributes = input;
self
}
pub fn request_content_type(mut self, input: impl Into<std::string::String>) -> Self {
self.request_content_type = Some(input.into());
self
}
pub fn set_request_content_type(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.request_content_type = input;
self
}
pub fn response_content_type(mut self, input: impl Into<std::string::String>) -> Self {
self.response_content_type = Some(input.into());
self
}
pub fn set_response_content_type(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.response_content_type = input;
self
}
pub fn input_stream(mut self, input: aws_smithy_http::byte_stream::ByteStream) -> Self {
self.input_stream = Some(input);
self
}
pub fn set_input_stream(
mut self,
input: std::option::Option<aws_smithy_http::byte_stream::ByteStream>,
) -> Self {
self.input_stream = input;
self
}
pub fn build(
self,
) -> Result<
crate::input::RecognizeUtteranceInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::input::RecognizeUtteranceInput {
bot_id: self.bot_id,
bot_alias_id: self.bot_alias_id,
locale_id: self.locale_id,
session_id: self.session_id,
session_state: self.session_state,
request_attributes: self.request_attributes,
request_content_type: self.request_content_type,
response_content_type: self.response_content_type,
input_stream: self.input_stream.unwrap_or_default(),
})
}
}
impl std::fmt::Debug for Builder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("Builder");
formatter.field("bot_id", &self.bot_id);
formatter.field("bot_alias_id", &self.bot_alias_id);
formatter.field("locale_id", &self.locale_id);
formatter.field("session_id", &self.session_id);
formatter.field("session_state", &"*** Sensitive Data Redacted ***");
formatter.field("request_attributes", &"*** Sensitive Data Redacted ***");
formatter.field("request_content_type", &self.request_content_type);
formatter.field("response_content_type", &self.response_content_type);
formatter.field("input_stream", &self.input_stream);
formatter.finish()
}
}
}
impl RecognizeUtteranceInput {
#[allow(unused_mut)]
#[allow(clippy::let_and_return)]
#[allow(clippy::needless_borrow)]
pub async fn make_operation(
self,
_config: &crate::config::Config,
) -> std::result::Result<
aws_smithy_http::operation::Operation<
crate::operation::RecognizeUtterance,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::operation::error::BuildError,
> {
let params_result = crate::endpoint::Params::builder()
.set_region(_config.region.as_ref().map(|r| r.as_ref().to_owned()))
.set_use_dual_stack(_config.use_dual_stack)
.set_use_fips(_config.use_fips)
.set_endpoint(_config.endpoint_url.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
"could not construct endpoint parameters",
err,
)
});
let (endpoint_result, params) = match params_result {
Ok(params) => (
_config.endpoint_resolver.resolve_endpoint(¶ms),
Some(params),
),
Err(e) => (Err(e), None),
};
let mut request = {
fn uri_base(
_input: &crate::input::RecognizeUtteranceInput,
output: &mut String,
) -> Result<(), aws_smithy_http::operation::error::BuildError> {
let input_17 = &_input.bot_id;
let input_17 = input_17.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_id",
"cannot be empty or unset",
)
})?;
let bot_id = aws_smithy_http::label::fmt_string(
input_17,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bot_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_id",
"cannot be empty or unset",
),
);
}
let input_18 = &_input.bot_alias_id;
let input_18 = input_18.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_alias_id",
"cannot be empty or unset",
)
})?;
let bot_alias_id = aws_smithy_http::label::fmt_string(
input_18,
aws_smithy_http::label::EncodingStrategy::Default,
);
if bot_alias_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"bot_alias_id",
"cannot be empty or unset",
),
);
}
let input_19 = &_input.locale_id;
let input_19 = input_19.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"locale_id",
"cannot be empty or unset",
)
})?;
let locale_id = aws_smithy_http::label::fmt_string(
input_19,
aws_smithy_http::label::EncodingStrategy::Default,
);
if locale_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"locale_id",
"cannot be empty or unset",
),
);
}
let input_20 = &_input.session_id;
let input_20 = input_20.as_ref().ok_or_else(|| {
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
)
})?;
let session_id = aws_smithy_http::label::fmt_string(
input_20,
aws_smithy_http::label::EncodingStrategy::Default,
);
if session_id.is_empty() {
return Err(
aws_smithy_http::operation::error::BuildError::missing_field(
"session_id",
"cannot be empty or unset",
),
);
}
write!(output, "/bots/{botId}/botAliases/{botAliasId}/botLocales/{localeId}/sessions/{sessionId}/utterance", botId = bot_id, botAliasId = bot_alias_id, localeId = locale_id, sessionId = session_id).expect("formatting should succeed");
Ok(())
}
#[allow(clippy::unnecessary_wraps)]
fn update_http_builder(
input: &crate::input::RecognizeUtteranceInput,
builder: http::request::Builder,
) -> std::result::Result<
http::request::Builder,
aws_smithy_http::operation::error::BuildError,
> {
let mut uri = String::new();
uri_base(input, &mut uri)?;
let builder = crate::http_serde::add_headers_recognize_utterance(input, builder)?;
Ok(builder.method("POST").uri(uri))
}
let mut builder = update_http_builder(&self, http::request::Builder::new())?;
builder = aws_smithy_http::header::set_request_header_if_absent(
builder,
http::header::CONTENT_TYPE,
"application/octet-stream",
);
builder
};
let mut properties = aws_smithy_http::property_bag::SharedPropertyBag::new();
#[allow(clippy::useless_conversion)]
let body = aws_smithy_http::body::SdkBody::from(
crate::operation_ser::serialize_payload_recognize_utterance_input(self.input_stream)?
.into_inner(),
);
if let Some(content_length) = body.content_length() {
request = aws_smithy_http::header::set_request_header_if_absent(
request,
http::header::CONTENT_LENGTH,
content_length,
);
}
let request = request.body(body).expect("should be valid request");
let mut request = aws_smithy_http::operation::Request::from_parts(request, properties);
request.properties_mut().insert(endpoint_result);
if let Some(params) = params {
request.properties_mut().insert(params);
}
request
.properties_mut()
.insert(vec![http::Version::HTTP_11, http::Version::HTTP_2]);
let mut user_agent = aws_http::user_agent::AwsUserAgent::new_from_environment(
aws_types::os_shim_internal::Env::real(),
crate::API_METADATA.clone(),
);
if let Some(app_name) = _config.app_name() {
user_agent = user_agent.with_app_name(app_name.clone());
}
request.properties_mut().insert(user_agent);
let mut signing_config = aws_sig_auth::signer::OperationSigningConfig::default_config();
signing_config.signing_options.content_sha256_header = true;
request
.properties_mut()
.insert(aws_sig_auth::signer::SignableBody::UnsignedPayload);
request.properties_mut().insert(signing_config);
request
.properties_mut()
.insert(aws_types::SigningService::from_static(
_config.signing_service(),
));
if let Some(region) = &_config.region {
request
.properties_mut()
.insert(aws_types::region::SigningRegion::from(region.clone()));
}
if let Some(region) = &_config.region {
request.properties_mut().insert(region.clone());
}
aws_http::auth::set_credentials_cache(
&mut request.properties_mut(),
_config.credentials_cache.clone(),
);
let op = aws_smithy_http::operation::Operation::new(
request,
crate::operation::RecognizeUtterance::new(),
)
.with_metadata(aws_smithy_http::operation::Metadata::new(
"RecognizeUtterance",
"lexruntimev2",
));
let op = op.with_retry_classifier(aws_http::retry::AwsResponseRetryClassifier::new());
Ok(op)
}
pub fn builder() -> crate::input::recognize_utterance_input::Builder {
crate::input::recognize_utterance_input::Builder::default()
}
}
#[allow(missing_docs)] #[non_exhaustive]
pub struct RecognizeUtteranceInput {
#[doc(hidden)]
pub bot_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub bot_alias_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub locale_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub session_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub session_state: std::option::Option<std::string::String>,
#[doc(hidden)]
pub request_attributes: std::option::Option<std::string::String>,
#[doc(hidden)]
pub request_content_type: std::option::Option<std::string::String>,
#[doc(hidden)]
pub response_content_type: std::option::Option<std::string::String>,
pub input_stream: aws_smithy_http::byte_stream::ByteStream,
}
impl RecognizeUtteranceInput {
pub fn bot_id(&self) -> std::option::Option<&str> {
self.bot_id.as_deref()
}
pub fn bot_alias_id(&self) -> std::option::Option<&str> {
self.bot_alias_id.as_deref()
}
pub fn locale_id(&self) -> std::option::Option<&str> {
self.locale_id.as_deref()
}
pub fn session_id(&self) -> std::option::Option<&str> {
self.session_id.as_deref()
}
pub fn session_state(&self) -> std::option::Option<&str> {
self.session_state.as_deref()
}
pub fn request_attributes(&self) -> std::option::Option<&str> {
self.request_attributes.as_deref()
}
pub fn request_content_type(&self) -> std::option::Option<&str> {
self.request_content_type.as_deref()
}
pub fn response_content_type(&self) -> std::option::Option<&str> {
self.response_content_type.as_deref()
}
pub fn input_stream(&self) -> &aws_smithy_http::byte_stream::ByteStream {
&self.input_stream
}
}
impl std::fmt::Debug for RecognizeUtteranceInput {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("RecognizeUtteranceInput");
formatter.field("bot_id", &self.bot_id);
formatter.field("bot_alias_id", &self.bot_alias_id);
formatter.field("locale_id", &self.locale_id);
formatter.field("session_id", &self.session_id);
formatter.field("session_state", &"*** Sensitive Data Redacted ***");
formatter.field("request_attributes", &"*** Sensitive Data Redacted ***");
formatter.field("request_content_type", &self.request_content_type);
formatter.field("response_content_type", &self.response_content_type);
formatter.field("input_stream", &self.input_stream);
formatter.finish()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct RecognizeTextInput {
#[doc(hidden)]
pub bot_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub bot_alias_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub locale_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub session_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub text: std::option::Option<std::string::String>,
#[doc(hidden)]
pub session_state: std::option::Option<crate::model::SessionState>,
#[doc(hidden)]
pub request_attributes:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
}
impl RecognizeTextInput {
pub fn bot_id(&self) -> std::option::Option<&str> {
self.bot_id.as_deref()
}
pub fn bot_alias_id(&self) -> std::option::Option<&str> {
self.bot_alias_id.as_deref()
}
pub fn locale_id(&self) -> std::option::Option<&str> {
self.locale_id.as_deref()
}
pub fn session_id(&self) -> std::option::Option<&str> {
self.session_id.as_deref()
}
pub fn text(&self) -> std::option::Option<&str> {
self.text.as_deref()
}
pub fn session_state(&self) -> std::option::Option<&crate::model::SessionState> {
self.session_state.as_ref()
}
pub fn request_attributes(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.request_attributes.as_ref()
}
}
impl std::fmt::Debug for RecognizeTextInput {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("RecognizeTextInput");
formatter.field("bot_id", &self.bot_id);
formatter.field("bot_alias_id", &self.bot_alias_id);
formatter.field("locale_id", &self.locale_id);
formatter.field("session_id", &self.session_id);
formatter.field("text", &"*** Sensitive Data Redacted ***");
formatter.field("session_state", &self.session_state);
formatter.field("request_attributes", &self.request_attributes);
formatter.finish()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct PutSessionInput {
#[doc(hidden)]
pub bot_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub bot_alias_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub locale_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub session_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub messages: std::option::Option<std::vec::Vec<crate::model::Message>>,
#[doc(hidden)]
pub session_state: std::option::Option<crate::model::SessionState>,
#[doc(hidden)]
pub request_attributes:
std::option::Option<std::collections::HashMap<std::string::String, std::string::String>>,
#[doc(hidden)]
pub response_content_type: std::option::Option<std::string::String>,
}
impl PutSessionInput {
pub fn bot_id(&self) -> std::option::Option<&str> {
self.bot_id.as_deref()
}
pub fn bot_alias_id(&self) -> std::option::Option<&str> {
self.bot_alias_id.as_deref()
}
pub fn locale_id(&self) -> std::option::Option<&str> {
self.locale_id.as_deref()
}
pub fn session_id(&self) -> std::option::Option<&str> {
self.session_id.as_deref()
}
pub fn messages(&self) -> std::option::Option<&[crate::model::Message]> {
self.messages.as_deref()
}
pub fn session_state(&self) -> std::option::Option<&crate::model::SessionState> {
self.session_state.as_ref()
}
pub fn request_attributes(
&self,
) -> std::option::Option<&std::collections::HashMap<std::string::String, std::string::String>>
{
self.request_attributes.as_ref()
}
pub fn response_content_type(&self) -> std::option::Option<&str> {
self.response_content_type.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct GetSessionInput {
#[doc(hidden)]
pub bot_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub bot_alias_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub locale_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub session_id: std::option::Option<std::string::String>,
}
impl GetSessionInput {
pub fn bot_id(&self) -> std::option::Option<&str> {
self.bot_id.as_deref()
}
pub fn bot_alias_id(&self) -> std::option::Option<&str> {
self.bot_alias_id.as_deref()
}
pub fn locale_id(&self) -> std::option::Option<&str> {
self.locale_id.as_deref()
}
pub fn session_id(&self) -> std::option::Option<&str> {
self.session_id.as_deref()
}
}
#[allow(missing_docs)] #[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct DeleteSessionInput {
#[doc(hidden)]
pub bot_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub bot_alias_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub locale_id: std::option::Option<std::string::String>,
#[doc(hidden)]
pub session_id: std::option::Option<std::string::String>,
}
impl DeleteSessionInput {
pub fn bot_id(&self) -> std::option::Option<&str> {
self.bot_id.as_deref()
}
pub fn bot_alias_id(&self) -> std::option::Option<&str> {
self.bot_alias_id.as_deref()
}
pub fn locale_id(&self) -> std::option::Option<&str> {
self.locale_id.as_deref()
}
pub fn session_id(&self) -> std::option::Option<&str> {
self.session_id.as_deref()
}
}