diff options
author | Paul Woolcock <paul@woolcock.us> | 2020-10-07 05:44:32 -0400 |
---|---|---|
committer | Paul Woolcock <paul@woolcock.us> | 2020-10-07 09:06:13 -0400 |
commit | 5a8dd3fd8411f763f26dff90ac2e92422785500a (patch) | |
tree | aa103ad42b9211f768fd03f50216755267dd306d /src/entities/announcement.rs | |
parent | 6ed05e7d2357c01e2545f36316fc9262409483b6 (diff) |
Add some new entities & update some existing ones
Diffstat (limited to 'src/entities/announcement.rs')
-rw-r--r-- | src/entities/announcement.rs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/entities/announcement.rs b/src/entities/announcement.rs new file mode 100644 index 0000000..d1b5f5a --- /dev/null +++ b/src/entities/announcement.rs @@ -0,0 +1,50 @@ +use serde::{Deserialize, Serialize}; + +/// Custom emoji fields for AnnouncementReaction +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +pub struct AnnouncementReactionCustomEmoji { + /// A link to the custom emoji. + pub url: String, + /// A link to a non-animated version of the custom emoji. + pub static_url: String, +} + +/// Represents an emoji reaction to an Announcement. +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +pub struct AnnouncementReaction { + /// The emoji used for the reaction. Either a unicode emoji, or a custom emoji's shortcode. + pub name: String, + /// The total number of users who have added this reaction. + pub count: u64, + /// Whether the authorized user has added this reaction to the announcement. + pub me: bool, + #[serde(flatten)] + pub emoji: Option<AnnouncementReactionCustomEmoji>, +} + +/// Represents an announcement set by an administrator. +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] +pub struct Announcement { + /// The announcement id. + id: String, + /// The content of the announcement. + text: String, + /// Whether the announcement is currently active. + published: bool, + /// Whether the announcement has a start/end time. + all_day: bool, + /// When the announcement was created. + created_at: String, // Datetime + /// When the announcement was last updated. + updated_at: String, // Datetime + /// Whether the announcement has been read by the user. + read: bool, + /// Emoji reactions attached to the announcement. + reactions: Vec<AnnouncementReaction>, + /// When the future announcement was scheduled. + scheduled_at: Option<String>, // Datetime + /// When the future announcement will start. + starts_at: Option<String>, // Datetime + /// When the future announcement will end. + ends_at: Option<String>, // Datetime +}
\ No newline at end of file |