ExDav.CardDav.XML (ExDav v0.4.9)

Copy Markdown View Source

XML response builders and small request parsers for the CardDAV endpoints. Generates Multi-Status (RFC 4918) responses with the CardDAV (RFC 6352) namespace extensions.

Summary

Functions

Render a Multi-Status XML document from a list of <response> elements.

Parse an addressbook-query body for prop-filters. Returns a map with

Parse MKCOL / MKCALENDAR-style body for displayname / description.

Parse an addressbook-multiget body to extract the list of <href> values.

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 whether address-data was requested.

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

multistatus(responses, extra \\ [])

Render a Multi-Status XML document from a list of <response> elements.

parse_addressbook_query(body)

Parse an addressbook-query body for prop-filters. Returns a map with:

  • :fn_match — text-match value for FN, or nil
  • :email_match — text-match value for EMAIL, or nil
  • :any_match — text-match with param-filter=any, or nil

parse_mkcol(body)

Parse MKCOL / MKCALENDAR-style body for displayname / description.

parse_multiget_hrefs(body)

Parse an addressbook-multiget body to extract the list of <href> values.

parse_proppatch(body)

Parse PROPPATCH body — best-effort for displayname / description.

parse_sync_collection(body)

Parse a sync-collection REPORT body. Returns the integer version encoded in the sync-token (or nil for an empty/initial token) and whether address-data was requested.

response(href, props_with_status)

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>.

response_status(href, status)

Build a deletion-style <d:response> (no <d:propstat>, just a top-level <d:status>). Used by sync-collection to signal removed resources.