mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Add BusinessLocation
class and corresp. field to ChatPrivate
This commit is contained in:
parent
fa17b48793
commit
f84e15a0a6
5 changed files with 32 additions and 3 deletions
|
@ -10,6 +10,7 @@ pub use bot_description::*;
|
||||||
pub use bot_name::*;
|
pub use bot_name::*;
|
||||||
pub use bot_short_description::*;
|
pub use bot_short_description::*;
|
||||||
pub use business_intro::*;
|
pub use business_intro::*;
|
||||||
|
pub use business_location::*;
|
||||||
pub use callback_game::*;
|
pub use callback_game::*;
|
||||||
pub use callback_query::*;
|
pub use callback_query::*;
|
||||||
pub use chat::*;
|
pub use chat::*;
|
||||||
|
@ -166,6 +167,7 @@ mod bot_description;
|
||||||
mod bot_name;
|
mod bot_name;
|
||||||
mod bot_short_description;
|
mod bot_short_description;
|
||||||
mod business_intro;
|
mod business_intro;
|
||||||
|
mod business_location;
|
||||||
mod callback_game;
|
mod callback_game;
|
||||||
mod callback_query;
|
mod callback_query;
|
||||||
mod chat;
|
mod chat;
|
||||||
|
|
12
crates/teloxide-core/src/types/business_location.rs
Normal file
12
crates/teloxide-core/src/types/business_location.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use crate::types::Location;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct BusinessLocation {
|
||||||
|
/// Address of the business.
|
||||||
|
pub address: String,
|
||||||
|
|
||||||
|
/// Location of the business.
|
||||||
|
pub location: Option<Location>,
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::types::{
|
use crate::types::{
|
||||||
BusinessIntro, ChatFullInfo, ChatId, ChatLocation, ChatPermissions, ChatPhoto, Message,
|
BusinessIntro, BusinessLocation, ChatFullInfo, ChatId, ChatLocation, ChatPermissions,
|
||||||
ReactionType, Seconds, True, User,
|
ChatPhoto, Message, ReactionType, Seconds, True, User,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::Birthdate;
|
use super::Birthdate;
|
||||||
|
@ -153,6 +153,12 @@ pub struct ChatPrivate {
|
||||||
///
|
///
|
||||||
/// [`GetChat`]: crate::payloads::GetChat
|
/// [`GetChat`]: crate::payloads::GetChat
|
||||||
pub business_intro: Option<BusinessIntro>,
|
pub business_intro: Option<BusinessIntro>,
|
||||||
|
|
||||||
|
/// For private chats with business accounts, the location of the business.
|
||||||
|
/// Returned only in [`GetChat`].
|
||||||
|
///
|
||||||
|
/// [`GetChat`]: crate::payloads::GetChat
|
||||||
|
pub business_location: Option<BusinessLocation>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[serde_with::skip_serializing_none]
|
#[serde_with::skip_serializing_none]
|
||||||
|
@ -583,7 +589,7 @@ impl Chat {
|
||||||
}
|
}
|
||||||
|
|
||||||
mod serde_helper {
|
mod serde_helper {
|
||||||
use crate::types::{Birthdate, BusinessIntro, True};
|
use crate::types::{Birthdate, BusinessIntro, BusinessLocation, True};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
|
@ -607,6 +613,7 @@ mod serde_helper {
|
||||||
personal_chat: Option<Box<super::Chat>>,
|
personal_chat: Option<Box<super::Chat>>,
|
||||||
birthdate: Option<Birthdate>,
|
birthdate: Option<Birthdate>,
|
||||||
business_intro: Option<BusinessIntro>,
|
business_intro: Option<BusinessIntro>,
|
||||||
|
business_location: Option<BusinessLocation>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ChatPrivate> for super::ChatPrivate {
|
impl From<ChatPrivate> for super::ChatPrivate {
|
||||||
|
@ -622,6 +629,7 @@ mod serde_helper {
|
||||||
personal_chat,
|
personal_chat,
|
||||||
birthdate,
|
birthdate,
|
||||||
business_intro,
|
business_intro,
|
||||||
|
business_location,
|
||||||
}: ChatPrivate,
|
}: ChatPrivate,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -634,6 +642,7 @@ mod serde_helper {
|
||||||
personal_chat,
|
personal_chat,
|
||||||
birthdate,
|
birthdate,
|
||||||
business_intro,
|
business_intro,
|
||||||
|
business_location,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -650,6 +659,7 @@ mod serde_helper {
|
||||||
personal_chat,
|
personal_chat,
|
||||||
birthdate,
|
birthdate,
|
||||||
business_intro,
|
business_intro,
|
||||||
|
business_location,
|
||||||
}: super::ChatPrivate,
|
}: super::ChatPrivate,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -663,6 +673,7 @@ mod serde_helper {
|
||||||
personal_chat,
|
personal_chat,
|
||||||
birthdate,
|
birthdate,
|
||||||
business_intro,
|
business_intro,
|
||||||
|
business_location,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -728,6 +739,7 @@ mod tests {
|
||||||
personal_chat: None,
|
personal_chat: None,
|
||||||
birthdate: None,
|
birthdate: None,
|
||||||
business_intro: None,
|
business_intro: None,
|
||||||
|
business_location: None,
|
||||||
}),
|
}),
|
||||||
photo: None,
|
photo: None,
|
||||||
available_reactions: Some(vec![ReactionType::Emoji { emoji: "🌭".to_owned() }]),
|
available_reactions: Some(vec![ReactionType::Emoji { emoji: "🌭".to_owned() }]),
|
||||||
|
@ -769,6 +781,7 @@ mod tests {
|
||||||
personal_chat: None,
|
personal_chat: None,
|
||||||
birthdate: None,
|
birthdate: None,
|
||||||
business_intro: None,
|
business_intro: None,
|
||||||
|
business_location: None,
|
||||||
}),
|
}),
|
||||||
photo: None,
|
photo: None,
|
||||||
available_reactions: None,
|
available_reactions: None,
|
||||||
|
|
|
@ -1905,6 +1905,7 @@ mod tests {
|
||||||
personal_chat: None,
|
personal_chat: None,
|
||||||
birthdate: None,
|
birthdate: None,
|
||||||
business_intro: None,
|
business_intro: None,
|
||||||
|
business_location: None,
|
||||||
}),
|
}),
|
||||||
photo: None,
|
photo: None,
|
||||||
available_reactions: None,
|
available_reactions: None,
|
||||||
|
|
|
@ -538,6 +538,7 @@ mod test {
|
||||||
personal_chat: None,
|
personal_chat: None,
|
||||||
birthdate: None,
|
birthdate: None,
|
||||||
business_intro: None,
|
business_intro: None,
|
||||||
|
business_location: None,
|
||||||
}),
|
}),
|
||||||
photo: None,
|
photo: None,
|
||||||
available_reactions: None,
|
available_reactions: None,
|
||||||
|
|
Loading…
Reference in a new issue