tg_flows/types/document.rs
1use mime::Mime;
2use serde::{Deserialize, Serialize};
3
4use crate::types::{FileMeta, PhotoSize};
5
6/// This object represents a general file (as opposed to [photos], [voice
7/// messages] and [audio files]).
8///
9/// [The official docs](https://core.telegram.org/bots/api#document).
10///
11/// [photos]: https://core.telegram.org/bots/api#photosize
12/// [voice messages]: https://core.telegram.org/bots/api#voice
13/// [audio files]: https://core.telegram.org/bots/api#audio
14#[serde_with_macros::skip_serializing_none]
15#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
16pub struct Document {
17 /// Metadata of the document file.
18 #[serde(flatten)]
19 pub file: FileMeta,
20
21 /// A document thumbnail as defined by a sender.
22 pub thumb: Option<PhotoSize>,
23
24 /// An original filename as defined by a sender.
25 pub file_name: Option<String>,
26
27 /// A MIME type of the file as defined by a sender.
28 #[serde(default, with = "crate::types::non_telegram_types::mime::opt_deser")]
29 pub mime_type: Option<Mime>,
30}