pub(crate) fn de_agent_info<'a, I>(
tokens: &mut ::std::iter::Peekable<I>,
_value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::AgentInfo>, ::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::AgentInfoBuilder::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() {
"Id" => {
builder = builder.set_id(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| u.into_owned()))
.transpose()?,
);
}
"AcceptedByAgentTimestamp" => {
builder = builder.set_accepted_by_agent_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
"PreviewEndTimestamp" => {
builder = builder.set_preview_end_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
"ConnectedToAgentTimestamp" => {
builder = builder.set_connected_to_agent_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
"AgentPauseDurationInSeconds" => {
builder = builder.set_agent_pause_duration_in_seconds(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"HierarchyGroups" => {
builder =
builder.set_hierarchy_groups(crate::protocol_serde::shape_hierarchy_groups::de_hierarchy_groups(tokens, _value)?);
}
"DeviceInfo" => {
builder = builder.set_device_info(crate::protocol_serde::shape_device_info::de_device_info(tokens, _value)?);
}
"Capabilities" => {
builder = builder.set_capabilities(crate::protocol_serde::shape_participant_capabilities::de_participant_capabilities(
tokens, _value,
)?);
}
"AfterContactWorkDuration" => {
builder = builder.set_after_contact_work_duration(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"AfterContactWorkStartTimestamp" => {
builder =
builder.set_after_contact_work_start_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
"AfterContactWorkEndTimestamp" => {
builder = builder.set_after_contact_work_end_timestamp(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
tokens.next(),
::aws_smithy_types::date_time::Format::EpochSeconds,
)?);
}
"AgentInitiatedHoldDuration" => {
builder = builder.set_agent_initiated_hold_duration(
::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
.map(i32::try_from)
.transpose()?,
);
}
"StateTransitions" => {
builder =
builder.set_state_transitions(crate::protocol_serde::shape_state_transitions::de_state_transitions(tokens, _value)?);
}
"VoiceEnhancementMode" => {
builder = builder.set_voice_enhancement_mode(
::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
.map(|s| s.to_unescaped().map(|u| crate::types::VoiceEnhancementMode::from(u.as_ref())))
.transpose()?,
);
}
_ => ::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(builder.build()))
}
_ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
"expected start object or null",
)),
}
}