Documentation ¶
Overview ¶
Package carddav provides a client and server CardDAV implementation.
CardDAV is defined in RFC 6352.
Index ¶
- Variables
- func Discover(domain string) (string, error)
- func Match(query *AddressBookQuery, ao *AddressObject) (matched bool, err error)
- func NewAddressBookHomeSet(path string) webdav.BackendSuppliedHomeSet
- func NewPreconditionError(err PreconditionType) error
- type AddressBook
- type AddressBookMultiGet
- type AddressBookQuery
- type AddressDataRequest
- type AddressDataType
- type AddressObject
- type Backend
- type Client
- func (c *Client) FindAddressBookHomeSet(principal string) (string, error)
- func (c *Client) FindAddressBooks(addressBookHomeSet string) ([]AddressBook, error)
- func (c *Client) GetAddressObject(path string) (*AddressObject, error)
- func (c *Client) HasSupport() error
- func (c *Client) MultiGetAddressBook(path string, multiGet *AddressBookMultiGet) ([]AddressObject, error)
- func (c *Client) PutAddressObject(path string, card vcard.Card) (*AddressObject, error)
- func (c *Client) QueryAddressBook(addressBook string, query *AddressBookQuery) ([]AddressObject, error)
- func (c *Client) SyncCollection(path string, query *SyncQuery) (*SyncResponse, error)
- type FilterTest
- type Handler
- type MatchType
- type ParamFilter
- type PreconditionType
- type PropFilter
- type PutAddressObjectOptions
- type SyncQuery
- type SyncResponse
- type TextMatch
Constants ¶
This section is empty.
Variables ¶
var CapabilityAddressBook = webdav.Capability("addressbook")
Functions ¶
func Discover ¶
Discover 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 *AddressBookQuery, ao *AddressObject) (matched bool, err error)
Match reports whether the provided AddressObject matches the query.
func NewAddressBookHomeSet ¶
func NewAddressBookHomeSet(path string) webdav.BackendSuppliedHomeSet
func NewPreconditionError ¶
func NewPreconditionError(err PreconditionType) error
Types ¶
type AddressBook ¶
type AddressBook struct { Path string Name string Description string MaxResourceSize int64 SupportedAddressData []AddressDataType }
func (*AddressBook) SupportsAddressData ¶
func (ab *AddressBook) SupportsAddressData(contentType, version string) bool
type AddressBookMultiGet ¶
type AddressBookMultiGet struct { Paths []string DataRequest AddressDataRequest }
type AddressBookQuery ¶
type AddressBookQuery struct { DataRequest AddressDataRequest PropFilters []PropFilter FilterTest FilterTest // defaults to FilterAnyOf Limit int // <= 0 means unlimited }
type AddressDataRequest ¶
type AddressDataType ¶
type AddressObject ¶
type AddressObject struct { Path string ModTime time.Time ContentLength int64 ETag string Card vcard.Card }
func Filter ¶
func Filter(query *AddressBookQuery, aos []AddressObject) ([]AddressObject, error)
Filter returns the filtered list of address objects matching the provided query. A nil query will return the full list of address objects.
type Backend ¶
type Backend interface { AddressbookHomeSetPath(ctx context.Context) (string, error) AddressBook(ctx context.Context) (*AddressBook, error) GetAddressObject(ctx context.Context, path string, req *AddressDataRequest) (*AddressObject, error) ListAddressObjects(ctx context.Context, req *AddressDataRequest) ([]AddressObject, error) QueryAddressObjects(ctx context.Context, query *AddressBookQuery) ([]AddressObject, error) PutAddressObject(ctx context.Context, path string, card vcard.Card, opts *PutAddressObjectOptions) (loc string, err error) DeleteAddressObject(ctx context.Context, path string) error webdav.UserPrincipalBackend }
Backend is a CardDAV server backend.
type Client ¶
type Client struct { *webdav.Client // contains filtered or unexported fields }
Client provides access to a remote CardDAV server.
func (*Client) FindAddressBookHomeSet ¶
func (*Client) FindAddressBooks ¶
func (c *Client) FindAddressBooks(addressBookHomeSet string) ([]AddressBook, error)
func (*Client) GetAddressObject ¶
func (c *Client) GetAddressObject(path string) (*AddressObject, error)
func (*Client) HasSupport ¶
func (*Client) MultiGetAddressBook ¶
func (c *Client) MultiGetAddressBook(path string, multiGet *AddressBookMultiGet) ([]AddressObject, error)
func (*Client) PutAddressObject ¶
func (c *Client) PutAddressObject(path string, card vcard.Card) (*AddressObject, error)
func (*Client) QueryAddressBook ¶
func (c *Client) QueryAddressBook(addressBook string, query *AddressBookQuery) ([]AddressObject, error)
func (*Client) SyncCollection ¶
func (c *Client) SyncCollection(path string, query *SyncQuery) (*SyncResponse, error)
SyncCollection performs a collection synchronization operation on the specified resource, as defined in RFC 6578.
type FilterTest ¶
type FilterTest string
const ( FilterAnyOf FilterTest = "anyof" FilterAllOf FilterTest = "allof" )
type ParamFilter ¶
type PreconditionType ¶
type PreconditionType string
https://tools.ietf.org/rfcmarkup?doc=6352#section-6.3.2.1
const ( PreconditionNoUIDConflict PreconditionType = "no-uid-conflict" PreconditionSupportedAddressData PreconditionType = "supported-address-data" PreconditionValidAddressData PreconditionType = "valid-address-data" PreconditionMaxResourceSize PreconditionType = "max-resource-size" )
type PropFilter ¶
type PropFilter struct { Name string Test FilterTest // defaults to FilterAnyOf // if IsNotDefined is set, TextMatches and Params need to be unset IsNotDefined bool TextMatches []TextMatch Params []ParamFilter }
type PutAddressObjectOptions ¶
type PutAddressObjectOptions 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 }
type SyncQuery ¶
type SyncQuery struct { DataRequest AddressDataRequest 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 []AddressObject Deleted []string }
SyncResponse contains the returned sync-token for next time