carddav: support address book creation/deletion

Now that the handling for multiple address books is in place, this
commit adds initial support for creation and deletion of address books.

These operations obviously require support from the backend, so the
interface gains two new methods. All properties of the address book
passed to `CreateAddressBook()` may be unset (e.g. when a client sends a
MKCOL request without a body), except for the path, which is always set.
It is up to the backend to put any desired default values in place.
This commit is contained in:
Conrad Hoffmann
2024-02-07 11:47:56 +01:00
committed by Simon Ser
parent 80d77a977a
commit 71bd967b43
3 changed files with 54 additions and 2 deletions

View File

@@ -68,6 +68,14 @@ func (b *testBackend) GetAddressBook(ctx context.Context, path string) (*Address
return nil, webdav.NewHTTPError(404, fmt.Errorf("Not found"))
}
func (*testBackend) CreateAddressBook(ctx context.Context, ab AddressBook) error {
panic("TODO: implement")
}
func (*testBackend) DeleteAddressBook(ctx context.Context, path string) error {
panic("TODO: implement")
}
func (*testBackend) GetAddressObject(ctx context.Context, path string, req *AddressDataRequest) (*AddressObject, error) {
if path == alicePath {
card, err := vcard.NewDecoder(strings.NewReader(aliceData)).Decode()