Skip to main content

jmap_calendars_types/
participant_identity.rs

1//! ParticipantIdentity object.
2//!
3//! Normative reference: draft-ietf-jmap-calendars-33 §3.
4
5use jmap_types::Id;
6use serde::{Deserialize, Serialize};
7
8/// A JMAP ParticipantIdentity object (draft-ietf-jmap-calendars-33 §3).
9///
10/// Represents a URI (typically a `mailto:` address) that identifies the
11/// authenticated user for iTIP scheduling purposes within a calendar account.
12/// The set is specific to the authenticated user as well as the account:
13/// different users with access to one account may see different
14/// identities, and a different default (§3).
15#[non_exhaustive]
16#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
17#[serde(rename_all = "camelCase")]
18pub struct ParticipantIdentity {
19    /// Server-assigned immutable identifier.
20    ///
21    /// `Option<Id>` with `skip_serializing_if` so /set create payloads
22    /// constructed by a typed caller do NOT emit a client-supplied `id`
23    /// on the wire. Per RFC 8620 §5.3, the `id` property MUST NOT be set
24    /// in the create object — the server assigns it. Matches the
25    /// in-crate sibling `CalendarEvent.id`
26    /// (crate-jmap-calendars-types/src/event.rs:43-44).
27    #[serde(skip_serializing_if = "Option::is_none")]
28    pub id: Option<Id>,
29
30    /// Display name to use when adding this identity as a participant
31    /// (default `""`).
32    #[serde(default)]
33    pub name: String,
34
35    /// The URI that represents this participant for iTIP scheduling
36    /// (e.g. `"mailto:user@example.com"`).
37    pub calendar_address: String,
38
39    /// Server-set; `true` for at most one of the identities the user can
40    /// see in the account (§3).
41    pub is_default: bool,
42
43    /// Catch-all for vendor / site / private extension fields not covered
44    /// by the typed fields above. Preserves unknown fields across
45    /// deserialize/serialize round-trip per workspace extras-preservation
46    /// policy (see workspace AGENTS.md).
47    #[serde(flatten, default, skip_serializing_if = "serde_json::Map::is_empty")]
48    pub extra: serde_json::Map<String, serde_json::Value>,
49}