diff --git a/entities/src/notification.rs b/entities/src/notification.rs index cd930fc..df538ff 100644 --- a/entities/src/notification.rs +++ b/entities/src/notification.rs @@ -9,7 +9,7 @@ use time::{serde::iso8601, OffsetDateTime}; #[derive(Debug, Clone, Deserialize, Serialize, PartialEq)] pub struct Notification { /// The notification ID. - pub id: String, + pub id: NotificationId, /// The type of notification. #[serde(rename = "type")] pub notification_type: NotificationType, @@ -22,6 +22,17 @@ pub struct Notification { pub status: Option, } +/// Wrapper type for a notification ID string +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(transparent)] +pub struct NotificationId(String); + +impl AsRef for NotificationId { + fn as_ref(&self) -> &str { + &self.0 + } +} + /// The type of notification. #[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)] #[serde(rename_all = "lowercase")]