caldav

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package caldav provides a client and server CalDAV implementation.

CalDAV is defined in RFC 4791.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPreconditionError

func NewPreconditionError(err PreconditionType) error

Types

type Backend

type Backend interface {
	Calendar(ctx context.Context) (*Calendar, error)
	GetCalendarObject(ctx context.Context, path string, req *CalendarCompRequest) (*CalendarObject, error)
	ListCalendarObjects(ctx context.Context, req *CalendarCompRequest) ([]CalendarObject, error)
	QueryCalendarObjects(ctx context.Context, query *CalendarQuery) ([]CalendarObject, error)
}

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
	ETag    string
	Data    *ical.Calendar
}

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 NewClient(c webdav.HTTPClient, endpoint string) (*Client, error)

func (*Client) FindCalendarHomeSet

func (c *Client) FindCalendarHomeSet(principal string) (string, error)

func (*Client) FindCalendars

func (c *Client) FindCalendars(calendarHomeSet string) ([]Calendar, error)

func (*Client) GetCalendarObject

func (c *Client) GetCalendarObject(path string) (*CalendarObject, error)

func (*Client) MultiGetCalendar

func (c *Client) MultiGetCalendar(path string, multiGet *CalendarMultiGet) ([]CalendarObject, error)

func (*Client) PutCalendarObject

func (c *Client) PutCalendarObject(path string, cal *ical.Calendar) (*CalendarObject, error)

func (*Client) QueryCalendar

func (c *Client) QueryCalendar(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

type Handler struct {
	Backend Backend
}

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 ParamFilter struct {
	Name         string
	IsNotDefined bool
	TextMatch    *TextMatch
}

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 TextMatch

type TextMatch struct {
	Text            string
	NegateCondition bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL