mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 06:25:10 +01:00
Add business_opening_hours
field to ChatPrivate
This commit is contained in:
parent
47fd589ea2
commit
6bec7a84ff
3 changed files with 18 additions and 5 deletions
|
@ -1,12 +1,10 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::{
|
||||
BusinessIntro, BusinessLocation, ChatFullInfo, ChatId, ChatLocation, ChatPermissions,
|
||||
ChatPhoto, Message, ReactionType, Seconds, True, User,
|
||||
Birthdate, BusinessIntro, BusinessLocation, BusinessOpeningHours, ChatFullInfo, ChatId,
|
||||
ChatLocation, ChatPermissions, ChatPhoto, Message, ReactionType, Seconds, True, User,
|
||||
};
|
||||
|
||||
use super::Birthdate;
|
||||
|
||||
/// This object represents a chat.
|
||||
///
|
||||
/// [The official docs](https://core.telegram.org/bots/api#chat).
|
||||
|
@ -159,6 +157,12 @@ pub struct ChatPrivate {
|
|||
///
|
||||
/// [`GetChat`]: crate::payloads::GetChat
|
||||
pub business_location: Option<BusinessLocation>,
|
||||
|
||||
/// For private chats with business accounts, the opening hours of the
|
||||
/// business. Returned only in [`GetChat`].
|
||||
///
|
||||
/// [`GetChat`]: crate::payloads::GetChat
|
||||
pub business_opening_hours: Option<BusinessOpeningHours>,
|
||||
}
|
||||
|
||||
#[serde_with::skip_serializing_none]
|
||||
|
@ -589,7 +593,7 @@ impl Chat {
|
|||
}
|
||||
|
||||
mod serde_helper {
|
||||
use crate::types::{Birthdate, BusinessIntro, BusinessLocation, True};
|
||||
use crate::types::{Birthdate, BusinessIntro, BusinessLocation, BusinessOpeningHours, True};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
|
@ -614,6 +618,7 @@ mod serde_helper {
|
|||
birthdate: Option<Birthdate>,
|
||||
business_intro: Option<BusinessIntro>,
|
||||
business_location: Option<BusinessLocation>,
|
||||
business_opening_hours: Option<BusinessOpeningHours>,
|
||||
}
|
||||
|
||||
impl From<ChatPrivate> for super::ChatPrivate {
|
||||
|
@ -630,6 +635,7 @@ mod serde_helper {
|
|||
birthdate,
|
||||
business_intro,
|
||||
business_location,
|
||||
business_opening_hours,
|
||||
}: ChatPrivate,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
@ -643,6 +649,7 @@ mod serde_helper {
|
|||
birthdate,
|
||||
business_intro,
|
||||
business_location,
|
||||
business_opening_hours,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -660,6 +667,7 @@ mod serde_helper {
|
|||
birthdate,
|
||||
business_intro,
|
||||
business_location,
|
||||
business_opening_hours,
|
||||
}: super::ChatPrivate,
|
||||
) -> Self {
|
||||
Self {
|
||||
|
@ -674,6 +682,7 @@ mod serde_helper {
|
|||
birthdate,
|
||||
business_intro,
|
||||
business_location,
|
||||
business_opening_hours,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -740,6 +749,7 @@ mod tests {
|
|||
birthdate: None,
|
||||
business_intro: None,
|
||||
business_location: None,
|
||||
business_opening_hours: None,
|
||||
}),
|
||||
photo: None,
|
||||
available_reactions: Some(vec![ReactionType::Emoji { emoji: "🌭".to_owned() }]),
|
||||
|
@ -782,6 +792,7 @@ mod tests {
|
|||
birthdate: None,
|
||||
business_intro: None,
|
||||
business_location: None,
|
||||
business_opening_hours: None,
|
||||
}),
|
||||
photo: None,
|
||||
available_reactions: None,
|
||||
|
|
|
@ -1906,6 +1906,7 @@ mod tests {
|
|||
birthdate: None,
|
||||
business_intro: None,
|
||||
business_location: None,
|
||||
business_opening_hours: None,
|
||||
}),
|
||||
photo: None,
|
||||
available_reactions: None,
|
||||
|
|
|
@ -539,6 +539,7 @@ mod test {
|
|||
birthdate: None,
|
||||
business_intro: None,
|
||||
business_location: None,
|
||||
business_opening_hours: None,
|
||||
}),
|
||||
photo: None,
|
||||
available_reactions: None,
|
||||
|
|
Loading…
Reference in a new issue