Skip to main content

Crate jmap_metadata_types

Crate jmap_metadata_types 

Source
Expand description

JMAP Object Metadata extension data types.

Implements the data types defined in draft-ietf-jmap-metadata-04. Types only — no method handlers, no async, no network I/O.

§Architecture change from -01 to -02

Since -02, the draft has no standalone Metadata object type. Instead, each listed data type gains metadata (shared) and privateMetadata (per-user) properties — plain String[Object] maps keyed by namespace identifier.

This crate provides the helper types that consumers need:

All public types and functions are re-exported at the crate root.

§Example

use jmap_metadata_types::{DataTypeMetadataInfo, is_valid_namespace};

// Server advertises per-type metadata capability
let json = r#"{
    "namespaces": ["photography"],
    "supportsVendorNamespaces": false,
    "supportsPrivate": false,
    "maxDepth": 3
}"#;
let info: DataTypeMetadataInfo = serde_json::from_str(json).unwrap();
assert_eq!(info.namespaces, vec!["photography"]);
assert_eq!(info.max_depth, Some(3));

// Validate namespace identifiers
assert!(is_valid_namespace("photography"));       // registered
assert!(is_valid_namespace("acme.example.com"));  // vendor domain
assert!(!is_valid_namespace(""));                 // empty

Structs§

DataTypeMetadataInfo
Per-data-type metadata capability advertisement (draft-ietf-jmap-metadata-04 §1.2.1).
MetadataTextMatch
Value shape for the text-matching metadata filter conditions (draft-ietf-jmap-metadata-04 §3.6).
WithMetadata
A per-type FilterCondition extended with the six draft-ietf-jmap-metadata-04 §3.6 condition fields.

Constants§

JMAP_METADATA_URI
The JMAP capability URI for the Metadata extension (draft-ietf-jmap-metadata-04 §1.2.1).

Functions§

is_registered_namespace
Returns true if name is a valid registered namespace identifier (draft-ietf-jmap-metadata-04 §2.1).
is_valid_namespace
Returns true if name is a valid namespace identifier of either kind (registered name or vendor domain name).
is_vendor_namespace
Returns true if name is a valid vendor (domain-name) namespace identifier (draft-ietf-jmap-metadata-04 §2.1).