telegram_bot2/models/input_media.rs
1use crate::models::MessageEntity;
2use serde::{Deserialize, Serialize};
3
4type InputFile = ();
5
6/// This object represents the content of a media message to be sent
7#[derive(Serialize, Deserialize, Clone, Debug)]
8pub enum InputMedia {
9 /// Represents a video to be sent.
10 Video {
11 /// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »
12 media: String,
13 /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »
14 thumb: InputFile,
15 /// . Caption of the video to be sent, 0-1024 characters after entities parsing
16 #[serde(default, skip_serializing_if = "Option::is_none")]
17 caption: Option<String>,
18 /// . Mode for parsing entities in the video caption. See formatting options for more details.
19 #[serde(default, skip_serializing_if = "Option::is_none")]
20 parse_mode: Option<String>,
21 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
22 #[serde(default, skip_serializing_if = "Vec::is_empty")]
23 caption_entities: Vec<MessageEntity>,
24 /// Pass True if the video needs to be covered with a spoiler animation
25 #[serde(skip_serializing_if = "Option::is_none")]
26 has_spoiler: Option<bool>,
27 /// . Video width
28 #[serde(default, skip_serializing_if = "Option::is_none")]
29 width: Option<i128>,
30 /// . Video height
31 #[serde(default, skip_serializing_if = "Option::is_none")]
32 height: Option<i128>,
33 /// . Video duration in seconds
34 #[serde(default, skip_serializing_if = "Option::is_none")]
35 duration: Option<i128>,
36 /// . Pass True if the uploaded video is suitable for streaming
37 #[serde(default, skip_serializing_if = "Option::is_none")]
38 supports_streaming: Option<bool>,
39 },
40
41 /// Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
42 Animation {
43 /// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »
44 media: String,
45 /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »
46 thumb: InputFile,
47 /// . Caption of the animation to be sent, 0-1024 characters after entities parsing
48 #[serde(default, skip_serializing_if = "Option::is_none")]
49 caption: Option<String>,
50 /// . Mode for parsing entities in the animation caption. See formatting options for more details.
51 #[serde(default, skip_serializing_if = "Option::is_none")]
52 parse_mode: Option<String>,
53 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
54 #[serde(default, skip_serializing_if = "Vec::is_empty")]
55 caption_entities: Vec<MessageEntity>,
56 /// Pass True if the animation needs to be covered with a spoiler animation
57 #[serde(skip_serializing_if = "Option::is_none")]
58 has_spoiler: Option<bool>,
59 /// . Animation width
60 #[serde(default, skip_serializing_if = "Option::is_none")]
61 width: Option<i128>,
62 /// . Animation height
63 #[serde(default, skip_serializing_if = "Option::is_none")]
64 height: Option<i128>,
65 /// . Animation duration in seconds
66 #[serde(default, skip_serializing_if = "Option::is_none")]
67 duration: Option<i128>,
68 },
69
70 /// Represents an audio file to be treated as music to be sent.
71 Audio {
72 /// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »
73 media: String,
74 /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »
75 thumb: InputFile,
76 /// . Caption of the audio to be sent, 0-1024 characters after entities parsing
77 #[serde(default, skip_serializing_if = "Option::is_none")]
78 caption: Option<String>,
79 /// . Mode for parsing entities in the audio caption. See formatting options for more details.
80 #[serde(default, skip_serializing_if = "Option::is_none")]
81 parse_mode: Option<String>,
82 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
83 #[serde(default, skip_serializing_if = "Vec::is_empty")]
84 caption_entities: Vec<MessageEntity>,
85 /// . Duration of the audio in seconds
86 #[serde(default, skip_serializing_if = "Option::is_none")]
87 duration: Option<i128>,
88 /// . Performer of the audio
89 #[serde(default, skip_serializing_if = "Option::is_none")]
90 performer: Option<String>,
91 /// . Title of the audio
92 #[serde(default, skip_serializing_if = "Option::is_none")]
93 title: Option<String>,
94 },
95
96 /// Represents a general file to be sent.
97 Document {
98 /// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »
99 media: String,
100 /// Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »
101 thumb: InputFile,
102 /// . Caption of the document to be sent, 0-1024 characters after entities parsing
103 #[serde(default, skip_serializing_if = "Option::is_none")]
104 caption: Option<String>,
105 /// . Mode for parsing entities in the document caption. See formatting options for more details.
106 #[serde(default, skip_serializing_if = "Option::is_none")]
107 parse_mode: Option<String>,
108 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
109 #[serde(default, skip_serializing_if = "Vec::is_empty")]
110 caption_entities: Vec<MessageEntity>,
111 /// . Disables automatic server-side content type detection for files uploaded using multipart/form-data. Always True, if the document is sent as part of an album.
112 #[serde(default, skip_serializing_if = "Option::is_none")]
113 disable_content_type_detection: Option<bool>,
114 },
115
116 /// Represents a photo to be sent
117 Photo {
118 /// File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »
119 media: String,
120 /// Caption of the photo to be sent, 0-1024 characters after entities parsing
121 #[serde(default, skip_serializing_if = "Option::is_none")]
122 caption: Option<String>,
123 /// Mode for parsing entities in the photo caption. See formatting options for more details.
124 #[serde(default, skip_serializing_if = "Option::is_none")]
125 parse_mode: Option<String>,
126 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
127 #[serde(default, skip_serializing_if = "Vec::is_empty")]
128 caption_entities: Vec<MessageEntity>,
129 /// Pass True if the photo needs to be covered with a spoiler animation
130 #[serde(skip_serializing_if = "Option::is_none")]
131 has_spoiler: Option<bool>,
132 },
133}