2017-09-03 19:11:36 +01:00
|
|
|
package carddav
|
|
|
|
|
|
|
|
// TODO: add context support
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
2017-09-04 11:06:06 +01:00
|
|
|
"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 {
|
|
|
|
Name string
|
|
|
|
Description string
|
|
|
|
MaxResourceSize int
|
|
|
|
}
|
|
|
|
|
2017-09-03 19:11:36 +01:00
|
|
|
type AddressObject interface {
|
|
|
|
ID() string
|
|
|
|
Card() (vcard.Card, error)
|
2017-09-04 11:06:06 +01:00
|
|
|
Stat() (os.FileInfo, error) // can return nil, nil
|
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)
|
|
|
|
}
|