Add Birthdate struct and corresponding field in ChatPrivate

This commit is contained in:
Akshett Rai Jindal 2024-08-20 19:34:09 +05:30
parent 2265141030
commit cb8ff44b09
3 changed files with 27 additions and 0 deletions

View file

@ -3,6 +3,7 @@
pub use allowed_update::*;
pub use animation::*;
pub use audio::*;
pub use birthdate::*;
pub use bot_command::*;
pub use bot_command_scope::*;
pub use bot_description::*;
@ -156,6 +157,7 @@ pub use write_access_allowed::*;
mod allowed_update;
mod animation;
mod audio;
mod birthdate;
mod bot_command;
mod bot_command_scope;
mod bot_description;

View file

@ -0,0 +1,17 @@
use serde::{Deserialize, Serialize};
/// Describes the birthdate of a user.
///
/// [The official docs](https://core.telegram.org/bots/api#birthdate)
#[serde_with::skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Birthdate {
/// Day of the user's birth; 1-31
pub day: u8,
/// Month of the user's birth; 1-12
pub month: u8,
/// Optional. Year of the user's birth
pub year: Option<u32>,
}

View file

@ -5,6 +5,8 @@ use crate::types::{
True, User,
};
use super::Birthdate;
/// This object represents a chat.
///
/// [The official docs](https://core.telegram.org/bots/api#chat).
@ -139,6 +141,12 @@ pub struct ChatPrivate {
///
/// [`GetChat`]: crate::payloads::GetChat
pub personal_chat: Option<Box<Chat>>,
/// For private chats, the date of birth of the user. Returned only in
/// [`GetChat`].
///
/// [`GetChat`]: crate::payloads::GetChat
pub birthdate: Option<Birthdate>,
}
#[serde_with::skip_serializing_none]