Add #[non_exhaustive] to all the API types

This commit is contained in:
Temirkhan Myrzamadi 2020-07-27 13:20:33 +06:00
parent 709fe18ade
commit d85b7fdab0
86 changed files with 177 additions and 25 deletions

View file

@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum AllowedUpdate {
Message,
EditedMessage,

View file

@ -8,6 +8,7 @@ use crate::types::{MimeWrapper, PhotoSize};
/// [The official docs](https://core.telegram.org/bots/api#animation).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Animation {
/// An identifier for this file.
pub file_id: String,

View file

@ -8,6 +8,7 @@ use crate::types::{MimeWrapper, PhotoSize};
/// [The official docs](https://core.telegram.org/bots/api#audio).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Audio {
/// An identifier for this file.
pub file_id: String,

View file

@ -9,4 +9,5 @@ use serde::{Deserialize, Serialize};
///
/// [@Botfather]: https://t.me/botfather
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct CallbackGame;

View file

@ -17,6 +17,7 @@ use crate::types::{Message, User};
/// [inline mode]: https://core.telegram.org/bots/api#inline-mode
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct CallbackQuery {
/// An unique identifier for this query.
pub id: String,

View file

@ -7,6 +7,7 @@ use crate::types::{ChatPermissions, ChatPhoto, Message};
/// [The official docs](https://core.telegram.org/bots/api#chat).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Chat {
/// A unique identifier for this chat. This number may be greater than 32
/// bits and some programming languages may have difficulty/silent defects
@ -27,6 +28,7 @@ pub struct Chat {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
#[non_exhaustive]
pub enum ChatKind {
Public(ChatPublic),
Private(ChatPrivate),
@ -34,6 +36,7 @@ pub enum ChatKind {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatPublic {
/// A title, for supergroups, channels and group chats.
pub title: Option<String>,
@ -68,6 +71,7 @@ pub struct ChatPublic {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatPrivate {
/// A dummy field. Used to ensure that the `type` field is equal to
/// `private`.
@ -90,6 +94,7 @@ pub struct ChatPrivate {
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum PublicChatKind {
Channel(PublicChatChannel),
Group(PublicChatGroup),
@ -98,6 +103,7 @@ pub enum PublicChatKind {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PublicChatChannel {
/// A username, for private chats, supergroups and channels if available.
pub username: Option<String>,
@ -105,6 +111,7 @@ pub struct PublicChatChannel {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PublicChatGroup {
/// A default chat member permissions, for groups and supergroups. Returned
/// only from [`Bot::get_chat`].
@ -115,6 +122,7 @@ pub struct PublicChatGroup {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PublicChatSupergroup {
/// A username, for private chats, supergroups and channels if
/// available.

View file

@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum ChatAction {
Typing,
UploadPhoto,

View file

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
/// (in the format `@channelusername`).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, Display, From)]
#[serde(untagged)]
#[non_exhaustive]
pub enum ChatId {
/// A chat identifier.
#[display(fmt = "{}", _0)]

View file

@ -7,6 +7,7 @@ use crate::types::User;
///
/// [The official docs](https://core.telegram.org/bots/api#chatmember).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatMember {
/// Information about the user.
pub user: User,

View file

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
/// A chat message or inline message.
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
#[non_exhaustive]
pub enum ChatOrInlineMessage {
Chat { chat_id: ChatId, message_id: i32 },
Inline { inline_message_id: i32 },

View file

@ -5,7 +5,8 @@ use serde::{Deserialize, Serialize};
///
/// [The official docs](https://core.telegram.org/bots/api#chatpermissions).
#[serde_with_macros::skip_serializing_none]
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[derive(Copy, Clone, Default, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatPermissions {
/// `true`, if the user is allowed to send text messages, contacts,
/// locations and venues.
@ -39,18 +40,3 @@ pub struct ChatPermissions {
/// supergroups.
pub can_pin_messages: Option<bool>,
}
impl Default for ChatPermissions {
fn default() -> Self {
Self {
can_send_messages: None,
can_send_media_messages: None,
can_send_polls: None,
can_send_other_messages: None,
can_add_web_page_previews: None,
can_change_info: None,
can_invite_users: None,
can_pin_messages: None,
}
}
}

View file

@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
///
/// [The official docs](https://core.telegram.org/bots/api#chatphoto).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChatPhoto {
/// A 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

View file

@ -10,6 +10,7 @@ use crate::types::{Location, User};
/// [result]: https://core.telegram.org/bots/api#inlinequeryresult
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ChosenInlineResult {
/// The unique identifier for the result that was chosen.
pub result_id: String,

View file

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
/// [The official docs](https://core.telegram.org/bots/api#contact).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Contact {
/// A contact's phone number.
pub phone_number: String,

View file

@ -12,6 +12,7 @@ use crate::types::{MimeWrapper, PhotoSize};
/// [audio files]: https://core.telegram.org/bots/api#audio
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Document {
/// An identifier for this file.
pub file_id: String,

View file

@ -13,6 +13,7 @@ use serde::{Deserialize, Serialize};
/// [Telegram Passport Documentation]: https://core.telegram.org/passport#receiving-information
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedCredentials {
/// Base64-encoded encrypted JSON-serialized data with unique user's
/// payload, data hashes and secrets required for

View file

@ -7,6 +7,7 @@ use super::PassportFile;
///
/// [The official docs](https://core.telegram.org/bots/api#encryptedpassportelement).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElement {
/// Base64-encoded element hash for using in
/// [`PassportElementErrorKind::Unspecified`].
@ -22,6 +23,7 @@ pub struct EncryptedPassportElement {
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[allow(clippy::large_enum_variant)]
#[non_exhaustive]
pub enum EncryptedPassportElementKind {
PersonalDetails(EncryptedPassportElementPersonalDetails),
Passport(EncryptedPassportElementPassport),
@ -40,6 +42,7 @@ pub enum EncryptedPassportElementKind {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementPersonalDetails {
/// Base64-encoded encrypted Telegram Passport element data provided
/// by the user, available for `personal_details`, `passport`,
@ -54,6 +57,7 @@ pub struct EncryptedPassportElementPersonalDetails {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementPassport {
/// Base64-encoded encrypted Telegram Passport element data provided
/// by the user, available for `personal_details`, `passport`,
@ -98,6 +102,7 @@ pub struct EncryptedPassportElementPassport {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementDriverLicense {
/// Base64-encoded encrypted Telegram Passport element data provided
/// by the user, available for `personal_details`, `passport`,
@ -151,6 +156,7 @@ pub struct EncryptedPassportElementDriverLicense {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementIdentityCard {
/// Base64-encoded encrypted Telegram Passport element data provided
/// by the user, available for `personal_details`, `passport`,
@ -204,7 +210,7 @@ pub struct EncryptedPassportElementIdentityCard {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementInternalPassport {
/// Base64-encoded encrypted Telegram Passport element data provided
/// by the user, available for `personal_details`, `passport`,
@ -249,6 +255,7 @@ pub struct EncryptedPassportElementInternalPassport {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementAddress {
/// Base64-encoded encrypted Telegram Passport element data provided
/// by the user, available for `personal_details`, `passport`,
@ -263,6 +270,7 @@ pub struct EncryptedPassportElementAddress {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementUtilityBill {
/// Array of encrypted files with documents provided by the user,
/// available for `utility_bill`, `bank_statement`, `rental_agreement`,
@ -289,7 +297,7 @@ pub struct EncryptedPassportElementUtilityBill {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementBankStatement {
/// Array of encrypted files with documents provided by the user,
/// available for `utility_bill`, `bank_statement`, `rental_agreement`,
@ -316,6 +324,7 @@ pub struct EncryptedPassportElementBankStatement {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementRentalAgreement {
/// Array of encrypted files with documents provided by the user,
/// available for `utility_bill`, `bank_statement`, `rental_agreement`,
@ -342,7 +351,7 @@ pub struct EncryptedPassportElementRentalAgreement {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementPassportRegistration {
/// Array of encrypted files with documents provided by the user,
/// available for `utility_bill`, `bank_statement`, `rental_agreement`,
@ -369,6 +378,7 @@ pub struct EncryptedPassportElementPassportRegistration {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementTemporaryRegistration {
/// Array of encrypted files with documents provided by the user,
/// available for `utility_bill`, `bank_statement`, `rental_agreement`,
@ -395,6 +405,7 @@ pub struct EncryptedPassportElementTemporaryRegistration {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementPhoneNumber {
/// User's verified phone number, available only for `phone_number`
/// type.
@ -403,7 +414,7 @@ pub struct EncryptedPassportElementPhoneNumber {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct EncryptedPassportElementEmail {
/// User's verified email address, available only for `email` type.
pub email: String,

View file

@ -10,6 +10,7 @@ use serde::{Deserialize, Serialize};
///
/// [`Bot::get_file`]: crate::Bot::get_file
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct File {
/// Identifier for this file.
pub file_id: String,

View file

@ -14,6 +14,7 @@ use crate::types::True;
/// [privacy mode]: https://core.telegram.org/bots#privacy-mode
#[serde_with_macros::skip_serializing_none]
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ForceReply {
/// Shows reply interface to the user, as if they manually selected the
/// bots message and tapped Reply'.

View file

@ -10,6 +10,7 @@ use crate::types::{Animation, MessageEntity, PhotoSize};
/// [@Botfather]: https://t.me/botfather
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Game {
/// Title of the game.
pub title: String,

View file

@ -6,6 +6,7 @@ use crate::types::user::User;
///
/// [The official docs](https://core.telegram.org/bots/api#gamehighscore).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct GameHighScore {
/// Position in high score table for the game.
pub position: u32,

View file

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
///
/// [The official docs](https://core.telegram.org/bots/api#inlinekeyboardbutton).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineKeyboardButton {
/// Label text on the button.
pub text: String,
@ -15,6 +16,7 @@ pub struct InlineKeyboardButton {
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum InlineKeyboardButtonKind {
/// HTTP or tg:// url to be opened when button is pressed.
Url(String),

View file

@ -12,6 +12,7 @@ use crate::types::InlineKeyboardButton;
///
/// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, Default)]
#[non_exhaustive]
pub struct InlineKeyboardMarkup {
/// Array of button rows, each represented by an array of
/// [`InlineKeyboardButton`] objects.

View file

@ -10,6 +10,7 @@ use crate::types::{Location, User};
/// [The official docs](https://core.telegram.org/bots/api#inlinequery).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQuery {
/// Unique identifier for this query.
pub id: String,

View file

@ -19,6 +19,7 @@ use crate::types::{
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, From)]
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum InlineQueryResult {
#[serde(rename = "audio")]
CachedAudio(InlineQueryResultCachedAudio),

View file

@ -7,6 +7,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultarticle).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultArticle {
/// Unique identifier for this result, 1-64 Bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultaudio).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultAudio {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedaudio).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultCachedAudio {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcacheddocument).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultCachedDocument {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedgif).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultCachedGif {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -12,6 +12,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedmpeg4gif).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultCachedMpeg4Gif {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedphoto).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultCachedPhoto {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedsticker).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultCachedSticker {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedvideo).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultCachedVideo {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedvideo).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultCachedVoice {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultcachedvideo).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultContact {
/// Unique identifier for this result, 1-64 Bytes.
pub id: String,

View file

@ -12,6 +12,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, MimeWrapper, Parse
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultdocument).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultDocument {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -9,6 +9,7 @@ use crate::types::InlineKeyboardMarkup;
/// [game]: https://core.telegram.org/bots/api#games
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultGame {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultgif).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultGif {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultlocation).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultLocation {
/// Unique identifier for this result, 1-64 Bytes.
pub id: String,

View file

@ -12,6 +12,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultMpeg4Gif {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultphoto).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultPhoto {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultvenue).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultVenue {
/// Unique identifier for this result, 1-64 Bytes.
pub id: String,

View file

@ -12,6 +12,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, MimeWrapper, Parse
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultvideo).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultVideo {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -12,6 +12,7 @@ use crate::types::{InlineKeyboardMarkup, InputMessageContent, ParseMode};
/// [The official docs](https://core.telegram.org/bots/api#inlinequeryresultvoice).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InlineQueryResultVoice {
/// Unique identifier for this result, 1-64 bytes.
pub id: String,

View file

@ -6,6 +6,7 @@ use std::{borrow::Cow, path::PathBuf};
///
/// [The official docs](https://core.telegram.org/bots/api#inputfile).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize)]
#[non_exhaustive]
pub enum InputFile {
File(PathBuf),
Memory { file_name: String, data: Cow<'static, [u8]> },

View file

@ -2,13 +2,13 @@ use serde::{Deserialize, Serialize};
use crate::types::{InputFile, ParseMode};
// TODO: should variants use new-type?
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
/// This object represents the content of a media message to be sent.
///
/// [The official docs](https://core.telegram.org/bots/api#inputmedia).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum InputMedia {
Photo(InputMediaPhoto),
Video(InputMediaVideo),

View file

@ -8,6 +8,7 @@ use crate::types::ParseMode;
/// [The official docs](https://core.telegram.org/bots/api#inputmessagecontent).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
#[non_exhaustive]
pub enum InputMessageContent {
Text(InputMessageContentText),
Location(InputMessageContentLocation),
@ -18,6 +19,7 @@ pub enum InputMessageContent {
/// inline query.
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InputMessageContentText {
/// Text of the message to be sent, 1-4096 characters.
pub message_text: String,
@ -38,6 +40,7 @@ pub struct InputMessageContentText {
/// inline query.
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InputMessageContentLocation {
/// Latitude of the location in degrees.
pub latitude: f64,
@ -54,7 +57,7 @@ pub struct InputMessageContentLocation {
/// an inline query.
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InputMessageContentVenue {
/// Latitude of the venue in degrees.
pub latitude: f64,
@ -81,6 +84,7 @@ pub struct InputMessageContentVenue {
/// an inline query.
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct InputMessageContentContact {
/// Contact's phone number.
pub phone_number: String,

View file

@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
///
/// [The official docs](https://core.telegram.org/bots/api#invoice).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Invoice {
/// Product name.
pub title: String,

View file

@ -10,6 +10,7 @@ use crate::types::{KeyboardButtonPollType, True};
/// [The official docs](https://core.telegram.org/bots/api#keyboardbutton).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct KeyboardButton {
/// Text of the button. If none of the optional fields are used, it will
/// be sent as a message when the button is pressed.
@ -45,6 +46,7 @@ impl KeyboardButton {
// Serialize + Deserialize are implemented by hand
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[non_exhaustive]
pub enum ButtonRequest {
Location,
Contact,
@ -54,6 +56,7 @@ pub enum ButtonRequest {
/// Helper struct for (de)serializing [`ButtonRequest`](ButtonRequest)
#[serde_with_macros::skip_serializing_none]
#[derive(Serialize, Deserialize)]
#[non_exhaustive]
struct RawRequest {
/// If `true`, the user's phone number will be sent as a contact
/// when the button is pressed. Available in private chats only.

View file

@ -1,6 +1,7 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct KeyboardButtonPollType {
poll_type: String,
}

View file

@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
///
/// [The official docs](https://core.telegram.org/bots/api#labeledprice).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct LabeledPrice {
/// Portion label.
pub label: String,

View file

@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
/// This object represents a point on the map.
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Location {
/// Longitude as defined by sender.
pub longitude: f64,

View file

@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize};
/// [Telegram Login Widget]: https://core.telegram.org/widgets/login
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct LoginUrl {
pub url: String,
pub forward_text: Option<String>,

View file

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
///
/// [The official docs](https://core.telegram.org/bots/api#maskposition).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MaskPosition {
/// The part of the face relative to which the mask should be placed. One
/// of `forehead`, `eyes`, `mouth`, or `chin`.

View file

@ -13,6 +13,7 @@ use crate::types::{
///
/// [The official docs](https://core.telegram.org/bots/api#message).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Message {
/// Unique message identifier inside this chat.
#[serde(rename = "message_id")]
@ -30,6 +31,7 @@ pub struct Message {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
#[non_exhaustive]
pub enum MessageKind {
Common(MessageCommon),
NewChatMembers(MessageNewChatMembers),
@ -50,6 +52,7 @@ pub enum MessageKind {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageCommon {
/// Sender, empty for messages sent to channels.
pub from: Option<User>,
@ -69,6 +72,7 @@ pub struct MessageCommon {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageNewChatMembers {
/// New members that were added to the group or supergroup and
/// information about them (the bot itself may be one of these
@ -77,6 +81,7 @@ pub struct MessageNewChatMembers {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageLeftChatMember {
/// A member was removed from the group, information about them (this
/// member may be the bot itself).
@ -84,30 +89,35 @@ pub struct MessageLeftChatMember {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageNewChatTitle {
/// A chat title was changed to this value.
pub new_chat_title: String,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageNewChatPhoto {
/// A chat photo was change to this value.
pub new_chat_photo: Vec<PhotoSize>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageDeleteChatPhoto {
/// Service message: the chat photo was deleted.
pub delete_chat_photo: True,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageGroupChatCreated {
/// Service message: the group has been created.
pub group_chat_created: True,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageSupergroupChatCreated {
/// Service message: the supergroup has been created. This field cant
/// be received in a message coming through updates, because bot cant
@ -118,6 +128,7 @@ pub struct MessageSupergroupChatCreated {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageChannelChatCreated {
/// Service message: the channel has been created. This field cant be
/// received in a message coming through updates, because bot cant be
@ -128,6 +139,7 @@ pub struct MessageChannelChatCreated {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageMigrate {
/// The group has been migrated to a supergroup with the specified
/// identifier. This number may be greater than 32 bits and some
@ -147,6 +159,7 @@ pub struct MessageMigrate {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessagePinned {
/// Specified message was pinned. Note that the Message object in this
/// field will not contain further `reply_to_message` fields even if it
@ -156,6 +169,7 @@ pub struct MessagePinned {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageInvoice {
/// Message is an invoice for a [payment], information about the
/// invoice. [More about payments »].
@ -166,6 +180,7 @@ pub struct MessageInvoice {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageSuccessfulPayment {
/// Message is a service message about a successful payment,
/// information about the payment. [More about payments »].
@ -175,6 +190,7 @@ pub struct MessageSuccessfulPayment {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageConnectedWebsite {
/// The domain name of the website on which the user has logged in.
/// [More about Telegram Login »].
@ -184,12 +200,14 @@ pub struct MessageConnectedWebsite {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessagePassportData {
/// Telegram Passport data.
pub passport_data: PassportData,
}
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ForwardedFrom {
#[serde(rename = "forward_from")]
User(User),
@ -199,6 +217,7 @@ pub enum ForwardedFrom {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
#[non_exhaustive]
pub enum ForwardKind {
Channel(ForwardChannel),
NonChannel(ForwardNonChannel),
@ -206,6 +225,7 @@ pub enum ForwardKind {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ForwardChannel {
#[serde(rename = "forward_date")]
pub date: i32,
@ -221,6 +241,7 @@ pub struct ForwardChannel {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ForwardNonChannel {
#[serde(rename = "forward_date")]
pub date: i32,
@ -230,12 +251,14 @@ pub struct ForwardNonChannel {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ForwardOrigin {
pub reply_to_message: Option<Box<Message>>,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
#[non_exhaustive]
pub enum MediaKind {
Animation(MediaAnimation),
Audio(MediaAudio),
@ -254,6 +277,7 @@ pub enum MediaKind {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaAnimation {
/// Message is an animation, information about the animation. For
/// backward compatibility, when this field is set, the document field
@ -276,6 +300,7 @@ pub struct MediaAnimation {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaAudio {
/// Message is an audio file, information about the file.
pub audio: Audio,
@ -290,6 +315,7 @@ pub struct MediaAudio {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaContact {
/// Message is a shared contact, information about the contact.
contact: Contact,
@ -297,6 +323,7 @@ pub struct MediaContact {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaDocument {
/// Message is a general file, information about the file.
pub document: Document,
@ -311,6 +338,7 @@ pub struct MediaDocument {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaGame {
/// Message is a game, information about the game. [More
/// about games »].
@ -320,6 +348,7 @@ pub struct MediaGame {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaLocation {
/// Message is a shared location, information about the location.
pub location: Location,
@ -327,6 +356,7 @@ pub struct MediaLocation {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaPhoto {
/// Message is a photo, available sizes of the photo.
pub photo: Vec<PhotoSize>,
@ -345,18 +375,21 @@ pub struct MediaPhoto {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaPoll {
/// Message is a native poll, information about the poll.
pub poll: Poll,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaSticker {
/// Message is a sticker, information about the sticker.
pub sticker: Sticker,
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaText {
/// For text messages, the actual UTF-8 text of the message, 0-4096
/// characters.
@ -370,6 +403,7 @@ pub struct MediaText {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaVideo {
/// Message is a video, information about the video.
pub video: Video,
@ -388,6 +422,7 @@ pub struct MediaVideo {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaVideoNote {
/// Message is a [video note], information about the video message.
///
@ -397,6 +432,7 @@ pub struct MediaVideoNote {
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaVoice {
/// Message is a voice message, information about the file.
pub voice: Voice,
@ -411,6 +447,7 @@ pub struct MediaVoice {
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MediaVenue {
/// Message is a venue, information about the venue.
pub venue: Venue,

View file

@ -8,6 +8,7 @@ use crate::types::{Message, User};
///
/// [The official docs](https://core.telegram.org/bots/api#messageentity).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MessageEntity {
#[serde(flatten)]
pub kind: MessageEntityKind,
@ -22,6 +23,7 @@ pub struct MessageEntity {
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum MessageEntityKind {
Mention,
Hashtag,

View file

@ -6,6 +6,7 @@ use crate::types::ShippingAddress;
///
/// [The official docs](https://core.telegram.org/bots/api#orderinfo).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct OrderInfo {
/// User's name.
pub name: String,

View file

@ -126,6 +126,7 @@ use serde::{Deserialize, Serialize};
/// [`HTML`]: ParseMode::HTML
/// [`Markdown`]: ParseMode::Markdown
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ParseMode {
MarkdownV2,
HTML,

View file

@ -7,6 +7,7 @@ use super::{EncryptedCredentials, EncryptedPassportElement};
///
/// [The official docs](https://core.telegram.org/bots/api#passportdata).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportData {
/// Array with information about documents and other Telegram Passport
/// elements that was shared with the bot.

View file

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
///
/// [The official docs](https://core.telegram.org/bots/api#passportelementerror).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportElementError {
/// Error message.
message: String,
@ -16,6 +17,7 @@ pub struct PassportElementError {
// TODO: use different types?
#[serde(tag = "source")]
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum PassportElementErrorKind {
#[serde(rename = "data")]
DataField(PassportElementErrorDataField),
@ -52,6 +54,7 @@ pub enum PassportElementErrorKind {
///
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrordatafield).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportElementErrorDataField {
/// The section of the user's Telegram Passport which has the error.
pub r#type: PassportElementErrorDataFieldType,
@ -70,6 +73,7 @@ pub struct PassportElementErrorDataField {
///
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrorfrontside).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportElementErrorFrontSide {
/// The section of the user's Telegram Passport which has the issue.
pub r#type: PassportElementErrorFrontSideType,
@ -86,6 +90,7 @@ pub struct PassportElementErrorFrontSide {
///
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrorreverseside).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportElementErrorReverseSide {
/// The section of the user's Telegram Passport which has the issue.
pub r#type: PassportElementErrorReverseSideType,
@ -101,6 +106,7 @@ pub struct PassportElementErrorReverseSide {
///
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrorselfie).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportElementErrorSelfie {
/// The section of the user's Telegram Passport which has the issue.
pub r#type: PassportElementErrorSelfieType,
@ -116,6 +122,7 @@ pub struct PassportElementErrorSelfie {
///
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrorfile).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportElementErrorFile {
/// The section of the user's Telegram Passport which has the issue.
pub r#type: PassportElementErrorFileType,
@ -131,6 +138,7 @@ pub struct PassportElementErrorFile {
///
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrorfiles).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportElementErrorFiles {
/// The section of the user's Telegram Passport which has the issue.
pub r#type: PassportElementErrorFilesType,
@ -146,6 +154,7 @@ pub struct PassportElementErrorFiles {
///
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrortranslationfile).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportElementErrorTranslationFile {
/// Type of element of the user's Telegram Passport which has the
/// issue.
@ -162,6 +171,7 @@ pub struct PassportElementErrorTranslationFile {
///
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrortranslationfiles).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportElementErrorTranslationFiles {
/// Type of element of the user's Telegram Passport which has the issue
pub r#type: PassportElementErrorTranslationFilesType,
@ -176,6 +186,7 @@ pub struct PassportElementErrorTranslationFiles {
///
/// [The official docs](https://core.telegram.org/bots/api#passportelementerrorunspecified).
#[derive(Clone, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportElementErrorUnspecified {
/// Type of element of the user's Telegram Passport which has the
/// issue.
@ -187,6 +198,7 @@ pub struct PassportElementErrorUnspecified {
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum PassportElementErrorDataFieldType {
PersonalDetails,
Passport,
@ -198,6 +210,7 @@ pub enum PassportElementErrorDataFieldType {
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum PassportElementErrorFrontSideType {
Passport,
DriverLicense,
@ -207,6 +220,7 @@ pub enum PassportElementErrorFrontSideType {
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum PassportElementErrorReverseSideType {
DriverLicense,
IdentityCard,
@ -214,6 +228,7 @@ pub enum PassportElementErrorReverseSideType {
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum PassportElementErrorSelfieType {
Passport,
DriverLicense,
@ -223,6 +238,7 @@ pub enum PassportElementErrorSelfieType {
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum PassportElementErrorFileType {
UtilityBill,
BankStatement,
@ -233,6 +249,7 @@ pub enum PassportElementErrorFileType {
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum PassportElementErrorFilesType {
UtilityBill,
BankStatement,
@ -243,6 +260,7 @@ pub enum PassportElementErrorFilesType {
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum PassportElementErrorTranslationFileType {
Passport,
DriverLicense,
@ -257,6 +275,7 @@ pub enum PassportElementErrorTranslationFileType {
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum PassportElementErrorTranslationFilesType {
Passport,
DriverLicense,
@ -271,6 +290,7 @@ pub enum PassportElementErrorTranslationFilesType {
#[derive(Clone, Copy, Debug, Hash, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum PassportElementErrorUnspecifiedType {
DataField,
FrontSide,

View file

@ -7,6 +7,7 @@ use serde::{Deserialize, Serialize};
///
/// [The official docs](https://core.telegram.org/bots/api#passportfile).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PassportFile {
/// Identifier for this file.
pub file_id: String,

View file

@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize};
/// [sticker]: crate::types::Sticker
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PhotoSize {
/// Identifier for this file.
pub file_id: String,

View file

@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize};
/// [The official docs](https://core.telegram.org/bots/api#poll).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Poll {
/// Unique poll identifier.
pub id: String,
@ -42,6 +43,7 @@ pub struct Poll {
///
/// [The official docs](https://core.telegram.org/bots/api#polloption).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PollOption {
/// Option text, 1-100 characters.
pub text: String,

View file

@ -2,6 +2,7 @@ use crate::types::User;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PollAnswer {
/// Unique poll identifier.
pub poll_id: String,

View file

@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum PollType {
Quiz,
Regular,

View file

@ -7,6 +7,7 @@ use crate::types::{Currency, OrderInfo, User};
/// [The official docs](https://core.telegram.org/bots/api#precheckoutquery).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct PreCheckoutQuery {
/// Unique query identifier.
pub id: String,

View file

@ -11,6 +11,7 @@ use crate::types::KeyboardButton;
/// [Introduction to bots]: https://core.telegram.org/bots#keyboards
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, Default)]
#[non_exhaustive]
pub struct ReplyKeyboardMarkup {
/// Array of button rows, each represented by an Array of
/// [`KeyboardButton`] objects

View file

@ -14,6 +14,7 @@ use crate::types::True;
/// [`ReplyKeyboardMarkup`]: crate::types::ReplyKeyboardMarkup
#[serde_with_macros::skip_serializing_none]
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ReplyKeyboardRemove {
/// 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

View file

@ -5,6 +5,7 @@ use crate::types::{ForceReply, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyK
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize, From)]
#[serde(untagged)]
#[non_exhaustive]
pub enum ReplyMarkup {
InlineKeyboardMarkup(InlineKeyboardMarkup),
ReplyKeyboardMarkup(ReplyKeyboardMarkup),

View file

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
/// [The official docs](https://core.telegram.org/bots/api#responseparameters).
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum ResponseParameters {
/// The group has been migrated to a supergroup with the specified
/// identifier. This number may be greater than 32 bits and some

View file

@ -5,6 +5,7 @@ use crate::types::{ChatId, InlineKeyboardMarkup, LabeledPrice};
// TODO: missing docs
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SendInvoice {
pub chat_id: ChatId,
pub title: String,

View file

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
///
/// [The official docs](https://core.telegram.org/bots/api#shippingaddress).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ShippingAddress {
/// ISO 3166-1 alpha-2 country code.
pub country_code: CountryCode,

View file

@ -6,6 +6,7 @@ use crate::types::LabeledPrice;
///
/// [The official docs](https://core.telegram.org/bots/api#shippingoption).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ShippingOption {
/// Shipping option identifier.
pub id: String,

View file

@ -6,6 +6,7 @@ use crate::types::{ShippingAddress, User};
///
/// [The official docs](https://core.telegram.org/bots/api#shippingquery).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct ShippingQuery {
/// Unique query identifier.
pub id: String,

View file

@ -7,6 +7,7 @@ use crate::types::{MaskPosition, PhotoSize};
/// [The official docs](https://core.telegram.org/bots/api#sticker).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Sticker {
/// Identifier for this file.
pub file_id: String,

View file

@ -6,6 +6,7 @@ use crate::types::Sticker;
///
/// [The official docs](https://core.telegram.org/bots/api#stickerset).
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct StickerSet {
/// Sticker set name.
pub name: String,

View file

@ -7,6 +7,7 @@ use crate::types::{Currency, OrderInfo};
/// [The official docs](https://core.telegram.org/bots/api#successfulpayment).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct SuccessfulPayment {
/// Three-letter ISO 4217 [currency] code.
///

View file

@ -14,6 +14,7 @@ use serde_json::Value;
///
/// [object]: https://core.telegram.org/bots/api#available-types
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Update {
/// The updates unique identifier. Update identifiers start from a certain
/// positive number and increase sequentially. This ID becomes especially
@ -54,6 +55,7 @@ impl Update {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[non_exhaustive]
pub enum UpdateKind {
/// New incoming message of any kind — text, photo, sticker, etc.
Message(Message),

View file

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
/// [The official docs](https://core.telegram.org/bots/api#user).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct User {
/// Unique identifier for this user or bot.
pub id: i32,
@ -48,6 +49,7 @@ impl User {
///
/// [`Bot::get_me`]: crate::Bot::get_me
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Me {
#[serde(flatten)]
pub user: User,

View file

@ -6,6 +6,7 @@ use crate::types::PhotoSize;
///
/// [The official docs](https://core.telegram.org/bots/api#userprofilephotos).
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct UserProfilePhotos {
/// Total number of profile pictures the target user has.
pub total_count: u32,

View file

@ -5,6 +5,7 @@ use crate::types::Location;
/// This object represents a venue.
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Venue {
/// Venue location.
pub location: Location,

View file

@ -7,6 +7,7 @@ use crate::types::{MimeWrapper, PhotoSize};
/// [The official docs](https://core.telegram.org/bots/api#video).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Video {
/// Identifier for this file.
pub file_id: String,

View file

@ -11,6 +11,7 @@ use crate::types::PhotoSize;
/// [v4.0]: https://telegram.org/blog/video-messages-and-telescope
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct VideoNote {
/// Identifier for this file.
pub file_id: String,

View file

@ -6,6 +6,7 @@ use serde::{Deserialize, Serialize};
/// [The official docs](https://core.telegram.org/bots/api#voice).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct Voice {
/// Identifier for this file.
pub file_id: String,

View file

@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
/// [The official docs](https://core.telegram.org/bots/api#webhookinfo).
#[serde_with_macros::skip_serializing_none]
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub struct WebhookInfo {
/// Webhook URL, may be empty if webhook is not set up.
pub url: String,