Skip to main content

ChangesResponse

Struct ChangesResponse 

Source
#[non_exhaustive]
pub struct ChangesResponse { pub account_id: Id, pub old_state: State, pub new_state: State, pub has_more_changes: bool, pub created: Vec<Id>, pub updated: Vec<Id>, pub destroyed: Vec<Id>, pub updated_properties: Option<Vec<String>>, pub extra: Map<String, Value>, }
Expand description

RFC 8620 §5.2 — Foo/changes response shape.

Reports the ids of objects created, updated, or destroyed since old_state. If has_more_changes is true, the client should call /changes again with since_state = new_state to retrieve the next page; otherwise new_state is the current state.

§Extension fields and the foundation-coupling trade-off

Some JMAP data-type extensions add an updatedProperties field to their /changes response shape:

  • RFC 8621 §2.2 (Mailbox/changes): set when only totalEmails / unreadEmails / totalThreads / unreadThreads changed.
  • RFC 9425 §5 (Quota/changes): set when only the used property changed.

For all other /changes methods (RFC 8621 §3.2 Thread/changes, §4.3 Email/changes, plus every extension /changes method not listed above) the server omits the field, and clients deserialize it as None.

Architectural decision (bd:JMAP-6xs8.5). Carrying updatedProperties on this base type, rather than on per-extension MailboxChangesResponse / QuotaChangesResponse newtypes, is a deliberate workspace trade-off:

  • Chosen shape: one foundation ChangesResponse with an Option<Vec<String>> field that two extensions populate.
  • Alternative (a): ChangesResponse<Ext = ()> generic with a per-type extension struct. Rejected: would force every /changes handler in every extension server to thread the Ext type parameter, and the 30-crate canonical-template family would have to settle on a single way to express “no extension” vs “Mailbox extension” vs “Quota extension”.
  • Alternative (b): MailboxChangesResponse and QuotaChangesResponse as separate types in jmap-mail-types and a future jmap-quota-types, delegating to a shared base via composition. Rejected: would duplicate the seven base fields (accountId, oldState, newState, hasMoreChanges, three id vectors) at every extension type, and require parallel handler / parse / dispatch code.
  • Alternative (c): leave updatedProperties as an extras flatten entry that mail/quota types explicitly read via resp.extra.get("updatedProperties"). Rejected: loses typed access, and the field is RFC-defined (not vendor / site), so the extras pattern (workspace AGENTS.md “Extras-preservation policy”) is the wrong tool.

Drift risk acknowledged: every future /changes extension (jmap-sharing, jmap-tasks, etc.) will face pressure to add its own typed field here “for parity”. Each such field would extend this foundation type by one more extension-specific column. Cautionary precedent: bd:JMAP-kt5k removed eight cap-advertising fields from the chat capability after they accreted there for the same parity-pressure reason. New /changes extension fields land here only when the field is RFC-defined and the alternative shapes above have been re-evaluated against the new use case; a vendor extension belongs in the extras catch-all, not on the typed surface.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§account_id: Id

The account the response refers to.

§old_state: State

The state token the client passed in.

§new_state: State

The current (or next-page) state token.

§has_more_changes: bool

true if there are more changes the client must page through.

§created: Vec<Id>

Ids of objects created since old_state.

§updated: Vec<Id>

Ids of objects updated since old_state.

§destroyed: Vec<Id>

Ids of objects destroyed since old_state.

§updated_properties: Option<Vec<String>>

Optional list of property names that changed (RFC 8621 §2.2, RFC 9425 §5). Servers MAY set this for Mailbox/changes and Quota/changes responses when the only changes are to a small known subset of properties; clients can then back-reference /updatedProperties into a follow-up Mailbox/get or Quota/get to fetch only those fields. For all other /changes methods the field is absent on the wire and None here.

§extra: Map<String, Value>

Catch-all for vendor / site / private extension fields not covered by the typed fields above. Preserves unknown fields across deserialize/serialize round-trip per workspace extras-preservation policy (see workspace AGENTS.md).

Trait Implementations§

Source§

impl Clone for ChangesResponse

Source§

fn clone(&self) -> ChangesResponse

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChangesResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ChangesResponse

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ChangesResponse

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.