aws_sdk_connect/protocol_serde/
shape_user_data.rs1pub(crate) fn de_user_data<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4 _value: &'a [u8],
5) -> ::std::result::Result<Option<crate::types::UserData>, ::aws_smithy_json::deserialize::error::DeserializeError>
6where
7 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
8{
9 match tokens.next().transpose()? {
10 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
11 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
12 #[allow(unused_mut)]
13 let mut builder = crate::types::builders::UserDataBuilder::default();
14 loop {
15 match tokens.next().transpose()? {
16 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
17 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
18 "User" => {
19 builder = builder.set_user(crate::protocol_serde::shape_user_reference::de_user_reference(tokens, _value)?);
20 }
21 "RoutingProfile" => {
22 builder = builder.set_routing_profile(
23 crate::protocol_serde::shape_routing_profile_reference::de_routing_profile_reference(tokens, _value)?,
24 );
25 }
26 "HierarchyPath" => {
27 builder = builder.set_hierarchy_path(crate::protocol_serde::shape_hierarchy_path_reference::de_hierarchy_path_reference(
28 tokens, _value,
29 )?);
30 }
31 "Status" => {
32 builder = builder.set_status(crate::protocol_serde::shape_agent_status_reference::de_agent_status_reference(
33 tokens, _value,
34 )?);
35 }
36 "AvailableSlotsByChannel" => {
37 builder = builder.set_available_slots_by_channel(
38 crate::protocol_serde::shape_channel_to_count_map::de_channel_to_count_map(tokens, _value)?,
39 );
40 }
41 "MaxSlotsByChannel" => {
42 builder = builder.set_max_slots_by_channel(crate::protocol_serde::shape_channel_to_count_map::de_channel_to_count_map(
43 tokens, _value,
44 )?);
45 }
46 "ActiveSlotsByChannel" => {
47 builder = builder.set_active_slots_by_channel(
48 crate::protocol_serde::shape_channel_to_count_map::de_channel_to_count_map(tokens, _value)?,
49 );
50 }
51 "Contacts" => {
52 builder = builder.set_contacts(
53 crate::protocol_serde::shape_agent_contact_reference_list::de_agent_contact_reference_list(tokens, _value)?,
54 );
55 }
56 "NextStatus" => {
57 builder = builder.set_next_status(
58 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
59 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
60 .transpose()?,
61 );
62 }
63 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
64 },
65 other => {
66 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
67 "expected object key or end object, found: {other:?}"
68 )))
69 }
70 }
71 }
72 Ok(Some(builder.build()))
73 }
74 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
75 "expected start object or null",
76 )),
77 }
78}