go-webdav/carddav/backend.go

36 lines
657 B
Go
Raw Normal View History

2017-09-03 19:11:36 +01:00
package carddav
// TODO: add context support
import (
"errors"
"os"
2017-09-03 19:11:36 +01:00
"github.com/emersion/go-vcard"
)
var (
ErrNotFound = errors.New("carddav: not found")
)
2017-09-09 15:45:31 +01:00
type AddressBookInfo struct {
2017-09-11 18:10:53 +01:00
Name string
Description string
2017-09-09 15:45:31 +01:00
MaxResourceSize int
}
2017-09-03 19:11:36 +01:00
type AddressObject interface {
ID() string
Stat() (os.FileInfo, error) // can return nil, nil
2017-09-13 18:02:12 +01:00
Card() (vcard.Card, error)
SetCard(vcard.Card) error
2017-09-14 10:51:57 +01:00
Remove() error
2017-09-03 19:11:36 +01:00
}
type AddressBook interface {
2017-09-09 15:45:31 +01:00
Info() (*AddressBookInfo, error)
2017-09-03 19:11:36 +01:00
GetAddressObject(id string) (AddressObject, error)
ListAddressObjects() ([]AddressObject, error)
2017-09-13 18:02:12 +01:00
CreateAddressObject(vcard.Card) (AddressObject, error)
2017-09-03 19:11:36 +01:00
}