telegram_bot_api/
types.rs

1/// All types used in the Bot API responses are represented as JSON-objects.
2/// It is safe to use 32-bit signed integers for storing all Integer fields unless otherwise noted.
3/// Optional fields may be not returned when irrelevant.
4use serde::{Deserialize, Serialize};
5use serde_json::Value;
6use std::collections::HashMap;
7
8/// This object represents an incoming update.
9#[derive(Deserialize, Serialize, Debug, Clone)]
10pub struct Update {
11    /// The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This ID becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.
12    pub update_id: i64,
13    /// Optional. New incoming message of any kind - text, photo, sticker, etc.
14    #[serde(skip_serializing_if = "Option::is_none")]
15    pub message: Option<Message>,
16    /// Optional. New version of a message that is known to the bot and was edited
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub edited_message: Option<Message>,
19    /// Optional. New incoming channel post of any kind - text, photo, sticker, etc.
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub channel_post: Option<Message>,
22    /// Optional. New version of a channel post that is known to the bot and was edited
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub edited_channel_post: Option<Message>,
25    /// Optional. New incoming inline query
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub inline_query: Option<InlineQuery>,
28    /// Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot.
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub chosen_inline_result: Option<ChosenInlineResult>,
31    /// Optional. New incoming callback query
32    #[serde(skip_serializing_if = "Option::is_none")]
33    pub callback_query: Option<CallbackQuery>,
34    /// Optional. New incoming shipping query. Only for invoices with flexible price
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub shipping_query: Option<ShippingQuery>,
37    /// Optional. New incoming pre-checkout query. Contains full information about checkout
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pub pre_checkout_query: Option<PreCheckoutQuery>,
40    /// Optional. New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot
41    #[serde(skip_serializing_if = "Option::is_none")]
42    pub poll: Option<Poll>,
43    /// Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.
44    #[serde(skip_serializing_if = "Option::is_none")]
45    pub poll_answer: Option<PollAnswer>,
46    /// Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.
47    #[serde(skip_serializing_if = "Option::is_none")]
48    pub my_chat_member: Option<ChatMemberUpdated>,
49    /// Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates.
50    #[serde(skip_serializing_if = "Option::is_none")]
51    pub chat_member: Option<ChatMemberUpdated>,
52    /// Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub chat_join_request: Option<ChatJoinRequest>,
55}
56impl Update {
57    pub fn new(update_id: i64) -> Self {
58        Self {
59            update_id,
60            message: None,
61            edited_message: None,
62            channel_post: None,
63            edited_channel_post: None,
64            inline_query: None,
65            chosen_inline_result: None,
66            callback_query: None,
67            shipping_query: None,
68            pre_checkout_query: None,
69            poll: None,
70            poll_answer: None,
71            my_chat_member: None,
72            chat_member: None,
73            chat_join_request: None,
74        }
75    }
76}
77
78/// Describes the current status of a webhook.
79#[derive(Deserialize, Serialize, Debug, Clone)]
80pub struct WebhookInfo {
81    /// Webhook URL, may be empty if webhook is not set up
82    pub url: String,
83    /// True, if a custom certificate was provided for webhook certificate checks
84    pub has_custom_certificate: bool,
85    /// Number of updates awaiting delivery
86    pub pending_update_count: i64,
87    /// Optional. Currently used webhook IP address
88    #[serde(skip_serializing_if = "Option::is_none")]
89    pub ip_address: Option<String>,
90    /// Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook
91    #[serde(skip_serializing_if = "Option::is_none")]
92    pub last_error_date: Option<i64>,
93    /// Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook
94    #[serde(skip_serializing_if = "Option::is_none")]
95    pub last_error_message: Option<String>,
96    /// Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters
97    #[serde(skip_serializing_if = "Option::is_none")]
98    pub last_synchronization_error_date: Option<i64>,
99    /// Optional. The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery
100    #[serde(skip_serializing_if = "Option::is_none")]
101    pub max_connections: Option<i64>,
102    /// Optional. A list of update types the bot is subscribed to. Defaults to all update types except chat_member
103    #[serde(skip_serializing_if = "Option::is_none")]
104    pub allowed_updates: Option<Vec<String>>,
105}
106impl WebhookInfo {
107    pub fn new(url: String, has_custom_certificate: bool, pending_update_count: i64) -> Self {
108        Self {
109            url,
110            has_custom_certificate,
111            pending_update_count,
112            ip_address: None,
113            last_error_date: None,
114            last_error_message: None,
115            last_synchronization_error_date: None,
116            max_connections: None,
117            allowed_updates: None,
118        }
119    }
120}
121
122/// This object represents a Telegram user or bot.
123#[derive(Deserialize, Serialize, Debug, Clone)]
124pub struct User {
125    /// Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
126    pub id: i64,
127    /// True, if this user is a bot
128    pub is_bot: bool,
129    /// User's or bot's first name
130    pub first_name: String,
131    /// Optional. User's or bot's last name
132    #[serde(skip_serializing_if = "Option::is_none")]
133    pub last_name: Option<String>,
134    /// Optional. User's or bot's username
135    #[serde(skip_serializing_if = "Option::is_none")]
136    pub username: Option<String>,
137    /// Optional. IETF language tag of the user's language
138    #[serde(skip_serializing_if = "Option::is_none")]
139    pub language_code: Option<String>,
140    /// Optional. True, if this user is a Telegram Premium user
141    #[serde(skip_serializing_if = "Option::is_none")]
142    pub is_premium: Option<bool>,
143    /// Optional. True, if this user added the bot to the attachment menu
144    #[serde(skip_serializing_if = "Option::is_none")]
145    pub added_to_attachment_menu: Option<bool>,
146    /// Optional. True, if the bot can be invited to groups. Returned only in getMe.
147    #[serde(skip_serializing_if = "Option::is_none")]
148    pub can_join_groups: Option<bool>,
149    /// Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
150    #[serde(skip_serializing_if = "Option::is_none")]
151    pub can_read_all_group_messages: Option<bool>,
152    /// Optional. True, if the bot supports inline queries. Returned only in getMe.
153    #[serde(skip_serializing_if = "Option::is_none")]
154    pub supports_inline_queries: Option<bool>,
155}
156impl User {
157    pub fn new(id: i64, is_bot: bool, first_name: String) -> Self {
158        Self {
159            id,
160            is_bot,
161            first_name,
162            last_name: None,
163            username: None,
164            language_code: None,
165            is_premium: None,
166            added_to_attachment_menu: None,
167            can_join_groups: None,
168            can_read_all_group_messages: None,
169            supports_inline_queries: None,
170        }
171    }
172}
173
174/// Type of chat, can be either “private”, “group”, “supergroup” or “channel”
175#[derive(Deserialize, Serialize, Debug, Clone)]
176pub enum ChatType {
177    #[serde(rename = "private")]
178    Private,
179    #[serde(rename = "group")]
180    Group,
181    #[serde(rename = "supergroup")]
182    Supergroup,
183    #[serde(rename = "channel")]
184    Channel,
185}
186
187/// This object represents a chat.
188#[derive(Deserialize, Serialize, Debug, Clone)]
189pub struct Chat {
190    /// Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
191    pub id: i64,
192    /// Type of chat, can be either “private”, “group”, “supergroup” or “channel”
193    #[serde(rename = "type")]
194    type_name: ChatType,
195    /// Optional. Title, for supergroups, channels and group chats
196    #[serde(skip_serializing_if = "Option::is_none")]
197    pub title: Option<String>,
198    /// Optional. Username, for private chats, supergroups and channels if available
199    #[serde(skip_serializing_if = "Option::is_none")]
200    pub username: Option<String>,
201    /// Optional. First name of the other party in a private chat
202    #[serde(skip_serializing_if = "Option::is_none")]
203    pub first_name: Option<String>,
204    /// Optional. Last name of the other party in a private chat
205    #[serde(skip_serializing_if = "Option::is_none")]
206    pub last_name: Option<String>,
207    /// Optional. Chat photo. Returned only in getChat.
208    #[serde(skip_serializing_if = "Option::is_none")]
209    pub photo: Option<ChatPhoto>,
210    /// Optional. Bio of the other party in a private chat. Returned only in getChat.
211    #[serde(skip_serializing_if = "Option::is_none")]
212    pub bio: Option<String>,
213    /// Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat.
214    #[serde(skip_serializing_if = "Option::is_none")]
215    pub has_private_forwards: Option<bool>,
216    /// Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat.
217    #[serde(skip_serializing_if = "Option::is_none")]
218    pub has_restricted_voice_and_video_messages: Option<bool>,
219    /// Optional. True, if users need to join the supergroup before they can send messages. Returned only in getChat.
220    #[serde(skip_serializing_if = "Option::is_none")]
221    pub join_to_send_messages: Option<bool>,
222    /// Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.
223    #[serde(skip_serializing_if = "Option::is_none")]
224    pub join_by_request: Option<bool>,
225    /// Optional. Description, for groups, supergroups and channel chats. Returned only in getChat.
226    #[serde(skip_serializing_if = "Option::is_none")]
227    pub description: Option<String>,
228    /// Optional. Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
229    #[serde(skip_serializing_if = "Option::is_none")]
230    pub invite_link: Option<String>,
231    /// Optional. The most recent pinned message (by sending date). Returned only in getChat.
232    #[serde(skip_serializing_if = "Option::is_none")]
233    pub pinned_message: Option<Message>,
234    /// Optional. Default chat member permissions, for groups and supergroups. Returned only in getChat.
235    #[serde(skip_serializing_if = "Option::is_none")]
236    pub permissions: Option<ChatPermissions>,
237    /// Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat.
238    #[serde(skip_serializing_if = "Option::is_none")]
239    pub slow_mode_delay: Option<i64>,
240    /// Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
241    #[serde(skip_serializing_if = "Option::is_none")]
242    pub message_auto_delete_time: Option<i64>,
243    /// Optional. True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.
244    #[serde(skip_serializing_if = "Option::is_none")]
245    pub has_protected_content: Option<bool>,
246    /// Optional. For supergroups, name of group sticker set. Returned only in getChat.
247    #[serde(skip_serializing_if = "Option::is_none")]
248    pub sticker_set_name: Option<String>,
249    /// Optional. True, if the bot can change the group sticker set. Returned only in getChat.
250    #[serde(skip_serializing_if = "Option::is_none")]
251    pub can_set_sticker_set: Option<bool>,
252    /// Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. Returned only in getChat.
253    #[serde(skip_serializing_if = "Option::is_none")]
254    pub linked_chat_id: Option<i64>,
255    /// Optional. For supergroups, the location to which the supergroup is connected. Returned only in getChat.
256    #[serde(skip_serializing_if = "Option::is_none")]
257    pub location: Option<ChatLocation>,
258}
259impl Chat {
260    pub fn new(id: i64, type_name: ChatType) -> Self {
261        Self {
262            id,
263            type_name,
264            title: None,
265            username: None,
266            first_name: None,
267            last_name: None,
268            photo: None,
269            bio: None,
270            has_private_forwards: None,
271            has_restricted_voice_and_video_messages: None,
272            join_to_send_messages: None,
273            join_by_request: None,
274            description: None,
275            invite_link: None,
276            pinned_message: None,
277            permissions: None,
278            slow_mode_delay: None,
279            message_auto_delete_time: None,
280            has_protected_content: None,
281            sticker_set_name: None,
282            can_set_sticker_set: None,
283            linked_chat_id: None,
284            location: None,
285        }
286    }
287}
288
289/// This object represents a message.
290#[derive(Deserialize, Serialize, Debug, Clone)]
291pub struct Message {
292    /// Unique message identifier inside this chat
293    pub message_id: i64,
294    /// Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
295    #[serde(skip_serializing_if = "Option::is_none")]
296    pub from: Option<User>,
297    /// Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
298    #[serde(skip_serializing_if = "Option::is_none")]
299    pub sender_chat: Option<Box<Chat>>,
300    /// Date the message was sent in Unix time
301    pub date: i64,
302    /// Conversation the message belongs to
303    pub chat: Box<Chat>,
304    /// Optional. For forwarded messages, sender of the original message
305    #[serde(skip_serializing_if = "Option::is_none")]
306    pub forward_from: Option<User>,
307    /// Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat
308    #[serde(skip_serializing_if = "Option::is_none")]
309    pub forward_from_chat: Option<Box<Chat>>,
310    /// Optional. For messages forwarded from channels, identifier of the original message in the channel
311    #[serde(skip_serializing_if = "Option::is_none")]
312    pub forward_from_message_id: Option<i64>,
313    /// Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present
314    #[serde(skip_serializing_if = "Option::is_none")]
315    pub forward_signature: Option<String>,
316    /// Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages
317    #[serde(skip_serializing_if = "Option::is_none")]
318    pub forward_sender_name: Option<String>,
319    /// Optional. For forwarded messages, date the original message was sent in Unix time
320    #[serde(skip_serializing_if = "Option::is_none")]
321    pub forward_date: Option<i64>,
322    /// Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group
323    #[serde(skip_serializing_if = "Option::is_none")]
324    pub is_automatic_forward: Option<bool>,
325    /// Optional. For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
326    #[serde(skip_serializing_if = "Option::is_none")]
327    pub reply_to_message: Option<Box<Message>>,
328    /// Optional. Bot through which the message was sent
329    #[serde(skip_serializing_if = "Option::is_none")]
330    pub via_bot: Option<User>,
331    /// Optional. Date the message was last edited in Unix time
332    #[serde(skip_serializing_if = "Option::is_none")]
333    pub edit_date: Option<i64>,
334    /// Optional. True, if the message can't be forwarded
335    #[serde(skip_serializing_if = "Option::is_none")]
336    pub has_protected_content: Option<bool>,
337    /// Optional. The unique identifier of a media message group this message belongs to
338    #[serde(skip_serializing_if = "Option::is_none")]
339    pub media_group_id: Option<String>,
340    /// Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
341    #[serde(skip_serializing_if = "Option::is_none")]
342    pub author_signature: Option<String>,
343    /// Optional. For text messages, the actual UTF-8 text of the message
344    #[serde(skip_serializing_if = "Option::is_none")]
345    pub text: Option<String>,
346    /// Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
347    #[serde(skip_serializing_if = "Option::is_none")]
348    pub entities: Option<Vec<MessageEntity>>,
349    /// Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set
350    #[serde(skip_serializing_if = "Option::is_none")]
351    pub animation: Option<Animation>,
352    /// Optional. Message is an audio file, information about the file
353    #[serde(skip_serializing_if = "Option::is_none")]
354    pub audio: Option<Audio>,
355    /// Optional. Message is a general file, information about the file
356    #[serde(skip_serializing_if = "Option::is_none")]
357    pub document: Option<Document>,
358    /// Optional. Message is a photo, available sizes of the photo
359    #[serde(skip_serializing_if = "Option::is_none")]
360    pub photo: Option<Vec<PhotoSize>>,
361    /// Optional. Message is a sticker, information about the sticker
362    #[serde(skip_serializing_if = "Option::is_none")]
363    pub sticker: Option<Sticker>,
364    /// Optional. Message is a video, information about the video
365    #[serde(skip_serializing_if = "Option::is_none")]
366    pub video: Option<Video>,
367    /// Optional. Message is a video note, information about the video message
368    #[serde(skip_serializing_if = "Option::is_none")]
369    pub video_note: Option<VideoNote>,
370    /// Optional. Message is a voice message, information about the file
371    #[serde(skip_serializing_if = "Option::is_none")]
372    pub voice: Option<Voice>,
373    /// Optional. Caption for the animation, audio, document, photo, video or voice
374    #[serde(skip_serializing_if = "Option::is_none")]
375    pub caption: Option<String>,
376    /// Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
377    #[serde(skip_serializing_if = "Option::is_none")]
378    pub caption_entities: Option<Vec<MessageEntity>>,
379    /// Optional. Message is a shared contact, information about the contact
380    #[serde(skip_serializing_if = "Option::is_none")]
381    pub contact: Option<Contact>,
382    /// Optional. Message is a dice with random value
383    #[serde(skip_serializing_if = "Option::is_none")]
384    pub dice: Option<Dice>,
385    /// Optional. Message is a game, information about the game. More about games »
386    #[serde(skip_serializing_if = "Option::is_none")]
387    pub game: Option<Game>,
388    /// Optional. Message is a native poll, information about the poll
389    #[serde(skip_serializing_if = "Option::is_none")]
390    pub poll: Option<Poll>,
391    /// Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set
392    #[serde(skip_serializing_if = "Option::is_none")]
393    pub venue: Option<Venue>,
394    /// Optional. Message is a shared location, information about the location
395    #[serde(skip_serializing_if = "Option::is_none")]
396    pub location: Option<Location>,
397    /// Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
398    #[serde(skip_serializing_if = "Option::is_none")]
399    pub new_chat_members: Option<Vec<User>>,
400    /// Optional. A member was removed from the group, information about them (this member may be the bot itself)
401    #[serde(skip_serializing_if = "Option::is_none")]
402    pub left_chat_member: Option<User>,
403    /// Optional. A chat title was changed to this value
404    #[serde(skip_serializing_if = "Option::is_none")]
405    pub new_chat_title: Option<String>,
406    /// Optional. A chat photo was change to this value
407    #[serde(skip_serializing_if = "Option::is_none")]
408    pub new_chat_photo: Option<Vec<PhotoSize>>,
409    /// Optional. Service message: the chat photo was deleted
410    #[serde(skip_serializing_if = "Option::is_none")]
411    pub delete_chat_photo: Option<bool>,
412    /// Optional. Service message: the group has been created
413    #[serde(skip_serializing_if = "Option::is_none")]
414    pub group_chat_created: Option<bool>,
415    /// Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
416    #[serde(skip_serializing_if = "Option::is_none")]
417    pub supergroup_chat_created: Option<bool>,
418    /// Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
419    #[serde(skip_serializing_if = "Option::is_none")]
420    pub channel_chat_created: Option<bool>,
421    /// Optional. Service message: auto-delete timer settings changed in the chat
422    #[serde(skip_serializing_if = "Option::is_none")]
423    pub message_auto_delete_timer_changed: Option<MessageAutoDeleteTimerChanged>,
424    /// Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
425    #[serde(skip_serializing_if = "Option::is_none")]
426    pub migrate_to_chat_id: Option<i64>,
427    /// Optional. The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
428    #[serde(skip_serializing_if = "Option::is_none")]
429    pub migrate_from_chat_id: Option<i64>,
430    /// Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.
431    #[serde(skip_serializing_if = "Option::is_none")]
432    pub pinned_message: Option<Box<Message>>,
433    /// Optional. Message is an invoice for a payment, information about the invoice. More about payments »
434    #[serde(skip_serializing_if = "Option::is_none")]
435    pub invoice: Option<Invoice>,
436    /// Optional. Message is a service message about a successful payment, information about the payment. More about payments »
437    #[serde(skip_serializing_if = "Option::is_none")]
438    pub successful_payment: Option<SuccessfulPayment>,
439    /// Optional. The domain name of the website on which the user has logged in. More about Telegram Login »
440    #[serde(skip_serializing_if = "Option::is_none")]
441    pub connected_website: Option<String>,
442    /// Optional. Telegram Passport data
443    #[serde(skip_serializing_if = "Option::is_none")]
444    pub passport_data: Option<PassportData>,
445    /// Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.
446    #[serde(skip_serializing_if = "Option::is_none")]
447    pub proximity_alert_triggered: Option<ProximityAlertTriggered>,
448    /// Optional. Service message: video chat scheduled
449    #[serde(skip_serializing_if = "Option::is_none")]
450    pub video_chat_scheduled: Option<VideoChatScheduled>,
451    /// Optional. Service message: video chat started
452    #[serde(skip_serializing_if = "Option::is_none")]
453    pub video_chat_started: Option<VideoChatStarted>,
454    /// Optional. Service message: video chat ended
455    #[serde(skip_serializing_if = "Option::is_none")]
456    pub video_chat_ended: Option<VideoChatEnded>,
457    /// Optional. Service message: new participants invited to a video chat
458    #[serde(skip_serializing_if = "Option::is_none")]
459    pub video_chat_participants_invited: Option<VideoChatParticipantsInvited>,
460    /// Optional. Service message: data sent by a Web App
461    #[serde(skip_serializing_if = "Option::is_none")]
462    pub web_app_data: Option<WebAppData>,
463    /// Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.
464    #[serde(skip_serializing_if = "Option::is_none")]
465    pub reply_markup: Option<InlineKeyboardMarkup>,
466}
467impl Message {
468    pub fn new(message_id: i64, date: i64, chat: Box<Chat>) -> Self {
469        Self {
470            message_id,
471            from: None,
472            sender_chat: None,
473            date,
474            chat,
475            forward_from: None,
476            forward_from_chat: None,
477            forward_from_message_id: None,
478            forward_signature: None,
479            forward_sender_name: None,
480            forward_date: None,
481            is_automatic_forward: None,
482            reply_to_message: None,
483            via_bot: None,
484            edit_date: None,
485            has_protected_content: None,
486            media_group_id: None,
487            author_signature: None,
488            text: None,
489            entities: None,
490            animation: None,
491            audio: None,
492            document: None,
493            photo: None,
494            sticker: None,
495            video: None,
496            video_note: None,
497            voice: None,
498            caption: None,
499            caption_entities: None,
500            contact: None,
501            dice: None,
502            game: None,
503            poll: None,
504            venue: None,
505            location: None,
506            new_chat_members: None,
507            left_chat_member: None,
508            new_chat_title: None,
509            new_chat_photo: None,
510            delete_chat_photo: None,
511            group_chat_created: None,
512            supergroup_chat_created: None,
513            channel_chat_created: None,
514            message_auto_delete_timer_changed: None,
515            migrate_to_chat_id: None,
516            migrate_from_chat_id: None,
517            pinned_message: None,
518            invoice: None,
519            successful_payment: None,
520            connected_website: None,
521            passport_data: None,
522            proximity_alert_triggered: None,
523            video_chat_scheduled: None,
524            video_chat_started: None,
525            video_chat_ended: None,
526            video_chat_participants_invited: None,
527            web_app_data: None,
528            reply_markup: None,
529        }
530    }
531}
532
533/// This object represents a unique message identifier.
534#[derive(Deserialize, Serialize, Debug, Clone)]
535pub struct MessageId {
536    /// Unique message identifier
537    pub message_id: i64,
538}
539impl MessageId {
540    pub fn new(message_id: i64) -> Self {
541        Self { message_id }
542    }
543}
544
545/// This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
546#[derive(Deserialize, Serialize, Debug, Clone)]
547pub struct MessageEntity {
548    /// Type of the entity. Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers)
549    #[serde(rename = "type")]
550    pub type_name: String,
551    /// Offset in UTF-16 code units to the start of the entity
552    pub offset: i64,
553    /// Length of the entity in UTF-16 code units
554    pub length: i64,
555    /// Optional. For “text_link” only, URL that will be opened after user taps on the text
556    #[serde(skip_serializing_if = "Option::is_none")]
557    pub url: Option<String>,
558    /// Optional. For “text_mention” only, the mentioned user
559    #[serde(skip_serializing_if = "Option::is_none")]
560    pub user: Option<User>,
561    /// Optional. For “pre” only, the programming language of the entity text
562    #[serde(skip_serializing_if = "Option::is_none")]
563    pub language: Option<String>,
564    /// Optional. For “custom_emoji” only, unique identifier of the custom emoji. Use getCustomEmojiStickers to get full information about the sticker
565    #[serde(skip_serializing_if = "Option::is_none")]
566    pub custom_emoji_id: Option<String>,
567}
568impl MessageEntity {
569    pub fn new(type_name: String, offset: i64, length: i64) -> Self {
570        Self {
571            type_name,
572            offset,
573            length,
574            url: None,
575            user: None,
576            language: None,
577            custom_emoji_id: None,
578        }
579    }
580}
581
582/// This object represents one size of a photo or a file / sticker thumbnail.
583#[derive(Deserialize, Serialize, Debug, Clone)]
584pub struct PhotoSize {
585    /// Identifier for this file, which can be used to download or reuse the file
586    pub file_id: String,
587    /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
588    pub file_unique_id: String,
589    /// Photo width
590    pub width: i64,
591    /// Photo height
592    pub height: i64,
593    /// Optional. File size in bytes
594    #[serde(skip_serializing_if = "Option::is_none")]
595    pub file_size: Option<i64>,
596}
597impl PhotoSize {
598    pub fn new(file_id: String, file_unique_id: String, width: i64, height: i64) -> Self {
599        Self {
600            file_id,
601            file_unique_id,
602            width,
603            height,
604            file_size: None,
605        }
606    }
607}
608
609/// This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
610#[derive(Deserialize, Serialize, Debug, Clone)]
611pub struct Animation {
612    /// Identifier for this file, which can be used to download or reuse the file
613    pub file_id: String,
614    /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
615    pub file_unique_id: String,
616    /// Video width as defined by sender
617    pub width: i64,
618    /// Video height as defined by sender
619    pub height: i64,
620    /// Duration of the video in seconds as defined by sender
621    pub duration: i64,
622    /// Optional. Animation thumbnail as defined by sender
623    #[serde(skip_serializing_if = "Option::is_none")]
624    pub thumb: Option<PhotoSize>,
625    /// Optional. Original animation filename as defined by sender
626    #[serde(skip_serializing_if = "Option::is_none")]
627    pub file_name: Option<String>,
628    /// Optional. MIME type of the file as defined by sender
629    #[serde(skip_serializing_if = "Option::is_none")]
630    pub mime_type: Option<String>,
631    /// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
632    #[serde(skip_serializing_if = "Option::is_none")]
633    pub file_size: Option<i64>,
634}
635impl Animation {
636    pub fn new(
637        file_id: String,
638        file_unique_id: String,
639        width: i64,
640        height: i64,
641        duration: i64,
642    ) -> Self {
643        Self {
644            file_id,
645            file_unique_id,
646            width,
647            height,
648            duration,
649            thumb: None,
650            file_name: None,
651            mime_type: None,
652            file_size: None,
653        }
654    }
655}
656
657/// This object represents an audio file to be treated as music by the Telegram clients.
658#[derive(Deserialize, Serialize, Debug, Clone)]
659pub struct Audio {
660    /// Identifier for this file, which can be used to download or reuse the file
661    pub file_id: String,
662    /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
663    pub file_unique_id: String,
664    /// Duration of the audio in seconds as defined by sender
665    pub duration: i64,
666    /// Optional. Performer of the audio as defined by sender or by audio tags
667    #[serde(skip_serializing_if = "Option::is_none")]
668    pub performer: Option<String>,
669    /// Optional. Title of the audio as defined by sender or by audio tags
670    #[serde(skip_serializing_if = "Option::is_none")]
671    pub title: Option<String>,
672    /// Optional. Original filename as defined by sender
673    #[serde(skip_serializing_if = "Option::is_none")]
674    pub file_name: Option<String>,
675    /// Optional. MIME type of the file as defined by sender
676    #[serde(skip_serializing_if = "Option::is_none")]
677    pub mime_type: Option<String>,
678    /// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
679    #[serde(skip_serializing_if = "Option::is_none")]
680    pub file_size: Option<i64>,
681    /// Optional. Thumbnail of the album cover to which the music file belongs
682    #[serde(skip_serializing_if = "Option::is_none")]
683    pub thumb: Option<PhotoSize>,
684}
685impl Audio {
686    pub fn new(file_id: String, file_unique_id: String, duration: i64) -> Self {
687        Self {
688            file_id,
689            file_unique_id,
690            duration,
691            performer: None,
692            title: None,
693            file_name: None,
694            mime_type: None,
695            file_size: None,
696            thumb: None,
697        }
698    }
699}
700
701/// This object represents a general file (as opposed to photos, voice messages and audio files).
702#[derive(Deserialize, Serialize, Debug, Clone)]
703pub struct Document {
704    /// Identifier for this file, which can be used to download or reuse the file
705    pub file_id: String,
706    /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
707    pub file_unique_id: String,
708    /// Optional. Document thumbnail as defined by sender
709    #[serde(skip_serializing_if = "Option::is_none")]
710    pub thumb: Option<PhotoSize>,
711    /// Optional. Original filename as defined by sender
712    #[serde(skip_serializing_if = "Option::is_none")]
713    pub file_name: Option<String>,
714    /// Optional. MIME type of the file as defined by sender
715    #[serde(skip_serializing_if = "Option::is_none")]
716    pub mime_type: Option<String>,
717    /// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
718    #[serde(skip_serializing_if = "Option::is_none")]
719    pub file_size: Option<i64>,
720}
721impl Document {
722    pub fn new(file_id: String, file_unique_id: String) -> Self {
723        Self {
724            file_id,
725            file_unique_id,
726            thumb: None,
727            file_name: None,
728            mime_type: None,
729            file_size: None,
730        }
731    }
732}
733
734/// This object represents a video file.
735#[derive(Deserialize, Serialize, Debug, Clone)]
736pub struct Video {
737    /// Identifier for this file, which can be used to download or reuse the file
738    pub file_id: String,
739    /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
740    pub file_unique_id: String,
741    /// Video width as defined by sender
742    pub width: i64,
743    /// Video height as defined by sender
744    pub height: i64,
745    /// Duration of the video in seconds as defined by sender
746    pub duration: i64,
747    /// Optional. Video thumbnail
748    #[serde(skip_serializing_if = "Option::is_none")]
749    pub thumb: Option<PhotoSize>,
750    /// Optional. Original filename as defined by sender
751    #[serde(skip_serializing_if = "Option::is_none")]
752    pub file_name: Option<String>,
753    /// Optional. MIME type of the file as defined by sender
754    #[serde(skip_serializing_if = "Option::is_none")]
755    pub mime_type: Option<String>,
756    /// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
757    #[serde(skip_serializing_if = "Option::is_none")]
758    pub file_size: Option<i64>,
759}
760impl Video {
761    pub fn new(
762        file_id: String,
763        file_unique_id: String,
764        width: i64,
765        height: i64,
766        duration: i64,
767    ) -> Self {
768        Self {
769            file_id,
770            file_unique_id,
771            width,
772            height,
773            duration,
774            thumb: None,
775            file_name: None,
776            mime_type: None,
777            file_size: None,
778        }
779    }
780}
781
782/// This object represents a video message (available in Telegram apps as of v.4.0).
783#[derive(Deserialize, Serialize, Debug, Clone)]
784pub struct VideoNote {
785    /// Identifier for this file, which can be used to download or reuse the file
786    pub file_id: String,
787    /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
788    pub file_unique_id: String,
789    /// Video width and height (diameter of the video message) as defined by sender
790    pub length: i64,
791    /// Duration of the video in seconds as defined by sender
792    pub duration: i64,
793    /// Optional. Video thumbnail
794    #[serde(skip_serializing_if = "Option::is_none")]
795    pub thumb: Option<PhotoSize>,
796    /// Optional. File size in bytes
797    #[serde(skip_serializing_if = "Option::is_none")]
798    pub file_size: Option<i64>,
799}
800impl VideoNote {
801    pub fn new(file_id: String, file_unique_id: String, length: i64, duration: i64) -> Self {
802        Self {
803            file_id,
804            file_unique_id,
805            length,
806            duration,
807            thumb: None,
808            file_size: None,
809        }
810    }
811}
812
813/// This object represents a voice note.
814#[derive(Deserialize, Serialize, Debug, Clone)]
815pub struct Voice {
816    /// Identifier for this file, which can be used to download or reuse the file
817    pub file_id: String,
818    /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
819    pub file_unique_id: String,
820    /// Duration of the audio in seconds as defined by sender
821    pub duration: i64,
822    /// Optional. MIME type of the file as defined by sender
823    #[serde(skip_serializing_if = "Option::is_none")]
824    pub mime_type: Option<String>,
825    /// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
826    #[serde(skip_serializing_if = "Option::is_none")]
827    pub file_size: Option<i64>,
828}
829impl Voice {
830    pub fn new(file_id: String, file_unique_id: String, duration: i64) -> Self {
831        Self {
832            file_id,
833            file_unique_id,
834            duration,
835            mime_type: None,
836            file_size: None,
837        }
838    }
839}
840
841/// This object represents a phone contact.
842#[derive(Deserialize, Serialize, Debug, Clone)]
843pub struct Contact {
844    /// Contact's phone number
845    pub phone_number: String,
846    /// Contact's first name
847    pub first_name: String,
848    /// Optional. Contact's last name
849    #[serde(skip_serializing_if = "Option::is_none")]
850    pub last_name: Option<String>,
851    /// Optional. Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier.
852    #[serde(skip_serializing_if = "Option::is_none")]
853    pub user_id: Option<i64>,
854    /// Optional. Additional data about the contact in the form of a vCard
855    #[serde(skip_serializing_if = "Option::is_none")]
856    pub vcard: Option<String>,
857}
858impl Contact {
859    pub fn new(phone_number: String, first_name: String) -> Self {
860        Self {
861            phone_number,
862            first_name,
863            last_name: None,
864            user_id: None,
865            vcard: None,
866        }
867    }
868}
869
870/// This object represents an animated emoji that displays a random value.
871#[derive(Deserialize, Serialize, Debug, Clone)]
872pub struct Dice {
873    /// Emoji on which the dice throw animation is based
874    pub emoji: String,
875    /// Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji
876    pub value: i64,
877}
878impl Dice {
879    pub fn new(emoji: String, value: i64) -> Self {
880        Self { emoji, value }
881    }
882}
883
884/// This object contains information about one answer option in a poll.
885#[derive(Deserialize, Serialize, Debug, Clone)]
886pub struct PollOption {
887    /// Option text, 1-100 characters
888    pub text: String,
889    /// Number of users that voted for this option
890    pub voter_count: i64,
891}
892impl PollOption {
893    pub fn new(text: String, voter_count: i64) -> Self {
894        Self { text, voter_count }
895    }
896}
897
898/// This object represents an answer of a user in a non-anonymous poll.
899#[derive(Deserialize, Serialize, Debug, Clone)]
900pub struct PollAnswer {
901    /// Unique poll identifier
902    pub poll_id: String,
903    /// The user, who changed the answer to the poll
904    pub user: User,
905    /// 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.
906    pub option_ids: Vec<i64>,
907}
908impl PollAnswer {
909    pub fn new(poll_id: String, user: User, option_ids: Vec<i64>) -> Self {
910        Self {
911            poll_id,
912            user,
913            option_ids,
914        }
915    }
916}
917
918/// This object contains information about a poll.
919#[derive(Deserialize, Serialize, Debug, Clone)]
920pub struct Poll {
921    /// Unique poll identifier
922    pub id: String,
923    /// Poll question, 1-300 characters
924    pub question: String,
925    /// List of poll options
926    pub options: Vec<PollOption>,
927    /// Total number of users that voted in the poll
928    pub total_voter_count: i64,
929    /// True, if the poll is closed
930    pub is_closed: bool,
931    /// True, if the poll is anonymous
932    pub is_anonymous: bool,
933    /// Poll type, currently can be “regular” or “quiz”
934    #[serde(rename = "type")]
935    pub type_name: String,
936    /// True, if the poll allows multiple answers
937    pub allows_multiple_answers: bool,
938    /// Optional. 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
939    #[serde(skip_serializing_if = "Option::is_none")]
940    pub correct_option_id: Option<i64>,
941    /// Optional. Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
942    #[serde(skip_serializing_if = "Option::is_none")]
943    pub explanation: Option<String>,
944    /// Optional. Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
945    #[serde(skip_serializing_if = "Option::is_none")]
946    pub explanation_entities: Option<Vec<MessageEntity>>,
947    /// Optional. Amount of time in seconds the poll will be active after creation
948    #[serde(skip_serializing_if = "Option::is_none")]
949    pub open_period: Option<i64>,
950    /// Optional. Point in time (Unix timestamp) when the poll will be automatically closed
951    #[serde(skip_serializing_if = "Option::is_none")]
952    pub close_date: Option<i64>,
953}
954impl Poll {
955    pub fn new(
956        id: String,
957        question: String,
958        options: Vec<PollOption>,
959        total_voter_count: i64,
960        is_closed: bool,
961        is_anonymous: bool,
962        type_name: String,
963        allows_multiple_answers: bool,
964    ) -> Self {
965        Self {
966            id,
967            question,
968            options,
969            total_voter_count,
970            is_closed,
971            is_anonymous,
972            type_name,
973            allows_multiple_answers,
974            correct_option_id: None,
975            explanation: None,
976            explanation_entities: None,
977            open_period: None,
978            close_date: None,
979        }
980    }
981}
982
983/// This object represents a point on the map.
984#[derive(Deserialize, Serialize, Debug, Clone)]
985pub struct Location {
986    /// Longitude as defined by sender
987    pub longitude: f64,
988    /// Latitude as defined by sender
989    pub latitude: f64,
990    /// Optional. The radius of uncertainty for the location, measured in meters; 0-1500
991    #[serde(skip_serializing_if = "Option::is_none")]
992    pub horizontal_accuracy: Option<f64>,
993    /// Optional. Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only.
994    #[serde(skip_serializing_if = "Option::is_none")]
995    pub live_period: Option<i64>,
996    /// Optional. The direction in which user is moving, in degrees; 1-360. For active live locations only.
997    #[serde(skip_serializing_if = "Option::is_none")]
998    pub heading: Option<i64>,
999    /// Optional. The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.
1000    #[serde(skip_serializing_if = "Option::is_none")]
1001    pub proximity_alert_radius: Option<i64>,
1002}
1003impl Location {
1004    pub fn new(longitude: f64, latitude: f64) -> Self {
1005        Self {
1006            longitude,
1007            latitude,
1008            horizontal_accuracy: None,
1009            live_period: None,
1010            heading: None,
1011            proximity_alert_radius: None,
1012        }
1013    }
1014}
1015
1016/// This object represents a venue.
1017#[derive(Deserialize, Serialize, Debug, Clone)]
1018pub struct Venue {
1019    /// Venue location. Can't be a live location
1020    pub location: Location,
1021    /// Name of the venue
1022    pub title: String,
1023    /// Address of the venue
1024    pub address: String,
1025    /// Optional. Foursquare identifier of the venue
1026    #[serde(skip_serializing_if = "Option::is_none")]
1027    pub foursquare_id: Option<String>,
1028    /// Optional. Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
1029    #[serde(skip_serializing_if = "Option::is_none")]
1030    pub foursquare_type: Option<String>,
1031    /// Optional. Google Places identifier of the venue
1032    #[serde(skip_serializing_if = "Option::is_none")]
1033    pub google_place_id: Option<String>,
1034    /// Optional. Google Places type of the venue. (See supported types.)
1035    #[serde(skip_serializing_if = "Option::is_none")]
1036    pub google_place_type: Option<String>,
1037}
1038impl Venue {
1039    pub fn new(location: Location, title: String, address: String) -> Self {
1040        Self {
1041            location,
1042            title,
1043            address,
1044            foursquare_id: None,
1045            foursquare_type: None,
1046            google_place_id: None,
1047            google_place_type: None,
1048        }
1049    }
1050}
1051
1052/// Describes data sent from a Web App to the bot.
1053#[derive(Deserialize, Serialize, Debug, Clone)]
1054pub struct WebAppData {
1055    /// The data. Be aware that a bad client can send arbitrary data in this field.
1056    pub data: String,
1057    /// Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field.
1058    pub button_text: String,
1059}
1060impl WebAppData {
1061    pub fn new(data: String, button_text: String) -> Self {
1062        Self { data, button_text }
1063    }
1064}
1065
1066/// This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
1067#[derive(Deserialize, Serialize, Debug, Clone)]
1068pub struct ProximityAlertTriggered {
1069    /// User that triggered the alert
1070    pub traveler: User,
1071    /// User that set the alert
1072    pub watcher: User,
1073    /// The distance between the users
1074    pub distance: i64,
1075}
1076impl ProximityAlertTriggered {
1077    pub fn new(traveler: User, watcher: User, distance: i64) -> Self {
1078        Self {
1079            traveler,
1080            watcher,
1081            distance,
1082        }
1083    }
1084}
1085
1086/// This object represents a service message about a change in auto-delete timer settings.
1087#[derive(Deserialize, Serialize, Debug, Clone)]
1088pub struct MessageAutoDeleteTimerChanged {
1089    /// New auto-delete time for messages in the chat; in seconds
1090    pub message_auto_delete_time: i64,
1091}
1092impl MessageAutoDeleteTimerChanged {
1093    pub fn new(message_auto_delete_time: i64) -> Self {
1094        Self {
1095            message_auto_delete_time,
1096        }
1097    }
1098}
1099
1100/// This object represents a service message about a video chat scheduled in the chat.
1101#[derive(Deserialize, Serialize, Debug, Clone)]
1102pub struct VideoChatScheduled {
1103    /// Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator
1104    pub start_date: i64,
1105}
1106impl VideoChatScheduled {
1107    pub fn new(start_date: i64) -> Self {
1108        Self { start_date }
1109    }
1110}
1111
1112/// This object represents a service message about a video chat started in the chat. Currently holds no information.
1113#[derive(Deserialize, Serialize, Debug, Clone)]
1114pub struct VideoChatStarted {}
1115impl VideoChatStarted {
1116    pub fn new() -> Self {
1117        Self {}
1118    }
1119}
1120
1121/// This object represents a service message about a video chat ended in the chat.
1122#[derive(Deserialize, Serialize, Debug, Clone)]
1123pub struct VideoChatEnded {
1124    /// Video chat duration in seconds
1125    pub duration: i64,
1126}
1127impl VideoChatEnded {
1128    pub fn new(duration: i64) -> Self {
1129        Self { duration }
1130    }
1131}
1132
1133/// This object represents a service message about new members invited to a video chat.
1134#[derive(Deserialize, Serialize, Debug, Clone)]
1135pub struct VideoChatParticipantsInvited {
1136    /// New members that were invited to the video chat
1137    pub users: Vec<User>,
1138}
1139impl VideoChatParticipantsInvited {
1140    pub fn new(users: Vec<User>) -> Self {
1141        Self { users }
1142    }
1143}
1144
1145/// This object represent a user's profile pictures.
1146#[derive(Deserialize, Serialize, Debug, Clone)]
1147pub struct UserProfilePhotos {
1148    /// Total number of profile pictures the target user has
1149    pub total_count: i64,
1150    /// Requested profile pictures (in up to 4 sizes each)
1151    pub photos: Vec<Vec<PhotoSize>>,
1152}
1153impl UserProfilePhotos {
1154    pub fn new(total_count: i64, photos: Vec<Vec<PhotoSize>>) -> Self {
1155        Self {
1156            total_count,
1157            photos,
1158        }
1159    }
1160}
1161
1162/// This object represents a file ready to be downloaded. The file can be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile.
1163#[derive(Deserialize, Serialize, Debug, Clone)]
1164pub struct File {
1165    /// Identifier for this file, which can be used to download or reuse the file
1166    pub file_id: String,
1167    /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
1168    pub file_unique_id: String,
1169    /// Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this value.
1170    #[serde(skip_serializing_if = "Option::is_none")]
1171    pub file_size: Option<i64>,
1172    /// Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file.
1173    #[serde(skip_serializing_if = "Option::is_none")]
1174    pub file_path: Option<String>,
1175}
1176impl File {
1177    pub fn new(file_id: String, file_unique_id: String) -> Self {
1178        Self {
1179            file_id,
1180            file_unique_id,
1181            file_size: None,
1182            file_path: None,
1183        }
1184    }
1185}
1186
1187/// Describes a Web App.
1188#[derive(Deserialize, Serialize, Debug, Clone)]
1189pub struct WebAppInfo {
1190    /// An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps
1191    pub url: String,
1192}
1193impl WebAppInfo {
1194    pub fn new(url: String) -> Self {
1195        Self { url }
1196    }
1197}
1198
1199/// This object represents a custom keyboard with reply options (see Introduction to bots for details and examples).
1200#[derive(Deserialize, Serialize, Debug, Clone)]
1201pub struct ReplyKeyboardMarkup {
1202    /// Array of button rows, each represented by an Array of KeyboardButton objects
1203    pub keyboard: Vec<Vec<KeyboardButton>>,
1204    /// Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
1205    #[serde(skip_serializing_if = "Option::is_none")]
1206    pub resize_keyboard: Option<bool>,
1207    /// Optional. Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
1208    #[serde(skip_serializing_if = "Option::is_none")]
1209    pub one_time_keyboard: Option<bool>,
1210    /// Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters
1211    #[serde(skip_serializing_if = "Option::is_none")]
1212    pub input_field_placeholder: Option<String>,
1213    /// Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
1214    #[serde(skip_serializing_if = "Option::is_none")]
1215    pub selective: Option<bool>,
1216}
1217impl ReplyKeyboardMarkup {
1218    pub fn new(keyboard: Vec<Vec<KeyboardButton>>) -> Self {
1219        Self {
1220            keyboard,
1221            resize_keyboard: None,
1222            one_time_keyboard: None,
1223            input_field_placeholder: None,
1224            selective: None,
1225        }
1226    }
1227}
1228
1229/// This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields web_app, request_contact, request_location, and request_poll are mutually exclusive.
1230#[derive(Deserialize, Serialize, Debug, Clone)]
1231pub struct KeyboardButton {
1232    /// Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed
1233    pub text: String,
1234    /// Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only.
1235    #[serde(skip_serializing_if = "Option::is_none")]
1236    pub request_contact: Option<bool>,
1237    /// Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only.
1238    #[serde(skip_serializing_if = "Option::is_none")]
1239    pub request_location: Option<bool>,
1240    /// Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed. Available in private chats only.
1241    #[serde(skip_serializing_if = "Option::is_none")]
1242    pub request_poll: Option<KeyboardButtonPollType>,
1243    /// Optional. If specified, the described Web App will be launched when the button is pressed. The Web App will be able to send a “web_app_data” service message. Available in private chats only.
1244    #[serde(skip_serializing_if = "Option::is_none")]
1245    pub web_app: Option<WebAppInfo>,
1246}
1247impl KeyboardButton {
1248    pub fn new(text: String) -> Self {
1249        Self {
1250            text,
1251            request_contact: None,
1252            request_location: None,
1253            request_poll: None,
1254            web_app: None,
1255        }
1256    }
1257}
1258
1259/// This object represents type of a poll, which is allowed to be created and sent when the corresponding button is pressed.
1260#[derive(Deserialize, Serialize, Debug, Clone)]
1261pub struct KeyboardButtonPollType {
1262    /// Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
1263    #[serde(skip_serializing_if = "Option::is_none", rename = "type")]
1264    pub type_name: Option<String>,
1265}
1266impl KeyboardButtonPollType {
1267    pub fn new() -> Self {
1268        Self { type_name: None }
1269    }
1270}
1271
1272/// Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
1273#[derive(Deserialize, Serialize, Debug, Clone)]
1274pub struct ReplyKeyboardRemove {
1275    /// Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup)
1276    pub remove_keyboard: bool,
1277    /// Optional. Use this parameter if you want to remove the keyboard for specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
1278    #[serde(skip_serializing_if = "Option::is_none")]
1279    pub selective: Option<bool>,
1280}
1281impl ReplyKeyboardRemove {
1282    pub fn new(remove_keyboard: bool) -> Self {
1283        Self {
1284            remove_keyboard,
1285            selective: None,
1286        }
1287    }
1288}
1289
1290/// This object represents an inline keyboard that appears right next to the message it belongs to.
1291#[derive(Deserialize, Serialize, Debug, Clone)]
1292pub struct InlineKeyboardMarkup {
1293    /// Array of button rows, each represented by an Array of InlineKeyboardButton objects
1294    pub inline_keyboard: Vec<Vec<InlineKeyboardButton>>,
1295}
1296impl InlineKeyboardMarkup {
1297    pub fn new(inline_keyboard: Vec<Vec<InlineKeyboardButton>>) -> Self {
1298        Self { inline_keyboard }
1299    }
1300}
1301
1302/// This object represents one button of an inline keyboard. You must use exactly one of the optional fields.
1303#[derive(Deserialize, Serialize, Debug, Clone)]
1304pub struct InlineKeyboardButton {
1305    /// Label text on the button
1306    pub text: String,
1307    /// Optional. HTTP or tg:// URL to be opened when the button is pressed. Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings.
1308    #[serde(skip_serializing_if = "Option::is_none")]
1309    pub url: Option<String>,
1310    /// Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
1311    #[serde(skip_serializing_if = "Option::is_none")]
1312    pub callback_data: Option<String>,
1313    /// Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery. Available only in private chats between a user and the bot.
1314    #[serde(skip_serializing_if = "Option::is_none")]
1315    pub web_app: Option<WebAppInfo>,
1316    /// Optional. An HTTPS URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.
1317    #[serde(skip_serializing_if = "Option::is_none")]
1318    pub login_url: Option<LoginUrl>,
1319    /// Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. May be empty, in which case just the bot's username will be inserted.
1320    #[serde(skip_serializing_if = "Option::is_none")]
1321    pub switch_inline_query: Option<String>,
1322    /// Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. May be empty, in which case only the bot's username will be inserted.
1323    #[serde(skip_serializing_if = "Option::is_none")]
1324    pub switch_inline_query_current_chat: Option<String>,
1325    /// Optional. Description of the game that will be launched when the user presses the button.
1326    #[serde(skip_serializing_if = "Option::is_none")]
1327    pub callback_game: Option<CallbackGame>,
1328    /// Optional. Specify True, to send a Pay button.
1329    #[serde(skip_serializing_if = "Option::is_none")]
1330    pub pay: Option<bool>,
1331}
1332impl InlineKeyboardButton {
1333    pub fn new(text: String) -> Self {
1334        Self {
1335            text,
1336            url: None,
1337            callback_data: None,
1338            web_app: None,
1339            login_url: None,
1340            switch_inline_query: None,
1341            switch_inline_query_current_chat: None,
1342            callback_game: None,
1343            pay: None,
1344        }
1345    }
1346}
1347
1348/// This object represents a parameter of the inline keyboard button used to automatically authorize a user. Serves as a great replacement for the Telegram Login Widget when the user is coming from Telegram. All the user needs to do is tap/click a button and confirm that they want to log in:
1349#[derive(Deserialize, Serialize, Debug, Clone)]
1350pub struct LoginUrl {
1351    /// An HTTPS URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.
1352    pub url: String,
1353    /// Optional. New text of the button in forwarded messages.
1354    #[serde(skip_serializing_if = "Option::is_none")]
1355    pub forward_text: Option<String>,
1356    /// Optional. Username of a bot, which will be used for user authorization. See Setting up a bot for more details. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details.
1357    #[serde(skip_serializing_if = "Option::is_none")]
1358    pub bot_username: Option<String>,
1359    /// Optional. Pass True to request the permission for your bot to send messages to the user.
1360    #[serde(skip_serializing_if = "Option::is_none")]
1361    pub request_write_access: Option<bool>,
1362}
1363impl LoginUrl {
1364    pub fn new(url: String) -> Self {
1365        Self {
1366            url,
1367            forward_text: None,
1368            bot_username: None,
1369            request_write_access: None,
1370        }
1371    }
1372}
1373
1374/// This object represents an incoming callback query from a callback button in an inline keyboard. If the button that originated the query was attached to a message sent by the bot, the field message will be present. If the button was attached to a message sent via the bot (in inline mode), the field inline_message_id will be present. Exactly one of the fields data or game_short_name will be present.
1375#[derive(Deserialize, Serialize, Debug, Clone)]
1376pub struct CallbackQuery {
1377    /// Unique identifier for this query
1378    pub id: String,
1379    /// Sender
1380    pub from: User,
1381    /// Optional. Message with the callback button that originated the query. Note that message content and message date will not be available if the message is too old
1382    #[serde(skip_serializing_if = "Option::is_none")]
1383    pub message: Option<Message>,
1384    /// Optional. Identifier of the message sent via the bot in inline mode, that originated the query.
1385    #[serde(skip_serializing_if = "Option::is_none")]
1386    pub inline_message_id: Option<String>,
1387    /// Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games.
1388    pub chat_instance: String,
1389    /// Optional. Data associated with the callback button. Be aware that the message originated the query can contain no callback buttons with this data.
1390    #[serde(skip_serializing_if = "Option::is_none")]
1391    pub data: Option<String>,
1392    /// Optional. Short name of a Game to be returned, serves as the unique identifier for the game
1393    #[serde(skip_serializing_if = "Option::is_none")]
1394    pub game_short_name: Option<String>,
1395}
1396impl CallbackQuery {
1397    pub fn new(id: String, from: User, chat_instance: String) -> Self {
1398        Self {
1399            id,
1400            from,
1401            message: None,
1402            inline_message_id: None,
1403            chat_instance,
1404            data: None,
1405            game_short_name: None,
1406        }
1407    }
1408}
1409
1410/// Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply'). This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
1411#[derive(Deserialize, Serialize, Debug, Clone)]
1412pub struct ForceReply {
1413    /// Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'
1414    pub force_reply: bool,
1415    /// Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters
1416    #[serde(skip_serializing_if = "Option::is_none")]
1417    pub input_field_placeholder: Option<String>,
1418    /// Optional. Use this parameter if you want to force reply from specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
1419    #[serde(skip_serializing_if = "Option::is_none")]
1420    pub selective: Option<bool>,
1421}
1422impl ForceReply {
1423    pub fn new(force_reply: bool) -> Self {
1424        Self {
1425            force_reply,
1426            input_field_placeholder: None,
1427            selective: None,
1428        }
1429    }
1430}
1431
1432/// This object represents a chat photo.
1433#[derive(Deserialize, Serialize, Debug, Clone)]
1434pub struct ChatPhoto {
1435    /// File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
1436    pub small_file_id: String,
1437    /// Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
1438    pub small_file_unique_id: String,
1439    /// File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
1440    pub big_file_id: String,
1441    /// Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
1442    pub big_file_unique_id: String,
1443}
1444impl ChatPhoto {
1445    pub fn new(
1446        small_file_id: String,
1447        small_file_unique_id: String,
1448        big_file_id: String,
1449        big_file_unique_id: String,
1450    ) -> Self {
1451        Self {
1452            small_file_id,
1453            small_file_unique_id,
1454            big_file_id,
1455            big_file_unique_id,
1456        }
1457    }
1458}
1459
1460/// Represents an invite link for a chat.
1461#[derive(Deserialize, Serialize, Debug, Clone)]
1462pub struct ChatInviteLink {
1463    /// The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”.
1464    pub invite_link: String,
1465    /// Creator of the link
1466    pub creator: User,
1467    /// True, if users joining the chat via the link need to be approved by chat administrators
1468    pub creates_join_request: bool,
1469    /// True, if the link is primary
1470    pub is_primary: bool,
1471    /// True, if the link is revoked
1472    pub is_revoked: bool,
1473    /// Optional. Invite link name
1474    #[serde(skip_serializing_if = "Option::is_none")]
1475    pub name: Option<String>,
1476    /// Optional. Point in time (Unix timestamp) when the link will expire or has been expired
1477    #[serde(skip_serializing_if = "Option::is_none")]
1478    pub expire_date: Option<i64>,
1479    /// Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
1480    #[serde(skip_serializing_if = "Option::is_none")]
1481    pub member_limit: Option<i64>,
1482    /// Optional. Number of pending join requests created using this link
1483    #[serde(skip_serializing_if = "Option::is_none")]
1484    pub pending_join_request_count: Option<i64>,
1485}
1486impl ChatInviteLink {
1487    pub fn new(
1488        invite_link: String,
1489        creator: User,
1490        creates_join_request: bool,
1491        is_primary: bool,
1492        is_revoked: bool,
1493    ) -> Self {
1494        Self {
1495            invite_link,
1496            creator,
1497            creates_join_request,
1498            is_primary,
1499            is_revoked,
1500            name: None,
1501            expire_date: None,
1502            member_limit: None,
1503            pending_join_request_count: None,
1504        }
1505    }
1506}
1507
1508/// Represents the rights of an administrator in a chat.
1509#[derive(Deserialize, Serialize, Debug, Clone)]
1510pub struct ChatAdministratorRights {
1511    /// True, if the user's presence in the chat is hidden
1512    pub is_anonymous: bool,
1513    /// True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
1514    pub can_manage_chat: bool,
1515    /// True, if the administrator can delete messages of other users
1516    pub can_delete_messages: bool,
1517    /// True, if the administrator can manage video chats
1518    pub can_manage_video_chats: bool,
1519    /// True, if the administrator can restrict, ban or unban chat members
1520    pub can_restrict_members: bool,
1521    /// True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)
1522    pub can_promote_members: bool,
1523    /// True, if the user is allowed to change the chat title, photo and other settings
1524    pub can_change_info: bool,
1525    /// True, if the user is allowed to invite new users to the chat
1526    pub can_invite_users: bool,
1527    /// Optional. True, if the administrator can post in the channel; channels only
1528    #[serde(skip_serializing_if = "Option::is_none")]
1529    pub can_post_messages: Option<bool>,
1530    /// Optional. True, if the administrator can edit messages of other users and can pin messages; channels only
1531    #[serde(skip_serializing_if = "Option::is_none")]
1532    pub can_edit_messages: Option<bool>,
1533    /// Optional. True, if the user is allowed to pin messages; groups and supergroups only
1534    #[serde(skip_serializing_if = "Option::is_none")]
1535    pub can_pin_messages: Option<bool>,
1536}
1537impl ChatAdministratorRights {
1538    pub fn new(
1539        is_anonymous: bool,
1540        can_manage_chat: bool,
1541        can_delete_messages: bool,
1542        can_manage_video_chats: bool,
1543        can_restrict_members: bool,
1544        can_promote_members: bool,
1545        can_change_info: bool,
1546        can_invite_users: bool,
1547    ) -> Self {
1548        Self {
1549            is_anonymous,
1550            can_manage_chat,
1551            can_delete_messages,
1552            can_manage_video_chats,
1553            can_restrict_members,
1554            can_promote_members,
1555            can_change_info,
1556            can_invite_users,
1557            can_post_messages: None,
1558            can_edit_messages: None,
1559            can_pin_messages: None,
1560        }
1561    }
1562}
1563
1564/// Represents a chat member that owns the chat and has all administrator privileges.
1565#[derive(Deserialize, Serialize, Debug, Clone)]
1566pub struct ChatMemberOwner {
1567    /// Information about the user
1568    pub user: User,
1569    /// True, if the user's presence in the chat is hidden
1570    pub is_anonymous: bool,
1571    /// Optional. Custom title for this user
1572    #[serde(skip_serializing_if = "Option::is_none")]
1573    pub custom_title: Option<String>,
1574}
1575impl ChatMemberOwner {
1576    pub fn new(user: User, is_anonymous: bool) -> Self {
1577        Self {
1578            user,
1579            is_anonymous,
1580            custom_title: None,
1581        }
1582    }
1583}
1584
1585/// Represents a chat member that has some additional privileges.
1586#[derive(Deserialize, Serialize, Debug, Clone)]
1587pub struct ChatMemberAdministrator {
1588    /// Information about the user
1589    pub user: User,
1590    /// True, if the bot is allowed to edit administrator privileges of that user
1591    pub can_be_edited: bool,
1592    /// True, if the user's presence in the chat is hidden
1593    pub is_anonymous: bool,
1594    /// True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
1595    pub can_manage_chat: bool,
1596    /// True, if the administrator can delete messages of other users
1597    pub can_delete_messages: bool,
1598    /// True, if the administrator can manage video chats
1599    pub can_manage_video_chats: bool,
1600    /// True, if the administrator can restrict, ban or unban chat members
1601    pub can_restrict_members: bool,
1602    /// True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)
1603    pub can_promote_members: bool,
1604    /// True, if the user is allowed to change the chat title, photo and other settings
1605    pub can_change_info: bool,
1606    /// True, if the user is allowed to invite new users to the chat
1607    pub can_invite_users: bool,
1608    /// Optional. True, if the administrator can post in the channel; channels only
1609    #[serde(skip_serializing_if = "Option::is_none")]
1610    pub can_post_messages: Option<bool>,
1611    /// Optional. True, if the administrator can edit messages of other users and can pin messages; channels only
1612    #[serde(skip_serializing_if = "Option::is_none")]
1613    pub can_edit_messages: Option<bool>,
1614    /// Optional. True, if the user is allowed to pin messages; groups and supergroups only
1615    #[serde(skip_serializing_if = "Option::is_none")]
1616    pub can_pin_messages: Option<bool>,
1617    /// Optional. Custom title for this user
1618    #[serde(skip_serializing_if = "Option::is_none")]
1619    pub custom_title: Option<String>,
1620}
1621impl ChatMemberAdministrator {
1622    pub fn new(
1623        user: User,
1624        can_be_edited: bool,
1625        is_anonymous: bool,
1626        can_manage_chat: bool,
1627        can_delete_messages: bool,
1628        can_manage_video_chats: bool,
1629        can_restrict_members: bool,
1630        can_promote_members: bool,
1631        can_change_info: bool,
1632        can_invite_users: bool,
1633    ) -> Self {
1634        Self {
1635            user,
1636            can_be_edited,
1637            is_anonymous,
1638            can_manage_chat,
1639            can_delete_messages,
1640            can_manage_video_chats,
1641            can_restrict_members,
1642            can_promote_members,
1643            can_change_info,
1644            can_invite_users,
1645            can_post_messages: None,
1646            can_edit_messages: None,
1647            can_pin_messages: None,
1648            custom_title: None,
1649        }
1650    }
1651}
1652
1653/// Represents a chat member that has no additional privileges or restrictions.
1654#[derive(Deserialize, Serialize, Debug, Clone)]
1655pub struct ChatMemberMember {
1656    /// Information about the user
1657    pub user: User,
1658}
1659impl ChatMemberMember {
1660    pub fn new(user: User) -> Self {
1661        Self { user }
1662    }
1663}
1664
1665/// Represents a chat member that is under certain restrictions in the chat. Supergroups only.
1666#[derive(Deserialize, Serialize, Debug, Clone)]
1667pub struct ChatMemberRestricted {
1668    /// Information about the user
1669    pub user: User,
1670    /// True, if the user is a member of the chat at the moment of the request
1671    pub is_member: bool,
1672    /// True, if the user is allowed to change the chat title, photo and other settings
1673    pub can_change_info: bool,
1674    /// True, if the user is allowed to invite new users to the chat
1675    pub can_invite_users: bool,
1676    /// True, if the user is allowed to pin messages
1677    pub can_pin_messages: bool,
1678    /// True, if the user is allowed to send text messages, contacts, locations and venues
1679    pub can_send_messages: bool,
1680    /// True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes
1681    pub can_send_media_messages: bool,
1682    /// True, if the user is allowed to send polls
1683    pub can_send_polls: bool,
1684    /// True, if the user is allowed to send animations, games, stickers and use inline bots
1685    pub can_send_other_messages: bool,
1686    /// True, if the user is allowed to add web page previews to their messages
1687    pub can_add_web_page_previews: bool,
1688    /// Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever
1689    pub until_date: i64,
1690}
1691impl ChatMemberRestricted {
1692    pub fn new(
1693        user: User,
1694        is_member: bool,
1695        can_change_info: bool,
1696        can_invite_users: bool,
1697        can_pin_messages: bool,
1698        can_send_messages: bool,
1699        can_send_media_messages: bool,
1700        can_send_polls: bool,
1701        can_send_other_messages: bool,
1702        can_add_web_page_previews: bool,
1703        until_date: i64,
1704    ) -> Self {
1705        Self {
1706            user,
1707            is_member,
1708            can_change_info,
1709            can_invite_users,
1710            can_pin_messages,
1711            can_send_messages,
1712            can_send_media_messages,
1713            can_send_polls,
1714            can_send_other_messages,
1715            can_add_web_page_previews,
1716            until_date,
1717        }
1718    }
1719}
1720
1721/// Represents a chat member that isn't currently a member of the chat, but may join it themselves.
1722#[derive(Deserialize, Serialize, Debug, Clone)]
1723pub struct ChatMemberLeft {
1724    /// Information about the user
1725    pub user: User,
1726}
1727impl ChatMemberLeft {
1728    pub fn new(user: User) -> Self {
1729        Self { user }
1730    }
1731}
1732
1733/// Represents a chat member that was banned in the chat and can't return to the chat or view chat messages.
1734#[derive(Deserialize, Serialize, Debug, Clone)]
1735pub struct ChatMemberBanned {
1736    /// Information about the user
1737    pub user: User,
1738    /// Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever
1739    pub until_date: i64,
1740}
1741impl ChatMemberBanned {
1742    pub fn new(user: User, until_date: i64) -> Self {
1743        Self { user, until_date }
1744    }
1745}
1746
1747/// This object represents changes in the status of a chat member.
1748#[derive(Deserialize, Serialize, Debug, Clone)]
1749pub struct ChatMemberUpdated {
1750    /// Chat the user belongs to
1751    pub chat: Chat,
1752    /// Performer of the action, which resulted in the change
1753    pub from: User,
1754    /// Date the change was done in Unix time
1755    pub date: i64,
1756    /// Previous information about the chat member
1757    pub old_chat_member: ChatMember,
1758    /// New information about the chat member
1759    pub new_chat_member: ChatMember,
1760    /// Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only.
1761    #[serde(skip_serializing_if = "Option::is_none")]
1762    pub invite_link: Option<ChatInviteLink>,
1763}
1764impl ChatMemberUpdated {
1765    pub fn new(
1766        chat: Chat,
1767        from: User,
1768        date: i64,
1769        old_chat_member: ChatMember,
1770        new_chat_member: ChatMember,
1771    ) -> Self {
1772        Self {
1773            chat,
1774            from,
1775            date,
1776            old_chat_member,
1777            new_chat_member,
1778            invite_link: None,
1779        }
1780    }
1781}
1782
1783/// Represents a join request sent to a chat.
1784#[derive(Deserialize, Serialize, Debug, Clone)]
1785pub struct ChatJoinRequest {
1786    /// Chat to which the request was sent
1787    pub chat: Chat,
1788    /// User that sent the join request
1789    pub from: User,
1790    /// Date the request was sent in Unix time
1791    pub date: i64,
1792    /// Optional. Bio of the user.
1793    #[serde(skip_serializing_if = "Option::is_none")]
1794    pub bio: Option<String>,
1795    /// Optional. Chat invite link that was used by the user to send the join request
1796    #[serde(skip_serializing_if = "Option::is_none")]
1797    pub invite_link: Option<ChatInviteLink>,
1798}
1799impl ChatJoinRequest {
1800    pub fn new(chat: Chat, from: User, date: i64) -> Self {
1801        Self {
1802            chat,
1803            from,
1804            date,
1805            bio: None,
1806            invite_link: None,
1807        }
1808    }
1809}
1810
1811/// Describes actions that a non-administrator user is allowed to take in a chat.
1812#[derive(Deserialize, Serialize, Debug, Clone)]
1813pub struct ChatPermissions {
1814    /// Optional. True, if the user is allowed to send text messages, contacts, locations and venues
1815    #[serde(skip_serializing_if = "Option::is_none")]
1816    pub can_send_messages: Option<bool>,
1817    /// Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
1818    #[serde(skip_serializing_if = "Option::is_none")]
1819    pub can_send_media_messages: Option<bool>,
1820    /// Optional. True, if the user is allowed to send polls, implies can_send_messages
1821    #[serde(skip_serializing_if = "Option::is_none")]
1822    pub can_send_polls: Option<bool>,
1823    /// Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages
1824    #[serde(skip_serializing_if = "Option::is_none")]
1825    pub can_send_other_messages: Option<bool>,
1826    /// Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages
1827    #[serde(skip_serializing_if = "Option::is_none")]
1828    pub can_add_web_page_previews: Option<bool>,
1829    /// Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
1830    #[serde(skip_serializing_if = "Option::is_none")]
1831    pub can_change_info: Option<bool>,
1832    /// Optional. True, if the user is allowed to invite new users to the chat
1833    #[serde(skip_serializing_if = "Option::is_none")]
1834    pub can_invite_users: Option<bool>,
1835    /// Optional. True, if the user is allowed to pin messages. Ignored in public supergroups
1836    #[serde(skip_serializing_if = "Option::is_none")]
1837    pub can_pin_messages: Option<bool>,
1838}
1839impl ChatPermissions {
1840    pub fn new() -> Self {
1841        Self {
1842            can_send_messages: None,
1843            can_send_media_messages: None,
1844            can_send_polls: None,
1845            can_send_other_messages: None,
1846            can_add_web_page_previews: None,
1847            can_change_info: None,
1848            can_invite_users: None,
1849            can_pin_messages: None,
1850        }
1851    }
1852}
1853
1854/// Represents a location to which a chat is connected.
1855#[derive(Deserialize, Serialize, Debug, Clone)]
1856pub struct ChatLocation {
1857    /// The location to which the supergroup is connected. Can't be a live location.
1858    pub location: Location,
1859    /// Location address; 1-64 characters, as defined by the chat owner
1860    pub address: String,
1861}
1862impl ChatLocation {
1863    pub fn new(location: Location, address: String) -> Self {
1864        Self { location, address }
1865    }
1866}
1867
1868/// This object represents a bot command.
1869#[derive(Deserialize, Serialize, Debug, Clone)]
1870pub struct BotCommand {
1871    /// Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores.
1872    pub command: String,
1873    /// Description of the command; 1-256 characters.
1874    pub description: String,
1875}
1876impl BotCommand {
1877    pub fn new(command: String, description: String) -> Self {
1878        Self {
1879            command,
1880            description,
1881        }
1882    }
1883}
1884
1885/// Represents the default scope of bot commands. Default commands are used if no commands with a narrower scope are specified for the user.
1886#[derive(Deserialize, Serialize, Debug, Clone)]
1887pub struct BotCommandScopeDefault {}
1888impl BotCommandScopeDefault {
1889    pub fn new() -> Self {
1890        Self {}
1891    }
1892}
1893
1894/// Represents the scope of bot commands, covering all private chats.
1895#[derive(Deserialize, Serialize, Debug, Clone)]
1896pub struct BotCommandScopeAllPrivateChats {}
1897impl BotCommandScopeAllPrivateChats {
1898    pub fn new() -> Self {
1899        Self {}
1900    }
1901}
1902
1903/// Represents the scope of bot commands, covering all group and supergroup chats.
1904#[derive(Deserialize, Serialize, Debug, Clone)]
1905pub struct BotCommandScopeAllGroupChats {}
1906impl BotCommandScopeAllGroupChats {
1907    pub fn new() -> Self {
1908        Self {}
1909    }
1910}
1911
1912/// Represents the scope of bot commands, covering all group and supergroup chat administrators.
1913#[derive(Deserialize, Serialize, Debug, Clone)]
1914pub struct BotCommandScopeAllChatAdministrators {}
1915impl BotCommandScopeAllChatAdministrators {
1916    pub fn new() -> Self {
1917        Self {}
1918    }
1919}
1920
1921/// Represents the scope of bot commands, covering a specific chat.
1922#[derive(Deserialize, Serialize, Debug, Clone)]
1923pub struct BotCommandScopeChat {
1924    /// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
1925    pub chat_id: ChatId,
1926}
1927impl BotCommandScopeChat {
1928    pub fn new(chat_id: ChatId) -> Self {
1929        Self { chat_id }
1930    }
1931}
1932
1933/// Represents the scope of bot commands, covering all administrators of a specific group or supergroup chat.
1934#[derive(Deserialize, Serialize, Debug, Clone)]
1935pub struct BotCommandScopeChatAdministrators {
1936    /// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
1937    pub chat_id: ChatId,
1938}
1939impl BotCommandScopeChatAdministrators {
1940    pub fn new(chat_id: ChatId) -> Self {
1941        Self { chat_id }
1942    }
1943}
1944
1945/// Represents the scope of bot commands, covering a specific member of a group or supergroup chat.
1946#[derive(Deserialize, Serialize, Debug, Clone)]
1947pub struct BotCommandScopeChatMember {
1948    /// Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
1949    pub chat_id: ChatId,
1950    /// Unique identifier of the target user
1951    pub user_id: i64,
1952}
1953impl BotCommandScopeChatMember {
1954    pub fn new(chat_id: ChatId, user_id: i64) -> Self {
1955        Self { chat_id, user_id }
1956    }
1957}
1958
1959/// Represents a menu button, which opens the bot's list of commands.
1960#[derive(Deserialize, Serialize, Debug, Clone)]
1961pub struct MenuButtonCommands {}
1962impl MenuButtonCommands {
1963    pub fn new() -> Self {
1964        Self {}
1965    }
1966}
1967
1968/// Represents a menu button, which launches a Web App.
1969#[derive(Deserialize, Serialize, Debug, Clone)]
1970pub struct MenuButtonWebApp {
1971    /// Text on the button
1972    pub text: String,
1973    /// Description of the Web App that will be launched when the user presses the button. The Web App will be able to send an arbitrary message on behalf of the user using the method answerWebAppQuery.
1974    pub web_app: WebAppInfo,
1975}
1976impl MenuButtonWebApp {
1977    pub fn new(text: String, web_app: WebAppInfo) -> Self {
1978        Self { text, web_app }
1979    }
1980}
1981
1982/// Describes that no specific value for the menu button was set.
1983#[derive(Deserialize, Serialize, Debug, Clone)]
1984pub struct MenuButtonDefault {}
1985impl MenuButtonDefault {
1986    pub fn new() -> Self {
1987        Self {}
1988    }
1989}
1990
1991/// Describes why a request was unsuccessful.
1992#[derive(Deserialize, Serialize, Debug, Clone)]
1993pub struct ResponseParameters {
1994    /// Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
1995    #[serde(skip_serializing_if = "Option::is_none")]
1996    pub migrate_to_chat_id: Option<i64>,
1997    /// Optional. In case of exceeding flood control, the number of seconds left to wait before the request can be repeated
1998    #[serde(skip_serializing_if = "Option::is_none")]
1999    pub retry_after: Option<i64>,
2000}
2001impl ResponseParameters {
2002    pub fn new() -> Self {
2003        Self {
2004            migrate_to_chat_id: None,
2005            retry_after: None,
2006        }
2007    }
2008}
2009
2010/// Represents a photo to be sent.
2011#[derive(Deserialize, Serialize, Debug, Clone)]
2012pub struct InputMediaPhoto {
2013    /// 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 »
2014    pub media: InputFile,
2015    /// Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing
2016    #[serde(skip_serializing_if = "Option::is_none")]
2017    pub caption: Option<String>,
2018    /// Optional. Mode for parsing entities in the photo caption. See formatting options for more details.
2019    #[serde(skip_serializing_if = "Option::is_none")]
2020    pub parse_mode: Option<String>,
2021    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2022    #[serde(skip_serializing_if = "Option::is_none")]
2023    pub caption_entities: Option<Vec<MessageEntity>>,
2024}
2025impl InputMediaPhoto {
2026    pub fn new(media: InputFile) -> Self {
2027        Self {
2028            media,
2029            caption: None,
2030            parse_mode: None,
2031            caption_entities: None,
2032        }
2033    }
2034}
2035
2036/// Represents a video to be sent.
2037#[derive(Deserialize, Serialize, Debug, Clone)]
2038pub struct InputMediaVideo {
2039    /// 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 »
2040    pub media: InputFile,
2041    /// Optional. 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 »
2042    #[serde(skip_serializing_if = "Option::is_none")]
2043    pub thumb: Option<InputFile>,
2044    /// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
2045    #[serde(skip_serializing_if = "Option::is_none")]
2046    pub caption: Option<String>,
2047    /// Optional. Mode for parsing entities in the video caption. See formatting options for more details.
2048    #[serde(skip_serializing_if = "Option::is_none")]
2049    pub parse_mode: Option<String>,
2050    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2051    #[serde(skip_serializing_if = "Option::is_none")]
2052    pub caption_entities: Option<Vec<MessageEntity>>,
2053    /// Optional. Video width
2054    #[serde(skip_serializing_if = "Option::is_none")]
2055    pub width: Option<i64>,
2056    /// Optional. Video height
2057    #[serde(skip_serializing_if = "Option::is_none")]
2058    pub height: Option<i64>,
2059    /// Optional. Video duration in seconds
2060    #[serde(skip_serializing_if = "Option::is_none")]
2061    pub duration: Option<i64>,
2062    /// Optional. Pass True if the uploaded video is suitable for streaming
2063    #[serde(skip_serializing_if = "Option::is_none")]
2064    pub supports_streaming: Option<bool>,
2065}
2066impl InputMediaVideo {
2067    pub fn new(media: InputFile) -> Self {
2068        Self {
2069            media,
2070            thumb: None,
2071            caption: None,
2072            parse_mode: None,
2073            caption_entities: None,
2074            width: None,
2075            height: None,
2076            duration: None,
2077            supports_streaming: None,
2078        }
2079    }
2080}
2081
2082/// Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
2083#[derive(Deserialize, Serialize, Debug, Clone)]
2084pub struct InputMediaAnimation {
2085    /// 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 »
2086    pub media: InputFile,
2087    /// Optional. 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 »
2088    #[serde(skip_serializing_if = "Option::is_none")]
2089    pub thumb: Option<InputFile>,
2090    /// Optional. Caption of the animation to be sent, 0-1024 characters after entities parsing
2091    #[serde(skip_serializing_if = "Option::is_none")]
2092    pub caption: Option<String>,
2093    /// Optional. Mode for parsing entities in the animation caption. See formatting options for more details.
2094    #[serde(skip_serializing_if = "Option::is_none")]
2095    pub parse_mode: Option<String>,
2096    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2097    #[serde(skip_serializing_if = "Option::is_none")]
2098    pub caption_entities: Option<Vec<MessageEntity>>,
2099    /// Optional. Animation width
2100    #[serde(skip_serializing_if = "Option::is_none")]
2101    pub width: Option<i64>,
2102    /// Optional. Animation height
2103    #[serde(skip_serializing_if = "Option::is_none")]
2104    pub height: Option<i64>,
2105    /// Optional. Animation duration in seconds
2106    #[serde(skip_serializing_if = "Option::is_none")]
2107    pub duration: Option<i64>,
2108}
2109impl InputMediaAnimation {
2110    pub fn new(media: InputFile) -> Self {
2111        Self {
2112            media,
2113            thumb: None,
2114            caption: None,
2115            parse_mode: None,
2116            caption_entities: None,
2117            width: None,
2118            height: None,
2119            duration: None,
2120        }
2121    }
2122}
2123
2124/// Represents an audio file to be treated as music to be sent.
2125#[derive(Deserialize, Serialize, Debug, Clone)]
2126pub struct InputMediaAudio {
2127    /// 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 »
2128    pub media: InputFile,
2129    /// Optional. 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 »
2130    #[serde(skip_serializing_if = "Option::is_none")]
2131    pub thumb: Option<InputFile>,
2132    /// Optional. Caption of the audio to be sent, 0-1024 characters after entities parsing
2133    #[serde(skip_serializing_if = "Option::is_none")]
2134    pub caption: Option<String>,
2135    /// Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
2136    #[serde(skip_serializing_if = "Option::is_none")]
2137    pub parse_mode: Option<String>,
2138    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2139    #[serde(skip_serializing_if = "Option::is_none")]
2140    pub caption_entities: Option<Vec<MessageEntity>>,
2141    /// Optional. Duration of the audio in seconds
2142    #[serde(skip_serializing_if = "Option::is_none")]
2143    pub duration: Option<i64>,
2144    /// Optional. Performer of the audio
2145    #[serde(skip_serializing_if = "Option::is_none")]
2146    pub performer: Option<String>,
2147    /// Optional. Title of the audio
2148    #[serde(skip_serializing_if = "Option::is_none")]
2149    pub title: Option<String>,
2150}
2151impl InputMediaAudio {
2152    pub fn new(media: InputFile) -> Self {
2153        Self {
2154            media,
2155            thumb: None,
2156            caption: None,
2157            parse_mode: None,
2158            caption_entities: None,
2159            duration: None,
2160            performer: None,
2161            title: None,
2162        }
2163    }
2164}
2165
2166/// Represents a general file to be sent.
2167#[derive(Deserialize, Serialize, Debug, Clone)]
2168pub struct InputMediaDocument {
2169    /// 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 »
2170    pub media: InputFile,
2171    /// Optional. 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 »
2172    #[serde(skip_serializing_if = "Option::is_none")]
2173    pub thumb: Option<InputFile>,
2174    /// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
2175    #[serde(skip_serializing_if = "Option::is_none")]
2176    pub caption: Option<String>,
2177    /// Optional. Mode for parsing entities in the document caption. See formatting options for more details.
2178    #[serde(skip_serializing_if = "Option::is_none")]
2179    pub parse_mode: Option<String>,
2180    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2181    #[serde(skip_serializing_if = "Option::is_none")]
2182    pub caption_entities: Option<Vec<MessageEntity>>,
2183    /// Optional. 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.
2184    #[serde(skip_serializing_if = "Option::is_none")]
2185    pub disable_content_type_detection: Option<bool>,
2186}
2187impl InputMediaDocument {
2188    pub fn new(media: InputFile) -> Self {
2189        Self {
2190            media,
2191            thumb: None,
2192            caption: None,
2193            parse_mode: None,
2194            caption_entities: None,
2195            disable_content_type_detection: None,
2196        }
2197    }
2198}
2199
2200/// This object represents a sticker.
2201#[derive(Deserialize, Serialize, Debug, Clone)]
2202pub struct Sticker {
2203    /// Identifier for this file, which can be used to download or reuse the file
2204    pub file_id: String,
2205    /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
2206    pub file_unique_id: String,
2207    /// Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video.
2208    #[serde(rename = "type")]
2209    pub type_name: String,
2210    /// Sticker width
2211    pub width: i64,
2212    /// Sticker height
2213    pub height: i64,
2214    /// True, if the sticker is animated
2215    pub is_animated: bool,
2216    /// True, if the sticker is a video sticker
2217    pub is_video: bool,
2218    /// Optional. Sticker thumbnail in the .WEBP or .JPG format
2219    #[serde(skip_serializing_if = "Option::is_none")]
2220    pub thumb: Option<PhotoSize>,
2221    /// Optional. Emoji associated with the sticker
2222    #[serde(skip_serializing_if = "Option::is_none")]
2223    pub emoji: Option<String>,
2224    /// Optional. Name of the sticker set to which the sticker belongs
2225    #[serde(skip_serializing_if = "Option::is_none")]
2226    pub set_name: Option<String>,
2227    /// Optional. For premium regular stickers, premium animation for the sticker
2228    #[serde(skip_serializing_if = "Option::is_none")]
2229    pub premium_animation: Option<File>,
2230    /// Optional. For mask stickers, the position where the mask should be placed
2231    #[serde(skip_serializing_if = "Option::is_none")]
2232    pub mask_position: Option<MaskPosition>,
2233    /// Optional. For custom emoji stickers, unique identifier of the custom emoji
2234    #[serde(skip_serializing_if = "Option::is_none")]
2235    pub custom_emoji_id: Option<String>,
2236    /// Optional. File size in bytes
2237    #[serde(skip_serializing_if = "Option::is_none")]
2238    pub file_size: Option<i64>,
2239}
2240impl Sticker {
2241    pub fn new(
2242        file_id: String,
2243        file_unique_id: String,
2244        type_name: String,
2245        width: i64,
2246        height: i64,
2247        is_animated: bool,
2248        is_video: bool,
2249    ) -> Self {
2250        Self {
2251            file_id,
2252            file_unique_id,
2253            type_name,
2254            width,
2255            height,
2256            is_animated,
2257            is_video,
2258            thumb: None,
2259            emoji: None,
2260            set_name: None,
2261            premium_animation: None,
2262            mask_position: None,
2263            custom_emoji_id: None,
2264            file_size: None,
2265        }
2266    }
2267}
2268
2269/// This object represents a sticker set.
2270#[derive(Deserialize, Serialize, Debug, Clone)]
2271pub struct StickerSet {
2272    /// Sticker set name
2273    pub name: String,
2274    /// Sticker set title
2275    pub title: String,
2276    /// Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji”
2277    pub sticker_type: String,
2278    /// True, if the sticker set contains animated stickers
2279    pub is_animated: bool,
2280    /// True, if the sticker set contains video stickers
2281    pub is_video: bool,
2282    /// List of all set stickers
2283    pub stickers: Vec<Sticker>,
2284    /// Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
2285    #[serde(skip_serializing_if = "Option::is_none")]
2286    pub thumb: Option<PhotoSize>,
2287}
2288impl StickerSet {
2289    pub fn new(
2290        name: String,
2291        title: String,
2292        sticker_type: String,
2293        is_animated: bool,
2294        is_video: bool,
2295        stickers: Vec<Sticker>,
2296    ) -> Self {
2297        Self {
2298            name,
2299            title,
2300            sticker_type,
2301            is_animated,
2302            is_video,
2303            stickers,
2304            thumb: None,
2305        }
2306    }
2307}
2308
2309/// This object describes the position on faces where a mask should be placed by default.
2310#[derive(Deserialize, Serialize, Debug, Clone)]
2311pub struct MaskPosition {
2312    /// The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.
2313    pub point: String,
2314    /// Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.
2315    pub x_shift: f64,
2316    /// Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.
2317    pub y_shift: f64,
2318    /// Mask scaling coefficient. For example, 2.0 means double size.
2319    pub scale: f64,
2320}
2321impl MaskPosition {
2322    pub fn new(point: String, x_shift: f64, y_shift: f64, scale: f64) -> Self {
2323        Self {
2324            point,
2325            x_shift,
2326            y_shift,
2327            scale,
2328        }
2329    }
2330}
2331
2332/// This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
2333#[derive(Deserialize, Serialize, Debug, Clone)]
2334pub struct InlineQuery {
2335    /// Unique identifier for this query
2336    pub id: String,
2337    /// Sender
2338    pub from: User,
2339    /// Text of the query (up to 256 characters)
2340    pub query: String,
2341    /// Offset of the results to be returned, can be controlled by the bot
2342    pub offset: String,
2343    /// Optional. Type of the chat from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should be always known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat
2344    #[serde(skip_serializing_if = "Option::is_none")]
2345    pub chat_type: Option<String>,
2346    /// Optional. Sender location, only for bots that request user location
2347    #[serde(skip_serializing_if = "Option::is_none")]
2348    pub location: Option<Location>,
2349}
2350impl InlineQuery {
2351    pub fn new(id: String, from: User, query: String, offset: String) -> Self {
2352        Self {
2353            id,
2354            from,
2355            query,
2356            offset,
2357            chat_type: None,
2358            location: None,
2359        }
2360    }
2361}
2362
2363/// Represents a link to an article or web page.
2364#[derive(Deserialize, Serialize, Debug, Clone)]
2365pub struct InlineQueryResultArticle {
2366    /// Unique identifier for this result, 1-64 Bytes
2367    pub id: String,
2368    /// Title of the result
2369    pub title: String,
2370    /// Content of the message to be sent
2371    pub input_message_content: InputMessageContent,
2372    /// Optional. Inline keyboard attached to the message
2373    #[serde(skip_serializing_if = "Option::is_none")]
2374    pub reply_markup: Option<InlineKeyboardMarkup>,
2375    /// Optional. URL of the result
2376    #[serde(skip_serializing_if = "Option::is_none")]
2377    pub url: Option<String>,
2378    /// Optional. Pass True if you don't want the URL to be shown in the message
2379    #[serde(skip_serializing_if = "Option::is_none")]
2380    pub hide_url: Option<bool>,
2381    /// Optional. Short description of the result
2382    #[serde(skip_serializing_if = "Option::is_none")]
2383    pub description: Option<String>,
2384    /// Optional. Url of the thumbnail for the result
2385    #[serde(skip_serializing_if = "Option::is_none")]
2386    pub thumb_url: Option<String>,
2387    /// Optional. Thumbnail width
2388    #[serde(skip_serializing_if = "Option::is_none")]
2389    pub thumb_width: Option<i64>,
2390    /// Optional. Thumbnail height
2391    #[serde(skip_serializing_if = "Option::is_none")]
2392    pub thumb_height: Option<i64>,
2393}
2394impl InlineQueryResultArticle {
2395    pub fn new(id: String, title: String, input_message_content: InputMessageContent) -> Self {
2396        Self {
2397            id,
2398            title,
2399            input_message_content,
2400            reply_markup: None,
2401            url: None,
2402            hide_url: None,
2403            description: None,
2404            thumb_url: None,
2405            thumb_width: None,
2406            thumb_height: None,
2407        }
2408    }
2409}
2410
2411/// Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
2412#[derive(Deserialize, Serialize, Debug, Clone)]
2413pub struct InlineQueryResultPhoto {
2414    /// Unique identifier for this result, 1-64 bytes
2415    pub id: String,
2416    /// A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB
2417    pub photo_url: String,
2418    /// URL of the thumbnail for the photo
2419    pub thumb_url: String,
2420    /// Optional. Width of the photo
2421    #[serde(skip_serializing_if = "Option::is_none")]
2422    pub photo_width: Option<i64>,
2423    /// Optional. Height of the photo
2424    #[serde(skip_serializing_if = "Option::is_none")]
2425    pub photo_height: Option<i64>,
2426    /// Optional. Title for the result
2427    #[serde(skip_serializing_if = "Option::is_none")]
2428    pub title: Option<String>,
2429    /// Optional. Short description of the result
2430    #[serde(skip_serializing_if = "Option::is_none")]
2431    pub description: Option<String>,
2432    /// Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing
2433    #[serde(skip_serializing_if = "Option::is_none")]
2434    pub caption: Option<String>,
2435    /// Optional. Mode for parsing entities in the photo caption. See formatting options for more details.
2436    #[serde(skip_serializing_if = "Option::is_none")]
2437    pub parse_mode: Option<String>,
2438    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2439    #[serde(skip_serializing_if = "Option::is_none")]
2440    pub caption_entities: Option<Vec<MessageEntity>>,
2441    /// Optional. Inline keyboard attached to the message
2442    #[serde(skip_serializing_if = "Option::is_none")]
2443    pub reply_markup: Option<InlineKeyboardMarkup>,
2444    /// Optional. Content of the message to be sent instead of the photo
2445    #[serde(skip_serializing_if = "Option::is_none")]
2446    pub input_message_content: Option<InputMessageContent>,
2447}
2448impl InlineQueryResultPhoto {
2449    pub fn new(id: String, photo_url: String, thumb_url: String) -> Self {
2450        Self {
2451            id,
2452            photo_url,
2453            thumb_url,
2454            photo_width: None,
2455            photo_height: None,
2456            title: None,
2457            description: None,
2458            caption: None,
2459            parse_mode: None,
2460            caption_entities: None,
2461            reply_markup: None,
2462            input_message_content: None,
2463        }
2464    }
2465}
2466
2467/// Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
2468#[derive(Deserialize, Serialize, Debug, Clone)]
2469pub struct InlineQueryResultGif {
2470    /// Unique identifier for this result, 1-64 bytes
2471    pub id: String,
2472    /// A valid URL for the GIF file. File size must not exceed 1MB
2473    pub gif_url: String,
2474    /// Optional. Width of the GIF
2475    #[serde(skip_serializing_if = "Option::is_none")]
2476    pub gif_width: Option<i64>,
2477    /// Optional. Height of the GIF
2478    #[serde(skip_serializing_if = "Option::is_none")]
2479    pub gif_height: Option<i64>,
2480    /// Optional. Duration of the GIF in seconds
2481    #[serde(skip_serializing_if = "Option::is_none")]
2482    pub gif_duration: Option<i64>,
2483    /// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
2484    pub thumb_url: String,
2485    /// Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
2486    #[serde(skip_serializing_if = "Option::is_none")]
2487    pub thumb_mime_type: Option<String>,
2488    /// Optional. Title for the result
2489    #[serde(skip_serializing_if = "Option::is_none")]
2490    pub title: Option<String>,
2491    /// Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing
2492    #[serde(skip_serializing_if = "Option::is_none")]
2493    pub caption: Option<String>,
2494    /// Optional. Mode for parsing entities in the caption. See formatting options for more details.
2495    #[serde(skip_serializing_if = "Option::is_none")]
2496    pub parse_mode: Option<String>,
2497    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2498    #[serde(skip_serializing_if = "Option::is_none")]
2499    pub caption_entities: Option<Vec<MessageEntity>>,
2500    /// Optional. Inline keyboard attached to the message
2501    #[serde(skip_serializing_if = "Option::is_none")]
2502    pub reply_markup: Option<InlineKeyboardMarkup>,
2503    /// Optional. Content of the message to be sent instead of the GIF animation
2504    #[serde(skip_serializing_if = "Option::is_none")]
2505    pub input_message_content: Option<InputMessageContent>,
2506}
2507impl InlineQueryResultGif {
2508    pub fn new(id: String, gif_url: String, thumb_url: String) -> Self {
2509        Self {
2510            id,
2511            gif_url,
2512            gif_width: None,
2513            gif_height: None,
2514            gif_duration: None,
2515            thumb_url,
2516            thumb_mime_type: None,
2517            title: None,
2518            caption: None,
2519            parse_mode: None,
2520            caption_entities: None,
2521            reply_markup: None,
2522            input_message_content: None,
2523        }
2524    }
2525}
2526
2527/// Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
2528#[derive(Deserialize, Serialize, Debug, Clone)]
2529pub struct InlineQueryResultMpeg4Gif {
2530    /// Unique identifier for this result, 1-64 bytes
2531    pub id: String,
2532    /// A valid URL for the MPEG4 file. File size must not exceed 1MB
2533    pub mpeg4_url: String,
2534    /// Optional. Video width
2535    #[serde(skip_serializing_if = "Option::is_none")]
2536    pub mpeg4_width: Option<i64>,
2537    /// Optional. Video height
2538    #[serde(skip_serializing_if = "Option::is_none")]
2539    pub mpeg4_height: Option<i64>,
2540    /// Optional. Video duration in seconds
2541    #[serde(skip_serializing_if = "Option::is_none")]
2542    pub mpeg4_duration: Option<i64>,
2543    /// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
2544    pub thumb_url: String,
2545    /// Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
2546    #[serde(skip_serializing_if = "Option::is_none")]
2547    pub thumb_mime_type: Option<String>,
2548    /// Optional. Title for the result
2549    #[serde(skip_serializing_if = "Option::is_none")]
2550    pub title: Option<String>,
2551    /// Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing
2552    #[serde(skip_serializing_if = "Option::is_none")]
2553    pub caption: Option<String>,
2554    /// Optional. Mode for parsing entities in the caption. See formatting options for more details.
2555    #[serde(skip_serializing_if = "Option::is_none")]
2556    pub parse_mode: Option<String>,
2557    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2558    #[serde(skip_serializing_if = "Option::is_none")]
2559    pub caption_entities: Option<Vec<MessageEntity>>,
2560    /// Optional. Inline keyboard attached to the message
2561    #[serde(skip_serializing_if = "Option::is_none")]
2562    pub reply_markup: Option<InlineKeyboardMarkup>,
2563    /// Optional. Content of the message to be sent instead of the video animation
2564    #[serde(skip_serializing_if = "Option::is_none")]
2565    pub input_message_content: Option<InputMessageContent>,
2566}
2567impl InlineQueryResultMpeg4Gif {
2568    pub fn new(id: String, mpeg4_url: String, thumb_url: String) -> Self {
2569        Self {
2570            id,
2571            mpeg4_url,
2572            mpeg4_width: None,
2573            mpeg4_height: None,
2574            mpeg4_duration: None,
2575            thumb_url,
2576            thumb_mime_type: None,
2577            title: None,
2578            caption: None,
2579            parse_mode: None,
2580            caption_entities: None,
2581            reply_markup: None,
2582            input_message_content: None,
2583        }
2584    }
2585}
2586
2587/// Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
2588#[derive(Deserialize, Serialize, Debug, Clone)]
2589pub struct InlineQueryResultVideo {
2590    /// Unique identifier for this result, 1-64 bytes
2591    pub id: String,
2592    /// A valid URL for the embedded video player or video file
2593    pub video_url: String,
2594    /// MIME type of the content of the video URL, “text/html” or “video/mp4”
2595    pub mime_type: String,
2596    /// URL of the thumbnail (JPEG only) for the video
2597    pub thumb_url: String,
2598    /// Title for the result
2599    pub title: String,
2600    /// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
2601    #[serde(skip_serializing_if = "Option::is_none")]
2602    pub caption: Option<String>,
2603    /// Optional. Mode for parsing entities in the video caption. See formatting options for more details.
2604    #[serde(skip_serializing_if = "Option::is_none")]
2605    pub parse_mode: Option<String>,
2606    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2607    #[serde(skip_serializing_if = "Option::is_none")]
2608    pub caption_entities: Option<Vec<MessageEntity>>,
2609    /// Optional. Video width
2610    #[serde(skip_serializing_if = "Option::is_none")]
2611    pub video_width: Option<i64>,
2612    /// Optional. Video height
2613    #[serde(skip_serializing_if = "Option::is_none")]
2614    pub video_height: Option<i64>,
2615    /// Optional. Video duration in seconds
2616    #[serde(skip_serializing_if = "Option::is_none")]
2617    pub video_duration: Option<i64>,
2618    /// Optional. Short description of the result
2619    #[serde(skip_serializing_if = "Option::is_none")]
2620    pub description: Option<String>,
2621    /// Optional. Inline keyboard attached to the message
2622    #[serde(skip_serializing_if = "Option::is_none")]
2623    pub reply_markup: Option<InlineKeyboardMarkup>,
2624    /// Optional. Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).
2625    #[serde(skip_serializing_if = "Option::is_none")]
2626    pub input_message_content: Option<InputMessageContent>,
2627}
2628impl InlineQueryResultVideo {
2629    pub fn new(
2630        id: String,
2631        video_url: String,
2632        mime_type: String,
2633        thumb_url: String,
2634        title: String,
2635    ) -> Self {
2636        Self {
2637            id,
2638            video_url,
2639            mime_type,
2640            thumb_url,
2641            title,
2642            caption: None,
2643            parse_mode: None,
2644            caption_entities: None,
2645            video_width: None,
2646            video_height: None,
2647            video_duration: None,
2648            description: None,
2649            reply_markup: None,
2650            input_message_content: None,
2651        }
2652    }
2653}
2654
2655/// Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
2656#[derive(Deserialize, Serialize, Debug, Clone)]
2657pub struct InlineQueryResultAudio {
2658    /// Unique identifier for this result, 1-64 bytes
2659    pub id: String,
2660    /// A valid URL for the audio file
2661    pub audio_url: String,
2662    /// Title
2663    pub title: String,
2664    /// Optional. Caption, 0-1024 characters after entities parsing
2665    #[serde(skip_serializing_if = "Option::is_none")]
2666    pub caption: Option<String>,
2667    /// Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
2668    #[serde(skip_serializing_if = "Option::is_none")]
2669    pub parse_mode: Option<String>,
2670    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2671    #[serde(skip_serializing_if = "Option::is_none")]
2672    pub caption_entities: Option<Vec<MessageEntity>>,
2673    /// Optional. Performer
2674    #[serde(skip_serializing_if = "Option::is_none")]
2675    pub performer: Option<String>,
2676    /// Optional. Audio duration in seconds
2677    #[serde(skip_serializing_if = "Option::is_none")]
2678    pub audio_duration: Option<i64>,
2679    /// Optional. Inline keyboard attached to the message
2680    #[serde(skip_serializing_if = "Option::is_none")]
2681    pub reply_markup: Option<InlineKeyboardMarkup>,
2682    /// Optional. Content of the message to be sent instead of the audio
2683    #[serde(skip_serializing_if = "Option::is_none")]
2684    pub input_message_content: Option<InputMessageContent>,
2685}
2686impl InlineQueryResultAudio {
2687    pub fn new(id: String, audio_url: String, title: String) -> Self {
2688        Self {
2689            id,
2690            audio_url,
2691            title,
2692            caption: None,
2693            parse_mode: None,
2694            caption_entities: None,
2695            performer: None,
2696            audio_duration: None,
2697            reply_markup: None,
2698            input_message_content: None,
2699        }
2700    }
2701}
2702
2703/// Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
2704#[derive(Deserialize, Serialize, Debug, Clone)]
2705pub struct InlineQueryResultVoice {
2706    /// Unique identifier for this result, 1-64 bytes
2707    pub id: String,
2708    /// A valid URL for the voice recording
2709    pub voice_url: String,
2710    /// Recording title
2711    pub title: String,
2712    /// Optional. Caption, 0-1024 characters after entities parsing
2713    #[serde(skip_serializing_if = "Option::is_none")]
2714    pub caption: Option<String>,
2715    /// Optional. Mode for parsing entities in the voice message caption. See formatting options for more details.
2716    #[serde(skip_serializing_if = "Option::is_none")]
2717    pub parse_mode: Option<String>,
2718    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2719    #[serde(skip_serializing_if = "Option::is_none")]
2720    pub caption_entities: Option<Vec<MessageEntity>>,
2721    /// Optional. Recording duration in seconds
2722    #[serde(skip_serializing_if = "Option::is_none")]
2723    pub voice_duration: Option<i64>,
2724    /// Optional. Inline keyboard attached to the message
2725    #[serde(skip_serializing_if = "Option::is_none")]
2726    pub reply_markup: Option<InlineKeyboardMarkup>,
2727    /// Optional. Content of the message to be sent instead of the voice recording
2728    #[serde(skip_serializing_if = "Option::is_none")]
2729    pub input_message_content: Option<InputMessageContent>,
2730}
2731impl InlineQueryResultVoice {
2732    pub fn new(id: String, voice_url: String, title: String) -> Self {
2733        Self {
2734            id,
2735            voice_url,
2736            title,
2737            caption: None,
2738            parse_mode: None,
2739            caption_entities: None,
2740            voice_duration: None,
2741            reply_markup: None,
2742            input_message_content: None,
2743        }
2744    }
2745}
2746
2747/// Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
2748#[derive(Deserialize, Serialize, Debug, Clone)]
2749pub struct InlineQueryResultDocument {
2750    /// Unique identifier for this result, 1-64 bytes
2751    pub id: String,
2752    /// Title for the result
2753    pub title: String,
2754    /// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
2755    #[serde(skip_serializing_if = "Option::is_none")]
2756    pub caption: Option<String>,
2757    /// Optional. Mode for parsing entities in the document caption. See formatting options for more details.
2758    #[serde(skip_serializing_if = "Option::is_none")]
2759    pub parse_mode: Option<String>,
2760    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
2761    #[serde(skip_serializing_if = "Option::is_none")]
2762    pub caption_entities: Option<Vec<MessageEntity>>,
2763    /// A valid URL for the file
2764    pub document_url: String,
2765    /// MIME type of the content of the file, either “application/pdf” or “application/zip”
2766    pub mime_type: String,
2767    /// Optional. Short description of the result
2768    #[serde(skip_serializing_if = "Option::is_none")]
2769    pub description: Option<String>,
2770    /// Optional. Inline keyboard attached to the message
2771    #[serde(skip_serializing_if = "Option::is_none")]
2772    pub reply_markup: Option<InlineKeyboardMarkup>,
2773    /// Optional. Content of the message to be sent instead of the file
2774    #[serde(skip_serializing_if = "Option::is_none")]
2775    pub input_message_content: Option<InputMessageContent>,
2776    /// Optional. URL of the thumbnail (JPEG only) for the file
2777    #[serde(skip_serializing_if = "Option::is_none")]
2778    pub thumb_url: Option<String>,
2779    /// Optional. Thumbnail width
2780    #[serde(skip_serializing_if = "Option::is_none")]
2781    pub thumb_width: Option<i64>,
2782    /// Optional. Thumbnail height
2783    #[serde(skip_serializing_if = "Option::is_none")]
2784    pub thumb_height: Option<i64>,
2785}
2786impl InlineQueryResultDocument {
2787    pub fn new(id: String, title: String, document_url: String, mime_type: String) -> Self {
2788        Self {
2789            id,
2790            title,
2791            caption: None,
2792            parse_mode: None,
2793            caption_entities: None,
2794            document_url,
2795            mime_type,
2796            description: None,
2797            reply_markup: None,
2798            input_message_content: None,
2799            thumb_url: None,
2800            thumb_width: None,
2801            thumb_height: None,
2802        }
2803    }
2804}
2805
2806/// Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
2807#[derive(Deserialize, Serialize, Debug, Clone)]
2808pub struct InlineQueryResultLocation {
2809    /// Unique identifier for this result, 1-64 Bytes
2810    pub id: String,
2811    /// Location latitude in degrees
2812    pub latitude: f64,
2813    /// Location longitude in degrees
2814    pub longitude: f64,
2815    /// Location title
2816    pub title: String,
2817    /// Optional. The radius of uncertainty for the location, measured in meters; 0-1500
2818    #[serde(skip_serializing_if = "Option::is_none")]
2819    pub horizontal_accuracy: Option<f64>,
2820    /// Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
2821    #[serde(skip_serializing_if = "Option::is_none")]
2822    pub live_period: Option<i64>,
2823    /// Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
2824    #[serde(skip_serializing_if = "Option::is_none")]
2825    pub heading: Option<i64>,
2826    /// Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
2827    #[serde(skip_serializing_if = "Option::is_none")]
2828    pub proximity_alert_radius: Option<i64>,
2829    /// Optional. Inline keyboard attached to the message
2830    #[serde(skip_serializing_if = "Option::is_none")]
2831    pub reply_markup: Option<InlineKeyboardMarkup>,
2832    /// Optional. Content of the message to be sent instead of the location
2833    #[serde(skip_serializing_if = "Option::is_none")]
2834    pub input_message_content: Option<InputMessageContent>,
2835    /// Optional. Url of the thumbnail for the result
2836    #[serde(skip_serializing_if = "Option::is_none")]
2837    pub thumb_url: Option<String>,
2838    /// Optional. Thumbnail width
2839    #[serde(skip_serializing_if = "Option::is_none")]
2840    pub thumb_width: Option<i64>,
2841    /// Optional. Thumbnail height
2842    #[serde(skip_serializing_if = "Option::is_none")]
2843    pub thumb_height: Option<i64>,
2844}
2845impl InlineQueryResultLocation {
2846    pub fn new(id: String, latitude: f64, longitude: f64, title: String) -> Self {
2847        Self {
2848            id,
2849            latitude,
2850            longitude,
2851            title,
2852            horizontal_accuracy: None,
2853            live_period: None,
2854            heading: None,
2855            proximity_alert_radius: None,
2856            reply_markup: None,
2857            input_message_content: None,
2858            thumb_url: None,
2859            thumb_width: None,
2860            thumb_height: None,
2861        }
2862    }
2863}
2864
2865/// Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
2866#[derive(Deserialize, Serialize, Debug, Clone)]
2867pub struct InlineQueryResultVenue {
2868    /// Unique identifier for this result, 1-64 Bytes
2869    pub id: String,
2870    /// Latitude of the venue location in degrees
2871    pub latitude: f64,
2872    /// Longitude of the venue location in degrees
2873    pub longitude: f64,
2874    /// Title of the venue
2875    pub title: String,
2876    /// Address of the venue
2877    pub address: String,
2878    /// Optional. Foursquare identifier of the venue if known
2879    #[serde(skip_serializing_if = "Option::is_none")]
2880    pub foursquare_id: Option<String>,
2881    /// Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
2882    #[serde(skip_serializing_if = "Option::is_none")]
2883    pub foursquare_type: Option<String>,
2884    /// Optional. Google Places identifier of the venue
2885    #[serde(skip_serializing_if = "Option::is_none")]
2886    pub google_place_id: Option<String>,
2887    /// Optional. Google Places type of the venue. (See supported types.)
2888    #[serde(skip_serializing_if = "Option::is_none")]
2889    pub google_place_type: Option<String>,
2890    /// Optional. Inline keyboard attached to the message
2891    #[serde(skip_serializing_if = "Option::is_none")]
2892    pub reply_markup: Option<InlineKeyboardMarkup>,
2893    /// Optional. Content of the message to be sent instead of the venue
2894    #[serde(skip_serializing_if = "Option::is_none")]
2895    pub input_message_content: Option<InputMessageContent>,
2896    /// Optional. Url of the thumbnail for the result
2897    #[serde(skip_serializing_if = "Option::is_none")]
2898    pub thumb_url: Option<String>,
2899    /// Optional. Thumbnail width
2900    #[serde(skip_serializing_if = "Option::is_none")]
2901    pub thumb_width: Option<i64>,
2902    /// Optional. Thumbnail height
2903    #[serde(skip_serializing_if = "Option::is_none")]
2904    pub thumb_height: Option<i64>,
2905}
2906impl InlineQueryResultVenue {
2907    pub fn new(id: String, latitude: f64, longitude: f64, title: String, address: String) -> Self {
2908        Self {
2909            id,
2910            latitude,
2911            longitude,
2912            title,
2913            address,
2914            foursquare_id: None,
2915            foursquare_type: None,
2916            google_place_id: None,
2917            google_place_type: None,
2918            reply_markup: None,
2919            input_message_content: None,
2920            thumb_url: None,
2921            thumb_width: None,
2922            thumb_height: None,
2923        }
2924    }
2925}
2926
2927/// Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
2928#[derive(Deserialize, Serialize, Debug, Clone)]
2929pub struct InlineQueryResultContact {
2930    /// Unique identifier for this result, 1-64 Bytes
2931    pub id: String,
2932    /// Contact's phone number
2933    pub phone_number: String,
2934    /// Contact's first name
2935    pub first_name: String,
2936    /// Optional. Contact's last name
2937    #[serde(skip_serializing_if = "Option::is_none")]
2938    pub last_name: Option<String>,
2939    /// Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
2940    #[serde(skip_serializing_if = "Option::is_none")]
2941    pub vcard: Option<String>,
2942    /// Optional. Inline keyboard attached to the message
2943    #[serde(skip_serializing_if = "Option::is_none")]
2944    pub reply_markup: Option<InlineKeyboardMarkup>,
2945    /// Optional. Content of the message to be sent instead of the contact
2946    #[serde(skip_serializing_if = "Option::is_none")]
2947    pub input_message_content: Option<InputMessageContent>,
2948    /// Optional. Url of the thumbnail for the result
2949    #[serde(skip_serializing_if = "Option::is_none")]
2950    pub thumb_url: Option<String>,
2951    /// Optional. Thumbnail width
2952    #[serde(skip_serializing_if = "Option::is_none")]
2953    pub thumb_width: Option<i64>,
2954    /// Optional. Thumbnail height
2955    #[serde(skip_serializing_if = "Option::is_none")]
2956    pub thumb_height: Option<i64>,
2957}
2958impl InlineQueryResultContact {
2959    pub fn new(id: String, phone_number: String, first_name: String) -> Self {
2960        Self {
2961            id,
2962            phone_number,
2963            first_name,
2964            last_name: None,
2965            vcard: None,
2966            reply_markup: None,
2967            input_message_content: None,
2968            thumb_url: None,
2969            thumb_width: None,
2970            thumb_height: None,
2971        }
2972    }
2973}
2974
2975/// Represents a Game.
2976#[derive(Deserialize, Serialize, Debug, Clone)]
2977pub struct InlineQueryResultGame {
2978    /// Unique identifier for this result, 1-64 bytes
2979    pub id: String,
2980    /// Short name of the game
2981    pub game_short_name: String,
2982    /// Optional. Inline keyboard attached to the message
2983    #[serde(skip_serializing_if = "Option::is_none")]
2984    pub reply_markup: Option<InlineKeyboardMarkup>,
2985}
2986impl InlineQueryResultGame {
2987    pub fn new(id: String, game_short_name: String) -> Self {
2988        Self {
2989            id,
2990            game_short_name,
2991            reply_markup: None,
2992        }
2993    }
2994}
2995
2996/// Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
2997#[derive(Deserialize, Serialize, Debug, Clone)]
2998pub struct InlineQueryResultCachedPhoto {
2999    /// Unique identifier for this result, 1-64 bytes
3000    pub id: String,
3001    /// A valid file identifier of the photo
3002    pub photo_file_id: String,
3003    /// Optional. Title for the result
3004    #[serde(skip_serializing_if = "Option::is_none")]
3005    pub title: Option<String>,
3006    /// Optional. Short description of the result
3007    #[serde(skip_serializing_if = "Option::is_none")]
3008    pub description: Option<String>,
3009    /// Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing
3010    #[serde(skip_serializing_if = "Option::is_none")]
3011    pub caption: Option<String>,
3012    /// Optional. Mode for parsing entities in the photo caption. See formatting options for more details.
3013    #[serde(skip_serializing_if = "Option::is_none")]
3014    pub parse_mode: Option<String>,
3015    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
3016    #[serde(skip_serializing_if = "Option::is_none")]
3017    pub caption_entities: Option<Vec<MessageEntity>>,
3018    /// Optional. Inline keyboard attached to the message
3019    #[serde(skip_serializing_if = "Option::is_none")]
3020    pub reply_markup: Option<InlineKeyboardMarkup>,
3021    /// Optional. Content of the message to be sent instead of the photo
3022    #[serde(skip_serializing_if = "Option::is_none")]
3023    pub input_message_content: Option<InputMessageContent>,
3024}
3025impl InlineQueryResultCachedPhoto {
3026    pub fn new(id: String, photo_file_id: String) -> Self {
3027        Self {
3028            id,
3029            photo_file_id,
3030            title: None,
3031            description: None,
3032            caption: None,
3033            parse_mode: None,
3034            caption_entities: None,
3035            reply_markup: None,
3036            input_message_content: None,
3037        }
3038    }
3039}
3040
3041/// Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
3042#[derive(Deserialize, Serialize, Debug, Clone)]
3043pub struct InlineQueryResultCachedGif {
3044    /// Unique identifier for this result, 1-64 bytes
3045    pub id: String,
3046    /// A valid file identifier for the GIF file
3047    pub gif_file_id: String,
3048    /// Optional. Title for the result
3049    #[serde(skip_serializing_if = "Option::is_none")]
3050    pub title: Option<String>,
3051    /// Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing
3052    #[serde(skip_serializing_if = "Option::is_none")]
3053    pub caption: Option<String>,
3054    /// Optional. Mode for parsing entities in the caption. See formatting options for more details.
3055    #[serde(skip_serializing_if = "Option::is_none")]
3056    pub parse_mode: Option<String>,
3057    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
3058    #[serde(skip_serializing_if = "Option::is_none")]
3059    pub caption_entities: Option<Vec<MessageEntity>>,
3060    /// Optional. Inline keyboard attached to the message
3061    #[serde(skip_serializing_if = "Option::is_none")]
3062    pub reply_markup: Option<InlineKeyboardMarkup>,
3063    /// Optional. Content of the message to be sent instead of the GIF animation
3064    #[serde(skip_serializing_if = "Option::is_none")]
3065    pub input_message_content: Option<InputMessageContent>,
3066}
3067impl InlineQueryResultCachedGif {
3068    pub fn new(id: String, gif_file_id: String) -> Self {
3069        Self {
3070            id,
3071            gif_file_id,
3072            title: None,
3073            caption: None,
3074            parse_mode: None,
3075            caption_entities: None,
3076            reply_markup: None,
3077            input_message_content: None,
3078        }
3079    }
3080}
3081
3082/// Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
3083#[derive(Deserialize, Serialize, Debug, Clone)]
3084pub struct InlineQueryResultCachedMpeg4Gif {
3085    /// Unique identifier for this result, 1-64 bytes
3086    pub id: String,
3087    /// A valid file identifier for the MPEG4 file
3088    pub mpeg4_file_id: String,
3089    /// Optional. Title for the result
3090    #[serde(skip_serializing_if = "Option::is_none")]
3091    pub title: Option<String>,
3092    /// Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing
3093    #[serde(skip_serializing_if = "Option::is_none")]
3094    pub caption: Option<String>,
3095    /// Optional. Mode for parsing entities in the caption. See formatting options for more details.
3096    #[serde(skip_serializing_if = "Option::is_none")]
3097    pub parse_mode: Option<String>,
3098    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
3099    #[serde(skip_serializing_if = "Option::is_none")]
3100    pub caption_entities: Option<Vec<MessageEntity>>,
3101    /// Optional. Inline keyboard attached to the message
3102    #[serde(skip_serializing_if = "Option::is_none")]
3103    pub reply_markup: Option<InlineKeyboardMarkup>,
3104    /// Optional. Content of the message to be sent instead of the video animation
3105    #[serde(skip_serializing_if = "Option::is_none")]
3106    pub input_message_content: Option<InputMessageContent>,
3107}
3108impl InlineQueryResultCachedMpeg4Gif {
3109    pub fn new(id: String, mpeg4_file_id: String) -> Self {
3110        Self {
3111            id,
3112            mpeg4_file_id,
3113            title: None,
3114            caption: None,
3115            parse_mode: None,
3116            caption_entities: None,
3117            reply_markup: None,
3118            input_message_content: None,
3119        }
3120    }
3121}
3122
3123/// Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
3124#[derive(Deserialize, Serialize, Debug, Clone)]
3125pub struct InlineQueryResultCachedSticker {
3126    /// Unique identifier for this result, 1-64 bytes
3127    pub id: String,
3128    /// A valid file identifier of the sticker
3129    pub sticker_file_id: String,
3130    /// Optional. Inline keyboard attached to the message
3131    #[serde(skip_serializing_if = "Option::is_none")]
3132    pub reply_markup: Option<InlineKeyboardMarkup>,
3133    /// Optional. Content of the message to be sent instead of the sticker,
3134    pub input_message_content: Option<InputMessageContent>,
3135}
3136impl InlineQueryResultCachedSticker {
3137    pub fn new(id: String, sticker_file_id: String) -> Self {
3138        Self {
3139            id,
3140            sticker_file_id,
3141            reply_markup: None,
3142            input_message_content: None,
3143        }
3144    }
3145}
3146
3147/// Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
3148#[derive(Deserialize, Serialize, Debug, Clone)]
3149pub struct InlineQueryResultCachedDocument {
3150    /// Unique identifier for this result, 1-64 bytes
3151    pub id: String,
3152    /// Title for the result
3153    pub title: String,
3154    /// A valid file identifier for the file
3155    pub document_file_id: String,
3156    /// Optional. Short description of the result
3157    #[serde(skip_serializing_if = "Option::is_none")]
3158    pub description: Option<String>,
3159    /// Optional. Caption of the document to be sent, 0-1024 characters after entities parsing
3160    #[serde(skip_serializing_if = "Option::is_none")]
3161    pub caption: Option<String>,
3162    /// Optional. Mode for parsing entities in the document caption. See formatting options for more details.
3163    #[serde(skip_serializing_if = "Option::is_none")]
3164    pub parse_mode: Option<String>,
3165    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
3166    #[serde(skip_serializing_if = "Option::is_none")]
3167    pub caption_entities: Option<Vec<MessageEntity>>,
3168    /// Optional. Inline keyboard attached to the message
3169    #[serde(skip_serializing_if = "Option::is_none")]
3170    pub reply_markup: Option<InlineKeyboardMarkup>,
3171    /// Optional. Content of the message to be sent instead of the file
3172    #[serde(skip_serializing_if = "Option::is_none")]
3173    pub input_message_content: Option<InputMessageContent>,
3174}
3175impl InlineQueryResultCachedDocument {
3176    pub fn new(id: String, title: String, document_file_id: String) -> Self {
3177        Self {
3178            id,
3179            title,
3180            document_file_id,
3181            description: None,
3182            caption: None,
3183            parse_mode: None,
3184            caption_entities: None,
3185            reply_markup: None,
3186            input_message_content: None,
3187        }
3188    }
3189}
3190
3191/// Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
3192#[derive(Deserialize, Serialize, Debug, Clone)]
3193pub struct InlineQueryResultCachedVideo {
3194    /// Unique identifier for this result, 1-64 bytes
3195    pub id: String,
3196    /// A valid file identifier for the video file
3197    pub video_file_id: String,
3198    /// Title for the result
3199    pub title: String,
3200    /// Optional. Short description of the result
3201    #[serde(skip_serializing_if = "Option::is_none")]
3202    pub description: Option<String>,
3203    /// Optional. Caption of the video to be sent, 0-1024 characters after entities parsing
3204    #[serde(skip_serializing_if = "Option::is_none")]
3205    pub caption: Option<String>,
3206    /// Optional. Mode for parsing entities in the video caption. See formatting options for more details.
3207    #[serde(skip_serializing_if = "Option::is_none")]
3208    pub parse_mode: Option<String>,
3209    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
3210    #[serde(skip_serializing_if = "Option::is_none")]
3211    pub caption_entities: Option<Vec<MessageEntity>>,
3212    /// Optional. Inline keyboard attached to the message
3213    #[serde(skip_serializing_if = "Option::is_none")]
3214    pub reply_markup: Option<InlineKeyboardMarkup>,
3215    /// Optional. Content of the message to be sent instead of the video
3216    #[serde(skip_serializing_if = "Option::is_none")]
3217    pub input_message_content: Option<InputMessageContent>,
3218}
3219impl InlineQueryResultCachedVideo {
3220    pub fn new(id: String, video_file_id: String, title: String) -> Self {
3221        Self {
3222            id,
3223            video_file_id,
3224            title,
3225            description: None,
3226            caption: None,
3227            parse_mode: None,
3228            caption_entities: None,
3229            reply_markup: None,
3230            input_message_content: None,
3231        }
3232    }
3233}
3234
3235/// Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
3236#[derive(Deserialize, Serialize, Debug, Clone)]
3237pub struct InlineQueryResultCachedVoice {
3238    /// Unique identifier for this result, 1-64 bytes
3239    pub id: String,
3240    /// A valid file identifier for the voice message
3241    pub voice_file_id: String,
3242    /// Voice message title
3243    pub title: String,
3244    /// Optional. Caption, 0-1024 characters after entities parsing
3245    #[serde(skip_serializing_if = "Option::is_none")]
3246    pub caption: Option<String>,
3247    /// Optional. Mode for parsing entities in the voice message caption. See formatting options for more details.
3248    #[serde(skip_serializing_if = "Option::is_none")]
3249    pub parse_mode: Option<String>,
3250    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
3251    #[serde(skip_serializing_if = "Option::is_none")]
3252    pub caption_entities: Option<Vec<MessageEntity>>,
3253    /// Optional. Inline keyboard attached to the message
3254    #[serde(skip_serializing_if = "Option::is_none")]
3255    pub reply_markup: Option<InlineKeyboardMarkup>,
3256    /// Optional. Content of the message to be sent instead of the voice message
3257    #[serde(skip_serializing_if = "Option::is_none")]
3258    pub input_message_content: Option<InputMessageContent>,
3259}
3260impl InlineQueryResultCachedVoice {
3261    pub fn new(id: String, voice_file_id: String, title: String) -> Self {
3262        Self {
3263            id,
3264            voice_file_id,
3265            title,
3266            caption: None,
3267            parse_mode: None,
3268            caption_entities: None,
3269            reply_markup: None,
3270            input_message_content: None,
3271        }
3272    }
3273}
3274
3275/// Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
3276#[derive(Deserialize, Serialize, Debug, Clone)]
3277pub struct InlineQueryResultCachedAudio {
3278    /// Unique identifier for this result, 1-64 bytes
3279    pub id: String,
3280    /// A valid file identifier for the audio file
3281    pub audio_file_id: String,
3282    /// Optional. Caption, 0-1024 characters after entities parsing
3283    #[serde(skip_serializing_if = "Option::is_none")]
3284    pub caption: Option<String>,
3285    /// Optional. Mode for parsing entities in the audio caption. See formatting options for more details.
3286    #[serde(skip_serializing_if = "Option::is_none")]
3287    pub parse_mode: Option<String>,
3288    /// Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode
3289    #[serde(skip_serializing_if = "Option::is_none")]
3290    pub caption_entities: Option<Vec<MessageEntity>>,
3291    /// Optional. Inline keyboard attached to the message
3292    #[serde(skip_serializing_if = "Option::is_none")]
3293    pub reply_markup: Option<InlineKeyboardMarkup>,
3294    /// Optional. Content of the message to be sent instead of the audio
3295    #[serde(skip_serializing_if = "Option::is_none")]
3296    pub input_message_content: Option<InputMessageContent>,
3297}
3298impl InlineQueryResultCachedAudio {
3299    pub fn new(id: String, audio_file_id: String) -> Self {
3300        Self {
3301            id,
3302            audio_file_id,
3303            caption: None,
3304            parse_mode: None,
3305            caption_entities: None,
3306            reply_markup: None,
3307            input_message_content: None,
3308        }
3309    }
3310}
3311
3312/// Represents the content of a text message to be sent as the result of an inline query.
3313#[derive(Deserialize, Serialize, Debug, Clone)]
3314pub struct InputTextMessageContent {
3315    /// Text of the message to be sent, 1-4096 characters
3316    pub message_text: String,
3317    /// Optional. Mode for parsing entities in the message text. See formatting options for more details.
3318    #[serde(skip_serializing_if = "Option::is_none")]
3319    pub parse_mode: Option<String>,
3320    /// Optional. List of special entities that appear in message text, which can be specified instead of parse_mode
3321    #[serde(skip_serializing_if = "Option::is_none")]
3322    pub entities: Option<Vec<MessageEntity>>,
3323    /// Optional. Disables link previews for links in the sent message
3324    #[serde(skip_serializing_if = "Option::is_none")]
3325    pub disable_web_page_preview: Option<bool>,
3326}
3327impl InputTextMessageContent {
3328    pub fn new(message_text: String) -> Self {
3329        Self {
3330            message_text,
3331            parse_mode: None,
3332            entities: None,
3333            disable_web_page_preview: None,
3334        }
3335    }
3336}
3337
3338/// Represents the content of a location message to be sent as the result of an inline query.
3339#[derive(Deserialize, Serialize, Debug, Clone)]
3340pub struct InputLocationMessageContent {
3341    /// Latitude of the location in degrees
3342    pub latitude: f64,
3343    /// Longitude of the location in degrees
3344    pub longitude: f64,
3345    /// Optional. The radius of uncertainty for the location, measured in meters; 0-1500
3346    #[serde(skip_serializing_if = "Option::is_none")]
3347    pub horizontal_accuracy: Option<f64>,
3348    /// Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
3349    #[serde(skip_serializing_if = "Option::is_none")]
3350    pub live_period: Option<i64>,
3351    /// Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
3352    #[serde(skip_serializing_if = "Option::is_none")]
3353    pub heading: Option<i64>,
3354    /// Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
3355    #[serde(skip_serializing_if = "Option::is_none")]
3356    pub proximity_alert_radius: Option<i64>,
3357}
3358impl InputLocationMessageContent {
3359    pub fn new(latitude: f64, longitude: f64) -> Self {
3360        Self {
3361            latitude,
3362            longitude,
3363            horizontal_accuracy: None,
3364            live_period: None,
3365            heading: None,
3366            proximity_alert_radius: None,
3367        }
3368    }
3369}
3370
3371/// Represents the content of a venue message to be sent as the result of an inline query.
3372#[derive(Deserialize, Serialize, Debug, Clone)]
3373pub struct InputVenueMessageContent {
3374    /// Latitude of the venue in degrees
3375    pub latitude: f64,
3376    /// Longitude of the venue in degrees
3377    pub longitude: f64,
3378    /// Name of the venue
3379    pub title: String,
3380    /// Address of the venue
3381    pub address: String,
3382    /// Optional. Foursquare identifier of the venue, if known
3383    #[serde(skip_serializing_if = "Option::is_none")]
3384    pub foursquare_id: Option<String>,
3385    /// Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
3386    #[serde(skip_serializing_if = "Option::is_none")]
3387    pub foursquare_type: Option<String>,
3388    /// Optional. Google Places identifier of the venue
3389    #[serde(skip_serializing_if = "Option::is_none")]
3390    pub google_place_id: Option<String>,
3391    /// Optional. Google Places type of the venue. (See supported types.)
3392    #[serde(skip_serializing_if = "Option::is_none")]
3393    pub google_place_type: Option<String>,
3394}
3395impl InputVenueMessageContent {
3396    pub fn new(latitude: f64, longitude: f64, title: String, address: String) -> Self {
3397        Self {
3398            latitude,
3399            longitude,
3400            title,
3401            address,
3402            foursquare_id: None,
3403            foursquare_type: None,
3404            google_place_id: None,
3405            google_place_type: None,
3406        }
3407    }
3408}
3409
3410/// Represents the content of a contact message to be sent as the result of an inline query.
3411#[derive(Deserialize, Serialize, Debug, Clone)]
3412pub struct InputContactMessageContent {
3413    /// Contact's phone number
3414    pub phone_number: String,
3415    /// Contact's first name
3416    pub first_name: String,
3417    /// Optional. Contact's last name
3418    #[serde(skip_serializing_if = "Option::is_none")]
3419    pub last_name: Option<String>,
3420    /// Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
3421    #[serde(skip_serializing_if = "Option::is_none")]
3422    pub vcard: Option<String>,
3423}
3424impl InputContactMessageContent {
3425    pub fn new(phone_number: String, first_name: String) -> Self {
3426        Self {
3427            phone_number,
3428            first_name,
3429            last_name: None,
3430            vcard: None,
3431        }
3432    }
3433}
3434
3435/// Represents the content of an invoice message to be sent as the result of an inline query.
3436#[derive(Deserialize, Serialize, Debug, Clone)]
3437pub struct InputInvoiceMessageContent {
3438    /// Product name, 1-32 characters
3439    pub title: String,
3440    /// Product description, 1-255 characters
3441    pub description: String,
3442    /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
3443    pub payload: String,
3444    /// Payment provider token, obtained via @BotFather
3445    pub provider_token: String,
3446    /// Three-letter ISO 4217 currency code, see more on currencies
3447    pub currency: String,
3448    /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
3449    pub prices: Vec<LabeledPrice>,
3450    /// Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0
3451    #[serde(skip_serializing_if = "Option::is_none")]
3452    pub max_tip_amount: Option<i64>,
3453    /// Optional. A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
3454    #[serde(skip_serializing_if = "Option::is_none")]
3455    pub suggested_tip_amounts: Option<Vec<i64>>,
3456    /// Optional. A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider.
3457    #[serde(skip_serializing_if = "Option::is_none")]
3458    pub provider_data: Option<String>,
3459    /// Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.
3460    #[serde(skip_serializing_if = "Option::is_none")]
3461    pub photo_url: Option<String>,
3462    /// Optional. Photo size in bytes
3463    #[serde(skip_serializing_if = "Option::is_none")]
3464    pub photo_size: Option<i64>,
3465    /// Optional. Photo width
3466    #[serde(skip_serializing_if = "Option::is_none")]
3467    pub photo_width: Option<i64>,
3468    /// Optional. Photo height
3469    #[serde(skip_serializing_if = "Option::is_none")]
3470    pub photo_height: Option<i64>,
3471    /// Optional. Pass True if you require the user's full name to complete the order
3472    #[serde(skip_serializing_if = "Option::is_none")]
3473    pub need_name: Option<bool>,
3474    /// Optional. Pass True if you require the user's phone number to complete the order
3475    #[serde(skip_serializing_if = "Option::is_none")]
3476    pub need_phone_number: Option<bool>,
3477    /// Optional. Pass True if you require the user's email address to complete the order
3478    #[serde(skip_serializing_if = "Option::is_none")]
3479    pub need_email: Option<bool>,
3480    /// Optional. Pass True if you require the user's shipping address to complete the order
3481    #[serde(skip_serializing_if = "Option::is_none")]
3482    pub need_shipping_address: Option<bool>,
3483    /// Optional. Pass True if the user's phone number should be sent to provider
3484    #[serde(skip_serializing_if = "Option::is_none")]
3485    pub send_phone_number_to_provider: Option<bool>,
3486    /// Optional. Pass True if the user's email address should be sent to provider
3487    #[serde(skip_serializing_if = "Option::is_none")]
3488    pub send_email_to_provider: Option<bool>,
3489    /// Optional. Pass True if the final price depends on the shipping method
3490    #[serde(skip_serializing_if = "Option::is_none")]
3491    pub is_flexible: Option<bool>,
3492}
3493impl InputInvoiceMessageContent {
3494    pub fn new(
3495        title: String,
3496        description: String,
3497        payload: String,
3498        provider_token: String,
3499        currency: String,
3500        prices: Vec<LabeledPrice>,
3501    ) -> Self {
3502        Self {
3503            title,
3504            description,
3505            payload,
3506            provider_token,
3507            currency,
3508            prices,
3509            max_tip_amount: None,
3510            suggested_tip_amounts: None,
3511            provider_data: None,
3512            photo_url: None,
3513            photo_size: None,
3514            photo_width: None,
3515            photo_height: None,
3516            need_name: None,
3517            need_phone_number: None,
3518            need_email: None,
3519            need_shipping_address: None,
3520            send_phone_number_to_provider: None,
3521            send_email_to_provider: None,
3522            is_flexible: None,
3523        }
3524    }
3525}
3526
3527/// Represents a result of an inline query that was chosen by the user and sent to their chat partner.
3528#[derive(Deserialize, Serialize, Debug, Clone)]
3529pub struct ChosenInlineResult {
3530    /// The unique identifier for the result that was chosen
3531    pub result_id: String,
3532    /// The user that chose the result
3533    pub from: User,
3534    /// Optional. Sender location, only for bots that require user location
3535    #[serde(skip_serializing_if = "Option::is_none")]
3536    pub location: Option<Location>,
3537    /// Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message.
3538    #[serde(skip_serializing_if = "Option::is_none")]
3539    pub inline_message_id: Option<String>,
3540    /// The query that was used to obtain the result
3541    pub query: String,
3542}
3543impl ChosenInlineResult {
3544    pub fn new(result_id: String, from: User, query: String) -> Self {
3545        Self {
3546            result_id,
3547            from,
3548            location: None,
3549            inline_message_id: None,
3550            query,
3551        }
3552    }
3553}
3554
3555/// Describes an inline message sent by a Web App on behalf of a user.
3556#[derive(Deserialize, Serialize, Debug, Clone)]
3557pub struct SentWebAppMessage {
3558    /// Optional. Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message.
3559    #[serde(skip_serializing_if = "Option::is_none")]
3560    pub inline_message_id: Option<String>,
3561}
3562impl SentWebAppMessage {
3563    pub fn new() -> Self {
3564        Self {
3565            inline_message_id: None,
3566        }
3567    }
3568}
3569
3570/// This object represents a portion of the price for goods or services.
3571#[derive(Deserialize, Serialize, Debug, Clone)]
3572pub struct LabeledPrice {
3573    /// Portion label
3574    pub label: String,
3575    /// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
3576    pub amount: i64,
3577}
3578impl LabeledPrice {
3579    pub fn new(label: String, amount: i64) -> Self {
3580        Self { label, amount }
3581    }
3582}
3583
3584/// This object contains basic information about an invoice.
3585#[derive(Deserialize, Serialize, Debug, Clone)]
3586pub struct Invoice {
3587    /// Product name
3588    pub title: String,
3589    /// Product description
3590    pub description: String,
3591    /// Unique bot deep-linking parameter that can be used to generate this invoice
3592    pub start_parameter: String,
3593    /// Three-letter ISO 4217 currency code
3594    pub currency: String,
3595    /// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
3596    pub total_amount: i64,
3597}
3598impl Invoice {
3599    pub fn new(
3600        title: String,
3601        description: String,
3602        start_parameter: String,
3603        currency: String,
3604        total_amount: i64,
3605    ) -> Self {
3606        Self {
3607            title,
3608            description,
3609            start_parameter,
3610            currency,
3611            total_amount,
3612        }
3613    }
3614}
3615
3616/// This object represents a shipping address.
3617#[derive(Deserialize, Serialize, Debug, Clone)]
3618pub struct ShippingAddress {
3619    /// Two-letter ISO 3166-1 alpha-2 country code
3620    pub country_code: String,
3621    /// State, if applicable
3622    pub state: String,
3623    /// City
3624    pub city: String,
3625    /// First line for the address
3626    pub street_line1: String,
3627    /// Second line for the address
3628    pub street_line2: String,
3629    /// Address post code
3630    pub post_code: String,
3631}
3632impl ShippingAddress {
3633    pub fn new(
3634        country_code: String,
3635        state: String,
3636        city: String,
3637        street_line1: String,
3638        street_line2: String,
3639        post_code: String,
3640    ) -> Self {
3641        Self {
3642            country_code,
3643            state,
3644            city,
3645            street_line1,
3646            street_line2,
3647            post_code,
3648        }
3649    }
3650}
3651
3652/// This object represents information about an order.
3653#[derive(Deserialize, Serialize, Debug, Clone)]
3654pub struct OrderInfo {
3655    /// Optional. User name
3656    #[serde(skip_serializing_if = "Option::is_none")]
3657    pub name: Option<String>,
3658    /// Optional. User's phone number
3659    #[serde(skip_serializing_if = "Option::is_none")]
3660    pub phone_number: Option<String>,
3661    /// Optional. User email
3662    #[serde(skip_serializing_if = "Option::is_none")]
3663    pub email: Option<String>,
3664    /// Optional. User shipping address
3665    #[serde(skip_serializing_if = "Option::is_none")]
3666    pub shipping_address: Option<ShippingAddress>,
3667}
3668impl OrderInfo {
3669    pub fn new() -> Self {
3670        Self {
3671            name: None,
3672            phone_number: None,
3673            email: None,
3674            shipping_address: None,
3675        }
3676    }
3677}
3678
3679/// This object represents one shipping option.
3680#[derive(Deserialize, Serialize, Debug, Clone)]
3681pub struct ShippingOption {
3682    /// Shipping option identifier
3683    pub id: String,
3684    /// Option title
3685    pub title: String,
3686    /// List of price portions
3687    pub prices: Vec<LabeledPrice>,
3688}
3689impl ShippingOption {
3690    pub fn new(id: String, title: String, prices: Vec<LabeledPrice>) -> Self {
3691        Self { id, title, prices }
3692    }
3693}
3694
3695/// This object contains basic information about a successful payment.
3696#[derive(Deserialize, Serialize, Debug, Clone)]
3697pub struct SuccessfulPayment {
3698    /// Three-letter ISO 4217 currency code
3699    pub currency: String,
3700    /// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
3701    pub total_amount: i64,
3702    /// Bot specified invoice payload
3703    pub invoice_payload: String,
3704    /// Optional. Identifier of the shipping option chosen by the user
3705    #[serde(skip_serializing_if = "Option::is_none")]
3706    pub shipping_option_id: Option<String>,
3707    /// Optional. Order information provided by the user
3708    #[serde(skip_serializing_if = "Option::is_none")]
3709    pub order_info: Option<OrderInfo>,
3710    /// Telegram payment identifier
3711    pub telegram_payment_charge_id: String,
3712    /// Provider payment identifier
3713    pub provider_payment_charge_id: String,
3714}
3715impl SuccessfulPayment {
3716    pub fn new(
3717        currency: String,
3718        total_amount: i64,
3719        invoice_payload: String,
3720        telegram_payment_charge_id: String,
3721        provider_payment_charge_id: String,
3722    ) -> Self {
3723        Self {
3724            currency,
3725            total_amount,
3726            invoice_payload,
3727            shipping_option_id: None,
3728            order_info: None,
3729            telegram_payment_charge_id,
3730            provider_payment_charge_id,
3731        }
3732    }
3733}
3734
3735/// This object contains information about an incoming shipping query.
3736#[derive(Deserialize, Serialize, Debug, Clone)]
3737pub struct ShippingQuery {
3738    /// Unique query identifier
3739    pub id: String,
3740    /// User who sent the query
3741    pub from: User,
3742    /// Bot specified invoice payload
3743    pub invoice_payload: String,
3744    /// User specified shipping address
3745    pub shipping_address: ShippingAddress,
3746}
3747impl ShippingQuery {
3748    pub fn new(
3749        id: String,
3750        from: User,
3751        invoice_payload: String,
3752        shipping_address: ShippingAddress,
3753    ) -> Self {
3754        Self {
3755            id,
3756            from,
3757            invoice_payload,
3758            shipping_address,
3759        }
3760    }
3761}
3762
3763/// This object contains information about an incoming pre-checkout query.
3764#[derive(Deserialize, Serialize, Debug, Clone)]
3765pub struct PreCheckoutQuery {
3766    /// Unique query identifier
3767    pub id: String,
3768    /// User who sent the query
3769    pub from: User,
3770    /// Three-letter ISO 4217 currency code
3771    pub currency: String,
3772    /// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
3773    pub total_amount: i64,
3774    /// Bot specified invoice payload
3775    pub invoice_payload: String,
3776    /// Optional. Identifier of the shipping option chosen by the user
3777    #[serde(skip_serializing_if = "Option::is_none")]
3778    pub shipping_option_id: Option<String>,
3779    /// Optional. Order information provided by the user
3780    #[serde(skip_serializing_if = "Option::is_none")]
3781    pub order_info: Option<OrderInfo>,
3782}
3783impl PreCheckoutQuery {
3784    pub fn new(
3785        id: String,
3786        from: User,
3787        currency: String,
3788        total_amount: i64,
3789        invoice_payload: String,
3790    ) -> Self {
3791        Self {
3792            id,
3793            from,
3794            currency,
3795            total_amount,
3796            invoice_payload,
3797            shipping_option_id: None,
3798            order_info: None,
3799        }
3800    }
3801}
3802
3803/// Describes Telegram Passport data shared with the bot by the user.
3804#[derive(Deserialize, Serialize, Debug, Clone)]
3805pub struct PassportData {
3806    /// Array with information about documents and other Telegram Passport elements that was shared with the bot
3807    pub data: Vec<EncryptedPassportElement>,
3808    /// Encrypted credentials required to decrypt the data
3809    pub credentials: EncryptedCredentials,
3810}
3811impl PassportData {
3812    pub fn new(data: Vec<EncryptedPassportElement>, credentials: EncryptedCredentials) -> Self {
3813        Self { data, credentials }
3814    }
3815}
3816
3817/// This object represents a file uploaded to Telegram Passport. Currently all Telegram Passport files are in JPEG format when decrypted and don't exceed 10MB.
3818#[derive(Deserialize, Serialize, Debug, Clone)]
3819pub struct PassportFile {
3820    /// Identifier for this file, which can be used to download or reuse the file
3821    pub file_id: String,
3822    /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
3823    pub file_unique_id: String,
3824    /// File size in bytes
3825    pub file_size: i64,
3826    /// Unix time when the file was uploaded
3827    pub file_date: i64,
3828}
3829impl PassportFile {
3830    pub fn new(file_id: String, file_unique_id: String, file_size: i64, file_date: i64) -> Self {
3831        Self {
3832            file_id,
3833            file_unique_id,
3834            file_size,
3835            file_date,
3836        }
3837    }
3838}
3839
3840/// Describes documents or other Telegram Passport elements shared with the bot by the user.
3841#[derive(Deserialize, Serialize, Debug, Clone)]
3842pub struct EncryptedPassportElement {
3843    /// Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
3844    #[serde(rename = "type")]
3845    pub type_name: String,
3846    /// Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types. Can be decrypted and verified using the accompanying EncryptedCredentials.
3847    #[serde(skip_serializing_if = "Option::is_none")]
3848    pub data: Option<String>,
3849    /// Optional. User's verified phone number, available only for “phone_number” type
3850    #[serde(skip_serializing_if = "Option::is_none")]
3851    pub phone_number: Option<String>,
3852    /// Optional. User's verified email address, available only for “email” type
3853    #[serde(skip_serializing_if = "Option::is_none")]
3854    pub email: Option<String>,
3855    /// Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
3856    #[serde(skip_serializing_if = "Option::is_none")]
3857    pub files: Option<Vec<PassportFile>>,
3858    /// Optional. Encrypted file with the front side of the document, provided by the user. Available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
3859    #[serde(skip_serializing_if = "Option::is_none")]
3860    pub front_side: Option<PassportFile>,
3861    /// Optional. Encrypted file with the reverse side of the document, provided by the user. Available for “driver_license” and “identity_card”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
3862    #[serde(skip_serializing_if = "Option::is_none")]
3863    pub reverse_side: Option<PassportFile>,
3864    /// Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”. The file can be decrypted and verified using the accompanying EncryptedCredentials.
3865    #[serde(skip_serializing_if = "Option::is_none")]
3866    pub selfie: Option<PassportFile>,
3867    /// Optional. Array of encrypted files with translated versions of documents provided by the user. Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types. Files can be decrypted and verified using the accompanying EncryptedCredentials.
3868    #[serde(skip_serializing_if = "Option::is_none")]
3869    pub translation: Option<Vec<PassportFile>>,
3870    /// Base64-encoded element hash for using in PassportElementErrorUnspecified
3871    pub hash: String,
3872}
3873impl EncryptedPassportElement {
3874    pub fn new(type_name: String, hash: String) -> Self {
3875        Self {
3876            type_name,
3877            data: None,
3878            phone_number: None,
3879            email: None,
3880            files: None,
3881            front_side: None,
3882            reverse_side: None,
3883            selfie: None,
3884            translation: None,
3885            hash,
3886        }
3887    }
3888}
3889
3890/// Describes data required for decrypting and authenticating EncryptedPassportElement. See the Telegram Passport Documentation for a complete description of the data decryption and authentication processes.
3891#[derive(Deserialize, Serialize, Debug, Clone)]
3892pub struct EncryptedCredentials {
3893    /// Base64-encoded encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication
3894    pub data: String,
3895    /// Base64-encoded data hash for data authentication
3896    pub hash: String,
3897    /// Base64-encoded secret, encrypted with the bot's public RSA key, required for data decryption
3898    pub secret: String,
3899}
3900impl EncryptedCredentials {
3901    pub fn new(data: String, hash: String, secret: String) -> Self {
3902        Self { data, hash, secret }
3903    }
3904}
3905
3906/// Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes.
3907#[derive(Deserialize, Serialize, Debug, Clone)]
3908pub struct PassportElementErrorDataField {
3909    /// Error source, must be data
3910    pub source: String,
3911    /// The section of the user's Telegram Passport which has the error, one of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”
3912    #[serde(rename = "type")]
3913    pub type_name: String,
3914    /// Name of the data field which has the error
3915    pub field_name: String,
3916    /// Base64-encoded data hash
3917    pub data_hash: String,
3918    /// Error message
3919    pub message: String,
3920}
3921impl PassportElementErrorDataField {
3922    pub fn new(
3923        source: String,
3924        type_name: String,
3925        field_name: String,
3926        data_hash: String,
3927        message: String,
3928    ) -> Self {
3929        Self {
3930            source,
3931            type_name,
3932            field_name,
3933            data_hash,
3934            message,
3935        }
3936    }
3937}
3938
3939/// Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes.
3940#[derive(Deserialize, Serialize, Debug, Clone)]
3941pub struct PassportElementErrorFrontSide {
3942    /// Error source, must be front_side
3943    pub source: String,
3944    /// The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”
3945    #[serde(rename = "type")]
3946    pub type_name: String,
3947    /// Base64-encoded hash of the file with the front side of the document
3948    pub file_hash: String,
3949    /// Error message
3950    pub message: String,
3951}
3952impl PassportElementErrorFrontSide {
3953    pub fn new(source: String, type_name: String, file_hash: String, message: String) -> Self {
3954        Self {
3955            source,
3956            type_name,
3957            file_hash,
3958            message,
3959        }
3960    }
3961}
3962
3963/// Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes.
3964#[derive(Deserialize, Serialize, Debug, Clone)]
3965pub struct PassportElementErrorReverseSide {
3966    /// Error source, must be reverse_side
3967    pub source: String,
3968    /// The section of the user's Telegram Passport which has the issue, one of “driver_license”, “identity_card”
3969    #[serde(rename = "type")]
3970    pub type_name: String,
3971    /// Base64-encoded hash of the file with the reverse side of the document
3972    pub file_hash: String,
3973    /// Error message
3974    pub message: String,
3975}
3976impl PassportElementErrorReverseSide {
3977    pub fn new(source: String, type_name: String, file_hash: String, message: String) -> Self {
3978        Self {
3979            source,
3980            type_name,
3981            file_hash,
3982            message,
3983        }
3984    }
3985}
3986
3987/// Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes.
3988#[derive(Deserialize, Serialize, Debug, Clone)]
3989pub struct PassportElementErrorSelfie {
3990    /// Error source, must be selfie
3991    pub source: String,
3992    /// The section of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”
3993    #[serde(rename = "type")]
3994    pub type_name: String,
3995    /// Base64-encoded hash of the file with the selfie
3996    pub file_hash: String,
3997    /// Error message
3998    pub message: String,
3999}
4000impl PassportElementErrorSelfie {
4001    pub fn new(source: String, type_name: String, file_hash: String, message: String) -> Self {
4002        Self {
4003            source,
4004            type_name,
4005            file_hash,
4006            message,
4007        }
4008    }
4009}
4010
4011/// Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes.
4012#[derive(Deserialize, Serialize, Debug, Clone)]
4013pub struct PassportElementErrorFile {
4014    /// Error source, must be file
4015    pub source: String,
4016    /// The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”
4017    #[serde(rename = "type")]
4018    pub type_name: String,
4019    /// Base64-encoded file hash
4020    pub file_hash: String,
4021    /// Error message
4022    pub message: String,
4023}
4024impl PassportElementErrorFile {
4025    pub fn new(source: String, type_name: String, file_hash: String, message: String) -> Self {
4026        Self {
4027            source,
4028            type_name,
4029            file_hash,
4030            message,
4031        }
4032    }
4033}
4034
4035/// Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes.
4036#[derive(Deserialize, Serialize, Debug, Clone)]
4037pub struct PassportElementErrorFiles {
4038    /// Error source, must be files
4039    pub source: String,
4040    /// The section of the user's Telegram Passport which has the issue, one of “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”
4041    #[serde(rename = "type")]
4042    pub type_name: String,
4043    /// List of base64-encoded file hashes
4044    pub file_hashes: Vec<String>,
4045    /// Error message
4046    pub message: String,
4047}
4048impl PassportElementErrorFiles {
4049    pub fn new(
4050        source: String,
4051        type_name: String,
4052        file_hashes: Vec<String>,
4053        message: String,
4054    ) -> Self {
4055        Self {
4056            source,
4057            type_name,
4058            file_hashes,
4059            message,
4060        }
4061    }
4062}
4063
4064/// Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes.
4065#[derive(Deserialize, Serialize, Debug, Clone)]
4066pub struct PassportElementErrorTranslationFile {
4067    /// Error source, must be translation_file
4068    pub source: String,
4069    /// Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”
4070    #[serde(rename = "type")]
4071    pub type_name: String,
4072    /// Base64-encoded file hash
4073    pub file_hash: String,
4074    /// Error message
4075    pub message: String,
4076}
4077impl PassportElementErrorTranslationFile {
4078    pub fn new(source: String, type_name: String, file_hash: String, message: String) -> Self {
4079        Self {
4080            source,
4081            type_name,
4082            file_hash,
4083            message,
4084        }
4085    }
4086}
4087
4088/// Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation change.
4089#[derive(Deserialize, Serialize, Debug, Clone)]
4090pub struct PassportElementErrorTranslationFiles {
4091    /// Error source, must be translation_files
4092    pub source: String,
4093    /// Type of element of the user's Telegram Passport which has the issue, one of “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”
4094    #[serde(rename = "type")]
4095    pub type_name: String,
4096    /// List of base64-encoded file hashes
4097    pub file_hashes: Vec<String>,
4098    /// Error message
4099    pub message: String,
4100}
4101impl PassportElementErrorTranslationFiles {
4102    pub fn new(
4103        source: String,
4104        type_name: String,
4105        file_hashes: Vec<String>,
4106        message: String,
4107    ) -> Self {
4108        Self {
4109            source,
4110            type_name,
4111            file_hashes,
4112            message,
4113        }
4114    }
4115}
4116
4117/// Represents an issue in an unspecified place. The error is considered resolved when new data is added.
4118#[derive(Deserialize, Serialize, Debug, Clone)]
4119pub struct PassportElementErrorUnspecified {
4120    /// Error source, must be unspecified
4121    pub source: String,
4122    /// Type of element of the user's Telegram Passport which has the issue
4123    #[serde(rename = "type")]
4124    pub type_name: String,
4125    /// Base64-encoded element hash
4126    pub element_hash: String,
4127    /// Error message
4128    pub message: String,
4129}
4130impl PassportElementErrorUnspecified {
4131    pub fn new(source: String, type_name: String, element_hash: String, message: String) -> Self {
4132        Self {
4133            source,
4134            type_name,
4135            element_hash,
4136            message,
4137        }
4138    }
4139}
4140
4141/// This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
4142#[derive(Deserialize, Serialize, Debug, Clone)]
4143pub struct Game {
4144    /// Title of the game
4145    pub title: String,
4146    /// Description of the game
4147    pub description: String,
4148    /// Photo that will be displayed in the game message in chats.
4149    pub photo: Vec<PhotoSize>,
4150    /// Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
4151    #[serde(skip_serializing_if = "Option::is_none")]
4152    pub text: Option<String>,
4153    /// Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
4154    #[serde(skip_serializing_if = "Option::is_none")]
4155    pub text_entities: Option<Vec<MessageEntity>>,
4156    /// Optional. Animation that will be displayed in the game message in chats. Upload via BotFather
4157    #[serde(skip_serializing_if = "Option::is_none")]
4158    pub animation: Option<Animation>,
4159}
4160impl Game {
4161    pub fn new(title: String, description: String, photo: Vec<PhotoSize>) -> Self {
4162        Self {
4163            title,
4164            description,
4165            photo,
4166            text: None,
4167            text_entities: None,
4168            animation: None,
4169        }
4170    }
4171}
4172
4173/// A placeholder, currently holds no information. Use BotFather to set up your game.
4174#[derive(Deserialize, Serialize, Debug, Clone)]
4175pub struct CallbackGame {}
4176impl CallbackGame {
4177    pub fn new() -> Self {
4178        Self {}
4179    }
4180}
4181
4182/// This object represents one row of the high scores table for a game.
4183#[derive(Deserialize, Serialize, Debug, Clone)]
4184pub struct GameHighScore {
4185    /// Position in high score table for the game
4186    pub position: i64,
4187    /// User
4188    pub user: User,
4189    /// Score
4190    pub score: i64,
4191}
4192impl GameHighScore {
4193    pub fn new(position: i64, user: User, score: i64) -> Self {
4194        Self {
4195            position,
4196            user,
4197            score,
4198        }
4199    }
4200}
4201
4202/// Params represents a set of parameters that gets passed to a request.
4203pub type Params = HashMap<String, Value>;
4204
4205/// Unique identifier for the target chat or username of the target channel
4206#[derive(Deserialize, Serialize, Debug, Clone)]
4207#[serde(untagged)]
4208pub enum ChatId {
4209    /// Unique identifier
4210    IntType(i64),
4211    /// username
4212    StringType(String),
4213}
4214
4215/// This object represents the contents of a file to be uploaded. Must be posted using multipart/form-data in the usual way that files are uploaded via the browser.
4216#[derive(Deserialize, Serialize, Debug, Clone)]
4217#[serde(untagged)]
4218pub enum InputFile {
4219    /// FileID is an ID of a file already uploaded to Telegram.
4220    FileID(String),
4221    /// FileURL is a URL to use as a file for a request.
4222    FileURL(String),
4223    /// fileAttach is an internal file type used for processed media groups.
4224    FileAttach(String),
4225    /// FileBytes contains information about a set of bytes to upload as a File.
4226    FileBytes(String, Vec<u8>),
4227    /// FilePath is a path to a local file.
4228    FilePath(String),
4229}
4230
4231/// On success,returns a InputFileResult object data method
4232pub enum InputFileResult {
4233    /// don't need upload
4234    Text(String),
4235    /// must upload using multipart/form-data
4236    Part(reqwest::multipart::Part),
4237}
4238
4239impl InputFile {
4240    pub fn need_upload(&self) -> bool {
4241        matches!(self, InputFile::FileBytes(_, _) | InputFile::FilePath(_))
4242    }
4243
4244    pub async fn data(&self) -> Result<InputFileResult, Box<dyn std::error::Error>> {
4245        match self {
4246            InputFile::FileID(id) => Ok(InputFileResult::Text(id.clone())),
4247            InputFile::FileURL(url) => Ok(InputFileResult::Text(url.clone())),
4248            InputFile::FileAttach(attach) => Ok(InputFileResult::Text(attach.clone())),
4249            InputFile::FileBytes(file_name, bytes) => Ok(InputFileResult::Part(
4250                reqwest::multipart::Part::bytes(bytes.clone()).file_name(file_name.to_string()),
4251            )),
4252            InputFile::FilePath(path) => Ok(InputFileResult::Part(
4253                reqwest::multipart::Part::stream(reqwest::Body::wrap_stream(
4254                    tokio_util::codec::FramedRead::new(
4255                        tokio::fs::File::open(path).await?,
4256                        tokio_util::codec::BytesCodec::new(),
4257                    ),
4258                ))
4259                .file_name(path.to_string()),
4260            )),
4261        }
4262    }
4263}
4264
4265/// Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
4266#[derive(Deserialize, Serialize, Debug, Clone)]
4267#[serde(untagged)]
4268pub enum ReplyMarkup {
4269    InlineKeyboardMarkup(InlineKeyboardMarkup),
4270    ReplyKeyboardMarkup(ReplyKeyboardMarkup),
4271    ReplyKeyboardRemove(ReplyKeyboardRemove),
4272    ForceReply(ForceReply),
4273}
4274/// This object contains information about one member of a chat. Currently, the following 6 types of chat members are supported:
4275/// ```
4276/// ChatMemberOwner
4277/// ChatMemberAdministrator
4278/// ChatMemberMember
4279/// ChatMemberRestricted
4280/// ChatMemberLeft
4281/// ChatMemberBanned
4282/// ```
4283#[derive(Deserialize, Serialize, Debug, Clone)]
4284#[serde(tag = "status")]
4285pub enum ChatMember {
4286    #[serde(rename = "creator")]
4287    ChatMemberOwner(ChatMemberOwner),
4288    #[serde(rename = "administrator")]
4289    ChatMemberAdministrator(ChatMemberAdministrator),
4290    #[serde(rename = "member")]
4291    ChatMemberMember(ChatMemberMember),
4292    #[serde(rename = "restricted")]
4293    ChatMemberRestricted(ChatMemberRestricted),
4294    #[serde(rename = "left")]
4295    ChatMemberLeft(ChatMemberLeft),
4296    #[serde(rename = "kicked")]
4297    ChatMemberBanned(ChatMemberBanned),
4298}
4299
4300/// This object represents the scope to which bot commands are applied. Currently, the following 7 scopes are supported:
4301/// ```
4302/// BotCommandScopeDefault
4303/// BotCommandScopeAllPrivateChats
4304/// BotCommandScopeAllGroupChats
4305/// BotCommandScopeAllChatAdministrators
4306/// BotCommandScopeChat
4307/// BotCommandScopeChatAdministrators
4308/// BotCommandScopeChatMember
4309/// ```
4310#[derive(Deserialize, Serialize, Debug, Clone)]
4311#[serde(tag = "type")]
4312pub enum BotCommandScope {
4313    #[serde(rename = "default")]
4314    BotCommandScopeDefault(BotCommandScopeDefault),
4315    #[serde(rename = "all_private_chats")]
4316    BotCommandScopeAllPrivateChats(BotCommandScopeAllPrivateChats),
4317    #[serde(rename = "all_group_chats")]
4318    BotCommandScopeAllGroupChats(BotCommandScopeAllGroupChats),
4319    #[serde(rename = "all_chat_administrators")]
4320    BotCommandScopeAllChatAdministrators(BotCommandScopeAllChatAdministrators),
4321    #[serde(rename = "chat")]
4322    BotCommandScopeChat(BotCommandScopeChat),
4323    #[serde(rename = "chat_administrators")]
4324    BotCommandScopeChatAdministrators(BotCommandScopeChatAdministrators),
4325    #[serde(rename = "chat_member")]
4326    BotCommandScopeChatMember(BotCommandScopeChatMember),
4327}
4328
4329/// This object describes the bot's menu button in a private chat. It should be one of
4330/// ```
4331/// MenuButtonCommands
4332/// MenuButtonWebApp
4333/// MenuButtonDefault
4334/// ```
4335/// If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands.
4336#[derive(Deserialize, Serialize, Debug, Clone)]
4337#[serde(tag = "type")]
4338pub enum MenuButton {
4339    #[serde(rename = "commands")]
4340    MenuButtonCommands(MenuButtonCommands),
4341    #[serde(rename = "web_app")]
4342    MenuButtonWebApp(MenuButtonWebApp),
4343    #[serde(rename = "default")]
4344    MenuButtonDefault(MenuButtonDefault),
4345}
4346
4347/// This object represents the content of a media message to be sent. It should be one of
4348/// ```
4349/// InputMediaAnimation
4350/// InputMediaDocument
4351/// InputMediaAudio
4352/// InputMediaPhoto
4353/// InputMediaVideo
4354/// ```
4355#[derive(Deserialize, Serialize, Debug, Clone)]
4356#[serde(tag = "type")]
4357pub enum InputMedia {
4358    #[serde(rename = "animation")]
4359    InputMediaAnimation(InputMediaAnimation),
4360    #[serde(rename = "document")]
4361    InputMediaDocument(InputMediaDocument),
4362    #[serde(rename = "audio")]
4363    InputMediaAudio(InputMediaAudio),
4364    #[serde(rename = "photo")]
4365    InputMediaPhoto(InputMediaPhoto),
4366    #[serde(rename = "video")]
4367    InputMediaVideo(InputMediaVideo),
4368}
4369
4370impl InputMedia {
4371    /// prepare_input_media_param evaluates a single InputMedia and determines if it
4372    /// needs to be modified for a successful upload. If it returns nil, then the
4373    /// value does not need to be included in the params. Otherwise, it will return
4374    /// the same type as was originally provided.
4375    ///
4376    /// The idx is used to calculate the file field name. If you only have a single
4377    /// file, 0 may be used. It is formatted into "attach://file-%d" for the primary
4378    /// media and "attach://file-%d-thumb" for thumbnails.
4379    ///
4380    /// It is expected to be used in conjunction with prepareInputMediaFile.
4381    pub fn prepare_input_media_param(&self, idx: i32) -> Self {
4382        match self {
4383            InputMedia::InputMediaAnimation(animation) => {
4384                let mut media = animation.media.clone();
4385                if media.need_upload() {
4386                    media = Self::attach_file(idx);
4387                }
4388                let mut thumb: Option<InputFile> = None;
4389                if let Some(some_thumb) = &animation.thumb {
4390                    if some_thumb.need_upload() {
4391                        thumb = Some(Self::attach_thumb_file(idx));
4392                    }
4393                }
4394                Self::InputMediaAnimation(InputMediaAnimation {
4395                    media,
4396                    thumb,
4397                    ..animation.clone()
4398                })
4399            }
4400            InputMedia::InputMediaDocument(document) => {
4401                let mut media = document.media.clone();
4402                if media.need_upload() {
4403                    media = Self::attach_file(idx);
4404                }
4405                let mut thumb: Option<InputFile> = None;
4406                if let Some(some_thumb) = &document.thumb {
4407                    if some_thumb.need_upload() {
4408                        thumb = Some(Self::attach_thumb_file(idx));
4409                    }
4410                }
4411                Self::InputMediaDocument(InputMediaDocument {
4412                    media,
4413                    thumb,
4414                    ..document.clone()
4415                })
4416            }
4417            InputMedia::InputMediaAudio(audio) => {
4418                let mut media = audio.media.clone();
4419                if media.need_upload() {
4420                    media = Self::attach_file(idx);
4421                }
4422                let mut thumb: Option<InputFile> = None;
4423                if let Some(some_thumb) = &audio.thumb {
4424                    if some_thumb.need_upload() {
4425                        thumb = Some(Self::attach_thumb_file(idx));
4426                    }
4427                }
4428                Self::InputMediaAudio(InputMediaAudio {
4429                    media,
4430                    thumb,
4431                    ..audio.clone()
4432                })
4433            }
4434            InputMedia::InputMediaPhoto(photo) => {
4435                if !photo.media.need_upload() {
4436                    return self.clone();
4437                }
4438                Self::InputMediaPhoto(InputMediaPhoto {
4439                    media: Self::attach_file(idx),
4440                    ..photo.clone()
4441                })
4442            }
4443            InputMedia::InputMediaVideo(video) => {
4444                let mut media = video.media.clone();
4445                if media.need_upload() {
4446                    media = Self::attach_file(idx);
4447                }
4448                let mut thumb: Option<InputFile> = None;
4449                if let Some(some_thumb) = &video.thumb {
4450                    if some_thumb.need_upload() {
4451                        thumb = Some(Self::attach_thumb_file(idx));
4452                    }
4453                }
4454                Self::InputMediaVideo(InputMediaVideo {
4455                    media,
4456                    thumb,
4457                    ..video.clone()
4458                })
4459            }
4460        }
4461    }
4462
4463    /// prepare_input_media_file generates an array of RequestFile to provide for
4464    /// Fileable's files method. It returns an array as a single InputMedia may have
4465    /// multiple files, for the primary media and a thumbnail.
4466    ///
4467    /// The idx parameter is used to generate file field names. It uses the names
4468    /// "file-%d" for the main file and "file-%d-thumb" for the thumbnail.
4469    ///
4470    /// It is expected to be used in conjunction with prepareInputMediaParam.
4471    pub fn prepare_input_media_file(&self, idx: i32) -> Vec<(String, InputFile)> {
4472        let mut result: Vec<(String, InputFile)> = Vec::new();
4473        match self {
4474            InputMedia::InputMediaAnimation(animation) => {
4475                let media = animation.media.clone();
4476                if media.need_upload() {
4477                    result.push((Self::attach_file_name(idx), media.clone()));
4478                }
4479                if let Some(thumb) = &animation.thumb {
4480                    if thumb.need_upload() {
4481                        result.push((Self::attach_thumb_file_name(idx), thumb.clone()));
4482                    }
4483                }
4484            }
4485            InputMedia::InputMediaDocument(document) => {
4486                let media = document.media.clone();
4487                if media.need_upload() {
4488                    result.push((Self::attach_file_name(idx), media.clone()));
4489                }
4490                if let Some(thumb) = &document.thumb {
4491                    if thumb.need_upload() {
4492                        result.push((Self::attach_thumb_file_name(idx), thumb.clone()));
4493                    }
4494                }
4495            }
4496            InputMedia::InputMediaAudio(audio) => {
4497                let media = audio.media.clone();
4498                if media.need_upload() {
4499                    result.push((Self::attach_file_name(idx), media.clone()));
4500                }
4501                if let Some(thumb) = &audio.thumb {
4502                    if thumb.need_upload() {
4503                        result.push((Self::attach_thumb_file_name(idx), thumb.clone()));
4504                    }
4505                }
4506            }
4507            InputMedia::InputMediaPhoto(photo) => {
4508                if photo.media.need_upload() {
4509                    result.push((Self::attach_file_name(idx), photo.media.clone()));
4510                }
4511            }
4512            InputMedia::InputMediaVideo(video) => {
4513                let media = video.media.clone();
4514                if media.need_upload() {
4515                    result.push((Self::attach_file_name(idx), media.clone()));
4516                }
4517                if let Some(thumb) = &video.thumb {
4518                    if thumb.need_upload() {
4519                        result.push((Self::attach_thumb_file_name(idx), thumb.clone()));
4520                    }
4521                }
4522            }
4523        }
4524        result
4525    }
4526
4527    fn attach_file_name(idx: i32) -> String {
4528        format!("file-{}", idx)
4529    }
4530
4531    fn attach_thumb_file_name(idx: i32) -> String {
4532        format!("file-{}-thumb", idx)
4533    }
4534
4535    fn attach_file(idx: i32) -> InputFile {
4536        InputFile::FileAttach(format!("attach://file-{}", idx))
4537    }
4538
4539    fn attach_thumb_file(idx: i32) -> InputFile {
4540        InputFile::FileAttach(format!("attach://file-{}-thumb", idx))
4541    }
4542}
4543
4544/// method will return Message or True
4545#[derive(Deserialize, Serialize, Debug, Clone)]
4546#[serde(untagged)]
4547pub enum MayBeMessage {
4548    Message(Message),
4549    Bool(bool),
4550}
4551
4552impl Chat {
4553    pub fn new_private(id: i64) -> Self {
4554        Self::new(id, ChatType::Private)
4555    }
4556    pub fn new_group(id: i64) -> Self {
4557        Self::new(id, ChatType::Group)
4558    }
4559    pub fn new_super_group(id: i64) -> Self {
4560        Self::new(id, ChatType::Supergroup)
4561    }
4562    pub fn new_channel(id: i64) -> Self {
4563        Self::new(id, ChatType::Channel)
4564    }
4565    pub fn is_private(&self) -> bool {
4566        matches!(self.type_name, ChatType::Private)
4567    }
4568    pub fn is_group(&self) -> bool {
4569        matches!(self.type_name, ChatType::Group)
4570    }
4571    pub fn is_super_group(&self) -> bool {
4572        matches!(self.type_name, ChatType::Supergroup)
4573    }
4574    pub fn is_channel(&self) -> bool {
4575        matches!(self.type_name, ChatType::Channel)
4576    }
4577}
4578
4579impl MessageEntity {
4580    pub fn new_mention(offset: i64, length: i64) -> Self {
4581        Self::new("mention".to_string(), offset, length)
4582    }
4583    pub fn new_hashtag(offset: i64, length: i64) -> Self {
4584        Self::new("hashtag".to_string(), offset, length)
4585    }
4586    pub fn new_cashtag(offset: i64, length: i64) -> Self {
4587        Self::new("cashtag".to_string(), offset, length)
4588    }
4589    pub fn new_bot_command(offset: i64, length: i64) -> Self {
4590        Self::new("bot_command".to_string(), offset, length)
4591    }
4592    pub fn new_url(offset: i64, length: i64) -> Self {
4593        Self::new("url".to_string(), offset, length)
4594    }
4595    pub fn new_email(offset: i64, length: i64) -> Self {
4596        Self::new("email".to_string(), offset, length)
4597    }
4598    pub fn new_phone_number(offset: i64, length: i64) -> Self {
4599        Self::new("phone_number".to_string(), offset, length)
4600    }
4601    pub fn new_bold(offset: i64, length: i64) -> Self {
4602        Self::new("bold".to_string(), offset, length)
4603    }
4604    pub fn new_italic(offset: i64, length: i64) -> Self {
4605        Self::new("italic".to_string(), offset, length)
4606    }
4607    pub fn new_underline(offset: i64, length: i64) -> Self {
4608        Self::new("underline".to_string(), offset, length)
4609    }
4610    pub fn new_strikethrough(offset: i64, length: i64) -> Self {
4611        Self::new("strikethrough".to_string(), offset, length)
4612    }
4613    pub fn new_code(offset: i64, length: i64) -> Self {
4614        Self::new("code".to_string(), offset, length)
4615    }
4616    pub fn new_pre(offset: i64, length: i64) -> Self {
4617        Self::new("pre".to_string(), offset, length)
4618    }
4619    pub fn new_text_link(offset: i64, length: i64) -> Self {
4620        Self::new("text_link".to_string(), offset, length)
4621    }
4622    pub fn new_text_mention(offset: i64, length: i64) -> Self {
4623        Self::new("text_mention".to_string(), offset, length)
4624    }
4625}
4626
4627impl Sticker {
4628    pub fn new_regular(
4629        file_id: String,
4630        file_unique_id: String,
4631        width: i64,
4632        height: i64,
4633        is_animated: bool,
4634        is_video: bool,
4635    ) -> Self {
4636        Self::new(
4637            file_id,
4638            file_unique_id,
4639            "regular".to_string(),
4640            width,
4641            height,
4642            is_animated,
4643            is_video,
4644        )
4645    }
4646    pub fn new_mask(
4647        file_id: String,
4648        file_unique_id: String,
4649        width: i64,
4650        height: i64,
4651        is_animated: bool,
4652        is_video: bool,
4653    ) -> Self {
4654        Self::new(
4655            file_id,
4656            file_unique_id,
4657            "mask".to_string(),
4658            width,
4659            height,
4660            is_animated,
4661            is_video,
4662        )
4663    }
4664    pub fn new_custom_emoji(
4665        file_id: String,
4666        file_unique_id: String,
4667        width: i64,
4668        height: i64,
4669        is_animated: bool,
4670        is_video: bool,
4671    ) -> Self {
4672        Self::new(
4673            file_id,
4674            file_unique_id,
4675            "custom_emoji".to_string(),
4676            width,
4677            height,
4678            is_animated,
4679            is_video,
4680        )
4681    }
4682}
4683
4684impl PassportElementErrorDataField {
4685    pub fn new_personal_details(
4686        source: String,
4687        field_name: String,
4688        data_hash: String,
4689        message: String,
4690    ) -> Self {
4691        Self::new(
4692            source,
4693            "personal_details".to_string(),
4694            field_name,
4695            data_hash,
4696            message,
4697        )
4698    }
4699    pub fn new_passport(
4700        source: String,
4701        field_name: String,
4702        data_hash: String,
4703        message: String,
4704    ) -> Self {
4705        Self::new(
4706            source,
4707            "passport".to_string(),
4708            field_name,
4709            data_hash,
4710            message,
4711        )
4712    }
4713    pub fn new_driver_license(
4714        source: String,
4715        field_name: String,
4716        data_hash: String,
4717        message: String,
4718    ) -> Self {
4719        Self::new(
4720            source,
4721            "driver_license".to_string(),
4722            field_name,
4723            data_hash,
4724            message,
4725        )
4726    }
4727    pub fn new_identity_card(
4728        source: String,
4729        field_name: String,
4730        data_hash: String,
4731        message: String,
4732    ) -> Self {
4733        Self::new(
4734            source,
4735            "identity_card".to_string(),
4736            field_name,
4737            data_hash,
4738            message,
4739        )
4740    }
4741    pub fn new_internal_passport(
4742        source: String,
4743        field_name: String,
4744        data_hash: String,
4745        message: String,
4746    ) -> Self {
4747        Self::new(
4748            source,
4749            "internal_passport".to_string(),
4750            field_name,
4751            data_hash,
4752            message,
4753        )
4754    }
4755    pub fn new_address(
4756        source: String,
4757        field_name: String,
4758        data_hash: String,
4759        message: String,
4760    ) -> Self {
4761        Self::new(
4762            source,
4763            "address".to_string(),
4764            field_name,
4765            data_hash,
4766            message,
4767        )
4768    }
4769}
4770
4771impl PassportElementErrorFrontSide {
4772    pub fn new_passport(source: String, file_hash: String, message: String) -> Self {
4773        Self::new(source, "passport".to_string(), file_hash, message)
4774    }
4775    pub fn new_driver_license(source: String, file_hash: String, message: String) -> Self {
4776        Self::new(source, "driver_license".to_string(), file_hash, message)
4777    }
4778    pub fn new_identity_card(source: String, file_hash: String, message: String) -> Self {
4779        Self::new(source, "identity_card".to_string(), file_hash, message)
4780    }
4781    pub fn new_internal_passport(source: String, file_hash: String, message: String) -> Self {
4782        Self::new(source, "internal_passport".to_string(), file_hash, message)
4783    }
4784}
4785
4786impl PassportElementErrorReverseSide {
4787    pub fn new_driver_license(source: String, file_hash: String, message: String) -> Self {
4788        Self::new(source, "driver_license".to_string(), file_hash, message)
4789    }
4790    pub fn new_identity_card(source: String, file_hash: String, message: String) -> Self {
4791        Self::new(source, "identity_card".to_string(), file_hash, message)
4792    }
4793}
4794
4795impl PassportElementErrorSelfie {
4796    pub fn new_passport(source: String, file_hash: String, message: String) -> Self {
4797        Self::new(source, "passport".to_string(), file_hash, message)
4798    }
4799    pub fn new_driver_license(source: String, file_hash: String, message: String) -> Self {
4800        Self::new(source, "driver_license".to_string(), file_hash, message)
4801    }
4802    pub fn new_identity_card(source: String, file_hash: String, message: String) -> Self {
4803        Self::new(source, "identity_card".to_string(), file_hash, message)
4804    }
4805    pub fn new_internal_passport(source: String, file_hash: String, message: String) -> Self {
4806        Self::new(source, "internal_passport".to_string(), file_hash, message)
4807    }
4808}
4809
4810impl PassportElementErrorFile {
4811    pub fn new_utility_bill(source: String, file_hash: String, message: String) -> Self {
4812        Self::new(source, "utility_bill".to_string(), file_hash, message)
4813    }
4814    pub fn new_bank_statement(source: String, file_hash: String, message: String) -> Self {
4815        Self::new(source, "bank_statement".to_string(), file_hash, message)
4816    }
4817    pub fn new_rental_agreement(source: String, file_hash: String, message: String) -> Self {
4818        Self::new(source, "rental_agreement".to_string(), file_hash, message)
4819    }
4820    pub fn new_passport_registration(source: String, file_hash: String, message: String) -> Self {
4821        Self::new(
4822            source,
4823            "passport_registration".to_string(),
4824            file_hash,
4825            message,
4826        )
4827    }
4828    pub fn new_temporary_registration(source: String, file_hash: String, message: String) -> Self {
4829        Self::new(
4830            source,
4831            "temporary_registration".to_string(),
4832            file_hash,
4833            message,
4834        )
4835    }
4836}
4837
4838impl PassportElementErrorFiles {
4839    pub fn new_utility_bill(source: String, file_hashes: Vec<String>, message: String) -> Self {
4840        Self::new(source, "utility_bill".to_string(), file_hashes, message)
4841    }
4842    pub fn new_bank_statement(source: String, file_hashes: Vec<String>, message: String) -> Self {
4843        Self::new(source, "bank_statement".to_string(), file_hashes, message)
4844    }
4845    pub fn new_rental_agreement(source: String, file_hashes: Vec<String>, message: String) -> Self {
4846        Self::new(source, "rental_agreement".to_string(), file_hashes, message)
4847    }
4848    pub fn new_passport_registration(
4849        source: String,
4850        file_hashes: Vec<String>,
4851        message: String,
4852    ) -> Self {
4853        Self::new(
4854            source,
4855            "passport_registration".to_string(),
4856            file_hashes,
4857            message,
4858        )
4859    }
4860    pub fn new_temporary_registration(
4861        source: String,
4862        file_hashes: Vec<String>,
4863        message: String,
4864    ) -> Self {
4865        Self::new(
4866            source,
4867            "temporary_registration".to_string(),
4868            file_hashes,
4869            message,
4870        )
4871    }
4872}
4873
4874impl PassportElementErrorTranslationFile {
4875    pub fn new_passport(source: String, file_hash: String, message: String) -> Self {
4876        Self::new(source, "passport".to_string(), file_hash, message)
4877    }
4878    pub fn new_driver_license(source: String, file_hash: String, message: String) -> Self {
4879        Self::new(source, "driver_license".to_string(), file_hash, message)
4880    }
4881    pub fn new_identity_card(source: String, file_hash: String, message: String) -> Self {
4882        Self::new(source, "identity_card".to_string(), file_hash, message)
4883    }
4884    pub fn new_internal_passport(source: String, file_hash: String, message: String) -> Self {
4885        Self::new(source, "internal_passport".to_string(), file_hash, message)
4886    }
4887    pub fn new_utility_bill(source: String, file_hash: String, message: String) -> Self {
4888        Self::new(source, "utility_bill".to_string(), file_hash, message)
4889    }
4890    pub fn new_bank_statement(source: String, file_hash: String, message: String) -> Self {
4891        Self::new(source, "bank_statement".to_string(), file_hash, message)
4892    }
4893    pub fn new_rental_agreement(source: String, file_hash: String, message: String) -> Self {
4894        Self::new(source, "rental_agreement".to_string(), file_hash, message)
4895    }
4896    pub fn new_passport_registration(source: String, file_hash: String, message: String) -> Self {
4897        Self::new(
4898            source,
4899            "passport_registration".to_string(),
4900            file_hash,
4901            message,
4902        )
4903    }
4904    pub fn new_temporary_registration(source: String, file_hash: String, message: String) -> Self {
4905        Self::new(
4906            source,
4907            "temporary_registration".to_string(),
4908            file_hash,
4909            message,
4910        )
4911    }
4912}
4913
4914impl PassportElementErrorTranslationFiles {
4915    pub fn new_passport(source: String, file_hashes: Vec<String>, message: String) -> Self {
4916        Self::new(source, "passport".to_string(), file_hashes, message)
4917    }
4918    pub fn new_driver_license(source: String, file_hashes: Vec<String>, message: String) -> Self {
4919        Self::new(source, "driver_license".to_string(), file_hashes, message)
4920    }
4921    pub fn new_identity_card(source: String, file_hashes: Vec<String>, message: String) -> Self {
4922        Self::new(source, "identity_card".to_string(), file_hashes, message)
4923    }
4924    pub fn new_internal_passport(
4925        source: String,
4926        file_hashes: Vec<String>,
4927        message: String,
4928    ) -> Self {
4929        Self::new(
4930            source,
4931            "internal_passport".to_string(),
4932            file_hashes,
4933            message,
4934        )
4935    }
4936    pub fn new_utility_bill(source: String, file_hashes: Vec<String>, message: String) -> Self {
4937        Self::new(source, "utility_bill".to_string(), file_hashes, message)
4938    }
4939    pub fn new_bank_statement(source: String, file_hashes: Vec<String>, message: String) -> Self {
4940        Self::new(source, "bank_statement".to_string(), file_hashes, message)
4941    }
4942    pub fn new_rental_agreement(source: String, file_hashes: Vec<String>, message: String) -> Self {
4943        Self::new(source, "rental_agreement".to_string(), file_hashes, message)
4944    }
4945    pub fn new_passport_registration(
4946        source: String,
4947        file_hashes: Vec<String>,
4948        message: String,
4949    ) -> Self {
4950        Self::new(
4951            source,
4952            "passport_registration".to_string(),
4953            file_hashes,
4954            message,
4955        )
4956    }
4957    pub fn new_temporary_registration(
4958        source: String,
4959        file_hashes: Vec<String>,
4960        message: String,
4961    ) -> Self {
4962        Self::new(
4963            source,
4964            "temporary_registration".to_string(),
4965            file_hashes,
4966            message,
4967        )
4968    }
4969}
4970
4971/// This object represents the content of a message to be sent as a result of an inline query. Telegram clients currently support the following 5 types:
4972/// ```
4973/// InputTextMessageContent
4974/// InputLocationMessageContent
4975/// InputVenueMessageContent
4976/// InputContactMessageContent
4977/// InputInvoiceMessageContent
4978/// ```
4979#[derive(Deserialize, Serialize, Debug, Clone)]
4980#[serde(untagged)]
4981pub enum InputMessageContent {
4982    InputTextMessageContent(InputTextMessageContent),
4983    InputLocationMessageContent(InputLocationMessageContent),
4984    InputVenueMessageContent(InputVenueMessageContent),
4985    InputContactMessageContent(InputContactMessageContent),
4986    InputInvoiceMessageContent(InputInvoiceMessageContent),
4987}
4988
4989/// This object represents an error in the Telegram Passport element which was submitted that should be resolved by the user. It should be one of:
4990/// ```
4991/// PassportElementErrorDataField
4992/// PassportElementErrorFrontSide
4993/// PassportElementErrorReverseSide
4994/// PassportElementErrorSelfie
4995/// PassportElementErrorFile
4996/// PassportElementErrorFiles
4997/// PassportElementErrorTranslationFile
4998/// PassportElementErrorTranslationFiles
4999/// PassportElementErrorUnspecified
5000/// ```
5001#[derive(Deserialize, Serialize, Debug, Clone)]
5002pub enum PassportElementError {
5003    PassportElementErrorDataField(PassportElementErrorDataField),
5004    PassportElementErrorFrontSide(PassportElementErrorFrontSide),
5005    PassportElementErrorReverseSide(PassportElementErrorReverseSide),
5006    PassportElementErrorSelfie(PassportElementErrorSelfie),
5007    PassportElementErrorFile(PassportElementErrorFile),
5008    PassportElementErrorFiles(PassportElementErrorFiles),
5009    PassportElementErrorTranslationFile(PassportElementErrorTranslationFile),
5010    PassportElementErrorTranslationFiles(PassportElementErrorTranslationFiles),
5011    PassportElementErrorUnspecified(PassportElementErrorUnspecified),
5012}
5013
5014/// This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
5015/// ```
5016/// InlineQueryResultCachedAudio
5017/// InlineQueryResultCachedDocument
5018/// InlineQueryResultCachedGif
5019/// InlineQueryResultCachedMpeg4Gif
5020/// InlineQueryResultCachedPhoto
5021/// InlineQueryResultCachedSticker
5022/// InlineQueryResultCachedVideo
5023/// InlineQueryResultCachedVoice
5024/// InlineQueryResultArticle
5025/// InlineQueryResultAudio
5026/// InlineQueryResultContact
5027/// InlineQueryResultGame
5028/// InlineQueryResultDocument
5029/// InlineQueryResultGif
5030/// InlineQueryResultLocation
5031/// InlineQueryResultMpeg4Gif
5032/// InlineQueryResultPhoto
5033/// InlineQueryResultVenue
5034/// InlineQueryResultVideo
5035/// InlineQueryResultVoice
5036/// ```
5037#[derive(Deserialize, Serialize, Debug, Clone)]
5038#[serde(tag = "type")]
5039pub enum InlineQueryResult {
5040    #[serde(rename = "audio")]
5041    InlineQueryResultCachedAudio(InlineQueryResultCachedAudio),
5042    #[serde(rename = "document")]
5043    InlineQueryResultCachedDocument(InlineQueryResultCachedDocument),
5044    #[serde(rename = "gif")]
5045    InlineQueryResultCachedGif(InlineQueryResultCachedGif),
5046    #[serde(rename = "mpeg4_gif")]
5047    InlineQueryResultCachedMpeg4Gif(InlineQueryResultCachedMpeg4Gif),
5048    #[serde(rename = "photo")]
5049    InlineQueryResultCachedPhoto(InlineQueryResultCachedPhoto),
5050    #[serde(rename = "sticker")]
5051    InlineQueryResultCachedSticker(InlineQueryResultCachedSticker),
5052    #[serde(rename = "video")]
5053    InlineQueryResultCachedVideo(InlineQueryResultCachedVideo),
5054    #[serde(rename = "voice")]
5055    InlineQueryResultCachedVoice(InlineQueryResultCachedVoice),
5056    #[serde(rename = "article")]
5057    InlineQueryResultArticle(InlineQueryResultArticle),
5058    #[serde(rename = "audio")]
5059    InlineQueryResultAudio(InlineQueryResultAudio),
5060    #[serde(rename = "contact")]
5061    InlineQueryResultContact(InlineQueryResultContact),
5062    #[serde(rename = "game")]
5063    InlineQueryResultGame(InlineQueryResultGame),
5064    #[serde(rename = "document")]
5065    InlineQueryResultDocument(InlineQueryResultDocument),
5066    #[serde(rename = "gif")]
5067    InlineQueryResultGif(InlineQueryResultGif),
5068    #[serde(rename = "location")]
5069    InlineQueryResultLocation(InlineQueryResultLocation),
5070    #[serde(rename = "mpeg4_gif")]
5071    InlineQueryResultMpeg4Gif(InlineQueryResultMpeg4Gif),
5072    #[serde(rename = "photo")]
5073    InlineQueryResultPhoto(InlineQueryResultPhoto),
5074    #[serde(rename = "venue")]
5075    InlineQueryResultVenue(InlineQueryResultVenue),
5076    #[serde(rename = "video")]
5077    InlineQueryResultVideo(InlineQueryResultVideo),
5078    #[serde(rename = "voice")]
5079    InlineQueryResultVoice(InlineQueryResultVoice),
5080}