6 6 | match input {
|
7 7 | crate::types::ContentBlock::Text(inner) => {
|
8 8 | object_3.key("text").string(inner.as_str());
|
9 9 | }
|
10 10 | crate::types::ContentBlock::Image(inner) => {
|
11 11 | #[allow(unused_mut)]
|
12 12 | let mut object_1 = object_3.key("image").start_object();
|
13 13 | crate::protocol_serde::shape_image_block::ser_image_block(&mut object_1, inner)?;
|
14 14 | object_1.finish();
|
15 15 | }
|
16 - | crate::types::ContentBlock::ToolUse(inner) => {
|
16 + | crate::types::ContentBlock::Document(inner) => {
|
17 17 | #[allow(unused_mut)]
|
18 - | let mut object_2 = object_3.key("toolUse").start_object();
|
19 - | crate::protocol_serde::shape_tool_use_block::ser_tool_use_block(&mut object_2, inner)?;
|
18 + | let mut object_2 = object_3.key("document").start_object();
|
19 + | crate::protocol_serde::shape_document_block::ser_document_block(&mut object_2, inner)?;
|
20 20 | object_2.finish();
|
21 21 | }
|
22 - | crate::types::ContentBlock::ToolResult(inner) => {
|
22 + | crate::types::ContentBlock::Video(inner) => {
|
23 23 | #[allow(unused_mut)]
|
24 - | let mut object_3 = object_3.key("toolResult").start_object();
|
25 - | crate::protocol_serde::shape_tool_result_block::ser_tool_result_block(&mut object_3, inner)?;
|
24 + | let mut object_3 = object_3.key("video").start_object();
|
25 + | crate::protocol_serde::shape_video_block::ser_video_block(&mut object_3, inner)?;
|
26 26 | object_3.finish();
|
27 27 | }
|
28 + | crate::types::ContentBlock::ToolUse(inner) => {
|
29 + | #[allow(unused_mut)]
|
30 + | let mut object_4 = object_3.key("toolUse").start_object();
|
31 + | crate::protocol_serde::shape_tool_use_block::ser_tool_use_block(&mut object_4, inner)?;
|
32 + | object_4.finish();
|
33 + | }
|
34 + | crate::types::ContentBlock::ToolResult(inner) => {
|
35 + | #[allow(unused_mut)]
|
36 + | let mut object_5 = object_3.key("toolResult").start_object();
|
37 + | crate::protocol_serde::shape_tool_result_block::ser_tool_result_block(&mut object_5, inner)?;
|
38 + | object_5.finish();
|
39 + | }
|
40 + | crate::types::ContentBlock::GuardContent(inner) => {
|
41 + | #[allow(unused_mut)]
|
42 + | let mut object_6 = object_3.key("guardContent").start_object();
|
43 + | crate::protocol_serde::shape_guardrail_converse_content_block::ser_guardrail_converse_content_block(&mut object_6, inner)?;
|
44 + | object_6.finish();
|
45 + | }
|
46 + | crate::types::ContentBlock::CachePoint(inner) => {
|
47 + | #[allow(unused_mut)]
|
48 + | let mut object_7 = object_3.key("cachePoint").start_object();
|
49 + | crate::protocol_serde::shape_cache_point_block::ser_cache_point_block(&mut object_7, inner)?;
|
50 + | object_7.finish();
|
51 + | }
|
52 + | crate::types::ContentBlock::ReasoningContent(inner) => {
|
53 + | #[allow(unused_mut)]
|
54 + | let mut object_8 = object_3.key("reasoningContent").start_object();
|
55 + | crate::protocol_serde::shape_reasoning_content_block::ser_reasoning_content_block(&mut object_8, inner)?;
|
56 + | object_8.finish();
|
57 + | }
|
58 + | crate::types::ContentBlock::CitationsContent(inner) => {
|
59 + | #[allow(unused_mut)]
|
60 + | let mut object_9 = object_3.key("citationsContent").start_object();
|
61 + | crate::protocol_serde::shape_citations_content_block::ser_citations_content_block(&mut object_9, inner)?;
|
62 + | object_9.finish();
|
63 + | }
|
28 64 | crate::types::ContentBlock::Unknown => return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant("ContentBlock")),
|
29 65 | }
|
30 66 | Ok(())
|
31 67 | }
|
32 68 |
|
33 69 | pub(crate) fn de_content_block<'a, I>(
|
34 70 | tokens: &mut ::std::iter::Peekable<I>,
|
35 71 | ) -> ::std::result::Result<Option<crate::types::ContentBlock>, ::aws_smithy_json::deserialize::error::DeserializeError>
|
36 72 | where
|
37 73 | I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
|
38 74 | {
|
39 75 | let mut variant = None;
|
40 76 | match tokens.next().transpose()? {
|
41 77 | Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
|
42 78 | Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
|
43 79 | match tokens.next().transpose()? {
|
44 80 | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
45 81 | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
46 82 | if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
|
47 83 | tokens.peek()
|
48 84 | {
|
49 85 | let _ = tokens.next().expect("peek returned a token")?;
|
50 86 | continue;
|
51 87 | }
|
52 88 | let key = key.to_unescaped()?;
|
53 89 | if key == "__type" {
|
54 90 | ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
|
55 91 | continue;
|
56 92 | }
|
57 93 | if variant.is_some() {
|
58 94 | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
59 95 | "encountered mixed variants in union",
|
60 96 | ));
|
61 97 | }
|
62 98 | variant = match key.as_ref() {
|
63 99 | "text" => Some(crate::types::ContentBlock::Text(
|
64 100 | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
65 101 | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
66 102 | .transpose()?
|
67 103 | .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'text' cannot be null"))?,
|
68 104 | )),
|
69 105 | "image" => Some(crate::types::ContentBlock::Image(
|
70 106 | crate::protocol_serde::shape_image_block::de_image_block(tokens)?
|
71 107 | .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'image' cannot be null"))?,
|
72 108 | )),
|
109 + | "document" => Some(crate::types::ContentBlock::Document(
|
110 + | crate::protocol_serde::shape_document_block::de_document_block(tokens)?.ok_or_else(|| {
|
111 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'document' cannot be null")
|
112 + | })?,
|
113 + | )),
|
114 + | "video" => Some(crate::types::ContentBlock::Video(
|
115 + | crate::protocol_serde::shape_video_block::de_video_block(tokens)?
|
116 + | .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'video' cannot be null"))?,
|
117 + | )),
|
73 118 | "toolUse" => Some(crate::types::ContentBlock::ToolUse(
|
74 119 | crate::protocol_serde::shape_tool_use_block::de_tool_use_block(tokens)?.ok_or_else(|| {
|
75 120 | ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'toolUse' cannot be null")
|
76 121 | })?,
|
77 122 | )),
|
78 123 | "toolResult" => Some(crate::types::ContentBlock::ToolResult(
|
79 124 | crate::protocol_serde::shape_tool_result_block::de_tool_result_block(tokens)?.ok_or_else(|| {
|
80 125 | ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'toolResult' cannot be null")
|
81 126 | })?,
|
82 127 | )),
|
128 + | "guardContent" => Some(crate::types::ContentBlock::GuardContent(
|
129 + | crate::protocol_serde::shape_guardrail_converse_content_block::de_guardrail_converse_content_block(tokens)?.ok_or_else(
|
130 + | || ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'guardContent' cannot be null"),
|
131 + | )?,
|
132 + | )),
|
133 + | "cachePoint" => Some(crate::types::ContentBlock::CachePoint(
|
134 + | crate::protocol_serde::shape_cache_point_block::de_cache_point_block(tokens)?.ok_or_else(|| {
|
135 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'cachePoint' cannot be null")
|
136 + | })?,
|
137 + | )),
|
138 + | "reasoningContent" => Some(crate::types::ContentBlock::ReasoningContent(
|
139 + | crate::protocol_serde::shape_reasoning_content_block::de_reasoning_content_block(tokens)?.ok_or_else(|| {
|
140 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'reasoningContent' cannot be null")
|
141 + | })?,
|
142 + | )),
|
143 + | "citationsContent" => Some(crate::types::ContentBlock::CitationsContent(
|
144 + | crate::protocol_serde::shape_citations_content_block::de_citations_content_block(tokens)?.ok_or_else(|| {
|
145 + | ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'citationsContent' cannot be null")
|
146 + | })?,
|
147 + | )),
|
83 148 | _ => {
|
84 149 | ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
|
85 150 | Some(crate::types::ContentBlock::Unknown)
|
86 151 | }
|
87 152 | };
|
88 153 | }
|
89 154 | other => {
|
90 155 | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
91 156 | "expected object key or end object, found: {:?}",
|
92 157 | other
|