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 CalendarExpandRequest
- type CalendarMultiGet
- type CalendarObject
- type CalendarQuery
- type Client
- func (c *Client) FindCalendar(ctx context.Context, path string) (*Calendar, error)
- 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)
- func (c *Client) SyncCollection(ctx context.Context, path string, query *SyncQuery) (*SyncResponse, error)
- type CompFilter
- type Handler
- type ParamFilter
- type PreconditionType
- type PropFilter
- type PutCalendarObjectOptions
- type SyncQuery
- type SyncResponse
- 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)
CreateCalendar(ctx context.Context, calendar *Calendar) error
ListCalendars(ctx context.Context) ([]Calendar, error)
GetCalendar(ctx context.Context, path string) (*Calendar, error)
DeleteCalendar(ctx context.Context, path string) error
UpdateCalendar(ctx context.Context, calendar *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, path string, query *CalendarQuery) ([]CalendarObject, error)
PutCalendarObject(ctx context.Context, path string, calendar *ical.Calendar, opts *PutCalendarObjectOptions) (*CalendarObject, 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
Expand *CalendarExpandRequest
}
type CalendarExpandRequest ¶
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) FindCalendar ¶
Get calendar information without loading all the events once the path of the calendar is known.
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)
func (*Client) SyncCollection ¶
func (c *Client) SyncCollection(ctx context.Context, path string, query *SyncQuery) (*SyncResponse, error)
SyncCollection performs a collection synchronization operation on the specified resource, as defined in RFC 6578.
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
type SyncQuery ¶
type SyncQuery struct {
CompRequest CalendarCompRequest
SyncToken string
Limit int // <= 0 means unlimited
}
SyncQuery is the query struct represents a sync-collection request
type SyncResponse ¶
type SyncResponse struct {
SyncToken string
Updated []CalendarObject
Deleted []string
}
SyncResponse contains the returned sync-token for next time