Skip to main content

jmap_base_client/
push.rs

1//! Canonical push notification types shared by SSE and WebSocket transports.
2//! Spec: RFC 8620 §7.1 (Push Subscriptions)
3
4use std::collections::HashMap;
5
6use serde::{Deserialize, Serialize};
7
8use jmap_types::{Id, State};
9
10/// A state change push notification (RFC 8620 §7.1).
11///
12/// Sent over both SSE (as a push event) and WebSocket (as a frame type).
13#[non_exhaustive]
14#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
15pub struct StateChange {
16    /// For each account that changed: maps data-type name to the new [`State`] token.
17    ///
18    /// Outer key: account [`Id`].  Inner key: JMAP data-type name (e.g. `"Email"`).
19    /// Inner value: new opaque state string; pass to `Email/changes` etc. as `sinceState`.
20    pub changed: HashMap<Id, HashMap<String, State>>,
21}