1#![allow(
5 clippy::too_many_arguments,
6 clippy::large_enum_variant,
7 clippy::result_large_err,
8 clippy::doc_markdown,
9)]
10
11pub type GetAccountBatchResult = Vec<BasicAccount>;
14
15#[derive(Debug, Clone, PartialEq, Eq)]
18#[non_exhaustive] pub struct Account {
20 pub account_id: crate::types::users_common::AccountId,
22 pub name: Name,
24 pub email: String,
27 pub email_verified: bool,
29 pub disabled: bool,
31 pub profile_photo_url: Option<String>,
33}
34
35impl Account {
36 pub fn new(
37 account_id: crate::types::users_common::AccountId,
38 name: Name,
39 email: String,
40 email_verified: bool,
41 disabled: bool,
42 ) -> Self {
43 Account {
44 account_id,
45 name,
46 email,
47 email_verified,
48 disabled,
49 profile_photo_url: None,
50 }
51 }
52
53 pub fn with_profile_photo_url(mut self, value: String) -> Self {
54 self.profile_photo_url = Some(value);
55 self
56 }
57}
58
59const ACCOUNT_FIELDS: &[&str] = &["account_id",
60 "name",
61 "email",
62 "email_verified",
63 "disabled",
64 "profile_photo_url"];
65impl Account {
66 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
67 map: V,
68 ) -> Result<Account, V::Error> {
69 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
70 }
71
72 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
73 mut map: V,
74 optional: bool,
75 ) -> Result<Option<Account>, V::Error> {
76 let mut field_account_id = None;
77 let mut field_name = None;
78 let mut field_email = None;
79 let mut field_email_verified = None;
80 let mut field_disabled = None;
81 let mut field_profile_photo_url = None;
82 let mut nothing = true;
83 while let Some(key) = map.next_key::<&str>()? {
84 nothing = false;
85 match key {
86 "account_id" => {
87 if field_account_id.is_some() {
88 return Err(::serde::de::Error::duplicate_field("account_id"));
89 }
90 field_account_id = Some(map.next_value()?);
91 }
92 "name" => {
93 if field_name.is_some() {
94 return Err(::serde::de::Error::duplicate_field("name"));
95 }
96 field_name = Some(map.next_value()?);
97 }
98 "email" => {
99 if field_email.is_some() {
100 return Err(::serde::de::Error::duplicate_field("email"));
101 }
102 field_email = Some(map.next_value()?);
103 }
104 "email_verified" => {
105 if field_email_verified.is_some() {
106 return Err(::serde::de::Error::duplicate_field("email_verified"));
107 }
108 field_email_verified = Some(map.next_value()?);
109 }
110 "disabled" => {
111 if field_disabled.is_some() {
112 return Err(::serde::de::Error::duplicate_field("disabled"));
113 }
114 field_disabled = Some(map.next_value()?);
115 }
116 "profile_photo_url" => {
117 if field_profile_photo_url.is_some() {
118 return Err(::serde::de::Error::duplicate_field("profile_photo_url"));
119 }
120 field_profile_photo_url = Some(map.next_value()?);
121 }
122 _ => {
123 map.next_value::<::serde_json::Value>()?;
125 }
126 }
127 }
128 if optional && nothing {
129 return Ok(None);
130 }
131 let result = Account {
132 account_id: field_account_id.ok_or_else(|| ::serde::de::Error::missing_field("account_id"))?,
133 name: field_name.ok_or_else(|| ::serde::de::Error::missing_field("name"))?,
134 email: field_email.ok_or_else(|| ::serde::de::Error::missing_field("email"))?,
135 email_verified: field_email_verified.ok_or_else(|| ::serde::de::Error::missing_field("email_verified"))?,
136 disabled: field_disabled.ok_or_else(|| ::serde::de::Error::missing_field("disabled"))?,
137 profile_photo_url: field_profile_photo_url.and_then(Option::flatten),
138 };
139 Ok(Some(result))
140 }
141
142 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
143 &self,
144 s: &mut S::SerializeStruct,
145 ) -> Result<(), S::Error> {
146 use serde::ser::SerializeStruct;
147 s.serialize_field("account_id", &self.account_id)?;
148 s.serialize_field("name", &self.name)?;
149 s.serialize_field("email", &self.email)?;
150 s.serialize_field("email_verified", &self.email_verified)?;
151 s.serialize_field("disabled", &self.disabled)?;
152 if let Some(val) = &self.profile_photo_url {
153 s.serialize_field("profile_photo_url", val)?;
154 }
155 Ok(())
156 }
157}
158
159impl<'de> ::serde::de::Deserialize<'de> for Account {
160 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
161 use serde::de::{MapAccess, Visitor};
163 struct StructVisitor;
164 impl<'de> Visitor<'de> for StructVisitor {
165 type Value = Account;
166 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
167 f.write_str("a Account struct")
168 }
169 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
170 Account::internal_deserialize(map)
171 }
172 }
173 deserializer.deserialize_struct("Account", ACCOUNT_FIELDS, StructVisitor)
174 }
175}
176
177impl ::serde::ser::Serialize for Account {
178 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
179 use serde::ser::SerializeStruct;
181 let mut s = serializer.serialize_struct("Account", 6)?;
182 self.internal_serialize::<S>(&mut s)?;
183 s.end()
184 }
185}
186
187#[derive(Debug, Clone, PartialEq, Eq)]
189#[non_exhaustive] pub struct BasicAccount {
191 pub account_id: crate::types::users_common::AccountId,
193 pub name: Name,
195 pub email: String,
198 pub email_verified: bool,
200 pub disabled: bool,
202 pub is_teammate: bool,
205 pub profile_photo_url: Option<String>,
207 pub team_member_id: Option<String>,
210}
211
212impl BasicAccount {
213 pub fn new(
214 account_id: crate::types::users_common::AccountId,
215 name: Name,
216 email: String,
217 email_verified: bool,
218 disabled: bool,
219 is_teammate: bool,
220 ) -> Self {
221 BasicAccount {
222 account_id,
223 name,
224 email,
225 email_verified,
226 disabled,
227 is_teammate,
228 profile_photo_url: None,
229 team_member_id: None,
230 }
231 }
232
233 pub fn with_profile_photo_url(mut self, value: String) -> Self {
234 self.profile_photo_url = Some(value);
235 self
236 }
237
238 pub fn with_team_member_id(mut self, value: String) -> Self {
239 self.team_member_id = Some(value);
240 self
241 }
242}
243
244const BASIC_ACCOUNT_FIELDS: &[&str] = &["account_id",
245 "name",
246 "email",
247 "email_verified",
248 "disabled",
249 "is_teammate",
250 "profile_photo_url",
251 "team_member_id"];
252impl BasicAccount {
253 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
254 map: V,
255 ) -> Result<BasicAccount, V::Error> {
256 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
257 }
258
259 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
260 mut map: V,
261 optional: bool,
262 ) -> Result<Option<BasicAccount>, V::Error> {
263 let mut field_account_id = None;
264 let mut field_name = None;
265 let mut field_email = None;
266 let mut field_email_verified = None;
267 let mut field_disabled = None;
268 let mut field_is_teammate = None;
269 let mut field_profile_photo_url = None;
270 let mut field_team_member_id = None;
271 let mut nothing = true;
272 while let Some(key) = map.next_key::<&str>()? {
273 nothing = false;
274 match key {
275 "account_id" => {
276 if field_account_id.is_some() {
277 return Err(::serde::de::Error::duplicate_field("account_id"));
278 }
279 field_account_id = Some(map.next_value()?);
280 }
281 "name" => {
282 if field_name.is_some() {
283 return Err(::serde::de::Error::duplicate_field("name"));
284 }
285 field_name = Some(map.next_value()?);
286 }
287 "email" => {
288 if field_email.is_some() {
289 return Err(::serde::de::Error::duplicate_field("email"));
290 }
291 field_email = Some(map.next_value()?);
292 }
293 "email_verified" => {
294 if field_email_verified.is_some() {
295 return Err(::serde::de::Error::duplicate_field("email_verified"));
296 }
297 field_email_verified = Some(map.next_value()?);
298 }
299 "disabled" => {
300 if field_disabled.is_some() {
301 return Err(::serde::de::Error::duplicate_field("disabled"));
302 }
303 field_disabled = Some(map.next_value()?);
304 }
305 "is_teammate" => {
306 if field_is_teammate.is_some() {
307 return Err(::serde::de::Error::duplicate_field("is_teammate"));
308 }
309 field_is_teammate = Some(map.next_value()?);
310 }
311 "profile_photo_url" => {
312 if field_profile_photo_url.is_some() {
313 return Err(::serde::de::Error::duplicate_field("profile_photo_url"));
314 }
315 field_profile_photo_url = Some(map.next_value()?);
316 }
317 "team_member_id" => {
318 if field_team_member_id.is_some() {
319 return Err(::serde::de::Error::duplicate_field("team_member_id"));
320 }
321 field_team_member_id = Some(map.next_value()?);
322 }
323 _ => {
324 map.next_value::<::serde_json::Value>()?;
326 }
327 }
328 }
329 if optional && nothing {
330 return Ok(None);
331 }
332 let result = BasicAccount {
333 account_id: field_account_id.ok_or_else(|| ::serde::de::Error::missing_field("account_id"))?,
334 name: field_name.ok_or_else(|| ::serde::de::Error::missing_field("name"))?,
335 email: field_email.ok_or_else(|| ::serde::de::Error::missing_field("email"))?,
336 email_verified: field_email_verified.ok_or_else(|| ::serde::de::Error::missing_field("email_verified"))?,
337 disabled: field_disabled.ok_or_else(|| ::serde::de::Error::missing_field("disabled"))?,
338 is_teammate: field_is_teammate.ok_or_else(|| ::serde::de::Error::missing_field("is_teammate"))?,
339 profile_photo_url: field_profile_photo_url.and_then(Option::flatten),
340 team_member_id: field_team_member_id.and_then(Option::flatten),
341 };
342 Ok(Some(result))
343 }
344
345 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
346 &self,
347 s: &mut S::SerializeStruct,
348 ) -> Result<(), S::Error> {
349 use serde::ser::SerializeStruct;
350 s.serialize_field("account_id", &self.account_id)?;
351 s.serialize_field("name", &self.name)?;
352 s.serialize_field("email", &self.email)?;
353 s.serialize_field("email_verified", &self.email_verified)?;
354 s.serialize_field("disabled", &self.disabled)?;
355 s.serialize_field("is_teammate", &self.is_teammate)?;
356 if let Some(val) = &self.profile_photo_url {
357 s.serialize_field("profile_photo_url", val)?;
358 }
359 if let Some(val) = &self.team_member_id {
360 s.serialize_field("team_member_id", val)?;
361 }
362 Ok(())
363 }
364}
365
366impl<'de> ::serde::de::Deserialize<'de> for BasicAccount {
367 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
368 use serde::de::{MapAccess, Visitor};
370 struct StructVisitor;
371 impl<'de> Visitor<'de> for StructVisitor {
372 type Value = BasicAccount;
373 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
374 f.write_str("a BasicAccount struct")
375 }
376 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
377 BasicAccount::internal_deserialize(map)
378 }
379 }
380 deserializer.deserialize_struct("BasicAccount", BASIC_ACCOUNT_FIELDS, StructVisitor)
381 }
382}
383
384impl ::serde::ser::Serialize for BasicAccount {
385 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
386 use serde::ser::SerializeStruct;
388 let mut s = serializer.serialize_struct("BasicAccount", 8)?;
389 self.internal_serialize::<S>(&mut s)?;
390 s.end()
391 }
392}
393
394impl From<BasicAccount> for Account {
396 fn from(subtype: BasicAccount) -> Self {
397 Self {
398 account_id: subtype.account_id,
399 name: subtype.name,
400 email: subtype.email,
401 email_verified: subtype.email_verified,
402 disabled: subtype.disabled,
403 profile_photo_url: subtype.profile_photo_url,
404 }
405 }
406}
407#[derive(Debug, Clone, PartialEq, Eq)]
409#[non_exhaustive] pub enum FileLockingValue {
411 Enabled(bool),
415 Other,
418}
419
420impl<'de> ::serde::de::Deserialize<'de> for FileLockingValue {
421 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
422 use serde::de::{self, MapAccess, Visitor};
424 struct EnumVisitor;
425 impl<'de> Visitor<'de> for EnumVisitor {
426 type Value = FileLockingValue;
427 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
428 f.write_str("a FileLockingValue structure")
429 }
430 fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
431 let tag: &str = match map.next_key()? {
432 Some(".tag") => map.next_value()?,
433 _ => return Err(de::Error::missing_field(".tag"))
434 };
435 let value = match tag {
436 "enabled" => {
437 match map.next_key()? {
438 Some("enabled") => FileLockingValue::Enabled(map.next_value()?),
439 None => return Err(de::Error::missing_field("enabled")),
440 _ => return Err(de::Error::unknown_field(tag, VARIANTS))
441 }
442 }
443 _ => FileLockingValue::Other,
444 };
445 crate::eat_json_fields(&mut map)?;
446 Ok(value)
447 }
448 }
449 const VARIANTS: &[&str] = &["enabled",
450 "other"];
451 deserializer.deserialize_struct("FileLockingValue", VARIANTS, EnumVisitor)
452 }
453}
454
455impl ::serde::ser::Serialize for FileLockingValue {
456 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
457 use serde::ser::SerializeStruct;
459 match self {
460 FileLockingValue::Enabled(x) => {
461 let mut s = serializer.serialize_struct("FileLockingValue", 2)?;
463 s.serialize_field(".tag", "enabled")?;
464 s.serialize_field("enabled", x)?;
465 s.end()
466 }
467 FileLockingValue::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
468 }
469 }
470}
471
472#[derive(Debug, Clone, PartialEq, Eq)]
474#[non_exhaustive] pub struct FullAccount {
476 pub account_id: crate::types::users_common::AccountId,
478 pub name: Name,
480 pub email: String,
483 pub email_verified: bool,
485 pub disabled: bool,
487 pub locale: String,
490 pub referral_link: String,
492 pub is_paired: bool,
495 pub account_type: crate::types::users_common::AccountType,
497 pub root_info: crate::types::common::RootInfo,
499 pub profile_photo_url: Option<String>,
501 pub country: Option<String>,
504 pub team: Option<FullTeam>,
506 pub team_member_id: Option<String>,
508}
509
510impl FullAccount {
511 pub fn new(
512 account_id: crate::types::users_common::AccountId,
513 name: Name,
514 email: String,
515 email_verified: bool,
516 disabled: bool,
517 locale: String,
518 referral_link: String,
519 is_paired: bool,
520 account_type: crate::types::users_common::AccountType,
521 root_info: crate::types::common::RootInfo,
522 ) -> Self {
523 FullAccount {
524 account_id,
525 name,
526 email,
527 email_verified,
528 disabled,
529 locale,
530 referral_link,
531 is_paired,
532 account_type,
533 root_info,
534 profile_photo_url: None,
535 country: None,
536 team: None,
537 team_member_id: None,
538 }
539 }
540
541 pub fn with_profile_photo_url(mut self, value: String) -> Self {
542 self.profile_photo_url = Some(value);
543 self
544 }
545
546 pub fn with_country(mut self, value: String) -> Self {
547 self.country = Some(value);
548 self
549 }
550
551 pub fn with_team(mut self, value: FullTeam) -> Self {
552 self.team = Some(value);
553 self
554 }
555
556 pub fn with_team_member_id(mut self, value: String) -> Self {
557 self.team_member_id = Some(value);
558 self
559 }
560}
561
562const FULL_ACCOUNT_FIELDS: &[&str] = &["account_id",
563 "name",
564 "email",
565 "email_verified",
566 "disabled",
567 "locale",
568 "referral_link",
569 "is_paired",
570 "account_type",
571 "root_info",
572 "profile_photo_url",
573 "country",
574 "team",
575 "team_member_id"];
576impl FullAccount {
577 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
578 map: V,
579 ) -> Result<FullAccount, V::Error> {
580 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
581 }
582
583 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
584 mut map: V,
585 optional: bool,
586 ) -> Result<Option<FullAccount>, V::Error> {
587 let mut field_account_id = None;
588 let mut field_name = None;
589 let mut field_email = None;
590 let mut field_email_verified = None;
591 let mut field_disabled = None;
592 let mut field_locale = None;
593 let mut field_referral_link = None;
594 let mut field_is_paired = None;
595 let mut field_account_type = None;
596 let mut field_root_info = None;
597 let mut field_profile_photo_url = None;
598 let mut field_country = None;
599 let mut field_team = None;
600 let mut field_team_member_id = None;
601 let mut nothing = true;
602 while let Some(key) = map.next_key::<&str>()? {
603 nothing = false;
604 match key {
605 "account_id" => {
606 if field_account_id.is_some() {
607 return Err(::serde::de::Error::duplicate_field("account_id"));
608 }
609 field_account_id = Some(map.next_value()?);
610 }
611 "name" => {
612 if field_name.is_some() {
613 return Err(::serde::de::Error::duplicate_field("name"));
614 }
615 field_name = Some(map.next_value()?);
616 }
617 "email" => {
618 if field_email.is_some() {
619 return Err(::serde::de::Error::duplicate_field("email"));
620 }
621 field_email = Some(map.next_value()?);
622 }
623 "email_verified" => {
624 if field_email_verified.is_some() {
625 return Err(::serde::de::Error::duplicate_field("email_verified"));
626 }
627 field_email_verified = Some(map.next_value()?);
628 }
629 "disabled" => {
630 if field_disabled.is_some() {
631 return Err(::serde::de::Error::duplicate_field("disabled"));
632 }
633 field_disabled = Some(map.next_value()?);
634 }
635 "locale" => {
636 if field_locale.is_some() {
637 return Err(::serde::de::Error::duplicate_field("locale"));
638 }
639 field_locale = Some(map.next_value()?);
640 }
641 "referral_link" => {
642 if field_referral_link.is_some() {
643 return Err(::serde::de::Error::duplicate_field("referral_link"));
644 }
645 field_referral_link = Some(map.next_value()?);
646 }
647 "is_paired" => {
648 if field_is_paired.is_some() {
649 return Err(::serde::de::Error::duplicate_field("is_paired"));
650 }
651 field_is_paired = Some(map.next_value()?);
652 }
653 "account_type" => {
654 if field_account_type.is_some() {
655 return Err(::serde::de::Error::duplicate_field("account_type"));
656 }
657 field_account_type = Some(map.next_value()?);
658 }
659 "root_info" => {
660 if field_root_info.is_some() {
661 return Err(::serde::de::Error::duplicate_field("root_info"));
662 }
663 field_root_info = Some(map.next_value()?);
664 }
665 "profile_photo_url" => {
666 if field_profile_photo_url.is_some() {
667 return Err(::serde::de::Error::duplicate_field("profile_photo_url"));
668 }
669 field_profile_photo_url = Some(map.next_value()?);
670 }
671 "country" => {
672 if field_country.is_some() {
673 return Err(::serde::de::Error::duplicate_field("country"));
674 }
675 field_country = Some(map.next_value()?);
676 }
677 "team" => {
678 if field_team.is_some() {
679 return Err(::serde::de::Error::duplicate_field("team"));
680 }
681 field_team = Some(map.next_value()?);
682 }
683 "team_member_id" => {
684 if field_team_member_id.is_some() {
685 return Err(::serde::de::Error::duplicate_field("team_member_id"));
686 }
687 field_team_member_id = Some(map.next_value()?);
688 }
689 _ => {
690 map.next_value::<::serde_json::Value>()?;
692 }
693 }
694 }
695 if optional && nothing {
696 return Ok(None);
697 }
698 let result = FullAccount {
699 account_id: field_account_id.ok_or_else(|| ::serde::de::Error::missing_field("account_id"))?,
700 name: field_name.ok_or_else(|| ::serde::de::Error::missing_field("name"))?,
701 email: field_email.ok_or_else(|| ::serde::de::Error::missing_field("email"))?,
702 email_verified: field_email_verified.ok_or_else(|| ::serde::de::Error::missing_field("email_verified"))?,
703 disabled: field_disabled.ok_or_else(|| ::serde::de::Error::missing_field("disabled"))?,
704 locale: field_locale.ok_or_else(|| ::serde::de::Error::missing_field("locale"))?,
705 referral_link: field_referral_link.ok_or_else(|| ::serde::de::Error::missing_field("referral_link"))?,
706 is_paired: field_is_paired.ok_or_else(|| ::serde::de::Error::missing_field("is_paired"))?,
707 account_type: field_account_type.ok_or_else(|| ::serde::de::Error::missing_field("account_type"))?,
708 root_info: field_root_info.ok_or_else(|| ::serde::de::Error::missing_field("root_info"))?,
709 profile_photo_url: field_profile_photo_url.and_then(Option::flatten),
710 country: field_country.and_then(Option::flatten),
711 team: field_team.and_then(Option::flatten),
712 team_member_id: field_team_member_id.and_then(Option::flatten),
713 };
714 Ok(Some(result))
715 }
716
717 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
718 &self,
719 s: &mut S::SerializeStruct,
720 ) -> Result<(), S::Error> {
721 use serde::ser::SerializeStruct;
722 s.serialize_field("account_id", &self.account_id)?;
723 s.serialize_field("name", &self.name)?;
724 s.serialize_field("email", &self.email)?;
725 s.serialize_field("email_verified", &self.email_verified)?;
726 s.serialize_field("disabled", &self.disabled)?;
727 s.serialize_field("locale", &self.locale)?;
728 s.serialize_field("referral_link", &self.referral_link)?;
729 s.serialize_field("is_paired", &self.is_paired)?;
730 s.serialize_field("account_type", &self.account_type)?;
731 s.serialize_field("root_info", &self.root_info)?;
732 if let Some(val) = &self.profile_photo_url {
733 s.serialize_field("profile_photo_url", val)?;
734 }
735 if let Some(val) = &self.country {
736 s.serialize_field("country", val)?;
737 }
738 if let Some(val) = &self.team {
739 s.serialize_field("team", val)?;
740 }
741 if let Some(val) = &self.team_member_id {
742 s.serialize_field("team_member_id", val)?;
743 }
744 Ok(())
745 }
746}
747
748impl<'de> ::serde::de::Deserialize<'de> for FullAccount {
749 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
750 use serde::de::{MapAccess, Visitor};
752 struct StructVisitor;
753 impl<'de> Visitor<'de> for StructVisitor {
754 type Value = FullAccount;
755 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
756 f.write_str("a FullAccount struct")
757 }
758 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
759 FullAccount::internal_deserialize(map)
760 }
761 }
762 deserializer.deserialize_struct("FullAccount", FULL_ACCOUNT_FIELDS, StructVisitor)
763 }
764}
765
766impl ::serde::ser::Serialize for FullAccount {
767 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
768 use serde::ser::SerializeStruct;
770 let mut s = serializer.serialize_struct("FullAccount", 14)?;
771 self.internal_serialize::<S>(&mut s)?;
772 s.end()
773 }
774}
775
776impl From<FullAccount> for Account {
778 fn from(subtype: FullAccount) -> Self {
779 Self {
780 account_id: subtype.account_id,
781 name: subtype.name,
782 email: subtype.email,
783 email_verified: subtype.email_verified,
784 disabled: subtype.disabled,
785 profile_photo_url: subtype.profile_photo_url,
786 }
787 }
788}
789#[derive(Debug, Clone, PartialEq, Eq)]
791#[non_exhaustive] pub struct FullTeam {
793 pub id: String,
795 pub name: String,
797 pub sharing_policies: crate::types::team_policies::TeamSharingPolicies,
799 pub office_addin_policy: crate::types::team_policies::OfficeAddInPolicy,
801}
802
803impl FullTeam {
804 pub fn new(
805 id: String,
806 name: String,
807 sharing_policies: crate::types::team_policies::TeamSharingPolicies,
808 office_addin_policy: crate::types::team_policies::OfficeAddInPolicy,
809 ) -> Self {
810 FullTeam {
811 id,
812 name,
813 sharing_policies,
814 office_addin_policy,
815 }
816 }
817}
818
819const FULL_TEAM_FIELDS: &[&str] = &["id",
820 "name",
821 "sharing_policies",
822 "office_addin_policy"];
823impl FullTeam {
824 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
825 map: V,
826 ) -> Result<FullTeam, V::Error> {
827 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
828 }
829
830 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
831 mut map: V,
832 optional: bool,
833 ) -> Result<Option<FullTeam>, V::Error> {
834 let mut field_id = None;
835 let mut field_name = None;
836 let mut field_sharing_policies = None;
837 let mut field_office_addin_policy = None;
838 let mut nothing = true;
839 while let Some(key) = map.next_key::<&str>()? {
840 nothing = false;
841 match key {
842 "id" => {
843 if field_id.is_some() {
844 return Err(::serde::de::Error::duplicate_field("id"));
845 }
846 field_id = Some(map.next_value()?);
847 }
848 "name" => {
849 if field_name.is_some() {
850 return Err(::serde::de::Error::duplicate_field("name"));
851 }
852 field_name = Some(map.next_value()?);
853 }
854 "sharing_policies" => {
855 if field_sharing_policies.is_some() {
856 return Err(::serde::de::Error::duplicate_field("sharing_policies"));
857 }
858 field_sharing_policies = Some(map.next_value()?);
859 }
860 "office_addin_policy" => {
861 if field_office_addin_policy.is_some() {
862 return Err(::serde::de::Error::duplicate_field("office_addin_policy"));
863 }
864 field_office_addin_policy = Some(map.next_value()?);
865 }
866 _ => {
867 map.next_value::<::serde_json::Value>()?;
869 }
870 }
871 }
872 if optional && nothing {
873 return Ok(None);
874 }
875 let result = FullTeam {
876 id: field_id.ok_or_else(|| ::serde::de::Error::missing_field("id"))?,
877 name: field_name.ok_or_else(|| ::serde::de::Error::missing_field("name"))?,
878 sharing_policies: field_sharing_policies.ok_or_else(|| ::serde::de::Error::missing_field("sharing_policies"))?,
879 office_addin_policy: field_office_addin_policy.ok_or_else(|| ::serde::de::Error::missing_field("office_addin_policy"))?,
880 };
881 Ok(Some(result))
882 }
883
884 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
885 &self,
886 s: &mut S::SerializeStruct,
887 ) -> Result<(), S::Error> {
888 use serde::ser::SerializeStruct;
889 s.serialize_field("id", &self.id)?;
890 s.serialize_field("name", &self.name)?;
891 s.serialize_field("sharing_policies", &self.sharing_policies)?;
892 s.serialize_field("office_addin_policy", &self.office_addin_policy)?;
893 Ok(())
894 }
895}
896
897impl<'de> ::serde::de::Deserialize<'de> for FullTeam {
898 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
899 use serde::de::{MapAccess, Visitor};
901 struct StructVisitor;
902 impl<'de> Visitor<'de> for StructVisitor {
903 type Value = FullTeam;
904 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
905 f.write_str("a FullTeam struct")
906 }
907 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
908 FullTeam::internal_deserialize(map)
909 }
910 }
911 deserializer.deserialize_struct("FullTeam", FULL_TEAM_FIELDS, StructVisitor)
912 }
913}
914
915impl ::serde::ser::Serialize for FullTeam {
916 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
917 use serde::ser::SerializeStruct;
919 let mut s = serializer.serialize_struct("FullTeam", 4)?;
920 self.internal_serialize::<S>(&mut s)?;
921 s.end()
922 }
923}
924
925impl From<FullTeam> for Team {
927 fn from(subtype: FullTeam) -> Self {
928 Self {
929 id: subtype.id,
930 name: subtype.name,
931 }
932 }
933}
934#[derive(Debug, Clone, PartialEq, Eq)]
935#[non_exhaustive] pub struct GetAccountArg {
937 pub account_id: crate::types::users_common::AccountId,
939}
940
941impl GetAccountArg {
942 pub fn new(account_id: crate::types::users_common::AccountId) -> Self {
943 GetAccountArg {
944 account_id,
945 }
946 }
947}
948
949const GET_ACCOUNT_ARG_FIELDS: &[&str] = &["account_id"];
950impl GetAccountArg {
951 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
952 map: V,
953 ) -> Result<GetAccountArg, V::Error> {
954 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
955 }
956
957 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
958 mut map: V,
959 optional: bool,
960 ) -> Result<Option<GetAccountArg>, V::Error> {
961 let mut field_account_id = None;
962 let mut nothing = true;
963 while let Some(key) = map.next_key::<&str>()? {
964 nothing = false;
965 match key {
966 "account_id" => {
967 if field_account_id.is_some() {
968 return Err(::serde::de::Error::duplicate_field("account_id"));
969 }
970 field_account_id = Some(map.next_value()?);
971 }
972 _ => {
973 map.next_value::<::serde_json::Value>()?;
975 }
976 }
977 }
978 if optional && nothing {
979 return Ok(None);
980 }
981 let result = GetAccountArg {
982 account_id: field_account_id.ok_or_else(|| ::serde::de::Error::missing_field("account_id"))?,
983 };
984 Ok(Some(result))
985 }
986
987 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
988 &self,
989 s: &mut S::SerializeStruct,
990 ) -> Result<(), S::Error> {
991 use serde::ser::SerializeStruct;
992 s.serialize_field("account_id", &self.account_id)?;
993 Ok(())
994 }
995}
996
997impl<'de> ::serde::de::Deserialize<'de> for GetAccountArg {
998 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
999 use serde::de::{MapAccess, Visitor};
1001 struct StructVisitor;
1002 impl<'de> Visitor<'de> for StructVisitor {
1003 type Value = GetAccountArg;
1004 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1005 f.write_str("a GetAccountArg struct")
1006 }
1007 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1008 GetAccountArg::internal_deserialize(map)
1009 }
1010 }
1011 deserializer.deserialize_struct("GetAccountArg", GET_ACCOUNT_ARG_FIELDS, StructVisitor)
1012 }
1013}
1014
1015impl ::serde::ser::Serialize for GetAccountArg {
1016 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1017 use serde::ser::SerializeStruct;
1019 let mut s = serializer.serialize_struct("GetAccountArg", 1)?;
1020 self.internal_serialize::<S>(&mut s)?;
1021 s.end()
1022 }
1023}
1024
1025#[derive(Debug, Clone, PartialEq, Eq)]
1026#[non_exhaustive] pub struct GetAccountBatchArg {
1028 pub account_ids: Vec<crate::types::users_common::AccountId>,
1030}
1031
1032impl GetAccountBatchArg {
1033 pub fn new(account_ids: Vec<crate::types::users_common::AccountId>) -> Self {
1034 GetAccountBatchArg {
1035 account_ids,
1036 }
1037 }
1038}
1039
1040const GET_ACCOUNT_BATCH_ARG_FIELDS: &[&str] = &["account_ids"];
1041impl GetAccountBatchArg {
1042 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
1043 map: V,
1044 ) -> Result<GetAccountBatchArg, V::Error> {
1045 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
1046 }
1047
1048 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
1049 mut map: V,
1050 optional: bool,
1051 ) -> Result<Option<GetAccountBatchArg>, V::Error> {
1052 let mut field_account_ids = None;
1053 let mut nothing = true;
1054 while let Some(key) = map.next_key::<&str>()? {
1055 nothing = false;
1056 match key {
1057 "account_ids" => {
1058 if field_account_ids.is_some() {
1059 return Err(::serde::de::Error::duplicate_field("account_ids"));
1060 }
1061 field_account_ids = Some(map.next_value()?);
1062 }
1063 _ => {
1064 map.next_value::<::serde_json::Value>()?;
1066 }
1067 }
1068 }
1069 if optional && nothing {
1070 return Ok(None);
1071 }
1072 let result = GetAccountBatchArg {
1073 account_ids: field_account_ids.ok_or_else(|| ::serde::de::Error::missing_field("account_ids"))?,
1074 };
1075 Ok(Some(result))
1076 }
1077
1078 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
1079 &self,
1080 s: &mut S::SerializeStruct,
1081 ) -> Result<(), S::Error> {
1082 use serde::ser::SerializeStruct;
1083 s.serialize_field("account_ids", &self.account_ids)?;
1084 Ok(())
1085 }
1086}
1087
1088impl<'de> ::serde::de::Deserialize<'de> for GetAccountBatchArg {
1089 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1090 use serde::de::{MapAccess, Visitor};
1092 struct StructVisitor;
1093 impl<'de> Visitor<'de> for StructVisitor {
1094 type Value = GetAccountBatchArg;
1095 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1096 f.write_str("a GetAccountBatchArg struct")
1097 }
1098 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1099 GetAccountBatchArg::internal_deserialize(map)
1100 }
1101 }
1102 deserializer.deserialize_struct("GetAccountBatchArg", GET_ACCOUNT_BATCH_ARG_FIELDS, StructVisitor)
1103 }
1104}
1105
1106impl ::serde::ser::Serialize for GetAccountBatchArg {
1107 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1108 use serde::ser::SerializeStruct;
1110 let mut s = serializer.serialize_struct("GetAccountBatchArg", 1)?;
1111 self.internal_serialize::<S>(&mut s)?;
1112 s.end()
1113 }
1114}
1115
1116#[derive(Debug, Clone, PartialEq, Eq)]
1117#[non_exhaustive] pub enum GetAccountBatchError {
1119 NoAccount(crate::types::users_common::AccountId),
1122 Other,
1125}
1126
1127impl<'de> ::serde::de::Deserialize<'de> for GetAccountBatchError {
1128 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1129 use serde::de::{self, MapAccess, Visitor};
1131 struct EnumVisitor;
1132 impl<'de> Visitor<'de> for EnumVisitor {
1133 type Value = GetAccountBatchError;
1134 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1135 f.write_str("a GetAccountBatchError structure")
1136 }
1137 fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
1138 let tag: &str = match map.next_key()? {
1139 Some(".tag") => map.next_value()?,
1140 _ => return Err(de::Error::missing_field(".tag"))
1141 };
1142 let value = match tag {
1143 "no_account" => {
1144 match map.next_key()? {
1145 Some("no_account") => GetAccountBatchError::NoAccount(map.next_value()?),
1146 None => return Err(de::Error::missing_field("no_account")),
1147 _ => return Err(de::Error::unknown_field(tag, VARIANTS))
1148 }
1149 }
1150 _ => GetAccountBatchError::Other,
1151 };
1152 crate::eat_json_fields(&mut map)?;
1153 Ok(value)
1154 }
1155 }
1156 const VARIANTS: &[&str] = &["no_account",
1157 "other"];
1158 deserializer.deserialize_struct("GetAccountBatchError", VARIANTS, EnumVisitor)
1159 }
1160}
1161
1162impl ::serde::ser::Serialize for GetAccountBatchError {
1163 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1164 use serde::ser::SerializeStruct;
1166 match self {
1167 GetAccountBatchError::NoAccount(x) => {
1168 let mut s = serializer.serialize_struct("GetAccountBatchError", 2)?;
1170 s.serialize_field(".tag", "no_account")?;
1171 s.serialize_field("no_account", x)?;
1172 s.end()
1173 }
1174 GetAccountBatchError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
1175 }
1176 }
1177}
1178
1179impl ::std::error::Error for GetAccountBatchError {
1180}
1181
1182impl ::std::fmt::Display for GetAccountBatchError {
1183 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1184 match self {
1185 GetAccountBatchError::NoAccount(inner) => write!(f, "no_account: {:?}", inner),
1186 _ => write!(f, "{:?}", *self),
1187 }
1188 }
1189}
1190
1191#[derive(Debug, Clone, PartialEq, Eq)]
1192#[non_exhaustive] pub enum GetAccountError {
1194 NoAccount,
1196 Other,
1199}
1200
1201impl<'de> ::serde::de::Deserialize<'de> for GetAccountError {
1202 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1203 use serde::de::{self, MapAccess, Visitor};
1205 struct EnumVisitor;
1206 impl<'de> Visitor<'de> for EnumVisitor {
1207 type Value = GetAccountError;
1208 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1209 f.write_str("a GetAccountError structure")
1210 }
1211 fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
1212 let tag: &str = match map.next_key()? {
1213 Some(".tag") => map.next_value()?,
1214 _ => return Err(de::Error::missing_field(".tag"))
1215 };
1216 let value = match tag {
1217 "no_account" => GetAccountError::NoAccount,
1218 _ => GetAccountError::Other,
1219 };
1220 crate::eat_json_fields(&mut map)?;
1221 Ok(value)
1222 }
1223 }
1224 const VARIANTS: &[&str] = &["no_account",
1225 "other"];
1226 deserializer.deserialize_struct("GetAccountError", VARIANTS, EnumVisitor)
1227 }
1228}
1229
1230impl ::serde::ser::Serialize for GetAccountError {
1231 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1232 use serde::ser::SerializeStruct;
1234 match self {
1235 GetAccountError::NoAccount => {
1236 let mut s = serializer.serialize_struct("GetAccountError", 1)?;
1238 s.serialize_field(".tag", "no_account")?;
1239 s.end()
1240 }
1241 GetAccountError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
1242 }
1243 }
1244}
1245
1246impl ::std::error::Error for GetAccountError {
1247}
1248
1249impl ::std::fmt::Display for GetAccountError {
1250 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1251 write!(f, "{:?}", *self)
1252 }
1253}
1254
1255#[derive(Debug, Clone, PartialEq, Eq)]
1256#[non_exhaustive] pub struct IndividualSpaceAllocation {
1258 pub allocated: u64,
1260}
1261
1262impl IndividualSpaceAllocation {
1263 pub fn new(allocated: u64) -> Self {
1264 IndividualSpaceAllocation {
1265 allocated,
1266 }
1267 }
1268}
1269
1270const INDIVIDUAL_SPACE_ALLOCATION_FIELDS: &[&str] = &["allocated"];
1271impl IndividualSpaceAllocation {
1272 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
1273 map: V,
1274 ) -> Result<IndividualSpaceAllocation, V::Error> {
1275 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
1276 }
1277
1278 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
1279 mut map: V,
1280 optional: bool,
1281 ) -> Result<Option<IndividualSpaceAllocation>, V::Error> {
1282 let mut field_allocated = None;
1283 let mut nothing = true;
1284 while let Some(key) = map.next_key::<&str>()? {
1285 nothing = false;
1286 match key {
1287 "allocated" => {
1288 if field_allocated.is_some() {
1289 return Err(::serde::de::Error::duplicate_field("allocated"));
1290 }
1291 field_allocated = Some(map.next_value()?);
1292 }
1293 _ => {
1294 map.next_value::<::serde_json::Value>()?;
1296 }
1297 }
1298 }
1299 if optional && nothing {
1300 return Ok(None);
1301 }
1302 let result = IndividualSpaceAllocation {
1303 allocated: field_allocated.ok_or_else(|| ::serde::de::Error::missing_field("allocated"))?,
1304 };
1305 Ok(Some(result))
1306 }
1307
1308 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
1309 &self,
1310 s: &mut S::SerializeStruct,
1311 ) -> Result<(), S::Error> {
1312 use serde::ser::SerializeStruct;
1313 s.serialize_field("allocated", &self.allocated)?;
1314 Ok(())
1315 }
1316}
1317
1318impl<'de> ::serde::de::Deserialize<'de> for IndividualSpaceAllocation {
1319 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1320 use serde::de::{MapAccess, Visitor};
1322 struct StructVisitor;
1323 impl<'de> Visitor<'de> for StructVisitor {
1324 type Value = IndividualSpaceAllocation;
1325 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1326 f.write_str("a IndividualSpaceAllocation struct")
1327 }
1328 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1329 IndividualSpaceAllocation::internal_deserialize(map)
1330 }
1331 }
1332 deserializer.deserialize_struct("IndividualSpaceAllocation", INDIVIDUAL_SPACE_ALLOCATION_FIELDS, StructVisitor)
1333 }
1334}
1335
1336impl ::serde::ser::Serialize for IndividualSpaceAllocation {
1337 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1338 use serde::ser::SerializeStruct;
1340 let mut s = serializer.serialize_struct("IndividualSpaceAllocation", 1)?;
1341 self.internal_serialize::<S>(&mut s)?;
1342 s.end()
1343 }
1344}
1345
1346#[derive(Debug, Clone, PartialEq, Eq)]
1348#[non_exhaustive] pub struct Name {
1350 pub given_name: String,
1352 pub surname: String,
1354 pub familiar_name: String,
1357 pub display_name: String,
1359 pub abbreviated_name: String,
1361}
1362
1363impl Name {
1364 pub fn new(
1365 given_name: String,
1366 surname: String,
1367 familiar_name: String,
1368 display_name: String,
1369 abbreviated_name: String,
1370 ) -> Self {
1371 Name {
1372 given_name,
1373 surname,
1374 familiar_name,
1375 display_name,
1376 abbreviated_name,
1377 }
1378 }
1379}
1380
1381const NAME_FIELDS: &[&str] = &["given_name",
1382 "surname",
1383 "familiar_name",
1384 "display_name",
1385 "abbreviated_name"];
1386impl Name {
1387 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
1388 map: V,
1389 ) -> Result<Name, V::Error> {
1390 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
1391 }
1392
1393 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
1394 mut map: V,
1395 optional: bool,
1396 ) -> Result<Option<Name>, V::Error> {
1397 let mut field_given_name = None;
1398 let mut field_surname = None;
1399 let mut field_familiar_name = None;
1400 let mut field_display_name = None;
1401 let mut field_abbreviated_name = None;
1402 let mut nothing = true;
1403 while let Some(key) = map.next_key::<&str>()? {
1404 nothing = false;
1405 match key {
1406 "given_name" => {
1407 if field_given_name.is_some() {
1408 return Err(::serde::de::Error::duplicate_field("given_name"));
1409 }
1410 field_given_name = Some(map.next_value()?);
1411 }
1412 "surname" => {
1413 if field_surname.is_some() {
1414 return Err(::serde::de::Error::duplicate_field("surname"));
1415 }
1416 field_surname = Some(map.next_value()?);
1417 }
1418 "familiar_name" => {
1419 if field_familiar_name.is_some() {
1420 return Err(::serde::de::Error::duplicate_field("familiar_name"));
1421 }
1422 field_familiar_name = Some(map.next_value()?);
1423 }
1424 "display_name" => {
1425 if field_display_name.is_some() {
1426 return Err(::serde::de::Error::duplicate_field("display_name"));
1427 }
1428 field_display_name = Some(map.next_value()?);
1429 }
1430 "abbreviated_name" => {
1431 if field_abbreviated_name.is_some() {
1432 return Err(::serde::de::Error::duplicate_field("abbreviated_name"));
1433 }
1434 field_abbreviated_name = Some(map.next_value()?);
1435 }
1436 _ => {
1437 map.next_value::<::serde_json::Value>()?;
1439 }
1440 }
1441 }
1442 if optional && nothing {
1443 return Ok(None);
1444 }
1445 let result = Name {
1446 given_name: field_given_name.ok_or_else(|| ::serde::de::Error::missing_field("given_name"))?,
1447 surname: field_surname.ok_or_else(|| ::serde::de::Error::missing_field("surname"))?,
1448 familiar_name: field_familiar_name.ok_or_else(|| ::serde::de::Error::missing_field("familiar_name"))?,
1449 display_name: field_display_name.ok_or_else(|| ::serde::de::Error::missing_field("display_name"))?,
1450 abbreviated_name: field_abbreviated_name.ok_or_else(|| ::serde::de::Error::missing_field("abbreviated_name"))?,
1451 };
1452 Ok(Some(result))
1453 }
1454
1455 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
1456 &self,
1457 s: &mut S::SerializeStruct,
1458 ) -> Result<(), S::Error> {
1459 use serde::ser::SerializeStruct;
1460 s.serialize_field("given_name", &self.given_name)?;
1461 s.serialize_field("surname", &self.surname)?;
1462 s.serialize_field("familiar_name", &self.familiar_name)?;
1463 s.serialize_field("display_name", &self.display_name)?;
1464 s.serialize_field("abbreviated_name", &self.abbreviated_name)?;
1465 Ok(())
1466 }
1467}
1468
1469impl<'de> ::serde::de::Deserialize<'de> for Name {
1470 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1471 use serde::de::{MapAccess, Visitor};
1473 struct StructVisitor;
1474 impl<'de> Visitor<'de> for StructVisitor {
1475 type Value = Name;
1476 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1477 f.write_str("a Name struct")
1478 }
1479 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1480 Name::internal_deserialize(map)
1481 }
1482 }
1483 deserializer.deserialize_struct("Name", NAME_FIELDS, StructVisitor)
1484 }
1485}
1486
1487impl ::serde::ser::Serialize for Name {
1488 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1489 use serde::ser::SerializeStruct;
1491 let mut s = serializer.serialize_struct("Name", 5)?;
1492 self.internal_serialize::<S>(&mut s)?;
1493 s.end()
1494 }
1495}
1496
1497#[derive(Debug, Clone, PartialEq, Eq)]
1499#[non_exhaustive] pub enum PaperAsFilesValue {
1501 Enabled(bool),
1506 Other,
1509}
1510
1511impl<'de> ::serde::de::Deserialize<'de> for PaperAsFilesValue {
1512 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1513 use serde::de::{self, MapAccess, Visitor};
1515 struct EnumVisitor;
1516 impl<'de> Visitor<'de> for EnumVisitor {
1517 type Value = PaperAsFilesValue;
1518 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1519 f.write_str("a PaperAsFilesValue structure")
1520 }
1521 fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
1522 let tag: &str = match map.next_key()? {
1523 Some(".tag") => map.next_value()?,
1524 _ => return Err(de::Error::missing_field(".tag"))
1525 };
1526 let value = match tag {
1527 "enabled" => {
1528 match map.next_key()? {
1529 Some("enabled") => PaperAsFilesValue::Enabled(map.next_value()?),
1530 None => return Err(de::Error::missing_field("enabled")),
1531 _ => return Err(de::Error::unknown_field(tag, VARIANTS))
1532 }
1533 }
1534 _ => PaperAsFilesValue::Other,
1535 };
1536 crate::eat_json_fields(&mut map)?;
1537 Ok(value)
1538 }
1539 }
1540 const VARIANTS: &[&str] = &["enabled",
1541 "other"];
1542 deserializer.deserialize_struct("PaperAsFilesValue", VARIANTS, EnumVisitor)
1543 }
1544}
1545
1546impl ::serde::ser::Serialize for PaperAsFilesValue {
1547 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1548 use serde::ser::SerializeStruct;
1550 match self {
1551 PaperAsFilesValue::Enabled(x) => {
1552 let mut s = serializer.serialize_struct("PaperAsFilesValue", 2)?;
1554 s.serialize_field(".tag", "enabled")?;
1555 s.serialize_field("enabled", x)?;
1556 s.end()
1557 }
1558 PaperAsFilesValue::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
1559 }
1560 }
1561}
1562
1563#[derive(Debug, Clone, PartialEq, Eq)]
1565#[non_exhaustive] pub enum SpaceAllocation {
1567 Individual(IndividualSpaceAllocation),
1569 Team(TeamSpaceAllocation),
1571 Other,
1574}
1575
1576impl<'de> ::serde::de::Deserialize<'de> for SpaceAllocation {
1577 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1578 use serde::de::{self, MapAccess, Visitor};
1580 struct EnumVisitor;
1581 impl<'de> Visitor<'de> for EnumVisitor {
1582 type Value = SpaceAllocation;
1583 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1584 f.write_str("a SpaceAllocation structure")
1585 }
1586 fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
1587 let tag: &str = match map.next_key()? {
1588 Some(".tag") => map.next_value()?,
1589 _ => return Err(de::Error::missing_field(".tag"))
1590 };
1591 let value = match tag {
1592 "individual" => SpaceAllocation::Individual(IndividualSpaceAllocation::internal_deserialize(&mut map)?),
1593 "team" => SpaceAllocation::Team(TeamSpaceAllocation::internal_deserialize(&mut map)?),
1594 _ => SpaceAllocation::Other,
1595 };
1596 crate::eat_json_fields(&mut map)?;
1597 Ok(value)
1598 }
1599 }
1600 const VARIANTS: &[&str] = &["individual",
1601 "team",
1602 "other"];
1603 deserializer.deserialize_struct("SpaceAllocation", VARIANTS, EnumVisitor)
1604 }
1605}
1606
1607impl ::serde::ser::Serialize for SpaceAllocation {
1608 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1609 use serde::ser::SerializeStruct;
1611 match self {
1612 SpaceAllocation::Individual(x) => {
1613 let mut s = serializer.serialize_struct("SpaceAllocation", 2)?;
1615 s.serialize_field(".tag", "individual")?;
1616 x.internal_serialize::<S>(&mut s)?;
1617 s.end()
1618 }
1619 SpaceAllocation::Team(x) => {
1620 let mut s = serializer.serialize_struct("SpaceAllocation", 6)?;
1622 s.serialize_field(".tag", "team")?;
1623 x.internal_serialize::<S>(&mut s)?;
1624 s.end()
1625 }
1626 SpaceAllocation::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
1627 }
1628 }
1629}
1630
1631#[derive(Debug, Clone, PartialEq, Eq)]
1633#[non_exhaustive] pub struct SpaceUsage {
1635 pub used: u64,
1637 pub allocation: SpaceAllocation,
1639}
1640
1641impl SpaceUsage {
1642 pub fn new(used: u64, allocation: SpaceAllocation) -> Self {
1643 SpaceUsage {
1644 used,
1645 allocation,
1646 }
1647 }
1648}
1649
1650const SPACE_USAGE_FIELDS: &[&str] = &["used",
1651 "allocation"];
1652impl SpaceUsage {
1653 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
1654 map: V,
1655 ) -> Result<SpaceUsage, V::Error> {
1656 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
1657 }
1658
1659 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
1660 mut map: V,
1661 optional: bool,
1662 ) -> Result<Option<SpaceUsage>, V::Error> {
1663 let mut field_used = None;
1664 let mut field_allocation = None;
1665 let mut nothing = true;
1666 while let Some(key) = map.next_key::<&str>()? {
1667 nothing = false;
1668 match key {
1669 "used" => {
1670 if field_used.is_some() {
1671 return Err(::serde::de::Error::duplicate_field("used"));
1672 }
1673 field_used = Some(map.next_value()?);
1674 }
1675 "allocation" => {
1676 if field_allocation.is_some() {
1677 return Err(::serde::de::Error::duplicate_field("allocation"));
1678 }
1679 field_allocation = Some(map.next_value()?);
1680 }
1681 _ => {
1682 map.next_value::<::serde_json::Value>()?;
1684 }
1685 }
1686 }
1687 if optional && nothing {
1688 return Ok(None);
1689 }
1690 let result = SpaceUsage {
1691 used: field_used.ok_or_else(|| ::serde::de::Error::missing_field("used"))?,
1692 allocation: field_allocation.ok_or_else(|| ::serde::de::Error::missing_field("allocation"))?,
1693 };
1694 Ok(Some(result))
1695 }
1696
1697 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
1698 &self,
1699 s: &mut S::SerializeStruct,
1700 ) -> Result<(), S::Error> {
1701 use serde::ser::SerializeStruct;
1702 s.serialize_field("used", &self.used)?;
1703 s.serialize_field("allocation", &self.allocation)?;
1704 Ok(())
1705 }
1706}
1707
1708impl<'de> ::serde::de::Deserialize<'de> for SpaceUsage {
1709 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1710 use serde::de::{MapAccess, Visitor};
1712 struct StructVisitor;
1713 impl<'de> Visitor<'de> for StructVisitor {
1714 type Value = SpaceUsage;
1715 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1716 f.write_str("a SpaceUsage struct")
1717 }
1718 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1719 SpaceUsage::internal_deserialize(map)
1720 }
1721 }
1722 deserializer.deserialize_struct("SpaceUsage", SPACE_USAGE_FIELDS, StructVisitor)
1723 }
1724}
1725
1726impl ::serde::ser::Serialize for SpaceUsage {
1727 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1728 use serde::ser::SerializeStruct;
1730 let mut s = serializer.serialize_struct("SpaceUsage", 2)?;
1731 self.internal_serialize::<S>(&mut s)?;
1732 s.end()
1733 }
1734}
1735
1736#[derive(Debug, Clone, PartialEq, Eq)]
1738#[non_exhaustive] pub struct Team {
1740 pub id: String,
1742 pub name: String,
1744}
1745
1746impl Team {
1747 pub fn new(id: String, name: String) -> Self {
1748 Team {
1749 id,
1750 name,
1751 }
1752 }
1753}
1754
1755const TEAM_FIELDS: &[&str] = &["id",
1756 "name"];
1757impl Team {
1758 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
1759 map: V,
1760 ) -> Result<Team, V::Error> {
1761 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
1762 }
1763
1764 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
1765 mut map: V,
1766 optional: bool,
1767 ) -> Result<Option<Team>, V::Error> {
1768 let mut field_id = None;
1769 let mut field_name = None;
1770 let mut nothing = true;
1771 while let Some(key) = map.next_key::<&str>()? {
1772 nothing = false;
1773 match key {
1774 "id" => {
1775 if field_id.is_some() {
1776 return Err(::serde::de::Error::duplicate_field("id"));
1777 }
1778 field_id = Some(map.next_value()?);
1779 }
1780 "name" => {
1781 if field_name.is_some() {
1782 return Err(::serde::de::Error::duplicate_field("name"));
1783 }
1784 field_name = Some(map.next_value()?);
1785 }
1786 _ => {
1787 map.next_value::<::serde_json::Value>()?;
1789 }
1790 }
1791 }
1792 if optional && nothing {
1793 return Ok(None);
1794 }
1795 let result = Team {
1796 id: field_id.ok_or_else(|| ::serde::de::Error::missing_field("id"))?,
1797 name: field_name.ok_or_else(|| ::serde::de::Error::missing_field("name"))?,
1798 };
1799 Ok(Some(result))
1800 }
1801
1802 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
1803 &self,
1804 s: &mut S::SerializeStruct,
1805 ) -> Result<(), S::Error> {
1806 use serde::ser::SerializeStruct;
1807 s.serialize_field("id", &self.id)?;
1808 s.serialize_field("name", &self.name)?;
1809 Ok(())
1810 }
1811}
1812
1813impl<'de> ::serde::de::Deserialize<'de> for Team {
1814 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1815 use serde::de::{MapAccess, Visitor};
1817 struct StructVisitor;
1818 impl<'de> Visitor<'de> for StructVisitor {
1819 type Value = Team;
1820 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1821 f.write_str("a Team struct")
1822 }
1823 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1824 Team::internal_deserialize(map)
1825 }
1826 }
1827 deserializer.deserialize_struct("Team", TEAM_FIELDS, StructVisitor)
1828 }
1829}
1830
1831impl ::serde::ser::Serialize for Team {
1832 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1833 use serde::ser::SerializeStruct;
1835 let mut s = serializer.serialize_struct("Team", 2)?;
1836 self.internal_serialize::<S>(&mut s)?;
1837 s.end()
1838 }
1839}
1840
1841#[derive(Debug, Clone, PartialEq, Eq)]
1842#[non_exhaustive] pub struct TeamSpaceAllocation {
1844 pub used: u64,
1846 pub allocated: u64,
1848 pub user_within_team_space_allocated: u64,
1851 pub user_within_team_space_limit_type: crate::types::team_common::MemberSpaceLimitType,
1853 pub user_within_team_space_used_cached: u64,
1855}
1856
1857impl TeamSpaceAllocation {
1858 pub fn new(
1859 used: u64,
1860 allocated: u64,
1861 user_within_team_space_allocated: u64,
1862 user_within_team_space_limit_type: crate::types::team_common::MemberSpaceLimitType,
1863 user_within_team_space_used_cached: u64,
1864 ) -> Self {
1865 TeamSpaceAllocation {
1866 used,
1867 allocated,
1868 user_within_team_space_allocated,
1869 user_within_team_space_limit_type,
1870 user_within_team_space_used_cached,
1871 }
1872 }
1873}
1874
1875const TEAM_SPACE_ALLOCATION_FIELDS: &[&str] = &["used",
1876 "allocated",
1877 "user_within_team_space_allocated",
1878 "user_within_team_space_limit_type",
1879 "user_within_team_space_used_cached"];
1880impl TeamSpaceAllocation {
1881 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
1882 map: V,
1883 ) -> Result<TeamSpaceAllocation, V::Error> {
1884 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
1885 }
1886
1887 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
1888 mut map: V,
1889 optional: bool,
1890 ) -> Result<Option<TeamSpaceAllocation>, V::Error> {
1891 let mut field_used = None;
1892 let mut field_allocated = None;
1893 let mut field_user_within_team_space_allocated = None;
1894 let mut field_user_within_team_space_limit_type = None;
1895 let mut field_user_within_team_space_used_cached = None;
1896 let mut nothing = true;
1897 while let Some(key) = map.next_key::<&str>()? {
1898 nothing = false;
1899 match key {
1900 "used" => {
1901 if field_used.is_some() {
1902 return Err(::serde::de::Error::duplicate_field("used"));
1903 }
1904 field_used = Some(map.next_value()?);
1905 }
1906 "allocated" => {
1907 if field_allocated.is_some() {
1908 return Err(::serde::de::Error::duplicate_field("allocated"));
1909 }
1910 field_allocated = Some(map.next_value()?);
1911 }
1912 "user_within_team_space_allocated" => {
1913 if field_user_within_team_space_allocated.is_some() {
1914 return Err(::serde::de::Error::duplicate_field("user_within_team_space_allocated"));
1915 }
1916 field_user_within_team_space_allocated = Some(map.next_value()?);
1917 }
1918 "user_within_team_space_limit_type" => {
1919 if field_user_within_team_space_limit_type.is_some() {
1920 return Err(::serde::de::Error::duplicate_field("user_within_team_space_limit_type"));
1921 }
1922 field_user_within_team_space_limit_type = Some(map.next_value()?);
1923 }
1924 "user_within_team_space_used_cached" => {
1925 if field_user_within_team_space_used_cached.is_some() {
1926 return Err(::serde::de::Error::duplicate_field("user_within_team_space_used_cached"));
1927 }
1928 field_user_within_team_space_used_cached = Some(map.next_value()?);
1929 }
1930 _ => {
1931 map.next_value::<::serde_json::Value>()?;
1933 }
1934 }
1935 }
1936 if optional && nothing {
1937 return Ok(None);
1938 }
1939 let result = TeamSpaceAllocation {
1940 used: field_used.ok_or_else(|| ::serde::de::Error::missing_field("used"))?,
1941 allocated: field_allocated.ok_or_else(|| ::serde::de::Error::missing_field("allocated"))?,
1942 user_within_team_space_allocated: field_user_within_team_space_allocated.ok_or_else(|| ::serde::de::Error::missing_field("user_within_team_space_allocated"))?,
1943 user_within_team_space_limit_type: field_user_within_team_space_limit_type.ok_or_else(|| ::serde::de::Error::missing_field("user_within_team_space_limit_type"))?,
1944 user_within_team_space_used_cached: field_user_within_team_space_used_cached.ok_or_else(|| ::serde::de::Error::missing_field("user_within_team_space_used_cached"))?,
1945 };
1946 Ok(Some(result))
1947 }
1948
1949 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
1950 &self,
1951 s: &mut S::SerializeStruct,
1952 ) -> Result<(), S::Error> {
1953 use serde::ser::SerializeStruct;
1954 s.serialize_field("used", &self.used)?;
1955 s.serialize_field("allocated", &self.allocated)?;
1956 s.serialize_field("user_within_team_space_allocated", &self.user_within_team_space_allocated)?;
1957 s.serialize_field("user_within_team_space_limit_type", &self.user_within_team_space_limit_type)?;
1958 s.serialize_field("user_within_team_space_used_cached", &self.user_within_team_space_used_cached)?;
1959 Ok(())
1960 }
1961}
1962
1963impl<'de> ::serde::de::Deserialize<'de> for TeamSpaceAllocation {
1964 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1965 use serde::de::{MapAccess, Visitor};
1967 struct StructVisitor;
1968 impl<'de> Visitor<'de> for StructVisitor {
1969 type Value = TeamSpaceAllocation;
1970 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1971 f.write_str("a TeamSpaceAllocation struct")
1972 }
1973 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1974 TeamSpaceAllocation::internal_deserialize(map)
1975 }
1976 }
1977 deserializer.deserialize_struct("TeamSpaceAllocation", TEAM_SPACE_ALLOCATION_FIELDS, StructVisitor)
1978 }
1979}
1980
1981impl ::serde::ser::Serialize for TeamSpaceAllocation {
1982 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1983 use serde::ser::SerializeStruct;
1985 let mut s = serializer.serialize_struct("TeamSpaceAllocation", 5)?;
1986 self.internal_serialize::<S>(&mut s)?;
1987 s.end()
1988 }
1989}
1990
1991#[derive(Debug, Clone, PartialEq, Eq)]
1993#[non_exhaustive] pub enum UserFeature {
1995 PaperAsFiles,
1997 FileLocking,
1999 Other,
2002}
2003
2004impl<'de> ::serde::de::Deserialize<'de> for UserFeature {
2005 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2006 use serde::de::{self, MapAccess, Visitor};
2008 struct EnumVisitor;
2009 impl<'de> Visitor<'de> for EnumVisitor {
2010 type Value = UserFeature;
2011 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2012 f.write_str("a UserFeature structure")
2013 }
2014 fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
2015 let tag: &str = match map.next_key()? {
2016 Some(".tag") => map.next_value()?,
2017 _ => return Err(de::Error::missing_field(".tag"))
2018 };
2019 let value = match tag {
2020 "paper_as_files" => UserFeature::PaperAsFiles,
2021 "file_locking" => UserFeature::FileLocking,
2022 _ => UserFeature::Other,
2023 };
2024 crate::eat_json_fields(&mut map)?;
2025 Ok(value)
2026 }
2027 }
2028 const VARIANTS: &[&str] = &["paper_as_files",
2029 "file_locking",
2030 "other"];
2031 deserializer.deserialize_struct("UserFeature", VARIANTS, EnumVisitor)
2032 }
2033}
2034
2035impl ::serde::ser::Serialize for UserFeature {
2036 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2037 use serde::ser::SerializeStruct;
2039 match self {
2040 UserFeature::PaperAsFiles => {
2041 let mut s = serializer.serialize_struct("UserFeature", 1)?;
2043 s.serialize_field(".tag", "paper_as_files")?;
2044 s.end()
2045 }
2046 UserFeature::FileLocking => {
2047 let mut s = serializer.serialize_struct("UserFeature", 1)?;
2049 s.serialize_field(".tag", "file_locking")?;
2050 s.end()
2051 }
2052 UserFeature::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
2053 }
2054 }
2055}
2056
2057#[derive(Debug, Clone, PartialEq, Eq)]
2059#[non_exhaustive] pub enum UserFeatureValue {
2061 PaperAsFiles(PaperAsFilesValue),
2062 FileLocking(FileLockingValue),
2063 Other,
2066}
2067
2068impl<'de> ::serde::de::Deserialize<'de> for UserFeatureValue {
2069 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2070 use serde::de::{self, MapAccess, Visitor};
2072 struct EnumVisitor;
2073 impl<'de> Visitor<'de> for EnumVisitor {
2074 type Value = UserFeatureValue;
2075 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2076 f.write_str("a UserFeatureValue structure")
2077 }
2078 fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
2079 let tag: &str = match map.next_key()? {
2080 Some(".tag") => map.next_value()?,
2081 _ => return Err(de::Error::missing_field(".tag"))
2082 };
2083 let value = match tag {
2084 "paper_as_files" => {
2085 match map.next_key()? {
2086 Some("paper_as_files") => UserFeatureValue::PaperAsFiles(map.next_value()?),
2087 None => return Err(de::Error::missing_field("paper_as_files")),
2088 _ => return Err(de::Error::unknown_field(tag, VARIANTS))
2089 }
2090 }
2091 "file_locking" => {
2092 match map.next_key()? {
2093 Some("file_locking") => UserFeatureValue::FileLocking(map.next_value()?),
2094 None => return Err(de::Error::missing_field("file_locking")),
2095 _ => return Err(de::Error::unknown_field(tag, VARIANTS))
2096 }
2097 }
2098 _ => UserFeatureValue::Other,
2099 };
2100 crate::eat_json_fields(&mut map)?;
2101 Ok(value)
2102 }
2103 }
2104 const VARIANTS: &[&str] = &["paper_as_files",
2105 "file_locking",
2106 "other"];
2107 deserializer.deserialize_struct("UserFeatureValue", VARIANTS, EnumVisitor)
2108 }
2109}
2110
2111impl ::serde::ser::Serialize for UserFeatureValue {
2112 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2113 use serde::ser::SerializeStruct;
2115 match self {
2116 UserFeatureValue::PaperAsFiles(x) => {
2117 let mut s = serializer.serialize_struct("UserFeatureValue", 2)?;
2119 s.serialize_field(".tag", "paper_as_files")?;
2120 s.serialize_field("paper_as_files", x)?;
2121 s.end()
2122 }
2123 UserFeatureValue::FileLocking(x) => {
2124 let mut s = serializer.serialize_struct("UserFeatureValue", 2)?;
2126 s.serialize_field(".tag", "file_locking")?;
2127 s.serialize_field("file_locking", x)?;
2128 s.end()
2129 }
2130 UserFeatureValue::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
2131 }
2132 }
2133}
2134
2135#[derive(Debug, Clone, PartialEq, Eq)]
2136#[non_exhaustive] pub struct UserFeaturesGetValuesBatchArg {
2138 pub features: Vec<UserFeature>,
2141}
2142
2143impl UserFeaturesGetValuesBatchArg {
2144 pub fn new(features: Vec<UserFeature>) -> Self {
2145 UserFeaturesGetValuesBatchArg {
2146 features,
2147 }
2148 }
2149}
2150
2151const USER_FEATURES_GET_VALUES_BATCH_ARG_FIELDS: &[&str] = &["features"];
2152impl UserFeaturesGetValuesBatchArg {
2153 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
2154 map: V,
2155 ) -> Result<UserFeaturesGetValuesBatchArg, V::Error> {
2156 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
2157 }
2158
2159 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
2160 mut map: V,
2161 optional: bool,
2162 ) -> Result<Option<UserFeaturesGetValuesBatchArg>, V::Error> {
2163 let mut field_features = None;
2164 let mut nothing = true;
2165 while let Some(key) = map.next_key::<&str>()? {
2166 nothing = false;
2167 match key {
2168 "features" => {
2169 if field_features.is_some() {
2170 return Err(::serde::de::Error::duplicate_field("features"));
2171 }
2172 field_features = Some(map.next_value()?);
2173 }
2174 _ => {
2175 map.next_value::<::serde_json::Value>()?;
2177 }
2178 }
2179 }
2180 if optional && nothing {
2181 return Ok(None);
2182 }
2183 let result = UserFeaturesGetValuesBatchArg {
2184 features: field_features.ok_or_else(|| ::serde::de::Error::missing_field("features"))?,
2185 };
2186 Ok(Some(result))
2187 }
2188
2189 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
2190 &self,
2191 s: &mut S::SerializeStruct,
2192 ) -> Result<(), S::Error> {
2193 use serde::ser::SerializeStruct;
2194 s.serialize_field("features", &self.features)?;
2195 Ok(())
2196 }
2197}
2198
2199impl<'de> ::serde::de::Deserialize<'de> for UserFeaturesGetValuesBatchArg {
2200 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2201 use serde::de::{MapAccess, Visitor};
2203 struct StructVisitor;
2204 impl<'de> Visitor<'de> for StructVisitor {
2205 type Value = UserFeaturesGetValuesBatchArg;
2206 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2207 f.write_str("a UserFeaturesGetValuesBatchArg struct")
2208 }
2209 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
2210 UserFeaturesGetValuesBatchArg::internal_deserialize(map)
2211 }
2212 }
2213 deserializer.deserialize_struct("UserFeaturesGetValuesBatchArg", USER_FEATURES_GET_VALUES_BATCH_ARG_FIELDS, StructVisitor)
2214 }
2215}
2216
2217impl ::serde::ser::Serialize for UserFeaturesGetValuesBatchArg {
2218 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2219 use serde::ser::SerializeStruct;
2221 let mut s = serializer.serialize_struct("UserFeaturesGetValuesBatchArg", 1)?;
2222 self.internal_serialize::<S>(&mut s)?;
2223 s.end()
2224 }
2225}
2226
2227#[derive(Debug, Clone, PartialEq, Eq)]
2228#[non_exhaustive] pub enum UserFeaturesGetValuesBatchError {
2230 EmptyFeaturesList,
2233 Other,
2236}
2237
2238impl<'de> ::serde::de::Deserialize<'de> for UserFeaturesGetValuesBatchError {
2239 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2240 use serde::de::{self, MapAccess, Visitor};
2242 struct EnumVisitor;
2243 impl<'de> Visitor<'de> for EnumVisitor {
2244 type Value = UserFeaturesGetValuesBatchError;
2245 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2246 f.write_str("a UserFeaturesGetValuesBatchError structure")
2247 }
2248 fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
2249 let tag: &str = match map.next_key()? {
2250 Some(".tag") => map.next_value()?,
2251 _ => return Err(de::Error::missing_field(".tag"))
2252 };
2253 let value = match tag {
2254 "empty_features_list" => UserFeaturesGetValuesBatchError::EmptyFeaturesList,
2255 _ => UserFeaturesGetValuesBatchError::Other,
2256 };
2257 crate::eat_json_fields(&mut map)?;
2258 Ok(value)
2259 }
2260 }
2261 const VARIANTS: &[&str] = &["empty_features_list",
2262 "other"];
2263 deserializer.deserialize_struct("UserFeaturesGetValuesBatchError", VARIANTS, EnumVisitor)
2264 }
2265}
2266
2267impl ::serde::ser::Serialize for UserFeaturesGetValuesBatchError {
2268 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2269 use serde::ser::SerializeStruct;
2271 match self {
2272 UserFeaturesGetValuesBatchError::EmptyFeaturesList => {
2273 let mut s = serializer.serialize_struct("UserFeaturesGetValuesBatchError", 1)?;
2275 s.serialize_field(".tag", "empty_features_list")?;
2276 s.end()
2277 }
2278 UserFeaturesGetValuesBatchError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
2279 }
2280 }
2281}
2282
2283impl ::std::error::Error for UserFeaturesGetValuesBatchError {
2284}
2285
2286impl ::std::fmt::Display for UserFeaturesGetValuesBatchError {
2287 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2288 write!(f, "{:?}", *self)
2289 }
2290}
2291
2292#[derive(Debug, Clone, PartialEq, Eq)]
2293#[non_exhaustive] pub struct UserFeaturesGetValuesBatchResult {
2295 pub values: Vec<UserFeatureValue>,
2296}
2297
2298impl UserFeaturesGetValuesBatchResult {
2299 pub fn new(values: Vec<UserFeatureValue>) -> Self {
2300 UserFeaturesGetValuesBatchResult {
2301 values,
2302 }
2303 }
2304}
2305
2306const USER_FEATURES_GET_VALUES_BATCH_RESULT_FIELDS: &[&str] = &["values"];
2307impl UserFeaturesGetValuesBatchResult {
2308 pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
2309 map: V,
2310 ) -> Result<UserFeaturesGetValuesBatchResult, V::Error> {
2311 Self::internal_deserialize_opt(map, false).map(Option::unwrap)
2312 }
2313
2314 pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
2315 mut map: V,
2316 optional: bool,
2317 ) -> Result<Option<UserFeaturesGetValuesBatchResult>, V::Error> {
2318 let mut field_values = None;
2319 let mut nothing = true;
2320 while let Some(key) = map.next_key::<&str>()? {
2321 nothing = false;
2322 match key {
2323 "values" => {
2324 if field_values.is_some() {
2325 return Err(::serde::de::Error::duplicate_field("values"));
2326 }
2327 field_values = Some(map.next_value()?);
2328 }
2329 _ => {
2330 map.next_value::<::serde_json::Value>()?;
2332 }
2333 }
2334 }
2335 if optional && nothing {
2336 return Ok(None);
2337 }
2338 let result = UserFeaturesGetValuesBatchResult {
2339 values: field_values.ok_or_else(|| ::serde::de::Error::missing_field("values"))?,
2340 };
2341 Ok(Some(result))
2342 }
2343
2344 pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
2345 &self,
2346 s: &mut S::SerializeStruct,
2347 ) -> Result<(), S::Error> {
2348 use serde::ser::SerializeStruct;
2349 s.serialize_field("values", &self.values)?;
2350 Ok(())
2351 }
2352}
2353
2354impl<'de> ::serde::de::Deserialize<'de> for UserFeaturesGetValuesBatchResult {
2355 fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2356 use serde::de::{MapAccess, Visitor};
2358 struct StructVisitor;
2359 impl<'de> Visitor<'de> for StructVisitor {
2360 type Value = UserFeaturesGetValuesBatchResult;
2361 fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
2362 f.write_str("a UserFeaturesGetValuesBatchResult struct")
2363 }
2364 fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
2365 UserFeaturesGetValuesBatchResult::internal_deserialize(map)
2366 }
2367 }
2368 deserializer.deserialize_struct("UserFeaturesGetValuesBatchResult", USER_FEATURES_GET_VALUES_BATCH_RESULT_FIELDS, StructVisitor)
2369 }
2370}
2371
2372impl ::serde::ser::Serialize for UserFeaturesGetValuesBatchResult {
2373 fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
2374 use serde::ser::SerializeStruct;
2376 let mut s = serializer.serialize_struct("UserFeaturesGetValuesBatchResult", 1)?;
2377 self.internal_serialize::<S>(&mut s)?;
2378 s.end()
2379 }
2380}
2381