package caldav
import "github.com/emersion/go-webdav/caldav"
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 NewClient(c webdav.HTTPClient, endpoint string) (*Client, 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)
- type CompFilter
- type Handler
- type ParamFilter
- type PreconditionType
- type PropFilter
- type PutCalendarObjectOptions
- type TextMatch
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) 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 Calendar ¶
type Calendar struct { Path string Name string Description string MaxResourceSize int64 SupportedComponentSet []string }
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 ¶
type Client struct {
*webdav.Client
// contains filtered or unexported fields
}
Client provides access to a remote CardDAV server.
func NewClient ¶
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 (c *Client) PutCalendarObject(ctx context.Context, path string, cal *ical.Calendar) (*CalendarObject, error)
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 Handler ¶
Handler handles CalDAV HTTP requests. It can be used to create a CalDAV server.
func (*Handler) ServeHTTP ¶
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.
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 PropFilter struct { Name string IsNotDefined bool Start, End time.Time TextMatch *TextMatch ParamFilter []ParamFilter }
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 TextMatch ¶
Source Files ¶
caldav.go client.go elements.go match.go server.go
- Version
- v0.6.0 (latest)
- Published
- Jul 13, 2024
- Platform
- linux/amd64
- Imports
- 14 packages
- Last checked
- 1 week ago –
Tools for package owners.