mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 06:25:10 +01:00
Add UserChatBoosts
struct
This commit is contained in:
parent
dbf138a5b3
commit
48b7c7b24b
2 changed files with 45 additions and 0 deletions
|
@ -132,6 +132,7 @@ pub use unit_false::*;
|
|||
pub use unit_true::*;
|
||||
pub use update::*;
|
||||
pub use user::*;
|
||||
pub use user_chat_boosts::*;
|
||||
pub use user_profile_photos::*;
|
||||
pub use users_shared::*;
|
||||
pub use venue::*;
|
||||
|
@ -252,6 +253,7 @@ mod unit_false;
|
|||
mod unit_true;
|
||||
mod update;
|
||||
mod user;
|
||||
mod user_chat_boosts;
|
||||
mod user_profile_photos;
|
||||
mod users_shared;
|
||||
mod venue;
|
||||
|
|
43
crates/teloxide-core/src/types/user_chat_boosts.rs
Normal file
43
crates/teloxide-core/src/types/user_chat_boosts.rs
Normal file
|
@ -0,0 +1,43 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::types::ChatBoost;
|
||||
|
||||
/// This object represents a list of boosts added to a chat by a user.
|
||||
#[serde_with::skip_serializing_none]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct UserChatBoosts {
|
||||
/// The list of boosts added to the chat by the user.
|
||||
pub boosts: Vec<ChatBoost>,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn deserialize() {
|
||||
let data = r#"
|
||||
{
|
||||
"boosts": [
|
||||
{
|
||||
"boost_id": "4506e1b7e866e33fcbde78fe1746ec3a",
|
||||
"add_date": 1721399621,
|
||||
"expiration_date": 1745088963,
|
||||
"source": {
|
||||
"source": "premium",
|
||||
"user": {
|
||||
"id": 1459074222,
|
||||
"is_bot": false,
|
||||
"first_name": "shadowchain",
|
||||
"username": "shdwchn10",
|
||||
"language_code": "en",
|
||||
"is_premium": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
"#;
|
||||
serde_json::from_str::<UserChatBoosts>(data).unwrap();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue