Skip to main content

handle_task_get

Function handle_task_get 

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

Handle a Task/get method call (draft-tasks-06 §4.5).

args is the RFC 8620 §5.1 /get request shape (accountId, optional ids, optional properties); the returned Value is the §5.1 /get response shape (accountId, state, list, notFound).

utcStart and utcDue are returned only when properties names them: “This is not included by default and must be requested explicitly” (draft-tasks-06 §4). For each requested one, TasksBackend::compute_utc_times is called per returned task and the value is UTCDate|null (jmapio/jmap PR #464): null when the task has no start (for utcStart) or no due (for utcDue), the computed date otherwise. A task that has the local time but for which the backend returns None (it cannot convert, e.g. the default compute_utc_times) gets no key at all, since null would claim the local time is unset. The local-time inputs (start, due, timeZone, timeZones) are fetched for that even when properties leaves them out, and dropped again before the response, so only the requested properties are returned (RFC 8620 §5.1).

The timeZone argument (TimeZoneId, default "Etc/UTC"; jmapio/jmap #456, as CalendarEvent/get, draft-ietf-jmap-calendars-34 §5.7) is the zone for floating tasks: “Floating tasks will be interpreted as per the time zone given as a Task/get argument” (draft-tasks-06 §4). It is passed to compute_utc_times as tz_hint. A value that is neither a string nor null is invalidArguments.

using is the request’s capability list (pass jmap_server::CallContext::using). When the backend lists Task for draft-ietf-jmap-metadata-05 (JmapAccounts::metadata_info), metadata is returned as an object, by default only with urn:ietf:params:jmap:metadata in using, and with that capability properties may hold metadata/<namespace> subselectors (-05 §2, §3.1); see jmap_server::handle_get_with_metadata.

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 ids or properties is malformed, or timeZone is not a string;
  • accountNotFound when the backend does not know accountId;
  • requestTooLarge when ids holds more than maxObjectsInGet ids;
  • serverFail when the backend fails.