jmap-metadata-client
What it is
Pure, stateless client-side helpers for the JMAP Object Metadata
extension (draft-ietf-jmap-metadata-02). No SessionClient, no
extension trait, no network I/O. Depends only on
jmap-metadata-types and serde_json.
What it's for
draft-02 has no standalone Metadata object and no Metadata/*
methods. Metadata is read and written through metadata /
privateMetadata properties on each opted-in data type, using that
type's own methods (§3). Use these helpers alongside the typed
extension clients (jmap-mail-client, jmap-calendars-client, …):
| Helper | Use | Draft § |
|---|---|---|
METADATA_PROPERTY, PRIVATE_METADATA_PROPERTY |
names for a Foo/get properties list |
§2, §3.1 |
IGNORE_METADATA_ONLY_CHANGES |
Foo/changes request argument name |
§3.3 |
is_metadata_property, is_metadata_only_change |
classify a Foo/changes updatedProperties value |
§3.3 |
metadata_exists_condition, private_metadata_exists_condition |
metadataExists / privateMetadataExists filter conditions |
§3.5 |
metadata_text_contains_condition, private_metadata_text_contains_condition |
metadataTextContains / privateMetadataTextContains |
§3.5 |
metadata_text_equals_condition, private_metadata_text_equals_condition |
metadataTextEquals / privateMetadataTextEquals |
§3.5 |
JMAP_METADATA_URI, DataTypeMetadataInfo, MetadataTextMatch, and
the namespace validators are re-exported from jmap-metadata-types.
How to use
use ;
use json;
// Fetch an object's shared metadata alongside other properties (§3.1).
let properties = vec!;
assert!;
// Compose a metadata condition with the type's own conditions (§3.5).
// An extension client's `*_query` method takes it as
// `jmap_types::query::Filter::Condition(filter)`; for a typed tree, use
// `jmap_metadata_types::WithMetadata<C>` leaves instead.
let filter = json!;
assert_eq!;
Gotchas
- Pinned to draft-02. draft-02 was a complete rewrite of -01; later revisions (or a final RFC) may change the wire shape again.
- Capability-dependent conditions. Any
privateMetadata*condition is rejected withunsupportedFilterwhen the data type'ssupportsPrivateis false; servers MAY reject the four text-match conditions withunsupportedFilterand clients SHOULD be prepared to fall back to a client-side scan (§3.5). CheckDataTypeMetadataInfoin the account capability first. - Typed filters. The extension-types
FilterConditionstructs carry no metadata fields (bd JMAP-ua37.4). The extension clients'*_query/*_query_changesmethods take a genericjmap_types::query::Filter<C>, so a typed tree usesjmap_metadata_types::WithMetadata<C>leaves and an untyped one is passed asFilter::Condition(value). The chat client's*_querymethods build their filter from*QueryInputfields and cannot carry metadata conditions; its*_query_changesmethods can.
Migration from 0.1 (draft-01)
The 0.1 crate exposed JmapMetadataExt, SessionClient,
metadata_get, metadata_changes, metadata_set, metadata_query,
metadata_query_changes, and their parameter structs. All are removed
in 0.2.
Crate family
jmap-metadata-types
└── jmap-metadata-client ← this crate
References
- draft-ietf-jmap-metadata-02 — JMAP Object Metadata (normative
for property names, the
/changesargument, and filter conditions). - RFC 8620 — JMAP Core (
/get,/changes,/query, filter operators).