pub(crate) fn de_phone_number_information<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
depth: u32,
) -> ::std::result::Result<Option<crate::types::PhoneNumberInformation>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
if depth >= 128u32 {
return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"maximum nesting depth exceeded",
));
}
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::PhoneNumberInformationBuilder::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() {
"PhoneNumberArn" => {
builder = builder.set_phone_number_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"PhoneNumberId" => {
builder = builder.set_phone_number_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"PhoneNumber" => {
builder = builder.set_phone_number(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"Status" => {
builder = builder.set_status(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::NumberStatus::from(u.as_ref())))
.transpose()?,
);
}
"IsoCountryCode" => {
builder = builder.set_iso_country_code(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"MessageType" => {
builder = builder.set_message_type(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::MessageType::from(u.as_ref())))
.transpose()?,
);
}
"NumberCapabilities" => {
builder = builder.set_number_capabilities(
crate::protocol_serde::shape_number_capability_list::de_number_capability_list(tokens, _value, depth + 1)?,
);
}
"NumberType" => {
builder = builder.set_number_type(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::NumberType::from(u.as_ref())))
.transpose()?,
);
}
"MonthlyLeasingPrice" => {
builder = builder.set_monthly_leasing_price(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"TwoWayEnabled" => {
builder = builder.set_two_way_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"TwoWayChannelArn" => {
builder = builder.set_two_way_channel_arn(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"TwoWayChannelRole" => {
builder = builder.set_two_way_channel_role(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"SelfManagedOptOutsEnabled" => {
builder =
builder.set_self_managed_opt_outs_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"OptOutListName" => {
builder = builder.set_opt_out_list_name(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"InternationalSendingEnabled" => {
builder =
builder.set_international_sending_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"DeletionProtectionEnabled" => {
builder =
builder.set_deletion_protection_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
}
"PoolId" => {
builder = builder.set_pool_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"RegistrationId" => {
builder = builder.set_registration_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"MessagingLimits" => {
builder = builder.set_messaging_limits(crate::protocol_serde::shape_messaging_limits::de_messaging_limits(
tokens,
_value,
depth + 1,
)?);
}
"CreatedTimestamp" => {
builder = builder.set_created_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
_ => ::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::phone_number_information_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",
)),
}
}