use chrono::{DateTime, Utc}; use serde::Deserialize; /// A blob record containing binary data metadata. #[derive(Debug, Clone, Deserialize)] pub struct BlobRecord { /// The record type #[serde(rename = "$type")] pub r#type: String, /// MIME type of the blob #[serde(rename = "mimeType")] pub mime_type: String, /// Size of the blob in bytes pub size: i64, /// Reference to the blob content #[serde(rename = "ref")] pub r#ref: BlobRef, } /// A reference to blob content via CID link. #[derive(Debug, Clone, Deserialize)] pub struct BlobRef { /// The CID link to the blob content #[serde(rename = "$link")] pub link: String, } /// An attachment to a blog post. #[derive(Debug, Clone, Deserialize)] pub struct PostAttachment { /// The attachment type #[serde(rename = "$type")] pub r#type: String, /// The blob content of the attachment pub content: BlobRecord, } /// A blog post record from the ATProtocol lexicon. #[derive(Debug, Clone, Deserialize)] pub struct PostRecord { /// The record type #[serde(rename = "$type")] pub r#type: String, /// Title of the blog post pub title: String, /// Main content of the blog post pub content: BlobRecord, /// Publication timestamp #[serde(rename = "publishedAt")] pub published_at: DateTime, /// List of attachments to the post #[serde(default = "empty_attachments")] pub attachments: Vec, /// Languages used in the post pub langs: Vec, } fn empty_attachments() -> Vec { Vec::new() }