diff options
author | D. Scott Boggs <scott@tams.tech> | 2023-01-30 10:30:24 -0500 |
---|---|---|
committer | D. Scott Boggs <scott@tams.tech> | 2023-01-30 10:43:51 -0500 |
commit | 6845b1498a01087920b4e694cb5a84db9c34852a (patch) | |
tree | fe6ef0ebc26617098c24cd971ac1c9cde039ac04 | |
parent | 1f6cc0335a69a74e6bcad314e11a43f91eb92fe8 (diff) |
Add Conversation entitycomb-entities/conversation
-rw-r--r-- | entities/src/conversation.rs | 18 | ||||
-rw-r--r-- | entities/src/ids.rs | 1 | ||||
-rw-r--r-- | entities/src/lib.rs | 2 |
3 files changed, 21 insertions, 0 deletions
diff --git a/entities/src/conversation.rs b/entities/src/conversation.rs new file mode 100644 index 0000000..91790ac --- /dev/null +++ b/entities/src/conversation.rs @@ -0,0 +1,18 @@ +use serde::{Deserialize, Serialize}; + +use crate::{account::Account, status::Status, ConversationId}; + +/// Represents a conversation with "direct message" visibility. +/// +/// See also [the API documentation](https://docs.joinmastodon.org/entities/Conversation/) +#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] +pub struct Conversation { + /// The ID of the conversation in the database. + pub id: ConversationId, + /// Is the conversation currently marked as unread? + pub unread: bool, + /// Participants in the conversation. + pub accounts: Vec<Account>, + /// The last status in the conversation. + pub last_status: Option<Status>, +} diff --git a/entities/src/ids.rs b/entities/src/ids.rs index 58a4f74..72976a9 100644 --- a/entities/src/ids.rs +++ b/entities/src/ids.rs @@ -58,4 +58,5 @@ define_ids!( "a measurement key" as MeasureKey, "an announcement ID" as AnnouncementId, "a Vapid key for push streaming API" as VapidKey, + "a conversation ID" as ConversationId, ); diff --git a/entities/src/lib.rs b/entities/src/lib.rs index 2106d83..2cfbf07 100644 --- a/entities/src/lib.rs +++ b/entities/src/lib.rs @@ -19,6 +19,8 @@ pub mod attachment; pub mod card; /// Data structures for ser/de of context-related resources pub mod context; +/// Data structures for ser/de of conversation-related resources +pub mod conversation; /// Module for converting values while serializing and deserializing. mod conversion; /// Data structures for ser/de of custom emoji |