Documentation ¶
Overview ¶
Package caldav provides a client and server CalDAV implementation.
CalDAV is defined in RFC 4791.
Index ¶
- Variables
- func DiscoverContextURL(ctx context.Context, domain string) (string, error)
- func Match(query CompFilter, co *CalendarObject) (matched bool, err error)
- func NewCalendarHomeSet(path string) webdav.BackendSuppliedHomeSet
- func NewPreconditionError(err PreconditionType) error
- func ValidateCalendarObject(cal *ical.Calendar) (eventType string, uid string, err error)
- type Backend
- type Calendar
- type CalendarCompRequest
- type CalendarMultiGet
- type CalendarObject
- type CalendarQuery
- type Client
- func (c *Client) FindCalendarHomeSet(ctx context.Context, principal string) (string, error)
- func (c *Client) FindCalendars(ctx context.Context, calendarHomeSet string) ([]Calendar, error)
- func (c *Client) GetCalendarObject(ctx context.Context, path string) (*CalendarObject, error)
- func (c *Client) MultiGetCalendar(ctx context.Context, path string, multiGet *CalendarMultiGet) ([]CalendarObject, error)
- func (c *Client) PutCalendarObject(ctx context.Context, path string, cal *ical.Calendar) (*CalendarObject, error)
- func (c *Client) QueryCalendar(ctx context.Context, calendar string, query *CalendarQuery) ([]CalendarObject, error)
- type CompFilter
- type Handler
- type ParamFilter
- type PreconditionType
- type PropFilter
- type PutCalendarObjectOptions
- type TextMatch
Constants ¶
This section is empty.
Variables ¶
var CapabilityCalendar = webdav.Capability("calendar-access")
Functions ¶
func DiscoverContextURL ¶
DiscoverContextURL performs a DNS-based CardDAV service discovery as described in RFC 6352 section 11. It returns the URL to the CardDAV server.
func Match ¶
func Match(query CompFilter, co *CalendarObject) (matched bool, err error)
Match reports whether the provided CalendarObject matches the query.
func NewCalendarHomeSet ¶
func NewCalendarHomeSet(path string) webdav.BackendSuppliedHomeSet
func NewPreconditionError ¶
func NewPreconditionError(err PreconditionType) error
func ValidateCalendarObject ¶
ValidateCalendarObject checks the validity of a calendar object according to the contraints layed out in RFC 4791 section 4.1 and returns the only event type and UID occuring in this calendar, or an error if the calendar could not be validated.
Types ¶
type Backend ¶
type Backend interface { CalendarHomeSetPath(ctx context.Context) (string, error) ListCalendars(ctx context.Context) ([]Calendar, error) GetCalendar(ctx context.Context, path string) (*Calendar, error) GetCalendarObject(ctx context.Context, path string, req *CalendarCompRequest) (*CalendarObject, error) ListCalendarObjects(ctx context.Context, path string, req *CalendarCompRequest) ([]CalendarObject, error) QueryCalendarObjects(ctx context.Context, query *CalendarQuery) ([]CalendarObject, error) PutCalendarObject(ctx context.Context, path string, calendar *ical.Calendar, opts *PutCalendarObjectOptions) (loc string, err error) DeleteCalendarObject(ctx context.Context, path string) error webdav.UserPrincipalBackend }
Backend is a CalDAV server backend.
type CalendarCompRequest ¶
type CalendarCompRequest struct { Name string AllProps bool Props []string AllComps bool Comps []CalendarCompRequest }
type CalendarMultiGet ¶
type CalendarMultiGet struct { Paths []string CompRequest CalendarCompRequest }
type CalendarObject ¶
type CalendarObject struct { Path string ModTime time.Time ContentLength int64 ETag string Data *ical.Calendar }
func Filter ¶
func Filter(query *CalendarQuery, cos []CalendarObject) ([]CalendarObject, error)
Filter returns the filtered list of calendar objects matching the provided query. A nil query will return the full list of calendar objects.
type CalendarQuery ¶
type CalendarQuery struct { CompRequest CalendarCompRequest CompFilter CompFilter }
type Client ¶
Client provides access to a remote CardDAV server.
func (*Client) FindCalendarHomeSet ¶
func (*Client) FindCalendars ¶
func (*Client) GetCalendarObject ¶
func (*Client) MultiGetCalendar ¶
func (c *Client) MultiGetCalendar(ctx context.Context, path string, multiGet *CalendarMultiGet) ([]CalendarObject, error)
func (*Client) PutCalendarObject ¶
func (*Client) QueryCalendar ¶
func (c *Client) QueryCalendar(ctx context.Context, calendar string, query *CalendarQuery) ([]CalendarObject, error)
type CompFilter ¶
type CompFilter struct { Name string IsNotDefined bool Start, End time.Time Props []PropFilter Comps []CompFilter }
type ParamFilter ¶
type PreconditionType ¶
type PreconditionType string
https://datatracker.ietf.org/doc/html/rfc4791#section-5.3.2.1
const ( PreconditionNoUIDConflict PreconditionType = "no-uid-conflict" PreconditionSupportedCalendarData PreconditionType = "supported-calendar-data" PreconditionSupportedCalendarComponent PreconditionType = "supported-calendar-component" PreconditionValidCalendarData PreconditionType = "valid-calendar-data" PreconditionValidCalendarObjectResource PreconditionType = "valid-calendar-object-resource" PreconditionCalendarCollectionLocationOk PreconditionType = "calendar-collection-location-ok" PreconditionMaxResourceSize PreconditionType = "max-resource-size" PreconditionMinDateTime PreconditionType = "min-date-time" PreconditionMaxDateTime PreconditionType = "max-date-time" PreconditionMaxInstances PreconditionType = "max-instances" PreconditionMaxAttendeesPerInstance PreconditionType = "max-attendees-per-instance" )
type PropFilter ¶
type PutCalendarObjectOptions ¶
type PutCalendarObjectOptions struct { // IfNoneMatch indicates that the client does not want to overwrite // an existing resource. IfNoneMatch webdav.ConditionalMatch // IfMatch provides the ETag of the resource that the client intends // to overwrite, can be "" IfMatch webdav.ConditionalMatch }
TODO if nothing more Caldav-specific needs to be added this should be merged with carddav.PutAddressObjectOptions