dropbox-sdk 0.20.1

Rust bindings to the Dropbox API, generated by Stone from the official spec.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
// DO NOT EDIT
// This file was @generated by Stone

#![allow(
    clippy::too_many_arguments,
    clippy::large_enum_variant,
    clippy::result_large_err,
    clippy::doc_markdown,
    clippy::doc_lazy_continuation,
)]

/// Structured transcript for APIv2
#[derive(Debug, Clone, PartialEq, Default)]
#[non_exhaustive] // structs may have more fields added in the future.
pub struct ApiStructuredTranscript {
    pub segments: Option<Vec<ApiTranscriptSegment>>,
    pub transcript_locale: String,
}

impl ApiStructuredTranscript {
    pub fn with_segments(mut self, value: Vec<ApiTranscriptSegment>) -> Self {
        self.segments = Some(value);
        self
    }

    pub fn with_transcript_locale(mut self, value: String) -> Self {
        self.transcript_locale = value;
        self
    }
}

const API_STRUCTURED_TRANSCRIPT_FIELDS: &[&str] = &["segments",
                                                    "transcript_locale"];
impl ApiStructuredTranscript {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<ApiStructuredTranscript, V::Error> {
        let mut field_segments = None;
        let mut field_transcript_locale = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "segments" => {
                    if field_segments.is_some() {
                        return Err(::serde::de::Error::duplicate_field("segments"));
                    }
                    field_segments = Some(map.next_value()?);
                }
                "transcript_locale" => {
                    if field_transcript_locale.is_some() {
                        return Err(::serde::de::Error::duplicate_field("transcript_locale"));
                    }
                    field_transcript_locale = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = ApiStructuredTranscript {
            segments: field_segments.and_then(Option::flatten),
            transcript_locale: field_transcript_locale.unwrap_or_default(),
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        if let Some(val) = &self.segments {
            s.serialize_field("segments", val)?;
        }
        if !self.transcript_locale.is_empty() {
            s.serialize_field("transcript_locale", &self.transcript_locale)?;
        }
        Ok(())
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ApiStructuredTranscript {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ApiStructuredTranscript;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ApiStructuredTranscript struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ApiStructuredTranscript::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ApiStructuredTranscript", API_STRUCTURED_TRANSCRIPT_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ApiStructuredTranscript {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ApiStructuredTranscript", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

/// Transcript segment for APIv2
#[derive(Debug, Clone, PartialEq, Default)]
#[non_exhaustive] // structs may have more fields added in the future.
pub struct ApiTranscriptSegment {
    pub text: String,
    pub start_time: f64,
    pub end_time: f64,
}

impl ApiTranscriptSegment {
    pub fn with_text(mut self, value: String) -> Self {
        self.text = value;
        self
    }

    pub fn with_start_time(mut self, value: f64) -> Self {
        self.start_time = value;
        self
    }

    pub fn with_end_time(mut self, value: f64) -> Self {
        self.end_time = value;
        self
    }
}

const API_TRANSCRIPT_SEGMENT_FIELDS: &[&str] = &["text",
                                                 "start_time",
                                                 "end_time"];
impl ApiTranscriptSegment {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<ApiTranscriptSegment, V::Error> {
        let mut field_text = None;
        let mut field_start_time = None;
        let mut field_end_time = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "text" => {
                    if field_text.is_some() {
                        return Err(::serde::de::Error::duplicate_field("text"));
                    }
                    field_text = Some(map.next_value()?);
                }
                "start_time" => {
                    if field_start_time.is_some() {
                        return Err(::serde::de::Error::duplicate_field("start_time"));
                    }
                    field_start_time = Some(map.next_value()?);
                }
                "end_time" => {
                    if field_end_time.is_some() {
                        return Err(::serde::de::Error::duplicate_field("end_time"));
                    }
                    field_end_time = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = ApiTranscriptSegment {
            text: field_text.unwrap_or_default(),
            start_time: field_start_time.unwrap_or(0.0),
            end_time: field_end_time.unwrap_or(0.0),
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        if !self.text.is_empty() {
            s.serialize_field("text", &self.text)?;
        }
        if self.start_time != 0.0 {
            s.serialize_field("start_time", &self.start_time)?;
        }
        if self.end_time != 0.0 {
            s.serialize_field("end_time", &self.end_time)?;
        }
        Ok(())
    }
}

impl<'de> ::serde::de::Deserialize<'de> for ApiTranscriptSegment {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = ApiTranscriptSegment;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ApiTranscriptSegment struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                ApiTranscriptSegment::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("ApiTranscriptSegment", API_TRANSCRIPT_SEGMENT_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for ApiTranscriptSegment {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("ApiTranscriptSegment", 3)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] // variants may be added in the future
pub enum ContentApiV2Error {
    ServerError(String),
    UserError(String),
    MediaDurationError(MediaDurationError),
    NoAudioError,
    LinkDownloadDisabledError,
    SharedLinkPasswordProtected,
    LimitExceededError,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for ContentApiV2Error {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = ContentApiV2Error;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ContentApiV2Error structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                let value = match tag {
                    "server_error" => {
                        match map.next_key()? {
                            Some("server_error") => ContentApiV2Error::ServerError(map.next_value()?),
                            None => return Err(de::Error::missing_field("server_error")),
                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
                        }
                    }
                    "user_error" => {
                        match map.next_key()? {
                            Some("user_error") => ContentApiV2Error::UserError(map.next_value()?),
                            None => return Err(de::Error::missing_field("user_error")),
                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
                        }
                    }
                    "media_duration_error" => ContentApiV2Error::MediaDurationError(MediaDurationError::internal_deserialize(&mut map)?),
                    "no_audio_error" => ContentApiV2Error::NoAudioError,
                    "link_download_disabled_error" => ContentApiV2Error::LinkDownloadDisabledError,
                    "shared_link_password_protected" => ContentApiV2Error::SharedLinkPasswordProtected,
                    "limit_exceeded_error" => ContentApiV2Error::LimitExceededError,
                    _ => ContentApiV2Error::Other,
                };
                crate::eat_json_fields(&mut map)?;
                Ok(value)
            }
        }
        const VARIANTS: &[&str] = &["server_error",
                                    "user_error",
                                    "media_duration_error",
                                    "no_audio_error",
                                    "link_download_disabled_error",
                                    "shared_link_password_protected",
                                    "limit_exceeded_error",
                                    "other"];
        deserializer.deserialize_struct("ContentApiV2Error", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for ContentApiV2Error {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match self {
            ContentApiV2Error::ServerError(x) => {
                // primitive
                let mut s = serializer.serialize_struct("ContentApiV2Error", 2)?;
                s.serialize_field(".tag", "server_error")?;
                s.serialize_field("server_error", x)?;
                s.end()
            }
            ContentApiV2Error::UserError(x) => {
                // primitive
                let mut s = serializer.serialize_struct("ContentApiV2Error", 2)?;
                s.serialize_field(".tag", "user_error")?;
                s.serialize_field("user_error", x)?;
                s.end()
            }
            ContentApiV2Error::MediaDurationError(x) => {
                // struct
                let mut s = serializer.serialize_struct("ContentApiV2Error", 2)?;
                s.serialize_field(".tag", "media_duration_error")?;
                x.internal_serialize::<S>(&mut s)?;
                s.end()
            }
            ContentApiV2Error::NoAudioError => {
                // unit
                let mut s = serializer.serialize_struct("ContentApiV2Error", 1)?;
                s.serialize_field(".tag", "no_audio_error")?;
                s.end()
            }
            ContentApiV2Error::LinkDownloadDisabledError => {
                // unit
                let mut s = serializer.serialize_struct("ContentApiV2Error", 1)?;
                s.serialize_field(".tag", "link_download_disabled_error")?;
                s.end()
            }
            ContentApiV2Error::SharedLinkPasswordProtected => {
                // unit
                let mut s = serializer.serialize_struct("ContentApiV2Error", 1)?;
                s.serialize_field(".tag", "shared_link_password_protected")?;
                s.end()
            }
            ContentApiV2Error::LimitExceededError => {
                // unit
                let mut s = serializer.serialize_struct("ContentApiV2Error", 1)?;
                s.serialize_field(".tag", "limit_exceeded_error")?;
                s.end()
            }
            ContentApiV2Error::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

impl ::std::error::Error for ContentApiV2Error {
}

impl ::std::fmt::Display for ContentApiV2Error {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        match self {
            ContentApiV2Error::ServerError(inner) => write!(f, "server_error: {:?}", inner),
            ContentApiV2Error::UserError(inner) => write!(f, "user_error: {:?}", inner),
            ContentApiV2Error::MediaDurationError(inner) => write!(f, "media_duration_error: {:?}", inner),
            _ => write!(f, "{:?}", *self),
        }
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] // variants may be added in the future
pub enum ErrorCode {
    UnknownError,
    /// 400
    BadRequest,
    /// 409
    ApiError,
    /// 403
    AccessError,
    /// 429
    RatelimitError,
    /// 503
    Unavailable,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for ErrorCode {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = ErrorCode;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a ErrorCode structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                let value = match tag {
                    "unknown_error" => ErrorCode::UnknownError,
                    "bad_request" => ErrorCode::BadRequest,
                    "api_error" => ErrorCode::ApiError,
                    "access_error" => ErrorCode::AccessError,
                    "ratelimit_error" => ErrorCode::RatelimitError,
                    "unavailable" => ErrorCode::Unavailable,
                    _ => ErrorCode::Other,
                };
                crate::eat_json_fields(&mut map)?;
                Ok(value)
            }
        }
        const VARIANTS: &[&str] = &["unknown_error",
                                    "bad_request",
                                    "api_error",
                                    "access_error",
                                    "ratelimit_error",
                                    "unavailable",
                                    "other"];
        deserializer.deserialize_struct("ErrorCode", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for ErrorCode {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match self {
            ErrorCode::UnknownError => {
                // unit
                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
                s.serialize_field(".tag", "unknown_error")?;
                s.end()
            }
            ErrorCode::BadRequest => {
                // unit
                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
                s.serialize_field(".tag", "bad_request")?;
                s.end()
            }
            ErrorCode::ApiError => {
                // unit
                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
                s.serialize_field(".tag", "api_error")?;
                s.end()
            }
            ErrorCode::AccessError => {
                // unit
                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
                s.serialize_field(".tag", "access_error")?;
                s.end()
            }
            ErrorCode::RatelimitError => {
                // unit
                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
                s.serialize_field(".tag", "ratelimit_error")?;
                s.end()
            }
            ErrorCode::Unavailable => {
                // unit
                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
                s.serialize_field(".tag", "unavailable")?;
                s.end()
            }
            ErrorCode::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] // variants may be added in the future
pub enum FileIdOrUrl {
    FileId(String),
    Url(String),
    Path(String),
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for FileIdOrUrl {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = FileIdOrUrl;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a FileIdOrUrl structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                let value = match tag {
                    "file_id" => {
                        match map.next_key()? {
                            Some("file_id") => FileIdOrUrl::FileId(map.next_value()?),
                            None => return Err(de::Error::missing_field("file_id")),
                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
                        }
                    }
                    "url" => {
                        match map.next_key()? {
                            Some("url") => FileIdOrUrl::Url(map.next_value()?),
                            None => return Err(de::Error::missing_field("url")),
                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
                        }
                    }
                    "path" => {
                        match map.next_key()? {
                            Some("path") => FileIdOrUrl::Path(map.next_value()?),
                            None => return Err(de::Error::missing_field("path")),
                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
                        }
                    }
                    _ => FileIdOrUrl::Other,
                };
                crate::eat_json_fields(&mut map)?;
                Ok(value)
            }
        }
        const VARIANTS: &[&str] = &["file_id",
                                    "url",
                                    "path",
                                    "other"];
        deserializer.deserialize_struct("FileIdOrUrl", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for FileIdOrUrl {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match self {
            FileIdOrUrl::FileId(x) => {
                // primitive
                let mut s = serializer.serialize_struct("FileIdOrUrl", 2)?;
                s.serialize_field(".tag", "file_id")?;
                s.serialize_field("file_id", x)?;
                s.end()
            }
            FileIdOrUrl::Url(x) => {
                // primitive
                let mut s = serializer.serialize_struct("FileIdOrUrl", 2)?;
                s.serialize_field(".tag", "url")?;
                s.serialize_field("url", x)?;
                s.end()
            }
            FileIdOrUrl::Path(x) => {
                // primitive
                let mut s = serializer.serialize_struct("FileIdOrUrl", 2)?;
                s.serialize_field(".tag", "path")?;
                s.serialize_field("path", x)?;
                s.end()
            }
            FileIdOrUrl::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

/// Arguments for the asynchronous `get_markdown_async` route. Exactly one of `file_id`, `path`, or
/// `url` must be supplied via `file_id_or_url` to identify the document to convert to markdown.
#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[non_exhaustive] // structs may have more fields added in the future.
pub struct GetMarkdownArgs {
    /// Identifier of the document to convert. Callers must set exactly one of the oneof variants: -
    /// file_id: a Dropbox-issued file id (format: "id:<id>") for a file the authenticated user has
    /// access to. - path: an absolute Dropbox path, e.g. "/folder/report.docx". - url: either a
    /// Dropbox shared link (www.dropbox.com) or an external HTTPS URL pointing to a supported
    /// document file. - Dropbox shared links are resolved internally using the caller's
    /// authenticated identity and the link's visibility / download settings. They therefore require
    /// an authenticated user context (anonymous `url` requests against Dropbox links are rejected
    /// with an `ACCESS_ERROR`). Links protected by a password are rejected with
    /// `shared_link_password_protected`; links with downloads disabled are rejected with
    /// `link_download_disabled_error`. - External URLs are fetched over HTTPS through the backend's
    /// egress proxy and must point at a supported document file extension. The referenced file must
    /// be a document in a supported format; requests against unsupported formats return
    /// `unsupported_format_error`.
    pub file_id_or_url: Option<FileIdOrUrl>,
    /// Enable OCR for PDF documents. Processing is slower when enabled.
    pub enable_ocr: bool,
    /// When true, embed images as base64 data URIs in the markdown output. This can significantly
    /// increase output size.
    pub embed_images: bool,
}

impl GetMarkdownArgs {
    pub fn with_file_id_or_url(mut self, value: FileIdOrUrl) -> Self {
        self.file_id_or_url = Some(value);
        self
    }

    pub fn with_enable_ocr(mut self, value: bool) -> Self {
        self.enable_ocr = value;
        self
    }

    pub fn with_embed_images(mut self, value: bool) -> Self {
        self.embed_images = value;
        self
    }
}

const GET_MARKDOWN_ARGS_FIELDS: &[&str] = &["file_id_or_url",
                                            "enable_ocr",
                                            "embed_images"];
impl GetMarkdownArgs {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<GetMarkdownArgs, V::Error> {
        let mut field_file_id_or_url = None;
        let mut field_enable_ocr = None;
        let mut field_embed_images = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "file_id_or_url" => {
                    if field_file_id_or_url.is_some() {
                        return Err(::serde::de::Error::duplicate_field("file_id_or_url"));
                    }
                    field_file_id_or_url = Some(map.next_value()?);
                }
                "enable_ocr" => {
                    if field_enable_ocr.is_some() {
                        return Err(::serde::de::Error::duplicate_field("enable_ocr"));
                    }
                    field_enable_ocr = Some(map.next_value()?);
                }
                "embed_images" => {
                    if field_embed_images.is_some() {
                        return Err(::serde::de::Error::duplicate_field("embed_images"));
                    }
                    field_embed_images = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = GetMarkdownArgs {
            file_id_or_url: field_file_id_or_url.and_then(Option::flatten),
            enable_ocr: field_enable_ocr.unwrap_or(false),
            embed_images: field_embed_images.unwrap_or(false),
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        if let Some(val) = &self.file_id_or_url {
            s.serialize_field("file_id_or_url", val)?;
        }
        if self.enable_ocr {
            s.serialize_field("enable_ocr", &self.enable_ocr)?;
        }
        if self.embed_images {
            s.serialize_field("embed_images", &self.embed_images)?;
        }
        Ok(())
    }
}

impl<'de> ::serde::de::Deserialize<'de> for GetMarkdownArgs {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = GetMarkdownArgs;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a GetMarkdownArgs struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                GetMarkdownArgs::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("GetMarkdownArgs", GET_MARKDOWN_ARGS_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for GetMarkdownArgs {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("GetMarkdownArgs", 3)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

/// Result type for EventBus async check
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] // variants may be added in the future
pub enum GetMarkdownAsyncCheckResult {
    InProgress,
    Complete(GetMarkdownResult),
    Failed(GetMarkdownAsyncError),
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for GetMarkdownAsyncCheckResult {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = GetMarkdownAsyncCheckResult;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a GetMarkdownAsyncCheckResult structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                let value = match tag {
                    "in_progress" => GetMarkdownAsyncCheckResult::InProgress,
                    "complete" => GetMarkdownAsyncCheckResult::Complete(GetMarkdownResult::internal_deserialize(&mut map)?),
                    "failed" => GetMarkdownAsyncCheckResult::Failed(GetMarkdownAsyncError::internal_deserialize(&mut map)?),
                    _ => GetMarkdownAsyncCheckResult::Other,
                };
                crate::eat_json_fields(&mut map)?;
                Ok(value)
            }
        }
        const VARIANTS: &[&str] = &["in_progress",
                                    "complete",
                                    "failed",
                                    "other"];
        deserializer.deserialize_struct("GetMarkdownAsyncCheckResult", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for GetMarkdownAsyncCheckResult {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match self {
            GetMarkdownAsyncCheckResult::InProgress => {
                // unit
                let mut s = serializer.serialize_struct("GetMarkdownAsyncCheckResult", 1)?;
                s.serialize_field(".tag", "in_progress")?;
                s.end()
            }
            GetMarkdownAsyncCheckResult::Complete(x) => {
                // struct
                let mut s = serializer.serialize_struct("GetMarkdownAsyncCheckResult", 2)?;
                s.serialize_field(".tag", "complete")?;
                x.internal_serialize::<S>(&mut s)?;
                s.end()
            }
            GetMarkdownAsyncCheckResult::Failed(x) => {
                // struct
                let mut s = serializer.serialize_struct("GetMarkdownAsyncCheckResult", 3)?;
                s.serialize_field(".tag", "failed")?;
                x.internal_serialize::<S>(&mut s)?;
                s.end()
            }
            GetMarkdownAsyncCheckResult::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] // structs may have more fields added in the future.
pub struct GetMarkdownAsyncError {
    pub error_code: ErrorCode,
    pub error_details: Option<MarkdownConversionApiV2Error>,
}

impl Default for GetMarkdownAsyncError {
    fn default() -> Self {
        GetMarkdownAsyncError {
            error_code: ErrorCode::UnknownError,
            error_details: None,
        }
    }
}

impl GetMarkdownAsyncError {
    pub fn with_error_code(mut self, value: ErrorCode) -> Self {
        self.error_code = value;
        self
    }

    pub fn with_error_details(mut self, value: MarkdownConversionApiV2Error) -> Self {
        self.error_details = Some(value);
        self
    }
}

const GET_MARKDOWN_ASYNC_ERROR_FIELDS: &[&str] = &["error_code",
                                                   "error_details"];
impl GetMarkdownAsyncError {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<GetMarkdownAsyncError, V::Error> {
        let mut field_error_code = None;
        let mut field_error_details = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "error_code" => {
                    if field_error_code.is_some() {
                        return Err(::serde::de::Error::duplicate_field("error_code"));
                    }
                    field_error_code = Some(map.next_value()?);
                }
                "error_details" => {
                    if field_error_details.is_some() {
                        return Err(::serde::de::Error::duplicate_field("error_details"));
                    }
                    field_error_details = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = GetMarkdownAsyncError {
            error_code: field_error_code.unwrap_or(ErrorCode::UnknownError),
            error_details: field_error_details.and_then(Option::flatten),
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        if self.error_code != ErrorCode::UnknownError {
            s.serialize_field("error_code", &self.error_code)?;
        }
        if let Some(val) = &self.error_details {
            s.serialize_field("error_details", val)?;
        }
        Ok(())
    }
}

impl<'de> ::serde::de::Deserialize<'de> for GetMarkdownAsyncError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = GetMarkdownAsyncError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a GetMarkdownAsyncError struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                GetMarkdownAsyncError::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("GetMarkdownAsyncError", GET_MARKDOWN_ASYNC_ERROR_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for GetMarkdownAsyncError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("GetMarkdownAsyncError", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[non_exhaustive] // structs may have more fields added in the future.
pub struct GetMarkdownResult {
    /// The converted markdown content
    pub markdown: String,
}

impl GetMarkdownResult {
    pub fn with_markdown(mut self, value: String) -> Self {
        self.markdown = value;
        self
    }
}

const GET_MARKDOWN_RESULT_FIELDS: &[&str] = &["markdown"];
impl GetMarkdownResult {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<GetMarkdownResult, V::Error> {
        let mut field_markdown = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "markdown" => {
                    if field_markdown.is_some() {
                        return Err(::serde::de::Error::duplicate_field("markdown"));
                    }
                    field_markdown = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = GetMarkdownResult {
            markdown: field_markdown.unwrap_or_default(),
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        if !self.markdown.is_empty() {
            s.serialize_field("markdown", &self.markdown)?;
        }
        Ok(())
    }
}

impl<'de> ::serde::de::Deserialize<'de> for GetMarkdownResult {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = GetMarkdownResult;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a GetMarkdownResult struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                GetMarkdownResult::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("GetMarkdownResult", GET_MARKDOWN_RESULT_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for GetMarkdownResult {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("GetMarkdownResult", 1)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

/// Arguments for the asynchronous `get_transcript_async` route. Exactly one of `file_id`, `path`,
/// or `url` must be supplied via `file_id_or_url` to identify the audio or video asset to
/// transcribe.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] // structs may have more fields added in the future.
pub struct GetTranscriptArgs {
    /// Identifier of the media asset to transcribe. Callers must set exactly one of the oneof
    /// variants: - file_id: a Dropbox-issued file id (format: "id:<id>") for a file the
    /// authenticated user has access to. - path: an absolute Dropbox path, e.g.
    /// "/folder/recording.mp4". - url: either a Dropbox shared link (www.dropbox.com) or an
    /// external HTTPS URL pointing to a supported audio/video file. - Dropbox shared links are
    /// resolved internally using the caller's authenticated identity and the link's visibility /
    /// download settings. They therefore require an authenticated user context (anonymous `url`
    /// requests against Dropbox links are rejected with an `ACCESS_ERROR`). Links protected by a
    /// password are rejected with `shared_link_password_protected`; links with downloads disabled
    /// are rejected with `link_download_disabled_error`. - External URLs are fetched over HTTPS
    /// through the backend's egress proxy and must point at a supported audio/video file extension.
    /// The referenced asset must be an audio or video file in a supported format; requests against
    /// files with no audio track return a `no_audio_error`.
    pub file_id_or_url: Option<FileIdOrUrl>,
    /// Granularity of the time offsets returned for each transcript segment. Defaults to `SENTENCE.
    /// - SENTENCE: one segment per spoken sentence (recommended). - WORD: one segment per word,
    /// useful for fine-grained alignment such as captioning or highlight-as-you-listen experiences.
    pub timestamp_level: TimestampLevel,
    /// Comma-delimited list of non-lexical filler words to preserve in the transcript output, e.g.
    /// `"uh, ah, uhm"`. By default these fillers are stripped. Unrecognized tokens are ignored.
    /// Leave empty to use the default filtering behavior.
    pub included_special_words: String,
    /// Optional BCP-47 language tag hinting the spoken language of the source audio (e.g. "en-US",
    /// "ja-JP"). When empty, the service auto-detects the language; supplying a hint improves
    /// accuracy and latency for short or ambiguous clips. Unsupported languages fall back to
    /// auto-detection.
    pub audio_language: String,
}

impl Default for GetTranscriptArgs {
    fn default() -> Self {
        GetTranscriptArgs {
            file_id_or_url: None,
            timestamp_level: TimestampLevel::Unknown,
            included_special_words: String::new(),
            audio_language: String::new(),
        }
    }
}

impl GetTranscriptArgs {
    pub fn with_file_id_or_url(mut self, value: FileIdOrUrl) -> Self {
        self.file_id_or_url = Some(value);
        self
    }

    pub fn with_timestamp_level(mut self, value: TimestampLevel) -> Self {
        self.timestamp_level = value;
        self
    }

    pub fn with_included_special_words(mut self, value: String) -> Self {
        self.included_special_words = value;
        self
    }

    pub fn with_audio_language(mut self, value: String) -> Self {
        self.audio_language = value;
        self
    }
}

const GET_TRANSCRIPT_ARGS_FIELDS: &[&str] = &["file_id_or_url",
                                              "timestamp_level",
                                              "included_special_words",
                                              "audio_language"];
impl GetTranscriptArgs {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<GetTranscriptArgs, V::Error> {
        let mut field_file_id_or_url = None;
        let mut field_timestamp_level = None;
        let mut field_included_special_words = None;
        let mut field_audio_language = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "file_id_or_url" => {
                    if field_file_id_or_url.is_some() {
                        return Err(::serde::de::Error::duplicate_field("file_id_or_url"));
                    }
                    field_file_id_or_url = Some(map.next_value()?);
                }
                "timestamp_level" => {
                    if field_timestamp_level.is_some() {
                        return Err(::serde::de::Error::duplicate_field("timestamp_level"));
                    }
                    field_timestamp_level = Some(map.next_value()?);
                }
                "included_special_words" => {
                    if field_included_special_words.is_some() {
                        return Err(::serde::de::Error::duplicate_field("included_special_words"));
                    }
                    field_included_special_words = Some(map.next_value()?);
                }
                "audio_language" => {
                    if field_audio_language.is_some() {
                        return Err(::serde::de::Error::duplicate_field("audio_language"));
                    }
                    field_audio_language = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = GetTranscriptArgs {
            file_id_or_url: field_file_id_or_url.and_then(Option::flatten),
            timestamp_level: field_timestamp_level.unwrap_or(TimestampLevel::Unknown),
            included_special_words: field_included_special_words.unwrap_or_default(),
            audio_language: field_audio_language.unwrap_or_default(),
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        if let Some(val) = &self.file_id_or_url {
            s.serialize_field("file_id_or_url", val)?;
        }
        if self.timestamp_level != TimestampLevel::Unknown {
            s.serialize_field("timestamp_level", &self.timestamp_level)?;
        }
        if !self.included_special_words.is_empty() {
            s.serialize_field("included_special_words", &self.included_special_words)?;
        }
        if !self.audio_language.is_empty() {
            s.serialize_field("audio_language", &self.audio_language)?;
        }
        Ok(())
    }
}

impl<'de> ::serde::de::Deserialize<'de> for GetTranscriptArgs {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = GetTranscriptArgs;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a GetTranscriptArgs struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                GetTranscriptArgs::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("GetTranscriptArgs", GET_TRANSCRIPT_ARGS_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for GetTranscriptArgs {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("GetTranscriptArgs", 4)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

/// Result type for EventBus async check - must end in "CheckResult"
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive] // variants may be added in the future
pub enum GetTranscriptAsyncCheckResult {
    InProgress,
    Complete(GetTranscriptResult),
    Failed(GetTranscriptAsyncError),
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for GetTranscriptAsyncCheckResult {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = GetTranscriptAsyncCheckResult;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a GetTranscriptAsyncCheckResult structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                let value = match tag {
                    "in_progress" => GetTranscriptAsyncCheckResult::InProgress,
                    "complete" => GetTranscriptAsyncCheckResult::Complete(GetTranscriptResult::internal_deserialize(&mut map)?),
                    "failed" => GetTranscriptAsyncCheckResult::Failed(GetTranscriptAsyncError::internal_deserialize(&mut map)?),
                    _ => GetTranscriptAsyncCheckResult::Other,
                };
                crate::eat_json_fields(&mut map)?;
                Ok(value)
            }
        }
        const VARIANTS: &[&str] = &["in_progress",
                                    "complete",
                                    "failed",
                                    "other"];
        deserializer.deserialize_struct("GetTranscriptAsyncCheckResult", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for GetTranscriptAsyncCheckResult {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match self {
            GetTranscriptAsyncCheckResult::InProgress => {
                // unit
                let mut s = serializer.serialize_struct("GetTranscriptAsyncCheckResult", 1)?;
                s.serialize_field(".tag", "in_progress")?;
                s.end()
            }
            GetTranscriptAsyncCheckResult::Complete(x) => {
                // struct
                let mut s = serializer.serialize_struct("GetTranscriptAsyncCheckResult", 2)?;
                s.serialize_field(".tag", "complete")?;
                x.internal_serialize::<S>(&mut s)?;
                s.end()
            }
            GetTranscriptAsyncCheckResult::Failed(x) => {
                // struct
                let mut s = serializer.serialize_struct("GetTranscriptAsyncCheckResult", 3)?;
                s.serialize_field(".tag", "failed")?;
                x.internal_serialize::<S>(&mut s)?;
                s.end()
            }
            GetTranscriptAsyncCheckResult::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] // structs may have more fields added in the future.
pub struct GetTranscriptAsyncError {
    pub error_code: ErrorCode,
    pub error_details: Option<ContentApiV2Error>,
}

impl Default for GetTranscriptAsyncError {
    fn default() -> Self {
        GetTranscriptAsyncError {
            error_code: ErrorCode::UnknownError,
            error_details: None,
        }
    }
}

impl GetTranscriptAsyncError {
    pub fn with_error_code(mut self, value: ErrorCode) -> Self {
        self.error_code = value;
        self
    }

    pub fn with_error_details(mut self, value: ContentApiV2Error) -> Self {
        self.error_details = Some(value);
        self
    }
}

const GET_TRANSCRIPT_ASYNC_ERROR_FIELDS: &[&str] = &["error_code",
                                                     "error_details"];
impl GetTranscriptAsyncError {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<GetTranscriptAsyncError, V::Error> {
        let mut field_error_code = None;
        let mut field_error_details = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "error_code" => {
                    if field_error_code.is_some() {
                        return Err(::serde::de::Error::duplicate_field("error_code"));
                    }
                    field_error_code = Some(map.next_value()?);
                }
                "error_details" => {
                    if field_error_details.is_some() {
                        return Err(::serde::de::Error::duplicate_field("error_details"));
                    }
                    field_error_details = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = GetTranscriptAsyncError {
            error_code: field_error_code.unwrap_or(ErrorCode::UnknownError),
            error_details: field_error_details.and_then(Option::flatten),
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        if self.error_code != ErrorCode::UnknownError {
            s.serialize_field("error_code", &self.error_code)?;
        }
        if let Some(val) = &self.error_details {
            s.serialize_field("error_details", val)?;
        }
        Ok(())
    }
}

impl<'de> ::serde::de::Deserialize<'de> for GetTranscriptAsyncError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = GetTranscriptAsyncError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a GetTranscriptAsyncError struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                GetTranscriptAsyncError::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("GetTranscriptAsyncError", GET_TRANSCRIPT_ASYNC_ERROR_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for GetTranscriptAsyncError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("GetTranscriptAsyncError", 2)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug, Clone, PartialEq, Default)]
#[non_exhaustive] // structs may have more fields added in the future.
pub struct GetTranscriptResult {
    /// The structured transcript produced for the requested media asset, with per-segment text,
    /// start/end offsets (in seconds from the beginning of the media), and the detected or
    /// caller-supplied locale.
    pub structured_transcript: Option<ApiStructuredTranscript>,
}

impl GetTranscriptResult {
    pub fn with_structured_transcript(mut self, value: ApiStructuredTranscript) -> Self {
        self.structured_transcript = Some(value);
        self
    }
}

const GET_TRANSCRIPT_RESULT_FIELDS: &[&str] = &["structured_transcript"];
impl GetTranscriptResult {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<GetTranscriptResult, V::Error> {
        let mut field_structured_transcript = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "structured_transcript" => {
                    if field_structured_transcript.is_some() {
                        return Err(::serde::de::Error::duplicate_field("structured_transcript"));
                    }
                    field_structured_transcript = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = GetTranscriptResult {
            structured_transcript: field_structured_transcript.and_then(Option::flatten),
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        if let Some(val) = &self.structured_transcript {
            s.serialize_field("structured_transcript", val)?;
        }
        Ok(())
    }
}

impl<'de> ::serde::de::Deserialize<'de> for GetTranscriptResult {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = GetTranscriptResult;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a GetTranscriptResult struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                GetTranscriptResult::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("GetTranscriptResult", GET_TRANSCRIPT_RESULT_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for GetTranscriptResult {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("GetTranscriptResult", 1)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] // variants may be added in the future
pub enum MarkdownConversionApiV2Error {
    ServerError(String),
    UserError(String),
    UnsupportedFormatError,
    LinkDownloadDisabledError,
    SharedLinkPasswordProtected,
    LimitExceededError,
    ConversionFailureError,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for MarkdownConversionApiV2Error {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = MarkdownConversionApiV2Error;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a MarkdownConversionApiV2Error structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                let value = match tag {
                    "server_error" => {
                        match map.next_key()? {
                            Some("server_error") => MarkdownConversionApiV2Error::ServerError(map.next_value()?),
                            None => return Err(de::Error::missing_field("server_error")),
                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
                        }
                    }
                    "user_error" => {
                        match map.next_key()? {
                            Some("user_error") => MarkdownConversionApiV2Error::UserError(map.next_value()?),
                            None => return Err(de::Error::missing_field("user_error")),
                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
                        }
                    }
                    "unsupported_format_error" => MarkdownConversionApiV2Error::UnsupportedFormatError,
                    "link_download_disabled_error" => MarkdownConversionApiV2Error::LinkDownloadDisabledError,
                    "shared_link_password_protected" => MarkdownConversionApiV2Error::SharedLinkPasswordProtected,
                    "limit_exceeded_error" => MarkdownConversionApiV2Error::LimitExceededError,
                    "conversion_failure_error" => MarkdownConversionApiV2Error::ConversionFailureError,
                    _ => MarkdownConversionApiV2Error::Other,
                };
                crate::eat_json_fields(&mut map)?;
                Ok(value)
            }
        }
        const VARIANTS: &[&str] = &["server_error",
                                    "user_error",
                                    "unsupported_format_error",
                                    "link_download_disabled_error",
                                    "shared_link_password_protected",
                                    "limit_exceeded_error",
                                    "conversion_failure_error",
                                    "other"];
        deserializer.deserialize_struct("MarkdownConversionApiV2Error", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for MarkdownConversionApiV2Error {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match self {
            MarkdownConversionApiV2Error::ServerError(x) => {
                // primitive
                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 2)?;
                s.serialize_field(".tag", "server_error")?;
                s.serialize_field("server_error", x)?;
                s.end()
            }
            MarkdownConversionApiV2Error::UserError(x) => {
                // primitive
                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 2)?;
                s.serialize_field(".tag", "user_error")?;
                s.serialize_field("user_error", x)?;
                s.end()
            }
            MarkdownConversionApiV2Error::UnsupportedFormatError => {
                // unit
                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 1)?;
                s.serialize_field(".tag", "unsupported_format_error")?;
                s.end()
            }
            MarkdownConversionApiV2Error::LinkDownloadDisabledError => {
                // unit
                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 1)?;
                s.serialize_field(".tag", "link_download_disabled_error")?;
                s.end()
            }
            MarkdownConversionApiV2Error::SharedLinkPasswordProtected => {
                // unit
                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 1)?;
                s.serialize_field(".tag", "shared_link_password_protected")?;
                s.end()
            }
            MarkdownConversionApiV2Error::LimitExceededError => {
                // unit
                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 1)?;
                s.serialize_field(".tag", "limit_exceeded_error")?;
                s.end()
            }
            MarkdownConversionApiV2Error::ConversionFailureError => {
                // unit
                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 1)?;
                s.serialize_field(".tag", "conversion_failure_error")?;
                s.end()
            }
            MarkdownConversionApiV2Error::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}

impl ::std::error::Error for MarkdownConversionApiV2Error {
}

impl ::std::fmt::Display for MarkdownConversionApiV2Error {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        match self {
            MarkdownConversionApiV2Error::ServerError(inner) => write!(f, "server_error: {:?}", inner),
            MarkdownConversionApiV2Error::UserError(inner) => write!(f, "user_error: {:?}", inner),
            _ => write!(f, "{:?}", *self),
        }
    }
}

#[derive(Debug, Clone, PartialEq, Eq, Default)]
#[non_exhaustive] // structs may have more fields added in the future.
pub struct MediaDurationError {
    pub limit: i32,
}

impl MediaDurationError {
    pub fn with_limit(mut self, value: i32) -> Self {
        self.limit = value;
        self
    }
}

const MEDIA_DURATION_ERROR_FIELDS: &[&str] = &["limit"];
impl MediaDurationError {
    // no _opt deserializer
    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
        mut map: V,
    ) -> Result<MediaDurationError, V::Error> {
        let mut field_limit = None;
        while let Some(key) = map.next_key::<&str>()? {
            match key {
                "limit" => {
                    if field_limit.is_some() {
                        return Err(::serde::de::Error::duplicate_field("limit"));
                    }
                    field_limit = Some(map.next_value()?);
                }
                _ => {
                    // unknown field allowed and ignored
                    map.next_value::<::serde_json::Value>()?;
                }
            }
        }
        let result = MediaDurationError {
            limit: field_limit.unwrap_or(0),
        };
        Ok(result)
    }

    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
        &self,
        s: &mut S::SerializeStruct,
    ) -> Result<(), S::Error> {
        use serde::ser::SerializeStruct;
        if self.limit != 0 {
            s.serialize_field("limit", &self.limit)?;
        }
        Ok(())
    }
}

impl<'de> ::serde::de::Deserialize<'de> for MediaDurationError {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // struct deserializer
        use serde::de::{MapAccess, Visitor};
        struct StructVisitor;
        impl<'de> Visitor<'de> for StructVisitor {
            type Value = MediaDurationError;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a MediaDurationError struct")
            }
            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
                MediaDurationError::internal_deserialize(map)
            }
        }
        deserializer.deserialize_struct("MediaDurationError", MEDIA_DURATION_ERROR_FIELDS, StructVisitor)
    }
}

impl ::serde::ser::Serialize for MediaDurationError {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // struct serializer
        use serde::ser::SerializeStruct;
        let mut s = serializer.serialize_struct("MediaDurationError", 1)?;
        self.internal_serialize::<S>(&mut s)?;
        s.end()
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] // variants may be added in the future
pub enum TimestampLevel {
    Unknown,
    Sentence,
    Word,
    /// Catch-all used for unrecognized values returned from the server. Encountering this value
    /// typically indicates that this SDK version is out of date.
    Other,
}

impl<'de> ::serde::de::Deserialize<'de> for TimestampLevel {
    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        // union deserializer
        use serde::de::{self, MapAccess, Visitor};
        struct EnumVisitor;
        impl<'de> Visitor<'de> for EnumVisitor {
            type Value = TimestampLevel;
            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
                f.write_str("a TimestampLevel structure")
            }
            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
                let tag: &str = match map.next_key()? {
                    Some(".tag") => map.next_value()?,
                    _ => return Err(de::Error::missing_field(".tag"))
                };
                let value = match tag {
                    "unknown" => TimestampLevel::Unknown,
                    "sentence" => TimestampLevel::Sentence,
                    "word" => TimestampLevel::Word,
                    _ => TimestampLevel::Other,
                };
                crate::eat_json_fields(&mut map)?;
                Ok(value)
            }
        }
        const VARIANTS: &[&str] = &["unknown",
                                    "sentence",
                                    "word",
                                    "other"];
        deserializer.deserialize_struct("TimestampLevel", VARIANTS, EnumVisitor)
    }
}

impl ::serde::ser::Serialize for TimestampLevel {
    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        // union serializer
        use serde::ser::SerializeStruct;
        match self {
            TimestampLevel::Unknown => {
                // unit
                let mut s = serializer.serialize_struct("TimestampLevel", 1)?;
                s.serialize_field(".tag", "unknown")?;
                s.end()
            }
            TimestampLevel::Sentence => {
                // unit
                let mut s = serializer.serialize_struct("TimestampLevel", 1)?;
                s.serialize_field(".tag", "sentence")?;
                s.end()
            }
            TimestampLevel::Word => {
                // unit
                let mut s = serializer.serialize_struct("TimestampLevel", 1)?;
                s.serialize_field(".tag", "word")?;
                s.end()
            }
            TimestampLevel::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
        }
    }
}