Documentation
¶
Overview ¶
Package carddav provides a client and server CardDAV implementation.
CardDAV is defined in RFC 6352.
Index ¶
- Variables
- func DiscoverContextURL(ctx context.Context, 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(ctx context.Context, principal string) (string, error)
- func (c *Client) FindAddressBooks(ctx context.Context, addressBookHomeSet string) ([]AddressBook, error)
- func (c *Client) GetAddressObject(ctx context.Context, path string) (*AddressObject, error)
- func (c *Client) HasSupport(ctx context.Context) error
- func (c *Client) MultiGetAddressBook(ctx context.Context, path string, multiGet *AddressBookMultiGet) ([]AddressObject, error)
- func (c *Client) PutAddressObject(ctx context.Context, path string, card vcard.Card) (*AddressObject, error)
- func (c *Client) QueryAddressBook(ctx context.Context, addressBook string, query *AddressBookQuery) ([]AddressObject, error)
- func (c *Client) SyncCollection(ctx context.Context, 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 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 *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)
ListAddressBooks(ctx context.Context) ([]AddressBook, error)
GetAddressBook(ctx context.Context, path string) (*AddressBook, error)
CreateAddressBook(ctx context.Context, addressBook *AddressBook) error
DeleteAddressBook(ctx context.Context, path string) error
GetAddressObject(ctx context.Context, path string, req *AddressDataRequest) (*AddressObject, error)
ListAddressObjects(ctx context.Context, path string, req *AddressDataRequest) ([]AddressObject, error)
QueryAddressObjects(ctx context.Context, path string, query *AddressBookQuery) ([]AddressObject, error)
PutAddressObject(ctx context.Context, path string, card vcard.Card, opts *PutAddressObjectOptions) (*AddressObject, error)
DeleteAddressObject(ctx context.Context, path string) error
webdav.UserPrincipalBackend
}
Backend is a CardDAV server backend.
type Client ¶
Client provides access to a remote CardDAV server.
func (*Client) FindAddressBookHomeSet ¶
func (*Client) FindAddressBooks ¶
func (*Client) GetAddressObject ¶
func (*Client) MultiGetAddressBook ¶
func (c *Client) MultiGetAddressBook(ctx context.Context, path string, multiGet *AddressBookMultiGet) ([]AddressObject, error)
func (*Client) PutAddressObject ¶
func (*Client) QueryAddressBook ¶
func (c *Client) QueryAddressBook(ctx context.Context, addressBook string, query *AddressBookQuery) ([]AddressObject, 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 FilterTest ¶
type FilterTest string
const ( FilterAnyOf FilterTest = "anyof" FilterAllOf FilterTest = "allof" )
type ParamFilter ¶
type PreconditionType ¶
type PreconditionType string
PreconditionType as defined in 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