Add ID type for pushes

This commit is contained in:
D. Scott Boggs 2023-01-09 07:53:44 -05:00 committed by Scott Boggs
parent f188c20250
commit f4ef3c27ab
1 changed files with 12 additions and 1 deletions

View File

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