Skip to main content

handle_task_set

Function handle_task_set 

Source
pub async fn handle_task_set<B: TasksBackend>(
    backend: &B,
    caller: &B::CallerCtx,
    created_ids: &BTreeMap<Id, Id>,
    args: Value,
    using: &[String],
) -> Result<HandlerOutput, JmapError>
Expand description

Handle a Task/set method call (draft-tasks-06 §4.7).

args is the RFC 8620 §5.3 /set request shape (accountId, optional ifInState, optional create / update / destroy maps); the returned Value is the §5.3 /set response shape (accountId, oldState, newState, plus the per-operation result maps).

isDraft immutability: this handler does not check isDraft. The backend’s crate::TasksBackend::update_object MUST reject a patch that sets isDraft: true on a Task whose stored value is not true with invalidProperties, atomically with the write; the rejection is reported in notUpdated.

taskListId references: a #creationId value on create or update names a TaskList created earlier in the request and resolves against created_ids (pass jmap_server::CallContext::created_ids; RFC 8620 §5.3). An unknown reference is invalidProperties naming taskListId.

using is the request’s capability list (pass jmap_server::CallContext::using): a write to metadata or privateMetadata without urn:ietf:params:jmap:metadata is invalidProperties (draft-ietf-jmap-metadata-05 §3), as is null for either in a create (-05 §3.2). The backend validates the rest.

Returns (response_args, extra_invocations). The extra list is always empty.

§Errors

Returns a method-level JmapError:

  • invalidArguments when accountId is missing or not a valid Id, or when create, update or destroy is malformed;
  • accountNotFound when the backend does not know accountId;
  • requestTooLarge when create, update and destroy together hold more than maxObjectsInSet objects;
  • stateMismatch when ifInState is not the current state;
  • serverFail when the backend fails.

A create, update or destroy that fails on its own is a SetError in the response, not an Err.