Talk to a CalDAV server (RFC 4791), storing calendar resources of one component type, such as VTODO.
A connection is a map described by the ::connection spec:
:url The server's CalDAV URL, e.g. https://example.com/dav.php/,
or just its root, e.g. https://example.com/, in which case
the /.well-known/caldav URL (RFC 6764) is tried as well
:username String
:password String
:calendar Optional. The ID of the calendar to fetch and create
resources in: the last segment of a calendar's :url as
returned by calendars, e.g. tasks for
https://example.com/dav.php/calendars/me/tasks/. Only needed
when more than one calendar can hold the component
A component describes the type of resource stored:
:name The iCalendar component's name, e.g. "VTODO" :spec The spec a resource must satisfy to be written :parse A function of iCalendar text to a resource, or nil when the text holds none :serialize A function of a resource to iCalendar text :noun What the resource is called in error messages, e.g. "task"
Resources come back with the :url of the CalDAV resource holding them and its :etag, which updating or deleting them requires.
Failures throw an ex-info whose data has a :type of:
::invalid-connection The connection map isn't a valid ::connection ::invalid-resource The resource can't be written: it doesn't satisfy the component's :spec, or it's being updated or deleted without the :url and :etag it was fetched with ::authentication-failed The server rejected the credentials (401) ::unreachable The server couldn't be reached ::conflict The resource was changed on the server since it was fetched, or one already exists where a new one was being created (412) ::calendar-not-found No calendar that can hold the component matches the connection's :calendar, or there's none at all ::ambiguous-calendar The connection has no :calendar and more than one calendar can hold the component ::unexpected-response The server responded with something else
Talk to a CalDAV server (RFC 4791), storing calendar resources of one
component type, such as VTODO.
A connection is a map described by the `::connection` spec:
:url The server's CalDAV URL, e.g. https://example.com/dav.php/,
or just its root, e.g. https://example.com/, in which case
the /.well-known/caldav URL (RFC 6764) is tried as well
:username String
:password String
:calendar Optional. The ID of the calendar to fetch and create
resources in: the last segment of a calendar's :url as
returned by `calendars`, e.g. tasks for
https://example.com/dav.php/calendars/me/tasks/. Only needed
when more than one calendar can hold the component
A component describes the type of resource stored:
:name The iCalendar component's name, e.g. "VTODO"
:spec The spec a resource must satisfy to be written
:parse A function of iCalendar text to a resource, or nil when the
text holds none
:serialize A function of a resource to iCalendar text
:noun What the resource is called in error messages, e.g. "task"
Resources come back with the :url of the CalDAV resource holding them and
its :etag, which updating or deleting them requires.
Failures throw an ex-info whose data has a :type of:
::invalid-connection The connection map isn't a valid ::connection
::invalid-resource The resource can't be written: it doesn't
satisfy the component's :spec, or it's being
updated or deleted without the :url and :etag it
was fetched with
::authentication-failed The server rejected the credentials (401)
::unreachable The server couldn't be reached
::conflict The resource was changed on the server since it
was fetched, or one already exists where a new
one was being created (412)
::calendar-not-found No calendar that can hold the component matches
the connection's :calendar, or there's none at
all
::ambiguous-calendar The connection has no :calendar and more than
one calendar can hold the component
::unexpected-response The server responded with something else(calendars conn component)Discovers the calendars on the server that can hold the component, returning a sequence of maps with the calendar's :url and :display-name.
Discovers the calendars on the server that can hold the component, returning a sequence of maps with the calendar's :url and :display-name.
(delete conn component {:keys [url etag] :as resource})Deletes the fetched resource and returns nil. Throws a ::conflict if it was changed on the server since it was fetched, leaving it in place. One that's already gone is fine, since that's what was wanted.
Deletes the fetched resource and returns nil. Throws a ::conflict if it was changed on the server since it was fetched, leaving it in place. One that's already gone is fine, since that's what was wanted.
(fetch conn component url)Fetches the resource at the URL (the :url of one returned by fetch-all),
with its :url and :etag attached, or returns nil if there's none there.
Fetches the resource at the URL (the :url of one returned by `fetch-all`), with its :url and :etag attached, or returns nil if there's none there.
(fetch-all conn component)Fetches every resource in the calendar matching the connection's :calendar or, when it has none, the only calendar that can hold the component.
Fetches every resource in the calendar matching the connection's :calendar or, when it has none, the only calendar that can hold the component.
(save conn component resource)Creates the resource when it has no :url or :etag, or else updates it, and returns it with its :url and new :etag. Updating throws a ::conflict if it was changed or deleted on the server since it was fetched, leaving the server's copy alone.
Creates the resource when it has no :url or :etag, or else updates it, and returns it with its :url and new :etag. Updating throws a ::conflict if it was changed or deleted on the server since it was fetched, leaving the server's copy alone.
(validate-connection conn)Throws an ::invalid-connection unless the connection is a valid ::connection.
Throws an ::invalid-connection unless the connection is a valid ::connection.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |