diff --git a/entities/src/push.rs b/entities/src/push.rs index c86f899..b2a1877 100644 --- a/entities/src/push.rs +++ b/entities/src/push.rs @@ -17,7 +17,7 @@ pub struct Alerts { #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct Subscription { /// The `id` of the subscription - pub id: String, + pub id: SubscriptionId, /// The endpoint of the subscription pub endpoint: String, /// The server key of the subscription @@ -26,6 +26,17 @@ pub struct Subscription { pub alerts: Option, } +/// Wrapper type for a subscription ID string +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] +#[serde(transparent)] +pub struct SubscriptionId(String); + +impl AsRef for SubscriptionId { + fn as_ref(&self) -> &str { + &self.0 + } +} + pub mod add_subscription { use serde::Serialize;