pub(crate) fn de_brand_definition<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
) -> ::std::result::Result<Option<crate::types::BrandDefinition>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
#[allow(unused_mut)]
let mut builder = crate::types::builders::BrandDefinitionBuilder::default();
loop {
match tokens.next().transpose()? {
Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
"BrandName" => {
builder = builder.set_brand_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Description" => {
builder = builder.set_description(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"ApplicationTheme" => {
builder = builder.set_application_theme(crate::protocol_serde::shape_application_theme::de_application_theme(tokens)?);
}
"LogoConfiguration" => {
builder = builder.set_logo_configuration(crate::protocol_serde::shape_logo_configuration::de_logo_configuration(tokens)?);
}
_ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
},
other => {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
"expected object key or end object, found: {other:?}"
)))
}
}
}
Ok(Some(crate::serde_util::brand_definition_correct_errors(builder).build().map_err(
|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
)?))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}
pub fn ser_brand_definition(
object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
input: &crate::types::BrandDefinition,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
{
object.key("BrandName").string(input.brand_name.as_str());
}
if let Some(var_1) = &input.description {
object.key("Description").string(var_1.as_str());
}
if let Some(var_2) = &input.application_theme {
#[allow(unused_mut)]
let mut object_3 = object.key("ApplicationTheme").start_object();
crate::protocol_serde::shape_application_theme::ser_application_theme(&mut object_3, var_2)?;
object_3.finish();
}
if let Some(var_4) = &input.logo_configuration {
#[allow(unused_mut)]
let mut object_5 = object.key("LogoConfiguration").start_object();
crate::protocol_serde::shape_logo_configuration::ser_logo_configuration(&mut object_5, var_4)?;
object_5.finish();
}
Ok(())
}