go-webdav
go-webdav copied to clipboard
return a nil CalendarCompRequest when empty
Hi. I'm trying to use QueryCalendar with iCloud calendars but cannot do it without these changes. If a CalendarCompRequest if not included in a calendar query, it will be initialized as a blank/empty struct. The code now tests if the CalendarCompRequest is empty and if so returns a nil comp so that the calendarDataReq can be sent properly without a Comp section.
The idea looks good to me. Maybe we could instead change the CalendarCompRequest fields to be pointers, but not sure it's worth it.
Hmm. Actually, why is CalendarCompRequest.Name not set to VCALENDAR? The RFC seems to indicate that <filter> MUST have a <comp-filter>, and that <comp-filter> MUST have a name attribute.
For reference, here's how I've been using QueryCalendar: https://git.sr.ht/~emersion/alps/tree/master/plugins/caldav/routes.go#L104
This package is in dire need of examples.
The idea looks good to me. Maybe we could instead change the
CalendarCompRequestfields to be pointers, but not sure it's worth it.
That would also work
Hmm. Actually, why is
CalendarCompRequest.Namenot set toVCALENDAR? The RFC seems to indicate that<filter>MUST have a<comp-filter>, and that<comp-filter>MUST have anameattribute.
Thoughts?