Add ID type for pushes
This commit is contained in:
parent
f188c20250
commit
f4ef3c27ab
|
@ -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<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 {
|
||||
use serde::Serialize;
|
||||
|
||||
|
|
Loading…
Reference in New Issue