Expand description
RFC 9610 + RFC 9553 data types for JMAP Contacts.
Provides AddressBook, AddressBookRights, ContactCard,
ContactCardFilterCondition, ContactCardComparator,
ContactsCapability, and ContactsAccountCapability.
This crate is types-only: no method handlers, no async, no network I/O.
It sits between jmap-types (shared JMAP base primitives) and the
server/client crates that consume these types.
All types implement serde::Serialize and serde::Deserialize with
the camelCase field names required by the JMAP wire format.
§JSContact sub-object types
The RFC 9553 JSContact sub-object types (Name, EmailAddress,
Phone, Address, etc.) live in the dedicated
jmap-jscontact-types crate and are re-exported here for caller
ergonomics. The ContactCard struct keeps its 22 sub-object fields
typed as Option<serde_json::Value> as the wire-format anchor — typed
access is opt-in via serde_json::from_value on a chosen field.
use jmap_contacts_types::{ContactCard, Name};
let card_json = serde_json::json!({
"name": {
"components": [
{ "kind": "given", "value": "Vincent" },
{ "kind": "surname", "value": "van Gogh" }
],
"isOrdered": true
}
});
let card: ContactCard = serde_json::from_value(card_json).unwrap();
let name: Name = serde_json::from_value(card.name.unwrap()).unwrap();
assert_eq!(name.components.unwrap()[0].value, "Vincent");§Example
use jmap_contacts_types::AddressBook;
let json = r#"{
"id": "ab1",
"name": "Personal",
"sortOrder": 0,
"isDefault": true,
"isSubscribed": true,
"shareWith": null,
"myRights": {
"mayRead": true,
"mayWrite": true,
"mayShare": true,
"mayDelete": false
}
}"#;
let ab: AddressBook = serde_json::from_str(json).unwrap();
assert_eq!(ab.name, "Personal");Re-exports§
pub use addressbook::AddressBook;pub use addressbook::AddressBookRights;pub use backend::AddressBookProperty;pub use backend::ContactCardProperty;pub use capability::ContactsAccountCapability;pub use capability::ContactsCapability;pub use capability::JMAP_CONTACTS_URI;pub use card::ContactCard;pub use card::ContactCardComparator;pub use card::ContactCardFilterCondition;pub use jmap_jscontact_types as jscontact;
Modules§
- addressbook
- RFC 9610 §2 — AddressBook object and component types.
- backend
- Property selector enums and
jmap_types::JmapObjectimpls for JMAP Contacts types. - capability
- RFC 9610 §1.4 — JMAP Contacts capability objects.
- card
- RFC 9610 §3 — ContactCard object and filter types.
Structs§
- Address
- A postal or geographic address (RFC 9553 §2.5.1).
- Address
Component - A single component of an
Address(RFC 9553 §2.5.1.2). - Anniversary
- A memorable date or event (RFC 9553 §2.8.1).
- Author
- The author of a
Note(RFC 9553 §2.8.3). - Calendar
- A calendaring resource (RFC 9553 §2.4.1).
- Crypto
Key - A cryptographic key or certificate associated with a Card (RFC 9553 §2.6.1). Extends the abstract Resource type.
- Directory
- A directory service associated with a Card (RFC 9553 §2.6.2).
- Email
Address - An email address (RFC 9553 §2.3.1).
- JsContact
Id - JSContact
Iddata type (RFC 9553 §1.4.1). - Language
Pref - A preferred language (RFC 9553 §2.3.4).
- Link
- A generic resource link associated with a Card (RFC 9553 §2.6.3).
- Media
- A media resource associated with a Card (RFC 9553 §2.6.4).
- Name
- The name of the entity represented by a Card (RFC 9553 §2.2.1).
- Name
Component - A single component of a
Name(RFC 9553 §2.2.1.2). - Nickname
- A nickname for the entity represented by a Card (RFC 9553 §2.2.2).
- Note
- A free-text note associated with a Card (RFC 9553 §2.8.3).
- Online
Service - An online service (messaging service, social media, etc.) (RFC 9553 §2.3.2).
- OrgUnit
- An organizational unit within an
Organization(RFC 9553 §2.2.3). - Organization
- A company or organization name associated with a Card (RFC 9553 §2.2.3).
- Partial
Date - A complete or partial Gregorian calendar date (RFC 9553 §2.8.1).
- Personal
Info - Personal information such as an expertise, hobby, or interest (RFC 9553 §2.8.4).
- Phone
- A phone number (RFC 9553 §2.3.3).
- Pronouns
- A pronouns entry (RFC 9553 §2.2.4).
- Relation
- A relationship to another Card (RFC 9553 §2.1.8).
- Scheduling
Address - An iTIP scheduling address (RFC 9553 §2.4.2).
- Speak
ToAs - How to address or refer to the entity represented by a Card (RFC 9553 §2.2.4).
- Timestamp
- A UTC point in time (RFC 9553 §2.8.1).
- Title
- A job title or functional position (RFC 9553 §2.2.5).
Enums§
- Anniversary
Date - The date value of an
Anniversary— either aPartialDateor aTimestamp(RFC 9553 §2.8.1).