Skip to main content

jmap_contacts_types/
capability.rs

1//! RFC 9610 §1.4 — JMAP Contacts capability objects.
2//!
3//! Provides [`ContactsCapability`] (session-level, empty object) and
4//! [`ContactsAccountCapability`] (account-level, with server limits).
5
6use serde::{Deserialize, Serialize};
7
8/// JMAP Contacts capability URI.
9///
10/// This is the key used in both the session `capabilities` object and in an
11/// account's `accountCapabilities` object.
12pub const JMAP_CONTACTS_URI: &str = "urn:ietf:params:jmap:contacts";
13
14/// Session-level contacts capability (RFC 9610 §1.4.1).
15///
16/// The value of the `urn:ietf:params:jmap:contacts` property in the JMAP
17/// Session `capabilities` object is an empty JSON object `{}`.
18#[non_exhaustive]
19#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
20pub struct ContactsCapability {}
21
22/// Account-level contacts capability (RFC 9610 §1.4.1).
23///
24/// The value of `urn:ietf:params:jmap:contacts` in an account's
25/// `accountCapabilities` object.  Contains server limits and permissions for
26/// the account.
27#[non_exhaustive]
28#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
29#[serde(rename_all = "camelCase")]
30pub struct ContactsAccountCapability {
31    /// Maximum number of AddressBooks that can be assigned to a single
32    /// ContactCard.  `null` means no limit.
33    pub max_address_books_per_card: Option<u32>,
34    /// `true` if the user may create an AddressBook in this account.
35    pub may_create_address_book: bool,
36}