Add ID type for notifications
This commit is contained in:
parent
c5f199b460
commit
f188c20250
|
@ -9,7 +9,7 @@ use time::{serde::iso8601, OffsetDateTime};
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
|
||||||
pub struct Notification {
|
pub struct Notification {
|
||||||
/// The notification ID.
|
/// The notification ID.
|
||||||
pub id: String,
|
pub id: NotificationId,
|
||||||
/// The type of notification.
|
/// The type of notification.
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub notification_type: NotificationType,
|
pub notification_type: NotificationType,
|
||||||
|
@ -22,6 +22,17 @@ pub struct Notification {
|
||||||
pub status: Option<Status>,
|
pub status: Option<Status>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Wrapper type for a notification ID string
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
|
#[serde(transparent)]
|
||||||
|
pub struct NotificationId(String);
|
||||||
|
|
||||||
|
impl AsRef<str> for NotificationId {
|
||||||
|
fn as_ref(&self) -> &str {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The type of notification.
|
/// The type of notification.
|
||||||
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
|
|
Loading…
Reference in New Issue