mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +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 serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{
|
use crate::types::{
|
||||||
BusinessIntro, BusinessLocation, ChatFullInfo, ChatId, ChatLocation, ChatPermissions,
|
Birthdate, BusinessIntro, BusinessLocation, BusinessOpeningHours, ChatFullInfo, ChatId,
|
||||||
ChatPhoto, Message, ReactionType, Seconds, True, User,
|
ChatLocation, ChatPermissions, ChatPhoto, Message, ReactionType, Seconds, True, User,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::Birthdate;
|
|
||||||
|
|
||||||
/// This object represents a chat.
|
/// This object represents a chat.
|
||||||
///
|
///
|
||||||
/// [The official docs](https://core.telegram.org/bots/api#chat).
|
/// [The official docs](https://core.telegram.org/bots/api#chat).
|
||||||
|
@ -159,6 +157,12 @@ pub struct ChatPrivate {
|
||||||
///
|
///
|
||||||
/// [`GetChat`]: crate::payloads::GetChat
|
/// [`GetChat`]: crate::payloads::GetChat
|
||||||
pub business_location: Option<BusinessLocation>,
|
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]
|
#[serde_with::skip_serializing_none]
|
||||||
|
@ -589,7 +593,7 @@ impl Chat {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod serde_helper {
|
mod serde_helper {
|
||||||
use crate::types::{Birthdate, BusinessIntro, BusinessLocation, True};
|
use crate::types::{Birthdate, BusinessIntro, BusinessLocation, BusinessOpeningHours, True};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
|
@ -614,6 +618,7 @@ mod serde_helper {
|
||||||
birthdate: Option<Birthdate>,
|
birthdate: Option<Birthdate>,
|
||||||
business_intro: Option<BusinessIntro>,
|
business_intro: Option<BusinessIntro>,
|
||||||
business_location: Option<BusinessLocation>,
|
business_location: Option<BusinessLocation>,
|
||||||
|
business_opening_hours: Option<BusinessOpeningHours>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ChatPrivate> for super::ChatPrivate {
|
impl From<ChatPrivate> for super::ChatPrivate {
|
||||||
|
@ -630,6 +635,7 @@ mod serde_helper {
|
||||||
birthdate,
|
birthdate,
|
||||||
business_intro,
|
business_intro,
|
||||||
business_location,
|
business_location,
|
||||||
|
business_opening_hours,
|
||||||
}: ChatPrivate,
|
}: ChatPrivate,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -643,6 +649,7 @@ mod serde_helper {
|
||||||
birthdate,
|
birthdate,
|
||||||
business_intro,
|
business_intro,
|
||||||
business_location,
|
business_location,
|
||||||
|
business_opening_hours,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -660,6 +667,7 @@ mod serde_helper {
|
||||||
birthdate,
|
birthdate,
|
||||||
business_intro,
|
business_intro,
|
||||||
business_location,
|
business_location,
|
||||||
|
business_opening_hours,
|
||||||
}: super::ChatPrivate,
|
}: super::ChatPrivate,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -674,6 +682,7 @@ mod serde_helper {
|
||||||
birthdate,
|
birthdate,
|
||||||
business_intro,
|
business_intro,
|
||||||
business_location,
|
business_location,
|
||||||
|
business_opening_hours,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -740,6 +749,7 @@ mod tests {
|
||||||
birthdate: None,
|
birthdate: None,
|
||||||
business_intro: None,
|
business_intro: None,
|
||||||
business_location: None,
|
business_location: None,
|
||||||
|
business_opening_hours: None,
|
||||||
}),
|
}),
|
||||||
photo: None,
|
photo: None,
|
||||||
available_reactions: Some(vec![ReactionType::Emoji { emoji: "🌭".to_owned() }]),
|
available_reactions: Some(vec![ReactionType::Emoji { emoji: "🌭".to_owned() }]),
|
||||||
|
@ -782,6 +792,7 @@ mod tests {
|
||||||
birthdate: None,
|
birthdate: None,
|
||||||
business_intro: None,
|
business_intro: None,
|
||||||
business_location: None,
|
business_location: None,
|
||||||
|
business_opening_hours: None,
|
||||||
}),
|
}),
|
||||||
photo: None,
|
photo: None,
|
||||||
available_reactions: None,
|
available_reactions: None,
|
||||||
|
|
|
@ -1906,6 +1906,7 @@ mod tests {
|
||||||
birthdate: None,
|
birthdate: None,
|
||||||
business_intro: None,
|
business_intro: None,
|
||||||
business_location: None,
|
business_location: None,
|
||||||
|
business_opening_hours: None,
|
||||||
}),
|
}),
|
||||||
photo: None,
|
photo: None,
|
||||||
available_reactions: None,
|
available_reactions: None,
|
||||||
|
|
|
@ -539,6 +539,7 @@ mod test {
|
||||||
birthdate: None,
|
birthdate: None,
|
||||||
business_intro: None,
|
business_intro: None,
|
||||||
business_location: None,
|
business_location: None,
|
||||||
|
business_opening_hours: None,
|
||||||
}),
|
}),
|
||||||
photo: None,
|
photo: None,
|
||||||
available_reactions: None,
|
available_reactions: None,
|
||||||
|
|
Loading…
Reference in a new issue