XML response builders and small request parsers for the CalDAV endpoints. Generates Multi-Status (RFC 4918) responses with the CalDAV (RFC 4791) and CalendarServer extensions.
Summary
Functions
Extract requested property element local names from a PROPFIND or
PROPPATCH body. Returns a list of {namespace, local_name} tuples.
Render a Multi-Status XML document from a list of <response> elements.
Parse a calendar-query body for a prop-filter[name=UID]/text-match
match. Returns {:uid, value} or :no_uid_filter. Also returns the
set of comp-filter component names found at the inner level
(e.g. ["VEVENT"]).
Parse MKCALENDAR body for displayname / description (best-effort).
Parse a calendar-multiget body to extract the list of <href> values.
Returns the list of requested property element names (as strings,
prefixed with d:/c:/cs: style tags) and a flag indicating whether
the request asked for <allprop> or <propname>. We keep parsing
minimal: anything not understood becomes a 404 Not Found propstat.
Parse PROPPATCH body — best-effort for displayname / description.
Parse a sync-collection REPORT body. Returns the integer version
encoded in the sync-token (or nil for an empty/initial token) and
the requested prop names (currently only used to decide whether to
return calendar-data).
Build a single <d:response> element. props_with_status is a list
of {status_string, [{prop_tag, attrs, children}]} tuples — each
group is wrapped in its own <d:propstat>.
Build a deletion-style <d:response> (no <d:propstat>, just a
top-level <d:status>). Used by sync-collection to signal removed
resources.
Functions
Extract requested property element local names from a PROPFIND or
PROPPATCH body. Returns a list of {namespace, local_name} tuples.
Render a Multi-Status XML document from a list of <response> elements.
Parse a calendar-query body for a prop-filter[name=UID]/text-match
match. Returns {:uid, value} or :no_uid_filter. Also returns the
set of comp-filter component names found at the inner level
(e.g. ["VEVENT"]).
Parse MKCALENDAR body for displayname / description (best-effort).
Parse a calendar-multiget body to extract the list of <href> values.
Returns the list of requested property element names (as strings,
prefixed with d:/c:/cs: style tags) and a flag indicating whether
the request asked for <allprop> or <propname>. We keep parsing
minimal: anything not understood becomes a 404 Not Found propstat.
Parse PROPPATCH body — best-effort for displayname / description.
Parse a sync-collection REPORT body. Returns the integer version
encoded in the sync-token (or nil for an empty/initial token) and
the requested prop names (currently only used to decide whether to
return calendar-data).
Build a single <d:response> element. props_with_status is a list
of {status_string, [{prop_tag, attrs, children}]} tuples — each
group is wrapped in its own <d:propstat>.
Build a deletion-style <d:response> (no <d:propstat>, just a
top-level <d:status>). Used by sync-collection to signal removed
resources.