pub struct I18nSet { /* private fields */ }Expand description
How a Foo/set handler treats locale and localizations
(draft-atwood-jmap-updates-00 §3, §4.1).
Build one per request with I18nSet::new. Call
I18nSet::check_create on each create object and
I18nSet::check_patch on each update patch before handing them to the
backend, and I18nSet::echo on each object returned in created or
updated. The checks that need the patched object (a key equal to the
new locale, pruning) run in the backend through localized_update,
inside the same atomic update.
Implementations§
Source§impl I18nSet
impl I18nSet
Sourcepub fn new<O: JmapObject>(using: &[String], info: Option<&I18nInfo>) -> Self
pub fn new<O: JmapObject>(using: &[String], info: Option<&I18nInfo>) -> Self
The handling for type O, given the request’s using and the
account’s JmapAccounts::i18n_info.
Sourcepub fn check_create(
&self,
create: &mut Map<String, Value>,
) -> Result<(), Box<SetError>>
pub fn check_create( &self, create: &mut Map<String, Value>, ) -> Result<(), Box<SetError>>
Check a create object and fold its tags to canonical case.
Without the capability in use, naming locale or localizations
is invalidProperties (§3). With it, locale must be null or a
language tag, and localizations must follow §4.1
(check_localizations) and the account’s
I18nInfo::max_localizations. Length and syntax limits of the
defining specification on localized values are the type’s handler’s
to apply.
§Errors
An invalidProperties SetError naming locale or
localizations.
Sourcepub fn check_patch(
&self,
patch: &Map<String, Value>,
) -> Result<(), Box<SetError>>
pub fn check_patch( &self, patch: &Map<String, Value>, ) -> Result<(), Box<SetError>>
Check an update patch before the backend applies it.
Without the capability in use, a patch path into locale or
localizations is invalidProperties (§3). Everything that depends
on the patched object is localized_update’s.
§Errors
An invalidProperties SetError naming locale or
localizations.