30 Commits

Author SHA1 Message Date
Robin van der Vleuten
8ddea980d4 caldav: make malformed calendar data non-fatal in client
QueryCalendar and MultiGetCalendar returned no objects at all when the
calendar-data of one of them failed to parse. Skip that object instead
and report its error, with its href, in the returned error, like
multistatus errors since 71ae569.
2026-11-12 22:07:44 +01:00
Henry Stern
4ce863ae71 caldav, carddav: support If-Match/If-None-Match on client PUT
PutCalendarObject and PutAddressObject sent no conditional request
headers, so a client could not perform an optimistic-concurrency write
(overwrite only if the resource still carries an expected ETag). Add an
options parameter to both, reusing the existing server-side
PutCalendarObjectOptions / PutAddressObjectOptions types so the client
and Backend interface mirror each other. A nil opts preserves the prior
unconditional behaviour; a non-nil opts sets If-Match / If-None-Match.

Signed-off-by: Henry Stern <henry@stern.ca>
Assisted-by: Claude Opus 4.8 <noreply@anthropic.com>
Closes: https://github.com/emersion/go-webdav/issues/130
2026-11-12 17:55:00 +01:00
Henry Stern
c16f8a9a13 caldav: decode inline calendar-data in SyncCollection responses
SyncCollection already requests calendar-data via the query's CompRequest, but
only the ETag and last-modified props were decoded, so a caller had to follow
every sync with a multiget even when the server (e.g. Radicale, SOGo) returned
the calendar object inline in the sync-collection response.

Decode the calendar-data prop into CalendarObject.Data when it is present; when
the server omits it, Data is left nil and the caller fetches it with a multiget
as before. Backward compatible.

Signed-off-by: Henry Stern <henry@stern.ca>
Assisted-by: Claude (Anthropic) <noreply@anthropic.com>
2026-06-28 12:28:23 +02:00
Gabor Pihaj
1916c2d907 caldav: get calendar data using PROPFIND
This change adds FindCalendar function to the caldav client. It can be
used to get calendar information without loading all the events, once the
path of the calendar is known.
2025-12-21 13:14:06 +01:00
Gabor Pihaj
8888fdf9b0
caldav: don't generate comp tag if it's empty
Closes: https://github.com/emersion/go-webdav/issues/196
2025-12-18 14:42:06 +01:00
LQR471814
82bb8a7aea caldav: add sync-collection functionality 2025-12-18 14:37:52 +01:00
Simon Ser
71ae569e8a caldav: make multistatus errors non-fatal in client 2025-10-30 20:30:38 +01:00
Jonathan Liu
75c185517e caldav: add expand request to client 2025-03-16 15:41:33 +01:00
Timo Furrer
002c347f47
caldav: support prop-filter in client requests
This change set adds support for correctly encoding the prop filters
into calendar requests.

Example Request with this change set:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<calendar-query
	xmlns="urn:ietf:params:xml:ns:caldav">
	<prop
		xmlns="DAV:">
		<calendar-data
			xmlns="urn:ietf:params:xml:ns:caldav">
			<comp
				xmlns="urn:ietf:params:xml:ns:caldav" name="VCALENDAR">
				<comp
					xmlns="urn:ietf:params:xml:ns:caldav" name="VEVENT">
					<prop
						xmlns="urn:ietf:params:xml:ns:caldav" name="UID">
					</prop>
					<prop
						xmlns="urn:ietf:params:xml:ns:caldav" name="ATTENDEE">
					</prop>
				</comp>
			</comp>
		</calendar-data>
		<getlastmodified
			xmlns="DAV:">
		</getlastmodified>
		<getetag
			xmlns="DAV:">
		</getetag>
	</prop>
	<filter
		xmlns="urn:ietf:params:xml:ns:caldav">
		<comp-filter
			xmlns="urn:ietf:params:xml:ns:caldav" name="VCALENDAR">
			<comp-filter
				xmlns="urn:ietf:params:xml:ns:caldav" name="VEVENT">
				<prop-filter
					xmlns="urn:ietf:params:xml:ns:caldav" name="UID">
					<text-match
						xmlns="urn:ietf:params:xml:ns:caldav">5bf5ee84-a9cf-4319-9def-437b00e2be8d
					</text-match>
				</prop-filter>
			</comp-filter>
		</comp-filter>
	</filter>
</calendar-query
```
2025-02-21 14:22:01 +01:00
Timo Furrer
172968d292 Fix service name for CalDav/CardDav endpoint discovery
This change set fixes the service names used by the endpoint discovery
for CalDav and CardDav.
2025-02-21 10:50:48 +01:00
Simon Ser
7e076258d6 caldav: add DiscoverContextURL 2023-12-27 23:16:49 +01:00
Simon Ser
379a418130 Add context for clients 2023-12-19 21:29:37 +01:00
Simon Ser
0e58dbb003 caldav, carddav: take header when populating object
References: https://github.com/emersion/go-webdav/pull/134
2023-12-18 18:18:56 +01:00
Simon Ser
fc4ea1aae2 caldav, carddav: drop unnecessary nil check
Closes: https://github.com/emersion/go-webdav/issues/92
2023-08-25 13:35:33 +02:00
Simon Ser
d7891ce50c internal: fix XML element struct naming
We were sometimes using TitleCase, sometimes Lowercase. Let's align
on the idiomatic Go naming and pick TitleCase everywhere.
2022-05-31 23:04:42 +02:00
Simon Ser
9ed4abce57 caldav: add Content-Length support to client
Follow-up for https://github.com/emersion/go-webdav/pull/83.
2022-05-24 10:47:40 +02:00
Konstantinos Koukas
25dfbaf95e caldav: add supported-calendar-component-set field 2022-04-12 09:38:26 +02:00
Simon Ser
a4e0e81003
caldav: add Client.MultiGetCalendar 2020-05-13 16:45:25 +02:00
Simon Ser
5328b4c493
caldav: set Depth to 1 for calendar-query REPORT requests
SabreDAV chokes on an unset Depth header field.
2020-05-13 15:06:16 +02:00
Simon Ser
514296664c
caldav: upgrade to latest go-ical API 2020-02-24 21:16:45 +01:00
Simon Ser
4c419a961d
caldav: add Client.GetCalendarObject 2020-02-24 18:19:39 +01:00
Simon Ser
7bb9b3aa0b
caldav: add Client.PutCalendarObject 2020-02-24 18:13:24 +01:00
Simon Ser
07d4dfae5e
Use new ical library 2020-02-24 17:52:25 +01:00
Simon Ser
ddf2a85958
Introduce HTTPClient, remove Client.SetBasicAuth 2020-02-19 16:02:49 +01:00
Simon Ser
baf63fb1b7
caldav: parse iCal data 2020-02-05 18:05:48 +01:00
Simon Ser
4eb8396edb
caldav: add support for time filters in client 2020-02-05 17:36:18 +01:00
Simon Ser
25678476db
internal: add ETag 2020-02-03 21:48:31 +01:00
Simon Ser
ca51e9427a
caldav: add Client.QueryCalendar 2020-02-03 17:26:55 +01:00
Simon Ser
bae7dcce43
caldav: add Client.FindCalendars 2020-01-30 13:51:02 +01:00
Simon Ser
6aea0eda2d
caldav: add Client boilerplate 2020-01-30 13:18:05 +01:00