diff --git a/entities/src/attachment.rs b/entities/src/attachment.rs index fa8a781..f34ffb6 100644 --- a/entities/src/attachment.rs +++ b/entities/src/attachment.rs @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] pub struct Attachment { /// ID of the attachment. - pub id: String, + pub id: AttachmentId, /// The media type of an attachment. #[serde(rename = "type")] pub media_type: MediaType, @@ -24,6 +24,16 @@ pub struct Attachment { /// Noop will be removed. pub description: Option, } +/// Wrapper type for a attachment ID string +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(transparent)] +pub struct AttachmentId(String); + +impl AsRef for AttachmentId { + fn as_ref(&self) -> &str { + &self.0 + } +} /// Information about the attachment itself. #[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]