Skip to main content

dropbox_sdk/generated/types/
riviera.rs

1// DO NOT EDIT
2// This file was @generated by Stone
3
4#![allow(
5    clippy::too_many_arguments,
6    clippy::large_enum_variant,
7    clippy::result_large_err,
8    clippy::doc_markdown,
9    clippy::doc_lazy_continuation,
10)]
11
12/// Structured transcript for APIv2
13#[derive(Debug, Clone, PartialEq, Default)]
14#[non_exhaustive] // structs may have more fields added in the future.
15pub struct ApiStructuredTranscript {
16    pub segments: Option<Vec<ApiTranscriptSegment>>,
17    pub transcript_locale: String,
18}
19
20impl ApiStructuredTranscript {
21    pub fn with_segments(mut self, value: Vec<ApiTranscriptSegment>) -> Self {
22        self.segments = Some(value);
23        self
24    }
25
26    pub fn with_transcript_locale(mut self, value: String) -> Self {
27        self.transcript_locale = value;
28        self
29    }
30}
31
32const API_STRUCTURED_TRANSCRIPT_FIELDS: &[&str] = &["segments",
33                                                    "transcript_locale"];
34impl ApiStructuredTranscript {
35    // no _opt deserializer
36    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
37        mut map: V,
38    ) -> Result<ApiStructuredTranscript, V::Error> {
39        let mut field_segments = None;
40        let mut field_transcript_locale = None;
41        while let Some(key) = map.next_key::<&str>()? {
42            match key {
43                "segments" => {
44                    if field_segments.is_some() {
45                        return Err(::serde::de::Error::duplicate_field("segments"));
46                    }
47                    field_segments = Some(map.next_value()?);
48                }
49                "transcript_locale" => {
50                    if field_transcript_locale.is_some() {
51                        return Err(::serde::de::Error::duplicate_field("transcript_locale"));
52                    }
53                    field_transcript_locale = Some(map.next_value()?);
54                }
55                _ => {
56                    // unknown field allowed and ignored
57                    map.next_value::<::serde_json::Value>()?;
58                }
59            }
60        }
61        let result = ApiStructuredTranscript {
62            segments: field_segments.and_then(Option::flatten),
63            transcript_locale: field_transcript_locale.unwrap_or_default(),
64        };
65        Ok(result)
66    }
67
68    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
69        &self,
70        s: &mut S::SerializeStruct,
71    ) -> Result<(), S::Error> {
72        use serde::ser::SerializeStruct;
73        if let Some(val) = &self.segments {
74            s.serialize_field("segments", val)?;
75        }
76        if !self.transcript_locale.is_empty() {
77            s.serialize_field("transcript_locale", &self.transcript_locale)?;
78        }
79        Ok(())
80    }
81}
82
83impl<'de> ::serde::de::Deserialize<'de> for ApiStructuredTranscript {
84    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
85        // struct deserializer
86        use serde::de::{MapAccess, Visitor};
87        struct StructVisitor;
88        impl<'de> Visitor<'de> for StructVisitor {
89            type Value = ApiStructuredTranscript;
90            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
91                f.write_str("a ApiStructuredTranscript struct")
92            }
93            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
94                ApiStructuredTranscript::internal_deserialize(map)
95            }
96        }
97        deserializer.deserialize_struct("ApiStructuredTranscript", API_STRUCTURED_TRANSCRIPT_FIELDS, StructVisitor)
98    }
99}
100
101impl ::serde::ser::Serialize for ApiStructuredTranscript {
102    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
103        // struct serializer
104        use serde::ser::SerializeStruct;
105        let mut s = serializer.serialize_struct("ApiStructuredTranscript", 2)?;
106        self.internal_serialize::<S>(&mut s)?;
107        s.end()
108    }
109}
110
111/// Transcript segment for APIv2
112#[derive(Debug, Clone, PartialEq, Default)]
113#[non_exhaustive] // structs may have more fields added in the future.
114pub struct ApiTranscriptSegment {
115    pub text: String,
116    pub start_time: f64,
117    pub end_time: f64,
118}
119
120impl ApiTranscriptSegment {
121    pub fn with_text(mut self, value: String) -> Self {
122        self.text = value;
123        self
124    }
125
126    pub fn with_start_time(mut self, value: f64) -> Self {
127        self.start_time = value;
128        self
129    }
130
131    pub fn with_end_time(mut self, value: f64) -> Self {
132        self.end_time = value;
133        self
134    }
135}
136
137const API_TRANSCRIPT_SEGMENT_FIELDS: &[&str] = &["text",
138                                                 "start_time",
139                                                 "end_time"];
140impl ApiTranscriptSegment {
141    // no _opt deserializer
142    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
143        mut map: V,
144    ) -> Result<ApiTranscriptSegment, V::Error> {
145        let mut field_text = None;
146        let mut field_start_time = None;
147        let mut field_end_time = None;
148        while let Some(key) = map.next_key::<&str>()? {
149            match key {
150                "text" => {
151                    if field_text.is_some() {
152                        return Err(::serde::de::Error::duplicate_field("text"));
153                    }
154                    field_text = Some(map.next_value()?);
155                }
156                "start_time" => {
157                    if field_start_time.is_some() {
158                        return Err(::serde::de::Error::duplicate_field("start_time"));
159                    }
160                    field_start_time = Some(map.next_value()?);
161                }
162                "end_time" => {
163                    if field_end_time.is_some() {
164                        return Err(::serde::de::Error::duplicate_field("end_time"));
165                    }
166                    field_end_time = Some(map.next_value()?);
167                }
168                _ => {
169                    // unknown field allowed and ignored
170                    map.next_value::<::serde_json::Value>()?;
171                }
172            }
173        }
174        let result = ApiTranscriptSegment {
175            text: field_text.unwrap_or_default(),
176            start_time: field_start_time.unwrap_or(0.0),
177            end_time: field_end_time.unwrap_or(0.0),
178        };
179        Ok(result)
180    }
181
182    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
183        &self,
184        s: &mut S::SerializeStruct,
185    ) -> Result<(), S::Error> {
186        use serde::ser::SerializeStruct;
187        if !self.text.is_empty() {
188            s.serialize_field("text", &self.text)?;
189        }
190        if self.start_time != 0.0 {
191            s.serialize_field("start_time", &self.start_time)?;
192        }
193        if self.end_time != 0.0 {
194            s.serialize_field("end_time", &self.end_time)?;
195        }
196        Ok(())
197    }
198}
199
200impl<'de> ::serde::de::Deserialize<'de> for ApiTranscriptSegment {
201    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
202        // struct deserializer
203        use serde::de::{MapAccess, Visitor};
204        struct StructVisitor;
205        impl<'de> Visitor<'de> for StructVisitor {
206            type Value = ApiTranscriptSegment;
207            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
208                f.write_str("a ApiTranscriptSegment struct")
209            }
210            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
211                ApiTranscriptSegment::internal_deserialize(map)
212            }
213        }
214        deserializer.deserialize_struct("ApiTranscriptSegment", API_TRANSCRIPT_SEGMENT_FIELDS, StructVisitor)
215    }
216}
217
218impl ::serde::ser::Serialize for ApiTranscriptSegment {
219    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
220        // struct serializer
221        use serde::ser::SerializeStruct;
222        let mut s = serializer.serialize_struct("ApiTranscriptSegment", 3)?;
223        self.internal_serialize::<S>(&mut s)?;
224        s.end()
225    }
226}
227
228#[derive(Debug, Clone, PartialEq, Eq)]
229#[non_exhaustive] // variants may be added in the future
230pub enum ContentApiV2Error {
231    ServerError(String),
232    UserError(String),
233    MediaDurationError(MediaDurationError),
234    NoAudioError,
235    LinkDownloadDisabledError,
236    SharedLinkPasswordProtected,
237    LimitExceededError,
238    /// Catch-all used for unrecognized values returned from the server. Encountering this value
239    /// typically indicates that this SDK version is out of date.
240    Other,
241}
242
243impl<'de> ::serde::de::Deserialize<'de> for ContentApiV2Error {
244    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
245        // union deserializer
246        use serde::de::{self, MapAccess, Visitor};
247        struct EnumVisitor;
248        impl<'de> Visitor<'de> for EnumVisitor {
249            type Value = ContentApiV2Error;
250            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
251                f.write_str("a ContentApiV2Error structure")
252            }
253            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
254                let tag: &str = match map.next_key()? {
255                    Some(".tag") => map.next_value()?,
256                    _ => return Err(de::Error::missing_field(".tag"))
257                };
258                let value = match tag {
259                    "server_error" => {
260                        match map.next_key()? {
261                            Some("server_error") => ContentApiV2Error::ServerError(map.next_value()?),
262                            None => return Err(de::Error::missing_field("server_error")),
263                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
264                        }
265                    }
266                    "user_error" => {
267                        match map.next_key()? {
268                            Some("user_error") => ContentApiV2Error::UserError(map.next_value()?),
269                            None => return Err(de::Error::missing_field("user_error")),
270                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
271                        }
272                    }
273                    "media_duration_error" => ContentApiV2Error::MediaDurationError(MediaDurationError::internal_deserialize(&mut map)?),
274                    "no_audio_error" => ContentApiV2Error::NoAudioError,
275                    "link_download_disabled_error" => ContentApiV2Error::LinkDownloadDisabledError,
276                    "shared_link_password_protected" => ContentApiV2Error::SharedLinkPasswordProtected,
277                    "limit_exceeded_error" => ContentApiV2Error::LimitExceededError,
278                    _ => ContentApiV2Error::Other,
279                };
280                crate::eat_json_fields(&mut map)?;
281                Ok(value)
282            }
283        }
284        const VARIANTS: &[&str] = &["server_error",
285                                    "user_error",
286                                    "media_duration_error",
287                                    "no_audio_error",
288                                    "link_download_disabled_error",
289                                    "shared_link_password_protected",
290                                    "limit_exceeded_error",
291                                    "other"];
292        deserializer.deserialize_struct("ContentApiV2Error", VARIANTS, EnumVisitor)
293    }
294}
295
296impl ::serde::ser::Serialize for ContentApiV2Error {
297    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
298        // union serializer
299        use serde::ser::SerializeStruct;
300        match self {
301            ContentApiV2Error::ServerError(x) => {
302                // primitive
303                let mut s = serializer.serialize_struct("ContentApiV2Error", 2)?;
304                s.serialize_field(".tag", "server_error")?;
305                s.serialize_field("server_error", x)?;
306                s.end()
307            }
308            ContentApiV2Error::UserError(x) => {
309                // primitive
310                let mut s = serializer.serialize_struct("ContentApiV2Error", 2)?;
311                s.serialize_field(".tag", "user_error")?;
312                s.serialize_field("user_error", x)?;
313                s.end()
314            }
315            ContentApiV2Error::MediaDurationError(x) => {
316                // struct
317                let mut s = serializer.serialize_struct("ContentApiV2Error", 2)?;
318                s.serialize_field(".tag", "media_duration_error")?;
319                x.internal_serialize::<S>(&mut s)?;
320                s.end()
321            }
322            ContentApiV2Error::NoAudioError => {
323                // unit
324                let mut s = serializer.serialize_struct("ContentApiV2Error", 1)?;
325                s.serialize_field(".tag", "no_audio_error")?;
326                s.end()
327            }
328            ContentApiV2Error::LinkDownloadDisabledError => {
329                // unit
330                let mut s = serializer.serialize_struct("ContentApiV2Error", 1)?;
331                s.serialize_field(".tag", "link_download_disabled_error")?;
332                s.end()
333            }
334            ContentApiV2Error::SharedLinkPasswordProtected => {
335                // unit
336                let mut s = serializer.serialize_struct("ContentApiV2Error", 1)?;
337                s.serialize_field(".tag", "shared_link_password_protected")?;
338                s.end()
339            }
340            ContentApiV2Error::LimitExceededError => {
341                // unit
342                let mut s = serializer.serialize_struct("ContentApiV2Error", 1)?;
343                s.serialize_field(".tag", "limit_exceeded_error")?;
344                s.end()
345            }
346            ContentApiV2Error::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
347        }
348    }
349}
350
351impl ::std::error::Error for ContentApiV2Error {
352}
353
354impl ::std::fmt::Display for ContentApiV2Error {
355    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
356        match self {
357            ContentApiV2Error::ServerError(inner) => write!(f, "server_error: {:?}", inner),
358            ContentApiV2Error::UserError(inner) => write!(f, "user_error: {:?}", inner),
359            ContentApiV2Error::MediaDurationError(inner) => write!(f, "media_duration_error: {:?}", inner),
360            _ => write!(f, "{:?}", *self),
361        }
362    }
363}
364
365#[derive(Debug, Clone, PartialEq, Eq)]
366#[non_exhaustive] // variants may be added in the future
367pub enum ErrorCode {
368    UnknownError,
369    /// 400
370    BadRequest,
371    /// 409
372    ApiError,
373    /// 403
374    AccessError,
375    /// 429
376    RatelimitError,
377    /// 503
378    Unavailable,
379    /// Catch-all used for unrecognized values returned from the server. Encountering this value
380    /// typically indicates that this SDK version is out of date.
381    Other,
382}
383
384impl<'de> ::serde::de::Deserialize<'de> for ErrorCode {
385    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
386        // union deserializer
387        use serde::de::{self, MapAccess, Visitor};
388        struct EnumVisitor;
389        impl<'de> Visitor<'de> for EnumVisitor {
390            type Value = ErrorCode;
391            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
392                f.write_str("a ErrorCode structure")
393            }
394            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
395                let tag: &str = match map.next_key()? {
396                    Some(".tag") => map.next_value()?,
397                    _ => return Err(de::Error::missing_field(".tag"))
398                };
399                let value = match tag {
400                    "unknown_error" => ErrorCode::UnknownError,
401                    "bad_request" => ErrorCode::BadRequest,
402                    "api_error" => ErrorCode::ApiError,
403                    "access_error" => ErrorCode::AccessError,
404                    "ratelimit_error" => ErrorCode::RatelimitError,
405                    "unavailable" => ErrorCode::Unavailable,
406                    _ => ErrorCode::Other,
407                };
408                crate::eat_json_fields(&mut map)?;
409                Ok(value)
410            }
411        }
412        const VARIANTS: &[&str] = &["unknown_error",
413                                    "bad_request",
414                                    "api_error",
415                                    "access_error",
416                                    "ratelimit_error",
417                                    "unavailable",
418                                    "other"];
419        deserializer.deserialize_struct("ErrorCode", VARIANTS, EnumVisitor)
420    }
421}
422
423impl ::serde::ser::Serialize for ErrorCode {
424    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
425        // union serializer
426        use serde::ser::SerializeStruct;
427        match self {
428            ErrorCode::UnknownError => {
429                // unit
430                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
431                s.serialize_field(".tag", "unknown_error")?;
432                s.end()
433            }
434            ErrorCode::BadRequest => {
435                // unit
436                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
437                s.serialize_field(".tag", "bad_request")?;
438                s.end()
439            }
440            ErrorCode::ApiError => {
441                // unit
442                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
443                s.serialize_field(".tag", "api_error")?;
444                s.end()
445            }
446            ErrorCode::AccessError => {
447                // unit
448                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
449                s.serialize_field(".tag", "access_error")?;
450                s.end()
451            }
452            ErrorCode::RatelimitError => {
453                // unit
454                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
455                s.serialize_field(".tag", "ratelimit_error")?;
456                s.end()
457            }
458            ErrorCode::Unavailable => {
459                // unit
460                let mut s = serializer.serialize_struct("ErrorCode", 1)?;
461                s.serialize_field(".tag", "unavailable")?;
462                s.end()
463            }
464            ErrorCode::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
465        }
466    }
467}
468
469#[derive(Debug, Clone, PartialEq, Eq)]
470#[non_exhaustive] // variants may be added in the future
471pub enum FileIdOrUrl {
472    FileId(String),
473    Url(String),
474    Path(String),
475    /// Catch-all used for unrecognized values returned from the server. Encountering this value
476    /// typically indicates that this SDK version is out of date.
477    Other,
478}
479
480impl<'de> ::serde::de::Deserialize<'de> for FileIdOrUrl {
481    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
482        // union deserializer
483        use serde::de::{self, MapAccess, Visitor};
484        struct EnumVisitor;
485        impl<'de> Visitor<'de> for EnumVisitor {
486            type Value = FileIdOrUrl;
487            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
488                f.write_str("a FileIdOrUrl structure")
489            }
490            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
491                let tag: &str = match map.next_key()? {
492                    Some(".tag") => map.next_value()?,
493                    _ => return Err(de::Error::missing_field(".tag"))
494                };
495                let value = match tag {
496                    "file_id" => {
497                        match map.next_key()? {
498                            Some("file_id") => FileIdOrUrl::FileId(map.next_value()?),
499                            None => return Err(de::Error::missing_field("file_id")),
500                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
501                        }
502                    }
503                    "url" => {
504                        match map.next_key()? {
505                            Some("url") => FileIdOrUrl::Url(map.next_value()?),
506                            None => return Err(de::Error::missing_field("url")),
507                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
508                        }
509                    }
510                    "path" => {
511                        match map.next_key()? {
512                            Some("path") => FileIdOrUrl::Path(map.next_value()?),
513                            None => return Err(de::Error::missing_field("path")),
514                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
515                        }
516                    }
517                    _ => FileIdOrUrl::Other,
518                };
519                crate::eat_json_fields(&mut map)?;
520                Ok(value)
521            }
522        }
523        const VARIANTS: &[&str] = &["file_id",
524                                    "url",
525                                    "path",
526                                    "other"];
527        deserializer.deserialize_struct("FileIdOrUrl", VARIANTS, EnumVisitor)
528    }
529}
530
531impl ::serde::ser::Serialize for FileIdOrUrl {
532    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
533        // union serializer
534        use serde::ser::SerializeStruct;
535        match self {
536            FileIdOrUrl::FileId(x) => {
537                // primitive
538                let mut s = serializer.serialize_struct("FileIdOrUrl", 2)?;
539                s.serialize_field(".tag", "file_id")?;
540                s.serialize_field("file_id", x)?;
541                s.end()
542            }
543            FileIdOrUrl::Url(x) => {
544                // primitive
545                let mut s = serializer.serialize_struct("FileIdOrUrl", 2)?;
546                s.serialize_field(".tag", "url")?;
547                s.serialize_field("url", x)?;
548                s.end()
549            }
550            FileIdOrUrl::Path(x) => {
551                // primitive
552                let mut s = serializer.serialize_struct("FileIdOrUrl", 2)?;
553                s.serialize_field(".tag", "path")?;
554                s.serialize_field("path", x)?;
555                s.end()
556            }
557            FileIdOrUrl::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
558        }
559    }
560}
561
562/// Arguments for the asynchronous `get_markdown_async` route. Exactly one of `file_id`, `path`, or
563/// `url` must be supplied via `file_id_or_url` to identify the document to convert to markdown.
564#[derive(Debug, Clone, PartialEq, Eq, Default)]
565#[non_exhaustive] // structs may have more fields added in the future.
566pub struct GetMarkdownArgs {
567    /// Identifier of the document to convert. Callers must set exactly one of the oneof variants: -
568    /// file_id: a Dropbox-issued file id (format: "id:<id>") for a file the authenticated user has
569    /// access to. - path: an absolute Dropbox path, e.g. "/folder/report.docx". - url: either a
570    /// Dropbox shared link (www.dropbox.com) or an external HTTPS URL pointing to a supported
571    /// document file. - Dropbox shared links are resolved internally using the caller's
572    /// authenticated identity and the link's visibility / download settings. They therefore require
573    /// an authenticated user context (anonymous `url` requests against Dropbox links are rejected
574    /// with an `ACCESS_ERROR`). Links protected by a password are rejected with
575    /// `shared_link_password_protected`; links with downloads disabled are rejected with
576    /// `link_download_disabled_error`. - External URLs are fetched over HTTPS through the backend's
577    /// egress proxy and must point at a supported document file extension. The referenced file must
578    /// be a document in a supported format; requests against unsupported formats return
579    /// `unsupported_format_error`.
580    pub file_id_or_url: Option<FileIdOrUrl>,
581    /// Enable OCR for PDF documents. Processing is slower when enabled.
582    pub enable_ocr: bool,
583    /// When true, embed images as base64 data URIs in the markdown output. This can significantly
584    /// increase output size.
585    pub embed_images: bool,
586}
587
588impl GetMarkdownArgs {
589    pub fn with_file_id_or_url(mut self, value: FileIdOrUrl) -> Self {
590        self.file_id_or_url = Some(value);
591        self
592    }
593
594    pub fn with_enable_ocr(mut self, value: bool) -> Self {
595        self.enable_ocr = value;
596        self
597    }
598
599    pub fn with_embed_images(mut self, value: bool) -> Self {
600        self.embed_images = value;
601        self
602    }
603}
604
605const GET_MARKDOWN_ARGS_FIELDS: &[&str] = &["file_id_or_url",
606                                            "enable_ocr",
607                                            "embed_images"];
608impl GetMarkdownArgs {
609    // no _opt deserializer
610    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
611        mut map: V,
612    ) -> Result<GetMarkdownArgs, V::Error> {
613        let mut field_file_id_or_url = None;
614        let mut field_enable_ocr = None;
615        let mut field_embed_images = None;
616        while let Some(key) = map.next_key::<&str>()? {
617            match key {
618                "file_id_or_url" => {
619                    if field_file_id_or_url.is_some() {
620                        return Err(::serde::de::Error::duplicate_field("file_id_or_url"));
621                    }
622                    field_file_id_or_url = Some(map.next_value()?);
623                }
624                "enable_ocr" => {
625                    if field_enable_ocr.is_some() {
626                        return Err(::serde::de::Error::duplicate_field("enable_ocr"));
627                    }
628                    field_enable_ocr = Some(map.next_value()?);
629                }
630                "embed_images" => {
631                    if field_embed_images.is_some() {
632                        return Err(::serde::de::Error::duplicate_field("embed_images"));
633                    }
634                    field_embed_images = Some(map.next_value()?);
635                }
636                _ => {
637                    // unknown field allowed and ignored
638                    map.next_value::<::serde_json::Value>()?;
639                }
640            }
641        }
642        let result = GetMarkdownArgs {
643            file_id_or_url: field_file_id_or_url.and_then(Option::flatten),
644            enable_ocr: field_enable_ocr.unwrap_or(false),
645            embed_images: field_embed_images.unwrap_or(false),
646        };
647        Ok(result)
648    }
649
650    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
651        &self,
652        s: &mut S::SerializeStruct,
653    ) -> Result<(), S::Error> {
654        use serde::ser::SerializeStruct;
655        if let Some(val) = &self.file_id_or_url {
656            s.serialize_field("file_id_or_url", val)?;
657        }
658        if self.enable_ocr {
659            s.serialize_field("enable_ocr", &self.enable_ocr)?;
660        }
661        if self.embed_images {
662            s.serialize_field("embed_images", &self.embed_images)?;
663        }
664        Ok(())
665    }
666}
667
668impl<'de> ::serde::de::Deserialize<'de> for GetMarkdownArgs {
669    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
670        // struct deserializer
671        use serde::de::{MapAccess, Visitor};
672        struct StructVisitor;
673        impl<'de> Visitor<'de> for StructVisitor {
674            type Value = GetMarkdownArgs;
675            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
676                f.write_str("a GetMarkdownArgs struct")
677            }
678            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
679                GetMarkdownArgs::internal_deserialize(map)
680            }
681        }
682        deserializer.deserialize_struct("GetMarkdownArgs", GET_MARKDOWN_ARGS_FIELDS, StructVisitor)
683    }
684}
685
686impl ::serde::ser::Serialize for GetMarkdownArgs {
687    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
688        // struct serializer
689        use serde::ser::SerializeStruct;
690        let mut s = serializer.serialize_struct("GetMarkdownArgs", 3)?;
691        self.internal_serialize::<S>(&mut s)?;
692        s.end()
693    }
694}
695
696/// Result type for EventBus async check
697#[derive(Debug, Clone, PartialEq, Eq)]
698#[non_exhaustive] // variants may be added in the future
699pub enum GetMarkdownAsyncCheckResult {
700    InProgress,
701    Complete(GetMarkdownResult),
702    Failed(GetMarkdownAsyncError),
703    /// Catch-all used for unrecognized values returned from the server. Encountering this value
704    /// typically indicates that this SDK version is out of date.
705    Other,
706}
707
708impl<'de> ::serde::de::Deserialize<'de> for GetMarkdownAsyncCheckResult {
709    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
710        // union deserializer
711        use serde::de::{self, MapAccess, Visitor};
712        struct EnumVisitor;
713        impl<'de> Visitor<'de> for EnumVisitor {
714            type Value = GetMarkdownAsyncCheckResult;
715            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
716                f.write_str("a GetMarkdownAsyncCheckResult structure")
717            }
718            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
719                let tag: &str = match map.next_key()? {
720                    Some(".tag") => map.next_value()?,
721                    _ => return Err(de::Error::missing_field(".tag"))
722                };
723                let value = match tag {
724                    "in_progress" => GetMarkdownAsyncCheckResult::InProgress,
725                    "complete" => GetMarkdownAsyncCheckResult::Complete(GetMarkdownResult::internal_deserialize(&mut map)?),
726                    "failed" => GetMarkdownAsyncCheckResult::Failed(GetMarkdownAsyncError::internal_deserialize(&mut map)?),
727                    _ => GetMarkdownAsyncCheckResult::Other,
728                };
729                crate::eat_json_fields(&mut map)?;
730                Ok(value)
731            }
732        }
733        const VARIANTS: &[&str] = &["in_progress",
734                                    "complete",
735                                    "failed",
736                                    "other"];
737        deserializer.deserialize_struct("GetMarkdownAsyncCheckResult", VARIANTS, EnumVisitor)
738    }
739}
740
741impl ::serde::ser::Serialize for GetMarkdownAsyncCheckResult {
742    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
743        // union serializer
744        use serde::ser::SerializeStruct;
745        match self {
746            GetMarkdownAsyncCheckResult::InProgress => {
747                // unit
748                let mut s = serializer.serialize_struct("GetMarkdownAsyncCheckResult", 1)?;
749                s.serialize_field(".tag", "in_progress")?;
750                s.end()
751            }
752            GetMarkdownAsyncCheckResult::Complete(x) => {
753                // struct
754                let mut s = serializer.serialize_struct("GetMarkdownAsyncCheckResult", 2)?;
755                s.serialize_field(".tag", "complete")?;
756                x.internal_serialize::<S>(&mut s)?;
757                s.end()
758            }
759            GetMarkdownAsyncCheckResult::Failed(x) => {
760                // struct
761                let mut s = serializer.serialize_struct("GetMarkdownAsyncCheckResult", 3)?;
762                s.serialize_field(".tag", "failed")?;
763                x.internal_serialize::<S>(&mut s)?;
764                s.end()
765            }
766            GetMarkdownAsyncCheckResult::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
767        }
768    }
769}
770
771#[derive(Debug, Clone, PartialEq, Eq)]
772#[non_exhaustive] // structs may have more fields added in the future.
773pub struct GetMarkdownAsyncError {
774    pub error_code: ErrorCode,
775    pub error_details: Option<MarkdownConversionApiV2Error>,
776}
777
778impl Default for GetMarkdownAsyncError {
779    fn default() -> Self {
780        GetMarkdownAsyncError {
781            error_code: ErrorCode::UnknownError,
782            error_details: None,
783        }
784    }
785}
786
787impl GetMarkdownAsyncError {
788    pub fn with_error_code(mut self, value: ErrorCode) -> Self {
789        self.error_code = value;
790        self
791    }
792
793    pub fn with_error_details(mut self, value: MarkdownConversionApiV2Error) -> Self {
794        self.error_details = Some(value);
795        self
796    }
797}
798
799const GET_MARKDOWN_ASYNC_ERROR_FIELDS: &[&str] = &["error_code",
800                                                   "error_details"];
801impl GetMarkdownAsyncError {
802    // no _opt deserializer
803    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
804        mut map: V,
805    ) -> Result<GetMarkdownAsyncError, V::Error> {
806        let mut field_error_code = None;
807        let mut field_error_details = None;
808        while let Some(key) = map.next_key::<&str>()? {
809            match key {
810                "error_code" => {
811                    if field_error_code.is_some() {
812                        return Err(::serde::de::Error::duplicate_field("error_code"));
813                    }
814                    field_error_code = Some(map.next_value()?);
815                }
816                "error_details" => {
817                    if field_error_details.is_some() {
818                        return Err(::serde::de::Error::duplicate_field("error_details"));
819                    }
820                    field_error_details = Some(map.next_value()?);
821                }
822                _ => {
823                    // unknown field allowed and ignored
824                    map.next_value::<::serde_json::Value>()?;
825                }
826            }
827        }
828        let result = GetMarkdownAsyncError {
829            error_code: field_error_code.unwrap_or(ErrorCode::UnknownError),
830            error_details: field_error_details.and_then(Option::flatten),
831        };
832        Ok(result)
833    }
834
835    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
836        &self,
837        s: &mut S::SerializeStruct,
838    ) -> Result<(), S::Error> {
839        use serde::ser::SerializeStruct;
840        if self.error_code != ErrorCode::UnknownError {
841            s.serialize_field("error_code", &self.error_code)?;
842        }
843        if let Some(val) = &self.error_details {
844            s.serialize_field("error_details", val)?;
845        }
846        Ok(())
847    }
848}
849
850impl<'de> ::serde::de::Deserialize<'de> for GetMarkdownAsyncError {
851    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
852        // struct deserializer
853        use serde::de::{MapAccess, Visitor};
854        struct StructVisitor;
855        impl<'de> Visitor<'de> for StructVisitor {
856            type Value = GetMarkdownAsyncError;
857            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
858                f.write_str("a GetMarkdownAsyncError struct")
859            }
860            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
861                GetMarkdownAsyncError::internal_deserialize(map)
862            }
863        }
864        deserializer.deserialize_struct("GetMarkdownAsyncError", GET_MARKDOWN_ASYNC_ERROR_FIELDS, StructVisitor)
865    }
866}
867
868impl ::serde::ser::Serialize for GetMarkdownAsyncError {
869    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
870        // struct serializer
871        use serde::ser::SerializeStruct;
872        let mut s = serializer.serialize_struct("GetMarkdownAsyncError", 2)?;
873        self.internal_serialize::<S>(&mut s)?;
874        s.end()
875    }
876}
877
878#[derive(Debug, Clone, PartialEq, Eq, Default)]
879#[non_exhaustive] // structs may have more fields added in the future.
880pub struct GetMarkdownResult {
881    /// The converted markdown content
882    pub markdown: String,
883}
884
885impl GetMarkdownResult {
886    pub fn with_markdown(mut self, value: String) -> Self {
887        self.markdown = value;
888        self
889    }
890}
891
892const GET_MARKDOWN_RESULT_FIELDS: &[&str] = &["markdown"];
893impl GetMarkdownResult {
894    // no _opt deserializer
895    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
896        mut map: V,
897    ) -> Result<GetMarkdownResult, V::Error> {
898        let mut field_markdown = None;
899        while let Some(key) = map.next_key::<&str>()? {
900            match key {
901                "markdown" => {
902                    if field_markdown.is_some() {
903                        return Err(::serde::de::Error::duplicate_field("markdown"));
904                    }
905                    field_markdown = Some(map.next_value()?);
906                }
907                _ => {
908                    // unknown field allowed and ignored
909                    map.next_value::<::serde_json::Value>()?;
910                }
911            }
912        }
913        let result = GetMarkdownResult {
914            markdown: field_markdown.unwrap_or_default(),
915        };
916        Ok(result)
917    }
918
919    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
920        &self,
921        s: &mut S::SerializeStruct,
922    ) -> Result<(), S::Error> {
923        use serde::ser::SerializeStruct;
924        if !self.markdown.is_empty() {
925            s.serialize_field("markdown", &self.markdown)?;
926        }
927        Ok(())
928    }
929}
930
931impl<'de> ::serde::de::Deserialize<'de> for GetMarkdownResult {
932    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
933        // struct deserializer
934        use serde::de::{MapAccess, Visitor};
935        struct StructVisitor;
936        impl<'de> Visitor<'de> for StructVisitor {
937            type Value = GetMarkdownResult;
938            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
939                f.write_str("a GetMarkdownResult struct")
940            }
941            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
942                GetMarkdownResult::internal_deserialize(map)
943            }
944        }
945        deserializer.deserialize_struct("GetMarkdownResult", GET_MARKDOWN_RESULT_FIELDS, StructVisitor)
946    }
947}
948
949impl ::serde::ser::Serialize for GetMarkdownResult {
950    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
951        // struct serializer
952        use serde::ser::SerializeStruct;
953        let mut s = serializer.serialize_struct("GetMarkdownResult", 1)?;
954        self.internal_serialize::<S>(&mut s)?;
955        s.end()
956    }
957}
958
959/// Arguments for the asynchronous `get_transcript_async` route. Exactly one of `file_id`, `path`,
960/// or `url` must be supplied via `file_id_or_url` to identify the audio or video asset to
961/// transcribe.
962#[derive(Debug, Clone, PartialEq, Eq)]
963#[non_exhaustive] // structs may have more fields added in the future.
964pub struct GetTranscriptArgs {
965    /// Identifier of the media asset to transcribe. Callers must set exactly one of the oneof
966    /// variants: - file_id: a Dropbox-issued file id (format: "id:<id>") for a file the
967    /// authenticated user has access to. - path: an absolute Dropbox path, e.g.
968    /// "/folder/recording.mp4". - url: either a Dropbox shared link (www.dropbox.com) or an
969    /// external HTTPS URL pointing to a supported audio/video file. - Dropbox shared links are
970    /// resolved internally using the caller's authenticated identity and the link's visibility /
971    /// download settings. They therefore require an authenticated user context (anonymous `url`
972    /// requests against Dropbox links are rejected with an `ACCESS_ERROR`). Links protected by a
973    /// password are rejected with `shared_link_password_protected`; links with downloads disabled
974    /// are rejected with `link_download_disabled_error`. - External URLs are fetched over HTTPS
975    /// through the backend's egress proxy and must point at a supported audio/video file extension.
976    /// The referenced asset must be an audio or video file in a supported format; requests against
977    /// files with no audio track return a `no_audio_error`.
978    pub file_id_or_url: Option<FileIdOrUrl>,
979    /// Granularity of the time offsets returned for each transcript segment. Defaults to `SENTENCE.
980    /// - SENTENCE: one segment per spoken sentence (recommended). - WORD: one segment per word,
981    /// useful for fine-grained alignment such as captioning or highlight-as-you-listen experiences.
982    pub timestamp_level: TimestampLevel,
983    /// Comma-delimited list of non-lexical filler words to preserve in the transcript output, e.g.
984    /// `"uh, ah, uhm"`. By default these fillers are stripped. Unrecognized tokens are ignored.
985    /// Leave empty to use the default filtering behavior.
986    pub included_special_words: String,
987    /// Optional BCP-47 language tag hinting the spoken language of the source audio (e.g. "en-US",
988    /// "ja-JP"). When empty, the service auto-detects the language; supplying a hint improves
989    /// accuracy and latency for short or ambiguous clips. Unsupported languages fall back to
990    /// auto-detection.
991    pub audio_language: String,
992}
993
994impl Default for GetTranscriptArgs {
995    fn default() -> Self {
996        GetTranscriptArgs {
997            file_id_or_url: None,
998            timestamp_level: TimestampLevel::Unknown,
999            included_special_words: String::new(),
1000            audio_language: String::new(),
1001        }
1002    }
1003}
1004
1005impl GetTranscriptArgs {
1006    pub fn with_file_id_or_url(mut self, value: FileIdOrUrl) -> Self {
1007        self.file_id_or_url = Some(value);
1008        self
1009    }
1010
1011    pub fn with_timestamp_level(mut self, value: TimestampLevel) -> Self {
1012        self.timestamp_level = value;
1013        self
1014    }
1015
1016    pub fn with_included_special_words(mut self, value: String) -> Self {
1017        self.included_special_words = value;
1018        self
1019    }
1020
1021    pub fn with_audio_language(mut self, value: String) -> Self {
1022        self.audio_language = value;
1023        self
1024    }
1025}
1026
1027const GET_TRANSCRIPT_ARGS_FIELDS: &[&str] = &["file_id_or_url",
1028                                              "timestamp_level",
1029                                              "included_special_words",
1030                                              "audio_language"];
1031impl GetTranscriptArgs {
1032    // no _opt deserializer
1033    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
1034        mut map: V,
1035    ) -> Result<GetTranscriptArgs, V::Error> {
1036        let mut field_file_id_or_url = None;
1037        let mut field_timestamp_level = None;
1038        let mut field_included_special_words = None;
1039        let mut field_audio_language = None;
1040        while let Some(key) = map.next_key::<&str>()? {
1041            match key {
1042                "file_id_or_url" => {
1043                    if field_file_id_or_url.is_some() {
1044                        return Err(::serde::de::Error::duplicate_field("file_id_or_url"));
1045                    }
1046                    field_file_id_or_url = Some(map.next_value()?);
1047                }
1048                "timestamp_level" => {
1049                    if field_timestamp_level.is_some() {
1050                        return Err(::serde::de::Error::duplicate_field("timestamp_level"));
1051                    }
1052                    field_timestamp_level = Some(map.next_value()?);
1053                }
1054                "included_special_words" => {
1055                    if field_included_special_words.is_some() {
1056                        return Err(::serde::de::Error::duplicate_field("included_special_words"));
1057                    }
1058                    field_included_special_words = Some(map.next_value()?);
1059                }
1060                "audio_language" => {
1061                    if field_audio_language.is_some() {
1062                        return Err(::serde::de::Error::duplicate_field("audio_language"));
1063                    }
1064                    field_audio_language = Some(map.next_value()?);
1065                }
1066                _ => {
1067                    // unknown field allowed and ignored
1068                    map.next_value::<::serde_json::Value>()?;
1069                }
1070            }
1071        }
1072        let result = GetTranscriptArgs {
1073            file_id_or_url: field_file_id_or_url.and_then(Option::flatten),
1074            timestamp_level: field_timestamp_level.unwrap_or(TimestampLevel::Unknown),
1075            included_special_words: field_included_special_words.unwrap_or_default(),
1076            audio_language: field_audio_language.unwrap_or_default(),
1077        };
1078        Ok(result)
1079    }
1080
1081    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
1082        &self,
1083        s: &mut S::SerializeStruct,
1084    ) -> Result<(), S::Error> {
1085        use serde::ser::SerializeStruct;
1086        if let Some(val) = &self.file_id_or_url {
1087            s.serialize_field("file_id_or_url", val)?;
1088        }
1089        if self.timestamp_level != TimestampLevel::Unknown {
1090            s.serialize_field("timestamp_level", &self.timestamp_level)?;
1091        }
1092        if !self.included_special_words.is_empty() {
1093            s.serialize_field("included_special_words", &self.included_special_words)?;
1094        }
1095        if !self.audio_language.is_empty() {
1096            s.serialize_field("audio_language", &self.audio_language)?;
1097        }
1098        Ok(())
1099    }
1100}
1101
1102impl<'de> ::serde::de::Deserialize<'de> for GetTranscriptArgs {
1103    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1104        // struct deserializer
1105        use serde::de::{MapAccess, Visitor};
1106        struct StructVisitor;
1107        impl<'de> Visitor<'de> for StructVisitor {
1108            type Value = GetTranscriptArgs;
1109            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1110                f.write_str("a GetTranscriptArgs struct")
1111            }
1112            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1113                GetTranscriptArgs::internal_deserialize(map)
1114            }
1115        }
1116        deserializer.deserialize_struct("GetTranscriptArgs", GET_TRANSCRIPT_ARGS_FIELDS, StructVisitor)
1117    }
1118}
1119
1120impl ::serde::ser::Serialize for GetTranscriptArgs {
1121    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1122        // struct serializer
1123        use serde::ser::SerializeStruct;
1124        let mut s = serializer.serialize_struct("GetTranscriptArgs", 4)?;
1125        self.internal_serialize::<S>(&mut s)?;
1126        s.end()
1127    }
1128}
1129
1130/// Result type for EventBus async check - must end in "CheckResult"
1131#[derive(Debug, Clone, PartialEq)]
1132#[non_exhaustive] // variants may be added in the future
1133pub enum GetTranscriptAsyncCheckResult {
1134    InProgress,
1135    Complete(GetTranscriptResult),
1136    Failed(GetTranscriptAsyncError),
1137    /// Catch-all used for unrecognized values returned from the server. Encountering this value
1138    /// typically indicates that this SDK version is out of date.
1139    Other,
1140}
1141
1142impl<'de> ::serde::de::Deserialize<'de> for GetTranscriptAsyncCheckResult {
1143    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1144        // union deserializer
1145        use serde::de::{self, MapAccess, Visitor};
1146        struct EnumVisitor;
1147        impl<'de> Visitor<'de> for EnumVisitor {
1148            type Value = GetTranscriptAsyncCheckResult;
1149            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1150                f.write_str("a GetTranscriptAsyncCheckResult structure")
1151            }
1152            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
1153                let tag: &str = match map.next_key()? {
1154                    Some(".tag") => map.next_value()?,
1155                    _ => return Err(de::Error::missing_field(".tag"))
1156                };
1157                let value = match tag {
1158                    "in_progress" => GetTranscriptAsyncCheckResult::InProgress,
1159                    "complete" => GetTranscriptAsyncCheckResult::Complete(GetTranscriptResult::internal_deserialize(&mut map)?),
1160                    "failed" => GetTranscriptAsyncCheckResult::Failed(GetTranscriptAsyncError::internal_deserialize(&mut map)?),
1161                    _ => GetTranscriptAsyncCheckResult::Other,
1162                };
1163                crate::eat_json_fields(&mut map)?;
1164                Ok(value)
1165            }
1166        }
1167        const VARIANTS: &[&str] = &["in_progress",
1168                                    "complete",
1169                                    "failed",
1170                                    "other"];
1171        deserializer.deserialize_struct("GetTranscriptAsyncCheckResult", VARIANTS, EnumVisitor)
1172    }
1173}
1174
1175impl ::serde::ser::Serialize for GetTranscriptAsyncCheckResult {
1176    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1177        // union serializer
1178        use serde::ser::SerializeStruct;
1179        match self {
1180            GetTranscriptAsyncCheckResult::InProgress => {
1181                // unit
1182                let mut s = serializer.serialize_struct("GetTranscriptAsyncCheckResult", 1)?;
1183                s.serialize_field(".tag", "in_progress")?;
1184                s.end()
1185            }
1186            GetTranscriptAsyncCheckResult::Complete(x) => {
1187                // struct
1188                let mut s = serializer.serialize_struct("GetTranscriptAsyncCheckResult", 2)?;
1189                s.serialize_field(".tag", "complete")?;
1190                x.internal_serialize::<S>(&mut s)?;
1191                s.end()
1192            }
1193            GetTranscriptAsyncCheckResult::Failed(x) => {
1194                // struct
1195                let mut s = serializer.serialize_struct("GetTranscriptAsyncCheckResult", 3)?;
1196                s.serialize_field(".tag", "failed")?;
1197                x.internal_serialize::<S>(&mut s)?;
1198                s.end()
1199            }
1200            GetTranscriptAsyncCheckResult::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
1201        }
1202    }
1203}
1204
1205#[derive(Debug, Clone, PartialEq, Eq)]
1206#[non_exhaustive] // structs may have more fields added in the future.
1207pub struct GetTranscriptAsyncError {
1208    pub error_code: ErrorCode,
1209    pub error_details: Option<ContentApiV2Error>,
1210}
1211
1212impl Default for GetTranscriptAsyncError {
1213    fn default() -> Self {
1214        GetTranscriptAsyncError {
1215            error_code: ErrorCode::UnknownError,
1216            error_details: None,
1217        }
1218    }
1219}
1220
1221impl GetTranscriptAsyncError {
1222    pub fn with_error_code(mut self, value: ErrorCode) -> Self {
1223        self.error_code = value;
1224        self
1225    }
1226
1227    pub fn with_error_details(mut self, value: ContentApiV2Error) -> Self {
1228        self.error_details = Some(value);
1229        self
1230    }
1231}
1232
1233const GET_TRANSCRIPT_ASYNC_ERROR_FIELDS: &[&str] = &["error_code",
1234                                                     "error_details"];
1235impl GetTranscriptAsyncError {
1236    // no _opt deserializer
1237    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
1238        mut map: V,
1239    ) -> Result<GetTranscriptAsyncError, V::Error> {
1240        let mut field_error_code = None;
1241        let mut field_error_details = None;
1242        while let Some(key) = map.next_key::<&str>()? {
1243            match key {
1244                "error_code" => {
1245                    if field_error_code.is_some() {
1246                        return Err(::serde::de::Error::duplicate_field("error_code"));
1247                    }
1248                    field_error_code = Some(map.next_value()?);
1249                }
1250                "error_details" => {
1251                    if field_error_details.is_some() {
1252                        return Err(::serde::de::Error::duplicate_field("error_details"));
1253                    }
1254                    field_error_details = Some(map.next_value()?);
1255                }
1256                _ => {
1257                    // unknown field allowed and ignored
1258                    map.next_value::<::serde_json::Value>()?;
1259                }
1260            }
1261        }
1262        let result = GetTranscriptAsyncError {
1263            error_code: field_error_code.unwrap_or(ErrorCode::UnknownError),
1264            error_details: field_error_details.and_then(Option::flatten),
1265        };
1266        Ok(result)
1267    }
1268
1269    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
1270        &self,
1271        s: &mut S::SerializeStruct,
1272    ) -> Result<(), S::Error> {
1273        use serde::ser::SerializeStruct;
1274        if self.error_code != ErrorCode::UnknownError {
1275            s.serialize_field("error_code", &self.error_code)?;
1276        }
1277        if let Some(val) = &self.error_details {
1278            s.serialize_field("error_details", val)?;
1279        }
1280        Ok(())
1281    }
1282}
1283
1284impl<'de> ::serde::de::Deserialize<'de> for GetTranscriptAsyncError {
1285    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1286        // struct deserializer
1287        use serde::de::{MapAccess, Visitor};
1288        struct StructVisitor;
1289        impl<'de> Visitor<'de> for StructVisitor {
1290            type Value = GetTranscriptAsyncError;
1291            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1292                f.write_str("a GetTranscriptAsyncError struct")
1293            }
1294            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1295                GetTranscriptAsyncError::internal_deserialize(map)
1296            }
1297        }
1298        deserializer.deserialize_struct("GetTranscriptAsyncError", GET_TRANSCRIPT_ASYNC_ERROR_FIELDS, StructVisitor)
1299    }
1300}
1301
1302impl ::serde::ser::Serialize for GetTranscriptAsyncError {
1303    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1304        // struct serializer
1305        use serde::ser::SerializeStruct;
1306        let mut s = serializer.serialize_struct("GetTranscriptAsyncError", 2)?;
1307        self.internal_serialize::<S>(&mut s)?;
1308        s.end()
1309    }
1310}
1311
1312#[derive(Debug, Clone, PartialEq, Default)]
1313#[non_exhaustive] // structs may have more fields added in the future.
1314pub struct GetTranscriptResult {
1315    /// The structured transcript produced for the requested media asset, with per-segment text,
1316    /// start/end offsets (in seconds from the beginning of the media), and the detected or
1317    /// caller-supplied locale.
1318    pub structured_transcript: Option<ApiStructuredTranscript>,
1319}
1320
1321impl GetTranscriptResult {
1322    pub fn with_structured_transcript(mut self, value: ApiStructuredTranscript) -> Self {
1323        self.structured_transcript = Some(value);
1324        self
1325    }
1326}
1327
1328const GET_TRANSCRIPT_RESULT_FIELDS: &[&str] = &["structured_transcript"];
1329impl GetTranscriptResult {
1330    // no _opt deserializer
1331    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
1332        mut map: V,
1333    ) -> Result<GetTranscriptResult, V::Error> {
1334        let mut field_structured_transcript = None;
1335        while let Some(key) = map.next_key::<&str>()? {
1336            match key {
1337                "structured_transcript" => {
1338                    if field_structured_transcript.is_some() {
1339                        return Err(::serde::de::Error::duplicate_field("structured_transcript"));
1340                    }
1341                    field_structured_transcript = Some(map.next_value()?);
1342                }
1343                _ => {
1344                    // unknown field allowed and ignored
1345                    map.next_value::<::serde_json::Value>()?;
1346                }
1347            }
1348        }
1349        let result = GetTranscriptResult {
1350            structured_transcript: field_structured_transcript.and_then(Option::flatten),
1351        };
1352        Ok(result)
1353    }
1354
1355    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
1356        &self,
1357        s: &mut S::SerializeStruct,
1358    ) -> Result<(), S::Error> {
1359        use serde::ser::SerializeStruct;
1360        if let Some(val) = &self.structured_transcript {
1361            s.serialize_field("structured_transcript", val)?;
1362        }
1363        Ok(())
1364    }
1365}
1366
1367impl<'de> ::serde::de::Deserialize<'de> for GetTranscriptResult {
1368    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1369        // struct deserializer
1370        use serde::de::{MapAccess, Visitor};
1371        struct StructVisitor;
1372        impl<'de> Visitor<'de> for StructVisitor {
1373            type Value = GetTranscriptResult;
1374            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1375                f.write_str("a GetTranscriptResult struct")
1376            }
1377            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1378                GetTranscriptResult::internal_deserialize(map)
1379            }
1380        }
1381        deserializer.deserialize_struct("GetTranscriptResult", GET_TRANSCRIPT_RESULT_FIELDS, StructVisitor)
1382    }
1383}
1384
1385impl ::serde::ser::Serialize for GetTranscriptResult {
1386    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1387        // struct serializer
1388        use serde::ser::SerializeStruct;
1389        let mut s = serializer.serialize_struct("GetTranscriptResult", 1)?;
1390        self.internal_serialize::<S>(&mut s)?;
1391        s.end()
1392    }
1393}
1394
1395#[derive(Debug, Clone, PartialEq, Eq)]
1396#[non_exhaustive] // variants may be added in the future
1397pub enum MarkdownConversionApiV2Error {
1398    ServerError(String),
1399    UserError(String),
1400    UnsupportedFormatError,
1401    LinkDownloadDisabledError,
1402    SharedLinkPasswordProtected,
1403    LimitExceededError,
1404    ConversionFailureError,
1405    /// Catch-all used for unrecognized values returned from the server. Encountering this value
1406    /// typically indicates that this SDK version is out of date.
1407    Other,
1408}
1409
1410impl<'de> ::serde::de::Deserialize<'de> for MarkdownConversionApiV2Error {
1411    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1412        // union deserializer
1413        use serde::de::{self, MapAccess, Visitor};
1414        struct EnumVisitor;
1415        impl<'de> Visitor<'de> for EnumVisitor {
1416            type Value = MarkdownConversionApiV2Error;
1417            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1418                f.write_str("a MarkdownConversionApiV2Error structure")
1419            }
1420            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
1421                let tag: &str = match map.next_key()? {
1422                    Some(".tag") => map.next_value()?,
1423                    _ => return Err(de::Error::missing_field(".tag"))
1424                };
1425                let value = match tag {
1426                    "server_error" => {
1427                        match map.next_key()? {
1428                            Some("server_error") => MarkdownConversionApiV2Error::ServerError(map.next_value()?),
1429                            None => return Err(de::Error::missing_field("server_error")),
1430                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
1431                        }
1432                    }
1433                    "user_error" => {
1434                        match map.next_key()? {
1435                            Some("user_error") => MarkdownConversionApiV2Error::UserError(map.next_value()?),
1436                            None => return Err(de::Error::missing_field("user_error")),
1437                            _ => return Err(de::Error::unknown_field(tag, VARIANTS))
1438                        }
1439                    }
1440                    "unsupported_format_error" => MarkdownConversionApiV2Error::UnsupportedFormatError,
1441                    "link_download_disabled_error" => MarkdownConversionApiV2Error::LinkDownloadDisabledError,
1442                    "shared_link_password_protected" => MarkdownConversionApiV2Error::SharedLinkPasswordProtected,
1443                    "limit_exceeded_error" => MarkdownConversionApiV2Error::LimitExceededError,
1444                    "conversion_failure_error" => MarkdownConversionApiV2Error::ConversionFailureError,
1445                    _ => MarkdownConversionApiV2Error::Other,
1446                };
1447                crate::eat_json_fields(&mut map)?;
1448                Ok(value)
1449            }
1450        }
1451        const VARIANTS: &[&str] = &["server_error",
1452                                    "user_error",
1453                                    "unsupported_format_error",
1454                                    "link_download_disabled_error",
1455                                    "shared_link_password_protected",
1456                                    "limit_exceeded_error",
1457                                    "conversion_failure_error",
1458                                    "other"];
1459        deserializer.deserialize_struct("MarkdownConversionApiV2Error", VARIANTS, EnumVisitor)
1460    }
1461}
1462
1463impl ::serde::ser::Serialize for MarkdownConversionApiV2Error {
1464    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1465        // union serializer
1466        use serde::ser::SerializeStruct;
1467        match self {
1468            MarkdownConversionApiV2Error::ServerError(x) => {
1469                // primitive
1470                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 2)?;
1471                s.serialize_field(".tag", "server_error")?;
1472                s.serialize_field("server_error", x)?;
1473                s.end()
1474            }
1475            MarkdownConversionApiV2Error::UserError(x) => {
1476                // primitive
1477                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 2)?;
1478                s.serialize_field(".tag", "user_error")?;
1479                s.serialize_field("user_error", x)?;
1480                s.end()
1481            }
1482            MarkdownConversionApiV2Error::UnsupportedFormatError => {
1483                // unit
1484                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 1)?;
1485                s.serialize_field(".tag", "unsupported_format_error")?;
1486                s.end()
1487            }
1488            MarkdownConversionApiV2Error::LinkDownloadDisabledError => {
1489                // unit
1490                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 1)?;
1491                s.serialize_field(".tag", "link_download_disabled_error")?;
1492                s.end()
1493            }
1494            MarkdownConversionApiV2Error::SharedLinkPasswordProtected => {
1495                // unit
1496                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 1)?;
1497                s.serialize_field(".tag", "shared_link_password_protected")?;
1498                s.end()
1499            }
1500            MarkdownConversionApiV2Error::LimitExceededError => {
1501                // unit
1502                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 1)?;
1503                s.serialize_field(".tag", "limit_exceeded_error")?;
1504                s.end()
1505            }
1506            MarkdownConversionApiV2Error::ConversionFailureError => {
1507                // unit
1508                let mut s = serializer.serialize_struct("MarkdownConversionApiV2Error", 1)?;
1509                s.serialize_field(".tag", "conversion_failure_error")?;
1510                s.end()
1511            }
1512            MarkdownConversionApiV2Error::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
1513        }
1514    }
1515}
1516
1517impl ::std::error::Error for MarkdownConversionApiV2Error {
1518}
1519
1520impl ::std::fmt::Display for MarkdownConversionApiV2Error {
1521    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1522        match self {
1523            MarkdownConversionApiV2Error::ServerError(inner) => write!(f, "server_error: {:?}", inner),
1524            MarkdownConversionApiV2Error::UserError(inner) => write!(f, "user_error: {:?}", inner),
1525            _ => write!(f, "{:?}", *self),
1526        }
1527    }
1528}
1529
1530#[derive(Debug, Clone, PartialEq, Eq, Default)]
1531#[non_exhaustive] // structs may have more fields added in the future.
1532pub struct MediaDurationError {
1533    pub limit: i32,
1534}
1535
1536impl MediaDurationError {
1537    pub fn with_limit(mut self, value: i32) -> Self {
1538        self.limit = value;
1539        self
1540    }
1541}
1542
1543const MEDIA_DURATION_ERROR_FIELDS: &[&str] = &["limit"];
1544impl MediaDurationError {
1545    // no _opt deserializer
1546    pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
1547        mut map: V,
1548    ) -> Result<MediaDurationError, V::Error> {
1549        let mut field_limit = None;
1550        while let Some(key) = map.next_key::<&str>()? {
1551            match key {
1552                "limit" => {
1553                    if field_limit.is_some() {
1554                        return Err(::serde::de::Error::duplicate_field("limit"));
1555                    }
1556                    field_limit = Some(map.next_value()?);
1557                }
1558                _ => {
1559                    // unknown field allowed and ignored
1560                    map.next_value::<::serde_json::Value>()?;
1561                }
1562            }
1563        }
1564        let result = MediaDurationError {
1565            limit: field_limit.unwrap_or(0),
1566        };
1567        Ok(result)
1568    }
1569
1570    pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
1571        &self,
1572        s: &mut S::SerializeStruct,
1573    ) -> Result<(), S::Error> {
1574        use serde::ser::SerializeStruct;
1575        if self.limit != 0 {
1576            s.serialize_field("limit", &self.limit)?;
1577        }
1578        Ok(())
1579    }
1580}
1581
1582impl<'de> ::serde::de::Deserialize<'de> for MediaDurationError {
1583    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1584        // struct deserializer
1585        use serde::de::{MapAccess, Visitor};
1586        struct StructVisitor;
1587        impl<'de> Visitor<'de> for StructVisitor {
1588            type Value = MediaDurationError;
1589            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1590                f.write_str("a MediaDurationError struct")
1591            }
1592            fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
1593                MediaDurationError::internal_deserialize(map)
1594            }
1595        }
1596        deserializer.deserialize_struct("MediaDurationError", MEDIA_DURATION_ERROR_FIELDS, StructVisitor)
1597    }
1598}
1599
1600impl ::serde::ser::Serialize for MediaDurationError {
1601    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1602        // struct serializer
1603        use serde::ser::SerializeStruct;
1604        let mut s = serializer.serialize_struct("MediaDurationError", 1)?;
1605        self.internal_serialize::<S>(&mut s)?;
1606        s.end()
1607    }
1608}
1609
1610#[derive(Debug, Clone, PartialEq, Eq)]
1611#[non_exhaustive] // variants may be added in the future
1612pub enum TimestampLevel {
1613    Unknown,
1614    Sentence,
1615    Word,
1616    /// Catch-all used for unrecognized values returned from the server. Encountering this value
1617    /// typically indicates that this SDK version is out of date.
1618    Other,
1619}
1620
1621impl<'de> ::serde::de::Deserialize<'de> for TimestampLevel {
1622    fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1623        // union deserializer
1624        use serde::de::{self, MapAccess, Visitor};
1625        struct EnumVisitor;
1626        impl<'de> Visitor<'de> for EnumVisitor {
1627            type Value = TimestampLevel;
1628            fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1629                f.write_str("a TimestampLevel structure")
1630            }
1631            fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
1632                let tag: &str = match map.next_key()? {
1633                    Some(".tag") => map.next_value()?,
1634                    _ => return Err(de::Error::missing_field(".tag"))
1635                };
1636                let value = match tag {
1637                    "unknown" => TimestampLevel::Unknown,
1638                    "sentence" => TimestampLevel::Sentence,
1639                    "word" => TimestampLevel::Word,
1640                    _ => TimestampLevel::Other,
1641                };
1642                crate::eat_json_fields(&mut map)?;
1643                Ok(value)
1644            }
1645        }
1646        const VARIANTS: &[&str] = &["unknown",
1647                                    "sentence",
1648                                    "word",
1649                                    "other"];
1650        deserializer.deserialize_struct("TimestampLevel", VARIANTS, EnumVisitor)
1651    }
1652}
1653
1654impl ::serde::ser::Serialize for TimestampLevel {
1655    fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
1656        // union serializer
1657        use serde::ser::SerializeStruct;
1658        match self {
1659            TimestampLevel::Unknown => {
1660                // unit
1661                let mut s = serializer.serialize_struct("TimestampLevel", 1)?;
1662                s.serialize_field(".tag", "unknown")?;
1663                s.end()
1664            }
1665            TimestampLevel::Sentence => {
1666                // unit
1667                let mut s = serializer.serialize_struct("TimestampLevel", 1)?;
1668                s.serialize_field(".tag", "sentence")?;
1669                s.end()
1670            }
1671            TimestampLevel::Word => {
1672                // unit
1673                let mut s = serializer.serialize_struct("TimestampLevel", 1)?;
1674                s.serialize_field(".tag", "word")?;
1675                s.end()
1676            }
1677            TimestampLevel::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
1678        }
1679    }
1680}
1681