pub struct MetadataProjection { /* private fields */ }Expand description
How a Foo/get handler returns metadata and privateMetadata
(draft-ietf-jmap-metadata-05 §2 and §3.1).
Build one per request with MetadataProjection::new, then call
MetadataProjection::apply on every returned object.
Implementations§
Source§impl MetadataProjection
impl MetadataProjection
Sourcepub fn new(
properties: Option<&[String]>,
default_includes: bool,
using: &[String],
info: Option<&DataTypeMetadataInfo>,
) -> Result<Self, JmapError>
pub fn new( properties: Option<&[String]>, default_includes: bool, using: &[String], info: Option<&DataTypeMetadataInfo>, ) -> Result<Self, JmapError>
Build the projection for one Foo/get request.
properties is the request’s properties (None for the default
list), default_includes is false for Email/get, whose
“default property list … is unchanged” (-05 §3.1), and true for
every other type; info is the type’s DataTypeMetadataInfo
(JmapBackend::metadata_info),
None when the type is not listed and so “does not gain the
metadata or privateMetadata properties” (-05 §1.2.1). The rules:
- Default list: both properties with the capability in
using(“the server MUST include metadata and, where supportsPrivate is true, privateMetadata”), neither without it (“not default properties of Foo/get”) (-05 §3, §3.1). - A root name returns the whole property, with or without the capability (“still returned when requested by name”).
- With the capability,
metadata/<namespace>andprivateMetadata/<namespace>return only the stored namespaces named; several combine by union and a root entry supersedes them. A namespace with no stored data is left out, which covers “A subselector naming a namespace that is not supported … MUST be silently omitted … unless the object has data stored under that namespace”. Without the capability these entries are ignored like any other unknown property. privateMetadatais never returned whensupportsPrivateis false (-05 §2: “this property MUST NOT be returned”).
§Errors
invalidArguments for an entry that begins with metadata/ or
privateMetadata/ and is not followed by a namespace identifier
(-05 §3.1: “Any other properties entry beginning with metadata/ or
privateMetadata/ MUST be rejected with an “invalidArguments”
method-level error“).