carddav

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CardDAVSpec = conf.SectionSpec{
	{
		Name:        "ID",
		Description: "ID uniquely identifies this CardDAV configuration and is used to perist the sync tokens",
		Type:        conf.StringType,
		Required:    true,
	},
	{
		Name:        "Source",
		Description: "The label to use for the customer source.",
		Type:        conf.StringType,
		Default:     "carddav",
	},
	{
		Name:        "Schedule",
		Description: "A cron-like schedule to import customers from CardDAV",
		Default:     "@every 6h",
		Type:        conf.StringType,
	},
	{
		Name:        "Server",
		Description: "The URL of the CardDAV server.",
		Type:        conf.StringType,
		Required:    true,
	},
	{
		Name:        "AllowInsecure",
		Description: "Wether or not insecure TLS server certificates should be accepted.",
		Type:        conf.BoolType,
	},
	{
		Name:        "User",
		Description: "The username required for HTTP Basic authentication",
		Type:        conf.StringType,
	},
	{
		Name:        "Password",
		Description: "The password required for HTTP Basic authentication",
		Type:        conf.StringType,
		Annotations: new(conf.Annotation).With(
			conf.SecretValue(),
		),
	},
	{
		Name:        "AddressBook",
		Description: "The name of the target address book. If unspecified, CIS will try to auto-detect the default address book of the authenticated user.",
		Type:        conf.StringType,
	},
}

Functions

func Register

func Register(ctx context.Context, manager *importer.Manager) error

Types

type CardDAVConfig

type CardDAVConfig struct {
	// ID is used to uniquely identify the CardDAV config
	// and is used to persist the sync-tokens.
	ID string
	// Source defines the customer source to use.
	Source string
	// Schedule describes the sync/import schedule using
	// cron syntax.
	Schedule string
	// Server holds the URL of the CardDAV server.
	Server string
	// AllowInsecure can be set to true to disable
	// TLS certificate checks.
	AllowInsecure bool
	// User is the username required for HTTP Basic
	// authentication.
	User string
	// Password is the password required for HTTP Basic
	// authentication.
	Password string
	// AddressBook is the name of the adressbook to use.
	// If left empty CIS tries to discover the default
	// address book of the authenticated user.
	AddressBook string
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client supports basic CardDAV operations.

func NewClient

func NewClient(cfg *CardDAVConfig) (*Client, error)

NewClient returns a new CardDAV client.

func (*Client) DeleteObject

func (cli *Client) DeleteObject(ctx context.Context, path string) error

func (*Client) ListAddressBooks

func (cli *Client) ListAddressBooks(ctx context.Context) ([]carddav.AddressBook, error)

func (*Client) Sync

func (cli *Client) Sync(ctx context.Context, col, syncToken string, deleted chan<- string, updated chan<- carddav.AddressObject) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL