Skip to content

Commit

Permalink
Bot API 7.0: Other changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrat555 committed Jan 4, 2024
1 parent 1db1135 commit b45566f
Showing 1 changed file with 38 additions and 23 deletions.
61 changes: 38 additions & 23 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,22 @@ pub struct Chat {
#[builder(setter(into, strip_option), default)]
pub available_reactions: Option<Vec<ReactionType>>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub accent_color_id: Option<u16>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub background_custom_emoji_id: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub profile_accent_color_id: Option<u16>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub profile_background_custom_emoji_id: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub emoji_status_custom_emoji_id: Option<String>,
Expand Down Expand Up @@ -567,6 +583,10 @@ pub struct Chat {
#[builder(setter(into, strip_option), default)]
pub has_protected_content: Option<bool>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub has_visible_history: Option<bool>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub sticker_set_name: Option<String>,
Expand Down Expand Up @@ -607,27 +627,7 @@ pub struct Message {

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub forward_from: Option<Box<User>>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub forward_from_chat: Option<Box<Chat>>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub forward_from_message_id: Option<i32>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub forward_signature: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub forward_sender_name: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub forward_date: Option<u64>,
pub forward_origin: Option<Box<MessageOrigin>>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
Expand Down Expand Up @@ -799,7 +799,7 @@ pub struct Message {

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub pinned_message: Option<Box<Message>>,
pub pinned_message: Option<Box<MaybeInaccessibleMessage>>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
Expand Down Expand Up @@ -1761,7 +1761,7 @@ pub struct CallbackQuery {

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
pub message: Option<Message>,
pub message: Option<MaybeInaccessibleMessage>,

#[serde(skip_serializing_if = "Option::is_none")]
#[builder(setter(into, strip_option), default)]
Expand Down Expand Up @@ -3701,6 +3701,21 @@ pub struct UserChatBoosts {
pub boosts: Vec<ChatBoost>,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub enum MaybeInaccessibleMessage {
Message(Message),
InaccessibleMessage(InaccessibleMessage),
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)]
pub struct InaccessibleMessage {
pub chat: Chat,

pub message_id: i32,

pub date: u64,
}

#[cfg(test)]
mod serde_tests {
use super::*;
Expand Down

0 comments on commit b45566f

Please sign in to comment.