rivet_party/
json_deser.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn parse_http_generic_error(
3	response: &http::Response<bytes::Bytes>,
4) -> Result<aws_smithy_types::Error, aws_smithy_json::deserialize::Error> {
5	crate::json_errors::parse_generic_error(response.body(), response.headers())
6}
7
8pub fn deser_structure_crate_error_internal_error_json_err(
9	value: &[u8],
10	mut builder: crate::error::internal_error::Builder,
11) -> Result<crate::error::internal_error::Builder, aws_smithy_json::deserialize::Error> {
12	let mut tokens_owned =
13		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
14			.peekable();
15	let tokens = &mut tokens_owned;
16	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
17	loop {
18		match tokens.next().transpose()? {
19			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
20			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
21				match key.to_unescaped()?.as_ref() {
22					"code" => {
23						builder = builder.set_code(
24							aws_smithy_json::deserialize::token::expect_string_or_null(
25								tokens.next(),
26							)?
27							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
28							.transpose()?,
29						);
30					}
31					"message" => {
32						builder = builder.set_message(
33							aws_smithy_json::deserialize::token::expect_string_or_null(
34								tokens.next(),
35							)?
36							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
37							.transpose()?,
38						);
39					}
40					"metadata" => {
41						builder = builder.set_metadata(Some(
42							aws_smithy_json::deserialize::token::expect_document(tokens)?,
43						));
44					}
45					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
46				}
47			}
48			other => {
49				return Err(aws_smithy_json::deserialize::Error::custom(format!(
50					"expected object key or end object, found: {:?}",
51					other
52				)))
53			}
54		}
55	}
56	if tokens.next().is_some() {
57		return Err(aws_smithy_json::deserialize::Error::custom(
58			"found more JSON tokens after completing parsing",
59		));
60	}
61	Ok(builder)
62}
63
64pub fn deser_structure_crate_error_rate_limit_error_json_err(
65	value: &[u8],
66	mut builder: crate::error::rate_limit_error::Builder,
67) -> Result<crate::error::rate_limit_error::Builder, aws_smithy_json::deserialize::Error> {
68	let mut tokens_owned =
69		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
70			.peekable();
71	let tokens = &mut tokens_owned;
72	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
73	loop {
74		match tokens.next().transpose()? {
75			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
76			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
77				match key.to_unescaped()?.as_ref() {
78					"code" => {
79						builder = builder.set_code(
80							aws_smithy_json::deserialize::token::expect_string_or_null(
81								tokens.next(),
82							)?
83							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
84							.transpose()?,
85						);
86					}
87					"message" => {
88						builder = builder.set_message(
89							aws_smithy_json::deserialize::token::expect_string_or_null(
90								tokens.next(),
91							)?
92							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
93							.transpose()?,
94						);
95					}
96					"metadata" => {
97						builder = builder.set_metadata(Some(
98							aws_smithy_json::deserialize::token::expect_document(tokens)?,
99						));
100					}
101					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
102				}
103			}
104			other => {
105				return Err(aws_smithy_json::deserialize::Error::custom(format!(
106					"expected object key or end object, found: {:?}",
107					other
108				)))
109			}
110		}
111	}
112	if tokens.next().is_some() {
113		return Err(aws_smithy_json::deserialize::Error::custom(
114			"found more JSON tokens after completing parsing",
115		));
116	}
117	Ok(builder)
118}
119
120pub fn deser_structure_crate_error_forbidden_error_json_err(
121	value: &[u8],
122	mut builder: crate::error::forbidden_error::Builder,
123) -> Result<crate::error::forbidden_error::Builder, aws_smithy_json::deserialize::Error> {
124	let mut tokens_owned =
125		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
126			.peekable();
127	let tokens = &mut tokens_owned;
128	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
129	loop {
130		match tokens.next().transpose()? {
131			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
132			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
133				match key.to_unescaped()?.as_ref() {
134					"code" => {
135						builder = builder.set_code(
136							aws_smithy_json::deserialize::token::expect_string_or_null(
137								tokens.next(),
138							)?
139							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
140							.transpose()?,
141						);
142					}
143					"message" => {
144						builder = builder.set_message(
145							aws_smithy_json::deserialize::token::expect_string_or_null(
146								tokens.next(),
147							)?
148							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
149							.transpose()?,
150						);
151					}
152					"metadata" => {
153						builder = builder.set_metadata(Some(
154							aws_smithy_json::deserialize::token::expect_document(tokens)?,
155						));
156					}
157					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
158				}
159			}
160			other => {
161				return Err(aws_smithy_json::deserialize::Error::custom(format!(
162					"expected object key or end object, found: {:?}",
163					other
164				)))
165			}
166		}
167	}
168	if tokens.next().is_some() {
169		return Err(aws_smithy_json::deserialize::Error::custom(
170			"found more JSON tokens after completing parsing",
171		));
172	}
173	Ok(builder)
174}
175
176pub fn deser_structure_crate_error_unauthorized_error_json_err(
177	value: &[u8],
178	mut builder: crate::error::unauthorized_error::Builder,
179) -> Result<crate::error::unauthorized_error::Builder, aws_smithy_json::deserialize::Error> {
180	let mut tokens_owned =
181		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
182			.peekable();
183	let tokens = &mut tokens_owned;
184	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
185	loop {
186		match tokens.next().transpose()? {
187			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
188			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
189				match key.to_unescaped()?.as_ref() {
190					"code" => {
191						builder = builder.set_code(
192							aws_smithy_json::deserialize::token::expect_string_or_null(
193								tokens.next(),
194							)?
195							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
196							.transpose()?,
197						);
198					}
199					"message" => {
200						builder = builder.set_message(
201							aws_smithy_json::deserialize::token::expect_string_or_null(
202								tokens.next(),
203							)?
204							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
205							.transpose()?,
206						);
207					}
208					"metadata" => {
209						builder = builder.set_metadata(Some(
210							aws_smithy_json::deserialize::token::expect_document(tokens)?,
211						));
212					}
213					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
214				}
215			}
216			other => {
217				return Err(aws_smithy_json::deserialize::Error::custom(format!(
218					"expected object key or end object, found: {:?}",
219					other
220				)))
221			}
222		}
223	}
224	if tokens.next().is_some() {
225		return Err(aws_smithy_json::deserialize::Error::custom(
226			"found more JSON tokens after completing parsing",
227		));
228	}
229	Ok(builder)
230}
231
232pub fn deser_structure_crate_error_not_found_error_json_err(
233	value: &[u8],
234	mut builder: crate::error::not_found_error::Builder,
235) -> Result<crate::error::not_found_error::Builder, aws_smithy_json::deserialize::Error> {
236	let mut tokens_owned =
237		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
238			.peekable();
239	let tokens = &mut tokens_owned;
240	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
241	loop {
242		match tokens.next().transpose()? {
243			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
244			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
245				match key.to_unescaped()?.as_ref() {
246					"code" => {
247						builder = builder.set_code(
248							aws_smithy_json::deserialize::token::expect_string_or_null(
249								tokens.next(),
250							)?
251							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
252							.transpose()?,
253						);
254					}
255					"message" => {
256						builder = builder.set_message(
257							aws_smithy_json::deserialize::token::expect_string_or_null(
258								tokens.next(),
259							)?
260							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
261							.transpose()?,
262						);
263					}
264					"metadata" => {
265						builder = builder.set_metadata(Some(
266							aws_smithy_json::deserialize::token::expect_document(tokens)?,
267						));
268					}
269					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
270				}
271			}
272			other => {
273				return Err(aws_smithy_json::deserialize::Error::custom(format!(
274					"expected object key or end object, found: {:?}",
275					other
276				)))
277			}
278		}
279	}
280	if tokens.next().is_some() {
281		return Err(aws_smithy_json::deserialize::Error::custom(
282			"found more JSON tokens after completing parsing",
283		));
284	}
285	Ok(builder)
286}
287
288pub fn deser_structure_crate_error_bad_request_error_json_err(
289	value: &[u8],
290	mut builder: crate::error::bad_request_error::Builder,
291) -> Result<crate::error::bad_request_error::Builder, aws_smithy_json::deserialize::Error> {
292	let mut tokens_owned =
293		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
294			.peekable();
295	let tokens = &mut tokens_owned;
296	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
297	loop {
298		match tokens.next().transpose()? {
299			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
300			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
301				match key.to_unescaped()?.as_ref() {
302					"code" => {
303						builder = builder.set_code(
304							aws_smithy_json::deserialize::token::expect_string_or_null(
305								tokens.next(),
306							)?
307							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
308							.transpose()?,
309						);
310					}
311					"message" => {
312						builder = builder.set_message(
313							aws_smithy_json::deserialize::token::expect_string_or_null(
314								tokens.next(),
315							)?
316							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
317							.transpose()?,
318						);
319					}
320					"metadata" => {
321						builder = builder.set_metadata(Some(
322							aws_smithy_json::deserialize::token::expect_document(tokens)?,
323						));
324					}
325					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
326				}
327			}
328			other => {
329				return Err(aws_smithy_json::deserialize::Error::custom(format!(
330					"expected object key or end object, found: {:?}",
331					other
332				)))
333			}
334		}
335	}
336	if tokens.next().is_some() {
337		return Err(aws_smithy_json::deserialize::Error::custom(
338			"found more JSON tokens after completing parsing",
339		));
340	}
341	Ok(builder)
342}
343
344pub fn deser_operation_crate_operation_create_party(
345	value: &[u8],
346	mut builder: crate::output::create_party_output::Builder,
347) -> Result<crate::output::create_party_output::Builder, aws_smithy_json::deserialize::Error> {
348	let mut tokens_owned =
349		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
350			.peekable();
351	let tokens = &mut tokens_owned;
352	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
353	loop {
354		match tokens.next().transpose()? {
355			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
356			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
357				match key.to_unescaped()?.as_ref() {
358					"invites" => {
359						builder = builder.set_invites(
360							crate::json_deser::deser_list_rivet_api_party_common_created_invites(
361								tokens,
362							)?,
363						);
364					}
365					"party_id" => {
366						builder = builder.set_party_id(
367							aws_smithy_json::deserialize::token::expect_string_or_null(
368								tokens.next(),
369							)?
370							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
371							.transpose()?,
372						);
373					}
374					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
375				}
376			}
377			other => {
378				return Err(aws_smithy_json::deserialize::Error::custom(format!(
379					"expected object key or end object, found: {:?}",
380					other
381				)))
382			}
383		}
384	}
385	if tokens.next().is_some() {
386		return Err(aws_smithy_json::deserialize::Error::custom(
387			"found more JSON tokens after completing parsing",
388		));
389	}
390	Ok(builder)
391}
392
393pub fn deser_operation_crate_operation_create_party_invite(
394	value: &[u8],
395	mut builder: crate::output::create_party_invite_output::Builder,
396) -> Result<crate::output::create_party_invite_output::Builder, aws_smithy_json::deserialize::Error>
397{
398	let mut tokens_owned =
399		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
400			.peekable();
401	let tokens = &mut tokens_owned;
402	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
403	loop {
404		match tokens.next().transpose()? {
405			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
406			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
407				match key.to_unescaped()?.as_ref() {
408					"invite" => {
409						builder = builder.set_invite(
410							crate::json_deser::deser_structure_crate_model_created_invite(tokens)?,
411						);
412					}
413					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
414				}
415			}
416			other => {
417				return Err(aws_smithy_json::deserialize::Error::custom(format!(
418					"expected object key or end object, found: {:?}",
419					other
420				)))
421			}
422		}
423	}
424	if tokens.next().is_some() {
425		return Err(aws_smithy_json::deserialize::Error::custom(
426			"found more JSON tokens after completing parsing",
427		));
428	}
429	Ok(builder)
430}
431
432pub fn deser_operation_crate_operation_get_party_from_invite(
433	value: &[u8],
434	mut builder: crate::output::get_party_from_invite_output::Builder,
435) -> Result<crate::output::get_party_from_invite_output::Builder, aws_smithy_json::deserialize::Error>
436{
437	let mut tokens_owned =
438		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
439			.peekable();
440	let tokens = &mut tokens_owned;
441	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
442	loop {
443		match tokens.next().transpose()? {
444			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
445			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
446				match key.to_unescaped()?.as_ref() {
447					"party" => {
448						builder = builder.set_party(
449							crate::json_deser::deser_structure_crate_model_party_summary(tokens)?,
450						);
451					}
452					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
453				}
454			}
455			other => {
456				return Err(aws_smithy_json::deserialize::Error::custom(format!(
457					"expected object key or end object, found: {:?}",
458					other
459				)))
460			}
461		}
462	}
463	if tokens.next().is_some() {
464		return Err(aws_smithy_json::deserialize::Error::custom(
465			"found more JSON tokens after completing parsing",
466		));
467	}
468	Ok(builder)
469}
470
471pub fn deser_operation_crate_operation_get_party_profile(
472	value: &[u8],
473	mut builder: crate::output::get_party_profile_output::Builder,
474) -> Result<crate::output::get_party_profile_output::Builder, aws_smithy_json::deserialize::Error> {
475	let mut tokens_owned =
476		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
477			.peekable();
478	let tokens = &mut tokens_owned;
479	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
480	loop {
481		match tokens.next().transpose()? {
482			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
483			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
484				match key.to_unescaped()?.as_ref() {
485					"party" => {
486						builder = builder.set_party(
487							crate::json_deser::deser_structure_crate_model_party_profile(tokens)?,
488						);
489					}
490					"watch" => {
491						builder = builder.set_watch(
492							crate::json_deser::deser_structure_crate_model_watch_response(tokens)?,
493						);
494					}
495					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
496				}
497			}
498			other => {
499				return Err(aws_smithy_json::deserialize::Error::custom(format!(
500					"expected object key or end object, found: {:?}",
501					other
502				)))
503			}
504		}
505	}
506	if tokens.next().is_some() {
507		return Err(aws_smithy_json::deserialize::Error::custom(
508			"found more JSON tokens after completing parsing",
509		));
510	}
511	Ok(builder)
512}
513
514pub fn deser_operation_crate_operation_get_party_self_profile(
515	value: &[u8],
516	mut builder: crate::output::get_party_self_profile_output::Builder,
517) -> Result<
518	crate::output::get_party_self_profile_output::Builder,
519	aws_smithy_json::deserialize::Error,
520> {
521	let mut tokens_owned =
522		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
523			.peekable();
524	let tokens = &mut tokens_owned;
525	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
526	loop {
527		match tokens.next().transpose()? {
528			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
529			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
530				match key.to_unescaped()?.as_ref() {
531					"party" => {
532						builder = builder.set_party(
533							crate::json_deser::deser_structure_crate_model_party_profile(tokens)?,
534						);
535					}
536					"watch" => {
537						builder = builder.set_watch(
538							crate::json_deser::deser_structure_crate_model_watch_response(tokens)?,
539						);
540					}
541					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
542				}
543			}
544			other => {
545				return Err(aws_smithy_json::deserialize::Error::custom(format!(
546					"expected object key or end object, found: {:?}",
547					other
548				)))
549			}
550		}
551	}
552	if tokens.next().is_some() {
553		return Err(aws_smithy_json::deserialize::Error::custom(
554			"found more JSON tokens after completing parsing",
555		));
556	}
557	Ok(builder)
558}
559
560pub fn deser_operation_crate_operation_get_party_self_summary(
561	value: &[u8],
562	mut builder: crate::output::get_party_self_summary_output::Builder,
563) -> Result<
564	crate::output::get_party_self_summary_output::Builder,
565	aws_smithy_json::deserialize::Error,
566> {
567	let mut tokens_owned =
568		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
569			.peekable();
570	let tokens = &mut tokens_owned;
571	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
572	loop {
573		match tokens.next().transpose()? {
574			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
575			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
576				match key.to_unescaped()?.as_ref() {
577					"party" => {
578						builder = builder.set_party(
579							crate::json_deser::deser_structure_crate_model_party_summary(tokens)?,
580						);
581					}
582					"watch" => {
583						builder = builder.set_watch(
584							crate::json_deser::deser_structure_crate_model_watch_response(tokens)?,
585						);
586					}
587					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
588				}
589			}
590			other => {
591				return Err(aws_smithy_json::deserialize::Error::custom(format!(
592					"expected object key or end object, found: {:?}",
593					other
594				)))
595			}
596		}
597	}
598	if tokens.next().is_some() {
599		return Err(aws_smithy_json::deserialize::Error::custom(
600			"found more JSON tokens after completing parsing",
601		));
602	}
603	Ok(builder)
604}
605
606pub fn deser_operation_crate_operation_get_party_summary(
607	value: &[u8],
608	mut builder: crate::output::get_party_summary_output::Builder,
609) -> Result<crate::output::get_party_summary_output::Builder, aws_smithy_json::deserialize::Error> {
610	let mut tokens_owned =
611		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
612			.peekable();
613	let tokens = &mut tokens_owned;
614	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
615	loop {
616		match tokens.next().transpose()? {
617			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
618			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
619				match key.to_unescaped()?.as_ref() {
620					"party" => {
621						builder = builder.set_party(
622							crate::json_deser::deser_structure_crate_model_party_summary(tokens)?,
623						);
624					}
625					"watch" => {
626						builder = builder.set_watch(
627							crate::json_deser::deser_structure_crate_model_watch_response(tokens)?,
628						);
629					}
630					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
631				}
632			}
633			other => {
634				return Err(aws_smithy_json::deserialize::Error::custom(format!(
635					"expected object key or end object, found: {:?}",
636					other
637				)))
638			}
639		}
640	}
641	if tokens.next().is_some() {
642		return Err(aws_smithy_json::deserialize::Error::custom(
643			"found more JSON tokens after completing parsing",
644		));
645	}
646	Ok(builder)
647}
648
649pub fn deser_operation_crate_operation_join_party(
650	value: &[u8],
651	mut builder: crate::output::join_party_output::Builder,
652) -> Result<crate::output::join_party_output::Builder, aws_smithy_json::deserialize::Error> {
653	let mut tokens_owned =
654		aws_smithy_json::deserialize::json_token_iter(crate::json_deser::or_empty_doc(value))
655			.peekable();
656	let tokens = &mut tokens_owned;
657	aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
658	loop {
659		match tokens.next().transpose()? {
660			Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
661			Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
662				match key.to_unescaped()?.as_ref() {
663					"party_id" => {
664						builder = builder.set_party_id(
665							aws_smithy_json::deserialize::token::expect_string_or_null(
666								tokens.next(),
667							)?
668							.map(|s| s.to_unescaped().map(|u| u.into_owned()))
669							.transpose()?,
670						);
671					}
672					_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
673				}
674			}
675			other => {
676				return Err(aws_smithy_json::deserialize::Error::custom(format!(
677					"expected object key or end object, found: {:?}",
678					other
679				)))
680			}
681		}
682	}
683	if tokens.next().is_some() {
684		return Err(aws_smithy_json::deserialize::Error::custom(
685			"found more JSON tokens after completing parsing",
686		));
687	}
688	Ok(builder)
689}
690
691pub fn or_empty_doc(data: &[u8]) -> &[u8] {
692	if data.is_empty() {
693		b"{}"
694	} else {
695		data
696	}
697}
698
699#[allow(clippy::type_complexity, non_snake_case)]
700pub fn deser_list_rivet_api_party_common_created_invites<'a, I>(
701	tokens: &mut std::iter::Peekable<I>,
702) -> Result<Option<std::vec::Vec<crate::model::CreatedInvite>>, aws_smithy_json::deserialize::Error>
703where
704	I: Iterator<
705		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
706	>,
707{
708	match tokens.next().transpose()? {
709		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
710		Some(aws_smithy_json::deserialize::Token::StartArray { .. }) => {
711			let mut items = Vec::new();
712			loop {
713				match tokens.peek() {
714					Some(Ok(aws_smithy_json::deserialize::Token::EndArray { .. })) => {
715						tokens.next().transpose().unwrap();
716						break;
717					}
718					_ => {
719						let value =
720							crate::json_deser::deser_structure_crate_model_created_invite(tokens)?;
721						if let Some(value) = value {
722							items.push(value);
723						}
724					}
725				}
726			}
727			Ok(Some(items))
728		}
729		_ => Err(aws_smithy_json::deserialize::Error::custom(
730			"expected start array or null",
731		)),
732	}
733}
734
735pub fn deser_structure_crate_model_created_invite<'a, I>(
736	tokens: &mut std::iter::Peekable<I>,
737) -> Result<Option<crate::model::CreatedInvite>, aws_smithy_json::deserialize::Error>
738where
739	I: Iterator<
740		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
741	>,
742{
743	match tokens.next().transpose()? {
744		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
745		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
746			#[allow(unused_mut)]
747			let mut builder = crate::model::CreatedInvite::builder();
748			loop {
749				match tokens.next().transpose()? {
750					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
751					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
752						match key.to_unescaped()?.as_ref() {
753							"token" => {
754								builder = builder.set_token(
755									aws_smithy_json::deserialize::token::expect_string_or_null(
756										tokens.next(),
757									)?
758									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
759									.transpose()?,
760								);
761							}
762							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
763						}
764					}
765					other => {
766						return Err(aws_smithy_json::deserialize::Error::custom(format!(
767							"expected object key or end object, found: {:?}",
768							other
769						)))
770					}
771				}
772			}
773			Ok(Some(builder.build()))
774		}
775		_ => Err(aws_smithy_json::deserialize::Error::custom(
776			"expected start object or null",
777		)),
778	}
779}
780
781pub fn deser_structure_crate_model_party_summary<'a, I>(
782	tokens: &mut std::iter::Peekable<I>,
783) -> Result<Option<crate::model::PartySummary>, aws_smithy_json::deserialize::Error>
784where
785	I: Iterator<
786		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
787	>,
788{
789	match tokens.next().transpose()? {
790		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
791		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
792			#[allow(unused_mut)]
793			let mut builder = crate::model::PartySummary::builder();
794			loop {
795				match tokens.next().transpose()? {
796					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
797					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
798						match key.to_unescaped()?.as_ref() {
799							"party_id" => {
800								builder = builder.set_party_id(
801									aws_smithy_json::deserialize::token::expect_string_or_null(
802										tokens.next(),
803									)?
804									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
805									.transpose()?,
806								);
807							}
808							"create_ts" => {
809								builder = builder.set_create_ts(
810									aws_smithy_json::deserialize::token::expect_timestamp_or_null(
811										tokens.next(),
812										aws_smithy_types::date_time::Format::DateTime,
813									)?,
814								);
815							}
816							"activity" => {
817								builder = builder.set_activity(
818									crate::json_deser::deser_union_crate_model_party_activity(
819										tokens,
820									)?,
821								);
822							}
823							"external" => {
824								builder = builder.set_external(
825                                    crate::json_deser::deser_structure_crate_model_party_external_links(tokens)?
826                                );
827							}
828							"publicity" => {
829								builder = builder.set_publicity(
830									crate::json_deser::deser_structure_crate_model_party_publicity(
831										tokens,
832									)?,
833								);
834							}
835							"party_size" => {
836								builder = builder.set_party_size(
837									aws_smithy_json::deserialize::token::expect_number_or_null(
838										tokens.next(),
839									)?
840									.map(|v| v.to_i32()),
841								);
842							}
843							"members" => {
844								builder = builder.set_members(
845                                    crate::json_deser::deser_list_rivet_party_party_member_summaries(tokens)?
846                                );
847							}
848							"thread_id" => {
849								builder = builder.set_thread_id(
850									aws_smithy_json::deserialize::token::expect_string_or_null(
851										tokens.next(),
852									)?
853									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
854									.transpose()?,
855								);
856							}
857							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
858						}
859					}
860					other => {
861						return Err(aws_smithy_json::deserialize::Error::custom(format!(
862							"expected object key or end object, found: {:?}",
863							other
864						)))
865					}
866				}
867			}
868			Ok(Some(builder.build()))
869		}
870		_ => Err(aws_smithy_json::deserialize::Error::custom(
871			"expected start object or null",
872		)),
873	}
874}
875
876pub fn deser_structure_crate_model_party_profile<'a, I>(
877	tokens: &mut std::iter::Peekable<I>,
878) -> Result<Option<crate::model::PartyProfile>, aws_smithy_json::deserialize::Error>
879where
880	I: Iterator<
881		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
882	>,
883{
884	match tokens.next().transpose()? {
885		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
886		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
887			#[allow(unused_mut)]
888			let mut builder = crate::model::PartyProfile::builder();
889			loop {
890				match tokens.next().transpose()? {
891					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
892					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
893						match key.to_unescaped()?.as_ref() {
894							"party_id" => {
895								builder = builder.set_party_id(
896									aws_smithy_json::deserialize::token::expect_string_or_null(
897										tokens.next(),
898									)?
899									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
900									.transpose()?,
901								);
902							}
903							"create_ts" => {
904								builder = builder.set_create_ts(
905									aws_smithy_json::deserialize::token::expect_timestamp_or_null(
906										tokens.next(),
907										aws_smithy_types::date_time::Format::DateTime,
908									)?,
909								);
910							}
911							"activity" => {
912								builder = builder.set_activity(
913									crate::json_deser::deser_union_crate_model_party_activity(
914										tokens,
915									)?,
916								);
917							}
918							"external" => {
919								builder = builder.set_external(
920                                    crate::json_deser::deser_structure_crate_model_party_external_links(tokens)?
921                                );
922							}
923							"publicity" => {
924								builder = builder.set_publicity(
925									crate::json_deser::deser_structure_crate_model_party_publicity(
926										tokens,
927									)?,
928								);
929							}
930							"party_size" => {
931								builder = builder.set_party_size(
932									aws_smithy_json::deserialize::token::expect_number_or_null(
933										tokens.next(),
934									)?
935									.map(|v| v.to_i32()),
936								);
937							}
938							"members" => {
939								builder = builder.set_members(
940                                    crate::json_deser::deser_list_rivet_party_party_member_summaries(tokens)?
941                                );
942							}
943							"thread_id" => {
944								builder = builder.set_thread_id(
945									aws_smithy_json::deserialize::token::expect_string_or_null(
946										tokens.next(),
947									)?
948									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
949									.transpose()?,
950								);
951							}
952							"invites" => {
953								builder = builder.set_invites(
954									crate::json_deser::deser_list_rivet_party_party_invites(
955										tokens,
956									)?,
957								);
958							}
959							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
960						}
961					}
962					other => {
963						return Err(aws_smithy_json::deserialize::Error::custom(format!(
964							"expected object key or end object, found: {:?}",
965							other
966						)))
967					}
968				}
969			}
970			Ok(Some(builder.build()))
971		}
972		_ => Err(aws_smithy_json::deserialize::Error::custom(
973			"expected start object or null",
974		)),
975	}
976}
977
978pub fn deser_structure_crate_model_watch_response<'a, I>(
979	tokens: &mut std::iter::Peekable<I>,
980) -> Result<Option<crate::model::WatchResponse>, aws_smithy_json::deserialize::Error>
981where
982	I: Iterator<
983		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
984	>,
985{
986	match tokens.next().transpose()? {
987		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
988		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
989			#[allow(unused_mut)]
990			let mut builder = crate::model::WatchResponse::builder();
991			loop {
992				match tokens.next().transpose()? {
993					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
994					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
995						match key.to_unescaped()?.as_ref() {
996							"index" => {
997								builder = builder.set_index(
998									aws_smithy_json::deserialize::token::expect_string_or_null(
999										tokens.next(),
1000									)?
1001									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1002									.transpose()?,
1003								);
1004							}
1005							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1006						}
1007					}
1008					other => {
1009						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1010							"expected object key or end object, found: {:?}",
1011							other
1012						)))
1013					}
1014				}
1015			}
1016			Ok(Some(builder.build()))
1017		}
1018		_ => Err(aws_smithy_json::deserialize::Error::custom(
1019			"expected start object or null",
1020		)),
1021	}
1022}
1023
1024pub fn deser_union_crate_model_party_activity<'a, I>(
1025	tokens: &mut std::iter::Peekable<I>,
1026) -> Result<Option<crate::model::PartyActivity>, aws_smithy_json::deserialize::Error>
1027where
1028	I: Iterator<
1029		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1030	>,
1031{
1032	let mut variant = None;
1033	match tokens.next().transpose()? {
1034		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
1035		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
1036			match tokens.next().transpose()? {
1037				Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1038				Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1039					if variant.is_some() {
1040						return Err(aws_smithy_json::deserialize::Error::custom(
1041							"encountered mixed variants in union",
1042						));
1043					}
1044					variant = match key.to_unescaped()?.as_ref() {
1045                            "idle" => {
1046                                Some(crate::model::PartyActivity::Idle(
1047                                    crate::json_deser::deser_structure_crate_model_party_activity_idle(tokens)?
1048                                    .ok_or_else(|| aws_smithy_json::deserialize::Error::custom("value for 'idle' cannot be null"))?
1049                                ))
1050                            }
1051                            "matchmaker_finding_lobby" => {
1052                                Some(crate::model::PartyActivity::MatchmakerFindingLobby(
1053                                    crate::json_deser::deser_structure_crate_model_party_activity_matchmaker_finding_lobby(tokens)?
1054                                    .ok_or_else(|| aws_smithy_json::deserialize::Error::custom("value for 'matchmaker_finding_lobby' cannot be null"))?
1055                                ))
1056                            }
1057                            "matchmaker_lobby" => {
1058                                Some(crate::model::PartyActivity::MatchmakerLobby(
1059                                    crate::json_deser::deser_structure_crate_model_party_activity_matchmaker_lobby(tokens)?
1060                                    .ok_or_else(|| aws_smithy_json::deserialize::Error::custom("value for 'matchmaker_lobby' cannot be null"))?
1061                                ))
1062                            }
1063                            _ => {
1064                                                                      aws_smithy_json::deserialize::token::skip_value(tokens)?;
1065                                                                      Some(crate::model::PartyActivity::Unknown)
1066                                                                    }
1067                        };
1068				}
1069				other => {
1070					return Err(aws_smithy_json::deserialize::Error::custom(format!(
1071						"expected object key or end object, found: {:?}",
1072						other
1073					)))
1074				}
1075			}
1076		},
1077		_ => {
1078			return Err(aws_smithy_json::deserialize::Error::custom(
1079				"expected start object or null",
1080			))
1081		}
1082	}
1083	Ok(variant)
1084}
1085
1086pub fn deser_structure_crate_model_party_external_links<'a, I>(
1087	tokens: &mut std::iter::Peekable<I>,
1088) -> Result<Option<crate::model::PartyExternalLinks>, aws_smithy_json::deserialize::Error>
1089where
1090	I: Iterator<
1091		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1092	>,
1093{
1094	match tokens.next().transpose()? {
1095		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1096		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1097			#[allow(unused_mut)]
1098			let mut builder = crate::model::PartyExternalLinks::builder();
1099			loop {
1100				match tokens.next().transpose()? {
1101					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1102					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1103						match key.to_unescaped()?.as_ref() {
1104							"chat" => {
1105								builder = builder.set_chat(
1106									aws_smithy_json::deserialize::token::expect_string_or_null(
1107										tokens.next(),
1108									)?
1109									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1110									.transpose()?,
1111								);
1112							}
1113							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1114						}
1115					}
1116					other => {
1117						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1118							"expected object key or end object, found: {:?}",
1119							other
1120						)))
1121					}
1122				}
1123			}
1124			Ok(Some(builder.build()))
1125		}
1126		_ => Err(aws_smithy_json::deserialize::Error::custom(
1127			"expected start object or null",
1128		)),
1129	}
1130}
1131
1132pub fn deser_structure_crate_model_party_publicity<'a, I>(
1133	tokens: &mut std::iter::Peekable<I>,
1134) -> Result<Option<crate::model::PartyPublicity>, aws_smithy_json::deserialize::Error>
1135where
1136	I: Iterator<
1137		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1138	>,
1139{
1140	match tokens.next().transpose()? {
1141		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1142		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1143			#[allow(unused_mut)]
1144			let mut builder = crate::model::PartyPublicity::builder();
1145			loop {
1146				match tokens.next().transpose()? {
1147					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1148					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1149						match key.to_unescaped()?.as_ref() {
1150							"public" => {
1151								builder = builder.set_public(
1152									aws_smithy_json::deserialize::token::expect_string_or_null(
1153										tokens.next(),
1154									)?
1155									.map(|s| {
1156										s.to_unescaped().map(|u| {
1157											crate::model::PartyPublicityLevel::from(u.as_ref())
1158										})
1159									})
1160									.transpose()?,
1161								);
1162							}
1163							"mutual_followers" => {
1164								builder = builder.set_mutual_followers(
1165									aws_smithy_json::deserialize::token::expect_string_or_null(
1166										tokens.next(),
1167									)?
1168									.map(|s| {
1169										s.to_unescaped().map(|u| {
1170											crate::model::PartyPublicityLevel::from(u.as_ref())
1171										})
1172									})
1173									.transpose()?,
1174								);
1175							}
1176							"groups" => {
1177								builder = builder.set_groups(
1178									aws_smithy_json::deserialize::token::expect_string_or_null(
1179										tokens.next(),
1180									)?
1181									.map(|s| {
1182										s.to_unescaped().map(|u| {
1183											crate::model::PartyPublicityLevel::from(u.as_ref())
1184										})
1185									})
1186									.transpose()?,
1187								);
1188							}
1189							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1190						}
1191					}
1192					other => {
1193						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1194							"expected object key or end object, found: {:?}",
1195							other
1196						)))
1197					}
1198				}
1199			}
1200			Ok(Some(builder.build()))
1201		}
1202		_ => Err(aws_smithy_json::deserialize::Error::custom(
1203			"expected start object or null",
1204		)),
1205	}
1206}
1207
1208#[allow(clippy::type_complexity, non_snake_case)]
1209pub fn deser_list_rivet_party_party_member_summaries<'a, I>(
1210	tokens: &mut std::iter::Peekable<I>,
1211) -> Result<
1212	Option<std::vec::Vec<crate::model::PartyMemberSummary>>,
1213	aws_smithy_json::deserialize::Error,
1214>
1215where
1216	I: Iterator<
1217		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1218	>,
1219{
1220	match tokens.next().transpose()? {
1221		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1222		Some(aws_smithy_json::deserialize::Token::StartArray { .. }) => {
1223			let mut items = Vec::new();
1224			loop {
1225				match tokens.peek() {
1226					Some(Ok(aws_smithy_json::deserialize::Token::EndArray { .. })) => {
1227						tokens.next().transpose().unwrap();
1228						break;
1229					}
1230					_ => {
1231						let value =
1232							crate::json_deser::deser_structure_crate_model_party_member_summary(
1233								tokens,
1234							)?;
1235						if let Some(value) = value {
1236							items.push(value);
1237						}
1238					}
1239				}
1240			}
1241			Ok(Some(items))
1242		}
1243		_ => Err(aws_smithy_json::deserialize::Error::custom(
1244			"expected start array or null",
1245		)),
1246	}
1247}
1248
1249#[allow(clippy::type_complexity, non_snake_case)]
1250pub fn deser_list_rivet_party_party_invites<'a, I>(
1251	tokens: &mut std::iter::Peekable<I>,
1252) -> Result<Option<std::vec::Vec<crate::model::PartyInvite>>, aws_smithy_json::deserialize::Error>
1253where
1254	I: Iterator<
1255		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1256	>,
1257{
1258	match tokens.next().transpose()? {
1259		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1260		Some(aws_smithy_json::deserialize::Token::StartArray { .. }) => {
1261			let mut items = Vec::new();
1262			loop {
1263				match tokens.peek() {
1264					Some(Ok(aws_smithy_json::deserialize::Token::EndArray { .. })) => {
1265						tokens.next().transpose().unwrap();
1266						break;
1267					}
1268					_ => {
1269						let value =
1270							crate::json_deser::deser_structure_crate_model_party_invite(tokens)?;
1271						if let Some(value) = value {
1272							items.push(value);
1273						}
1274					}
1275				}
1276			}
1277			Ok(Some(items))
1278		}
1279		_ => Err(aws_smithy_json::deserialize::Error::custom(
1280			"expected start array or null",
1281		)),
1282	}
1283}
1284
1285pub fn deser_structure_crate_model_party_activity_idle<'a, I>(
1286	tokens: &mut std::iter::Peekable<I>,
1287) -> Result<Option<crate::model::PartyActivityIdle>, aws_smithy_json::deserialize::Error>
1288where
1289	I: Iterator<
1290		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1291	>,
1292{
1293	match tokens.next().transpose()? {
1294		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1295		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1296			#[allow(unused_mut)]
1297			let mut builder = crate::model::PartyActivityIdle::builder();
1298			aws_smithy_json::deserialize::token::skip_to_end(tokens)?;
1299			Ok(Some(builder.build()))
1300		}
1301		_ => Err(aws_smithy_json::deserialize::Error::custom(
1302			"expected start object or null",
1303		)),
1304	}
1305}
1306
1307pub fn deser_structure_crate_model_party_activity_matchmaker_finding_lobby<'a, I>(
1308	tokens: &mut std::iter::Peekable<I>,
1309) -> Result<
1310	Option<crate::model::PartyActivityMatchmakerFindingLobby>,
1311	aws_smithy_json::deserialize::Error,
1312>
1313where
1314	I: Iterator<
1315		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1316	>,
1317{
1318	match tokens.next().transpose()? {
1319		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1320		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1321			#[allow(unused_mut)]
1322			let mut builder = crate::model::PartyActivityMatchmakerFindingLobby::builder();
1323			loop {
1324				match tokens.next().transpose()? {
1325					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1326					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1327						match key.to_unescaped()?.as_ref() {
1328							"game" => {
1329								builder = builder.set_game(
1330									crate::json_deser::deser_structure_crate_model_game_handle(
1331										tokens,
1332									)?,
1333								);
1334							}
1335							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1336						}
1337					}
1338					other => {
1339						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1340							"expected object key or end object, found: {:?}",
1341							other
1342						)))
1343					}
1344				}
1345			}
1346			Ok(Some(builder.build()))
1347		}
1348		_ => Err(aws_smithy_json::deserialize::Error::custom(
1349			"expected start object or null",
1350		)),
1351	}
1352}
1353
1354pub fn deser_structure_crate_model_party_activity_matchmaker_lobby<'a, I>(
1355	tokens: &mut std::iter::Peekable<I>,
1356) -> Result<Option<crate::model::PartyActivityMatchmakerLobby>, aws_smithy_json::deserialize::Error>
1357where
1358	I: Iterator<
1359		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1360	>,
1361{
1362	match tokens.next().transpose()? {
1363		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1364		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1365			#[allow(unused_mut)]
1366			let mut builder = crate::model::PartyActivityMatchmakerLobby::builder();
1367			loop {
1368				match tokens.next().transpose()? {
1369					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1370					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1371						match key.to_unescaped()?.as_ref() {
1372							"lobby" => {
1373								builder = builder.set_lobby(
1374                                    crate::json_deser::deser_structure_crate_model_party_matchmaker_lobby(tokens)?
1375                                );
1376							}
1377							"game" => {
1378								builder = builder.set_game(
1379									crate::json_deser::deser_structure_crate_model_game_handle(
1380										tokens,
1381									)?,
1382								);
1383							}
1384							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1385						}
1386					}
1387					other => {
1388						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1389							"expected object key or end object, found: {:?}",
1390							other
1391						)))
1392					}
1393				}
1394			}
1395			Ok(Some(builder.build()))
1396		}
1397		_ => Err(aws_smithy_json::deserialize::Error::custom(
1398			"expected start object or null",
1399		)),
1400	}
1401}
1402
1403pub fn deser_structure_crate_model_party_member_summary<'a, I>(
1404	tokens: &mut std::iter::Peekable<I>,
1405) -> Result<Option<crate::model::PartyMemberSummary>, aws_smithy_json::deserialize::Error>
1406where
1407	I: Iterator<
1408		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1409	>,
1410{
1411	match tokens.next().transpose()? {
1412		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1413		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1414			#[allow(unused_mut)]
1415			let mut builder = crate::model::PartyMemberSummary::builder();
1416			loop {
1417				match tokens.next().transpose()? {
1418					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1419					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1420						match key.to_unescaped()?.as_ref() {
1421							"identity" => {
1422								builder = builder.set_identity(
1423									crate::json_deser::deser_structure_crate_model_identity_handle(
1424										tokens,
1425									)?,
1426								);
1427							}
1428							"is_leader" => {
1429								builder = builder.set_is_leader(
1430									aws_smithy_json::deserialize::token::expect_bool_or_null(
1431										tokens.next(),
1432									)?,
1433								);
1434							}
1435							"join_ts" => {
1436								builder = builder.set_join_ts(
1437									aws_smithy_json::deserialize::token::expect_timestamp_or_null(
1438										tokens.next(),
1439										aws_smithy_types::date_time::Format::DateTime,
1440									)?,
1441								);
1442							}
1443							"state" => {
1444								builder = builder.set_state(
1445									crate::json_deser::deser_union_crate_model_party_member_state(
1446										tokens,
1447									)?,
1448								);
1449							}
1450							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1451						}
1452					}
1453					other => {
1454						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1455							"expected object key or end object, found: {:?}",
1456							other
1457						)))
1458					}
1459				}
1460			}
1461			Ok(Some(builder.build()))
1462		}
1463		_ => Err(aws_smithy_json::deserialize::Error::custom(
1464			"expected start object or null",
1465		)),
1466	}
1467}
1468
1469pub fn deser_structure_crate_model_party_invite<'a, I>(
1470	tokens: &mut std::iter::Peekable<I>,
1471) -> Result<Option<crate::model::PartyInvite>, aws_smithy_json::deserialize::Error>
1472where
1473	I: Iterator<
1474		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1475	>,
1476{
1477	match tokens.next().transpose()? {
1478		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1479		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1480			#[allow(unused_mut)]
1481			let mut builder = crate::model::PartyInvite::builder();
1482			loop {
1483				match tokens.next().transpose()? {
1484					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1485					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1486						match key.to_unescaped()?.as_ref() {
1487							"invite_id" => {
1488								builder = builder.set_invite_id(
1489									aws_smithy_json::deserialize::token::expect_string_or_null(
1490										tokens.next(),
1491									)?
1492									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1493									.transpose()?,
1494								);
1495							}
1496							"create_ts" => {
1497								builder = builder.set_create_ts(
1498									aws_smithy_json::deserialize::token::expect_timestamp_or_null(
1499										tokens.next(),
1500										aws_smithy_types::date_time::Format::DateTime,
1501									)?,
1502								);
1503							}
1504							"token" => {
1505								builder = builder.set_token(
1506									aws_smithy_json::deserialize::token::expect_string_or_null(
1507										tokens.next(),
1508									)?
1509									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1510									.transpose()?,
1511								);
1512							}
1513							"alias" => {
1514								builder = builder.set_alias(
1515                                    crate::json_deser::deser_structure_crate_model_party_invite_alias(tokens)?
1516                                );
1517							}
1518							"external" => {
1519								builder = builder.set_external(
1520                                    crate::json_deser::deser_structure_crate_model_party_invite_external_links(tokens)?
1521                                );
1522							}
1523							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1524						}
1525					}
1526					other => {
1527						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1528							"expected object key or end object, found: {:?}",
1529							other
1530						)))
1531					}
1532				}
1533			}
1534			Ok(Some(builder.build()))
1535		}
1536		_ => Err(aws_smithy_json::deserialize::Error::custom(
1537			"expected start object or null",
1538		)),
1539	}
1540}
1541
1542pub fn deser_structure_crate_model_game_handle<'a, I>(
1543	tokens: &mut std::iter::Peekable<I>,
1544) -> Result<Option<crate::model::GameHandle>, aws_smithy_json::deserialize::Error>
1545where
1546	I: Iterator<
1547		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1548	>,
1549{
1550	match tokens.next().transpose()? {
1551		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1552		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1553			#[allow(unused_mut)]
1554			let mut builder = crate::model::GameHandle::builder();
1555			loop {
1556				match tokens.next().transpose()? {
1557					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1558					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1559						match key.to_unescaped()?.as_ref() {
1560							"game_id" => {
1561								builder = builder.set_game_id(
1562									aws_smithy_json::deserialize::token::expect_string_or_null(
1563										tokens.next(),
1564									)?
1565									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1566									.transpose()?,
1567								);
1568							}
1569							"name_id" => {
1570								builder = builder.set_name_id(
1571									aws_smithy_json::deserialize::token::expect_string_or_null(
1572										tokens.next(),
1573									)?
1574									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1575									.transpose()?,
1576								);
1577							}
1578							"display_name" => {
1579								builder = builder.set_display_name(
1580									aws_smithy_json::deserialize::token::expect_string_or_null(
1581										tokens.next(),
1582									)?
1583									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1584									.transpose()?,
1585								);
1586							}
1587							"logo_url" => {
1588								builder = builder.set_logo_url(
1589									aws_smithy_json::deserialize::token::expect_string_or_null(
1590										tokens.next(),
1591									)?
1592									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1593									.transpose()?,
1594								);
1595							}
1596							"banner_url" => {
1597								builder = builder.set_banner_url(
1598									aws_smithy_json::deserialize::token::expect_string_or_null(
1599										tokens.next(),
1600									)?
1601									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1602									.transpose()?,
1603								);
1604							}
1605							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1606						}
1607					}
1608					other => {
1609						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1610							"expected object key or end object, found: {:?}",
1611							other
1612						)))
1613					}
1614				}
1615			}
1616			Ok(Some(builder.build()))
1617		}
1618		_ => Err(aws_smithy_json::deserialize::Error::custom(
1619			"expected start object or null",
1620		)),
1621	}
1622}
1623
1624pub fn deser_structure_crate_model_party_matchmaker_lobby<'a, I>(
1625	tokens: &mut std::iter::Peekable<I>,
1626) -> Result<Option<crate::model::PartyMatchmakerLobby>, aws_smithy_json::deserialize::Error>
1627where
1628	I: Iterator<
1629		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1630	>,
1631{
1632	match tokens.next().transpose()? {
1633		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1634		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1635			#[allow(unused_mut)]
1636			let mut builder = crate::model::PartyMatchmakerLobby::builder();
1637			loop {
1638				match tokens.next().transpose()? {
1639					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1640					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1641						match key.to_unescaped()?.as_ref() {
1642							"lobby_id" => {
1643								builder = builder.set_lobby_id(
1644									aws_smithy_json::deserialize::token::expect_string_or_null(
1645										tokens.next(),
1646									)?
1647									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1648									.transpose()?,
1649								);
1650							}
1651							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1652						}
1653					}
1654					other => {
1655						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1656							"expected object key or end object, found: {:?}",
1657							other
1658						)))
1659					}
1660				}
1661			}
1662			Ok(Some(builder.build()))
1663		}
1664		_ => Err(aws_smithy_json::deserialize::Error::custom(
1665			"expected start object or null",
1666		)),
1667	}
1668}
1669
1670pub fn deser_structure_crate_model_identity_handle<'a, I>(
1671	tokens: &mut std::iter::Peekable<I>,
1672) -> Result<Option<crate::model::IdentityHandle>, aws_smithy_json::deserialize::Error>
1673where
1674	I: Iterator<
1675		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1676	>,
1677{
1678	match tokens.next().transpose()? {
1679		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1680		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1681			#[allow(unused_mut)]
1682			let mut builder = crate::model::IdentityHandle::builder();
1683			loop {
1684				match tokens.next().transpose()? {
1685					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1686					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1687						match key.to_unescaped()?.as_ref() {
1688							"identity_id" => {
1689								builder = builder.set_identity_id(
1690									aws_smithy_json::deserialize::token::expect_string_or_null(
1691										tokens.next(),
1692									)?
1693									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1694									.transpose()?,
1695								);
1696							}
1697							"display_name" => {
1698								builder = builder.set_display_name(
1699									aws_smithy_json::deserialize::token::expect_string_or_null(
1700										tokens.next(),
1701									)?
1702									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1703									.transpose()?,
1704								);
1705							}
1706							"account_number" => {
1707								builder = builder.set_account_number(
1708									aws_smithy_json::deserialize::token::expect_number_or_null(
1709										tokens.next(),
1710									)?
1711									.map(|v| v.to_i32()),
1712								);
1713							}
1714							"avatar_url" => {
1715								builder = builder.set_avatar_url(
1716									aws_smithy_json::deserialize::token::expect_string_or_null(
1717										tokens.next(),
1718									)?
1719									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1720									.transpose()?,
1721								);
1722							}
1723							"presence" => {
1724								builder = builder.set_presence(
1725                                    crate::json_deser::deser_structure_crate_model_identity_presence(tokens)?
1726                                );
1727							}
1728							"party" => {
1729								builder = builder.set_party(
1730									crate::json_deser::deser_structure_crate_model_party_handle(
1731										tokens,
1732									)?,
1733								);
1734							}
1735							"is_registered" => {
1736								builder = builder.set_is_registered(
1737									aws_smithy_json::deserialize::token::expect_bool_or_null(
1738										tokens.next(),
1739									)?,
1740								);
1741							}
1742							"external" => {
1743								builder = builder.set_external(
1744                                    crate::json_deser::deser_structure_crate_model_identity_external_links(tokens)?
1745                                );
1746							}
1747							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1748						}
1749					}
1750					other => {
1751						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1752							"expected object key or end object, found: {:?}",
1753							other
1754						)))
1755					}
1756				}
1757			}
1758			Ok(Some(builder.build()))
1759		}
1760		_ => Err(aws_smithy_json::deserialize::Error::custom(
1761			"expected start object or null",
1762		)),
1763	}
1764}
1765
1766pub fn deser_union_crate_model_party_member_state<'a, I>(
1767	tokens: &mut std::iter::Peekable<I>,
1768) -> Result<Option<crate::model::PartyMemberState>, aws_smithy_json::deserialize::Error>
1769where
1770	I: Iterator<
1771		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1772	>,
1773{
1774	let mut variant = None;
1775	match tokens.next().transpose()? {
1776		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
1777		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
1778			match tokens.next().transpose()? {
1779				Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1780				Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1781					if variant.is_some() {
1782						return Err(aws_smithy_json::deserialize::Error::custom(
1783							"encountered mixed variants in union",
1784						));
1785					}
1786					variant = match key.to_unescaped()?.as_ref() {
1787                            "idle" => {
1788                                Some(crate::model::PartyMemberState::Idle(
1789                                    crate::json_deser::deser_structure_crate_model_party_member_state_idle(tokens)?
1790                                    .ok_or_else(|| aws_smithy_json::deserialize::Error::custom("value for 'idle' cannot be null"))?
1791                                ))
1792                            }
1793                            "matchmaker_pending" => {
1794                                Some(crate::model::PartyMemberState::MatchmakerPending(
1795                                    crate::json_deser::deser_structure_crate_model_party_member_state_matchmaker_pending(tokens)?
1796                                    .ok_or_else(|| aws_smithy_json::deserialize::Error::custom("value for 'matchmaker_pending' cannot be null"))?
1797                                ))
1798                            }
1799                            "matchmaker_finding_lobby" => {
1800                                Some(crate::model::PartyMemberState::MatchmakerFindingLobby(
1801                                    crate::json_deser::deser_structure_crate_model_party_member_state_matchmaker_finding_lobby(tokens)?
1802                                    .ok_or_else(|| aws_smithy_json::deserialize::Error::custom("value for 'matchmaker_finding_lobby' cannot be null"))?
1803                                ))
1804                            }
1805                            "matchmaker_lobby" => {
1806                                Some(crate::model::PartyMemberState::MatchmakerLobby(
1807                                    crate::json_deser::deser_structure_crate_model_party_member_state_matchmaker_lobby(tokens)?
1808                                    .ok_or_else(|| aws_smithy_json::deserialize::Error::custom("value for 'matchmaker_lobby' cannot be null"))?
1809                                ))
1810                            }
1811                            _ => {
1812                                                                      aws_smithy_json::deserialize::token::skip_value(tokens)?;
1813                                                                      Some(crate::model::PartyMemberState::Unknown)
1814                                                                    }
1815                        };
1816				}
1817				other => {
1818					return Err(aws_smithy_json::deserialize::Error::custom(format!(
1819						"expected object key or end object, found: {:?}",
1820						other
1821					)))
1822				}
1823			}
1824		},
1825		_ => {
1826			return Err(aws_smithy_json::deserialize::Error::custom(
1827				"expected start object or null",
1828			))
1829		}
1830	}
1831	Ok(variant)
1832}
1833
1834pub fn deser_structure_crate_model_party_invite_alias<'a, I>(
1835	tokens: &mut std::iter::Peekable<I>,
1836) -> Result<Option<crate::model::PartyInviteAlias>, aws_smithy_json::deserialize::Error>
1837where
1838	I: Iterator<
1839		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1840	>,
1841{
1842	match tokens.next().transpose()? {
1843		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1844		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1845			#[allow(unused_mut)]
1846			let mut builder = crate::model::PartyInviteAlias::builder();
1847			loop {
1848				match tokens.next().transpose()? {
1849					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1850					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1851						match key.to_unescaped()?.as_ref() {
1852							"namespace_id" => {
1853								builder = builder.set_namespace_id(
1854									aws_smithy_json::deserialize::token::expect_string_or_null(
1855										tokens.next(),
1856									)?
1857									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1858									.transpose()?,
1859								);
1860							}
1861							"alias" => {
1862								builder = builder.set_alias(
1863									aws_smithy_json::deserialize::token::expect_string_or_null(
1864										tokens.next(),
1865									)?
1866									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1867									.transpose()?,
1868								);
1869							}
1870							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1871						}
1872					}
1873					other => {
1874						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1875							"expected object key or end object, found: {:?}",
1876							other
1877						)))
1878					}
1879				}
1880			}
1881			Ok(Some(builder.build()))
1882		}
1883		_ => Err(aws_smithy_json::deserialize::Error::custom(
1884			"expected start object or null",
1885		)),
1886	}
1887}
1888
1889pub fn deser_structure_crate_model_party_invite_external_links<'a, I>(
1890	tokens: &mut std::iter::Peekable<I>,
1891) -> Result<Option<crate::model::PartyInviteExternalLinks>, aws_smithy_json::deserialize::Error>
1892where
1893	I: Iterator<
1894		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1895	>,
1896{
1897	match tokens.next().transpose()? {
1898		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1899		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1900			#[allow(unused_mut)]
1901			let mut builder = crate::model::PartyInviteExternalLinks::builder();
1902			loop {
1903				match tokens.next().transpose()? {
1904					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1905					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1906						match key.to_unescaped()?.as_ref() {
1907							"invite" => {
1908								builder = builder.set_invite(
1909									aws_smithy_json::deserialize::token::expect_string_or_null(
1910										tokens.next(),
1911									)?
1912									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
1913									.transpose()?,
1914								);
1915							}
1916							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1917						}
1918					}
1919					other => {
1920						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1921							"expected object key or end object, found: {:?}",
1922							other
1923						)))
1924					}
1925				}
1926			}
1927			Ok(Some(builder.build()))
1928		}
1929		_ => Err(aws_smithy_json::deserialize::Error::custom(
1930			"expected start object or null",
1931		)),
1932	}
1933}
1934
1935pub fn deser_structure_crate_model_identity_presence<'a, I>(
1936	tokens: &mut std::iter::Peekable<I>,
1937) -> Result<Option<crate::model::IdentityPresence>, aws_smithy_json::deserialize::Error>
1938where
1939	I: Iterator<
1940		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
1941	>,
1942{
1943	match tokens.next().transpose()? {
1944		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
1945		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
1946			#[allow(unused_mut)]
1947			let mut builder = crate::model::IdentityPresence::builder();
1948			loop {
1949				match tokens.next().transpose()? {
1950					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
1951					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
1952						match key.to_unescaped()?.as_ref() {
1953							"update_ts" => {
1954								builder = builder.set_update_ts(
1955									aws_smithy_json::deserialize::token::expect_timestamp_or_null(
1956										tokens.next(),
1957										aws_smithy_types::date_time::Format::DateTime,
1958									)?,
1959								);
1960							}
1961							"status" => {
1962								builder = builder.set_status(
1963									aws_smithy_json::deserialize::token::expect_string_or_null(
1964										tokens.next(),
1965									)?
1966									.map(|s| {
1967										s.to_unescaped()
1968											.map(|u| crate::model::IdentityStatus::from(u.as_ref()))
1969									})
1970									.transpose()?,
1971								);
1972							}
1973							"game_activity" => {
1974								builder = builder.set_game_activity(
1975                                    crate::json_deser::deser_structure_crate_model_identity_game_activity(tokens)?
1976                                );
1977							}
1978							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
1979						}
1980					}
1981					other => {
1982						return Err(aws_smithy_json::deserialize::Error::custom(format!(
1983							"expected object key or end object, found: {:?}",
1984							other
1985						)))
1986					}
1987				}
1988			}
1989			Ok(Some(builder.build()))
1990		}
1991		_ => Err(aws_smithy_json::deserialize::Error::custom(
1992			"expected start object or null",
1993		)),
1994	}
1995}
1996
1997pub fn deser_structure_crate_model_party_handle<'a, I>(
1998	tokens: &mut std::iter::Peekable<I>,
1999) -> Result<Option<crate::model::PartyHandle>, aws_smithy_json::deserialize::Error>
2000where
2001	I: Iterator<
2002		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
2003	>,
2004{
2005	match tokens.next().transpose()? {
2006		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
2007		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
2008			#[allow(unused_mut)]
2009			let mut builder = crate::model::PartyHandle::builder();
2010			loop {
2011				match tokens.next().transpose()? {
2012					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
2013					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
2014						match key.to_unescaped()?.as_ref() {
2015							"party_id" => {
2016								builder = builder.set_party_id(
2017									aws_smithy_json::deserialize::token::expect_string_or_null(
2018										tokens.next(),
2019									)?
2020									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
2021									.transpose()?,
2022								);
2023							}
2024							"create_ts" => {
2025								builder = builder.set_create_ts(
2026									aws_smithy_json::deserialize::token::expect_timestamp_or_null(
2027										tokens.next(),
2028										aws_smithy_types::date_time::Format::DateTime,
2029									)?,
2030								);
2031							}
2032							"activity" => {
2033								builder = builder.set_activity(
2034									crate::json_deser::deser_union_crate_model_party_activity(
2035										tokens,
2036									)?,
2037								);
2038							}
2039							"external" => {
2040								builder = builder.set_external(
2041                                    crate::json_deser::deser_structure_crate_model_party_external_links(tokens)?
2042                                );
2043							}
2044							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
2045						}
2046					}
2047					other => {
2048						return Err(aws_smithy_json::deserialize::Error::custom(format!(
2049							"expected object key or end object, found: {:?}",
2050							other
2051						)))
2052					}
2053				}
2054			}
2055			Ok(Some(builder.build()))
2056		}
2057		_ => Err(aws_smithy_json::deserialize::Error::custom(
2058			"expected start object or null",
2059		)),
2060	}
2061}
2062
2063pub fn deser_structure_crate_model_identity_external_links<'a, I>(
2064	tokens: &mut std::iter::Peekable<I>,
2065) -> Result<Option<crate::model::IdentityExternalLinks>, aws_smithy_json::deserialize::Error>
2066where
2067	I: Iterator<
2068		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
2069	>,
2070{
2071	match tokens.next().transpose()? {
2072		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
2073		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
2074			#[allow(unused_mut)]
2075			let mut builder = crate::model::IdentityExternalLinks::builder();
2076			loop {
2077				match tokens.next().transpose()? {
2078					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
2079					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
2080						match key.to_unescaped()?.as_ref() {
2081							"profile" => {
2082								builder = builder.set_profile(
2083									aws_smithy_json::deserialize::token::expect_string_or_null(
2084										tokens.next(),
2085									)?
2086									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
2087									.transpose()?,
2088								);
2089							}
2090							"settings" => {
2091								builder = builder.set_settings(
2092									aws_smithy_json::deserialize::token::expect_string_or_null(
2093										tokens.next(),
2094									)?
2095									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
2096									.transpose()?,
2097								);
2098							}
2099							"chat" => {
2100								builder = builder.set_chat(
2101									aws_smithy_json::deserialize::token::expect_string_or_null(
2102										tokens.next(),
2103									)?
2104									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
2105									.transpose()?,
2106								);
2107							}
2108							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
2109						}
2110					}
2111					other => {
2112						return Err(aws_smithy_json::deserialize::Error::custom(format!(
2113							"expected object key or end object, found: {:?}",
2114							other
2115						)))
2116					}
2117				}
2118			}
2119			Ok(Some(builder.build()))
2120		}
2121		_ => Err(aws_smithy_json::deserialize::Error::custom(
2122			"expected start object or null",
2123		)),
2124	}
2125}
2126
2127pub fn deser_structure_crate_model_party_member_state_idle<'a, I>(
2128	tokens: &mut std::iter::Peekable<I>,
2129) -> Result<Option<crate::model::PartyMemberStateIdle>, aws_smithy_json::deserialize::Error>
2130where
2131	I: Iterator<
2132		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
2133	>,
2134{
2135	match tokens.next().transpose()? {
2136		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
2137		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
2138			#[allow(unused_mut)]
2139			let mut builder = crate::model::PartyMemberStateIdle::builder();
2140			aws_smithy_json::deserialize::token::skip_to_end(tokens)?;
2141			Ok(Some(builder.build()))
2142		}
2143		_ => Err(aws_smithy_json::deserialize::Error::custom(
2144			"expected start object or null",
2145		)),
2146	}
2147}
2148
2149pub fn deser_structure_crate_model_party_member_state_matchmaker_pending<'a, I>(
2150	tokens: &mut std::iter::Peekable<I>,
2151) -> Result<
2152	Option<crate::model::PartyMemberStateMatchmakerPending>,
2153	aws_smithy_json::deserialize::Error,
2154>
2155where
2156	I: Iterator<
2157		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
2158	>,
2159{
2160	match tokens.next().transpose()? {
2161		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
2162		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
2163			#[allow(unused_mut)]
2164			let mut builder = crate::model::PartyMemberStateMatchmakerPending::builder();
2165			aws_smithy_json::deserialize::token::skip_to_end(tokens)?;
2166			Ok(Some(builder.build()))
2167		}
2168		_ => Err(aws_smithy_json::deserialize::Error::custom(
2169			"expected start object or null",
2170		)),
2171	}
2172}
2173
2174pub fn deser_structure_crate_model_party_member_state_matchmaker_finding_lobby<'a, I>(
2175	tokens: &mut std::iter::Peekable<I>,
2176) -> Result<
2177	Option<crate::model::PartyMemberStateMatchmakerFindingLobby>,
2178	aws_smithy_json::deserialize::Error,
2179>
2180where
2181	I: Iterator<
2182		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
2183	>,
2184{
2185	match tokens.next().transpose()? {
2186		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
2187		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
2188			#[allow(unused_mut)]
2189			let mut builder = crate::model::PartyMemberStateMatchmakerFindingLobby::builder();
2190			aws_smithy_json::deserialize::token::skip_to_end(tokens)?;
2191			Ok(Some(builder.build()))
2192		}
2193		_ => Err(aws_smithy_json::deserialize::Error::custom(
2194			"expected start object or null",
2195		)),
2196	}
2197}
2198
2199pub fn deser_structure_crate_model_party_member_state_matchmaker_lobby<'a, I>(
2200	tokens: &mut std::iter::Peekable<I>,
2201) -> Result<
2202	Option<crate::model::PartyMemberStateMatchmakerLobby>,
2203	aws_smithy_json::deserialize::Error,
2204>
2205where
2206	I: Iterator<
2207		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
2208	>,
2209{
2210	match tokens.next().transpose()? {
2211		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
2212		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
2213			#[allow(unused_mut)]
2214			let mut builder = crate::model::PartyMemberStateMatchmakerLobby::builder();
2215			loop {
2216				match tokens.next().transpose()? {
2217					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
2218					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
2219						match key.to_unescaped()?.as_ref() {
2220							"player_id" => {
2221								builder = builder.set_player_id(
2222									aws_smithy_json::deserialize::token::expect_string_or_null(
2223										tokens.next(),
2224									)?
2225									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
2226									.transpose()?,
2227								);
2228							}
2229							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
2230						}
2231					}
2232					other => {
2233						return Err(aws_smithy_json::deserialize::Error::custom(format!(
2234							"expected object key or end object, found: {:?}",
2235							other
2236						)))
2237					}
2238				}
2239			}
2240			Ok(Some(builder.build()))
2241		}
2242		_ => Err(aws_smithy_json::deserialize::Error::custom(
2243			"expected start object or null",
2244		)),
2245	}
2246}
2247
2248pub fn deser_structure_crate_model_identity_game_activity<'a, I>(
2249	tokens: &mut std::iter::Peekable<I>,
2250) -> Result<Option<crate::model::IdentityGameActivity>, aws_smithy_json::deserialize::Error>
2251where
2252	I: Iterator<
2253		Item = Result<aws_smithy_json::deserialize::Token<'a>, aws_smithy_json::deserialize::Error>,
2254	>,
2255{
2256	match tokens.next().transpose()? {
2257		Some(aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
2258		Some(aws_smithy_json::deserialize::Token::StartObject { .. }) => {
2259			#[allow(unused_mut)]
2260			let mut builder = crate::model::IdentityGameActivity::builder();
2261			loop {
2262				match tokens.next().transpose()? {
2263					Some(aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
2264					Some(aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
2265						match key.to_unescaped()?.as_ref() {
2266							"game" => {
2267								builder = builder.set_game(
2268									crate::json_deser::deser_structure_crate_model_game_handle(
2269										tokens,
2270									)?,
2271								);
2272							}
2273							"message" => {
2274								builder = builder.set_message(
2275									aws_smithy_json::deserialize::token::expect_string_or_null(
2276										tokens.next(),
2277									)?
2278									.map(|s| s.to_unescaped().map(|u| u.into_owned()))
2279									.transpose()?,
2280								);
2281							}
2282							"public_metadata" => {
2283								builder = builder.set_public_metadata(Some(
2284									aws_smithy_json::deserialize::token::expect_document(tokens)?,
2285								));
2286							}
2287							"mutual_metadata" => {
2288								builder = builder.set_mutual_metadata(Some(
2289									aws_smithy_json::deserialize::token::expect_document(tokens)?,
2290								));
2291							}
2292							_ => aws_smithy_json::deserialize::token::skip_value(tokens)?,
2293						}
2294					}
2295					other => {
2296						return Err(aws_smithy_json::deserialize::Error::custom(format!(
2297							"expected object key or end object, found: {:?}",
2298							other
2299						)))
2300					}
2301				}
2302			}
2303			Ok(Some(builder.build()))
2304		}
2305		_ => Err(aws_smithy_json::deserialize::Error::custom(
2306			"expected start object or null",
2307		)),
2308	}
2309}