api

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const PASSWORD_LENGTH = 12
View Source
const Version = "1.5.8"

Variables

This section is empty.

Functions

func Format

func Format(data interface{}) (string, error)

func FormatIfJSON

func FormatIfJSON(body []byte) string

func LookupDomain added in v1.3.0

func LookupDomain() (string, error)

func LookupURL added in v1.3.0

func LookupURL() (string, error)

func SetDefaults added in v1.3.0

func SetDefaults() error

func URIPath added in v1.4.4

func URIPath(uri string) (string, error)

Types

type AccountResponse added in v1.3.1

type AccountResponse struct {
	Response
	Username string `json:"username"`
	Password string `json:"password"`
}

type AddBookResponse

type AddBookResponse struct {
	Response
	Book Book `json:"book"`
}

type AddUserResponse

type AddUserResponse struct {
	Response
	User User `json:"user"`
}

type AddressResponse added in v1.1.5

type AddressResponse struct {
	Response
	Address *carddav.AddressObject `json:"address"`
}

type AddressesResponse added in v1.1.5

type AddressesResponse struct {
	Response
	Addresses []string `json:"addresses"`
}

type Book

type Book struct {
	UserName    string `json:"username"`
	BookName    string `json:"bookname"`
	Description string `json:"description"`
	Contacts    int    `json:"contacts"`
	Token       string `json:"token"`
	URI         string `json:"uri"`
}

type BooksResponse

type BooksResponse struct {
	Response
	Books []Book `json:"books"`
}

type ConfigDump added in v1.3.3

type ConfigDump struct {
	Users map[string]UserDump
}

type Controller added in v1.1.5

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

func NewAddressBookController added in v1.1.5

func NewAddressBookController() (*Controller, error)

func (*Controller) AddAddress added in v1.1.5

func (c *Controller) AddAddress(dav *davapi.CardClient, username, bookname, email, name string) (*AddressResponse, error)

func (*Controller) AddBook added in v1.1.5

func (c *Controller) AddBook(username, bookname, description string) (*AddBookResponse, error)

func (*Controller) AddUser added in v1.1.5

func (c *Controller) AddUser(username, display, password string) (*AddUserResponse, error)

func (*Controller) Addresses added in v1.1.5

func (c *Controller) Addresses(dav *davapi.CardClient, username, bookname string) (*AddressesResponse, error)

func (*Controller) Clear added in v1.3.3

func (c *Controller) Clear() (*Response, error)

func (*Controller) DeleteAddress added in v1.1.5

func (c *Controller) DeleteAddress(username, bookname, email string) (*AddressesResponse, error)

func (*Controller) DeleteBook added in v1.1.5

func (c *Controller) DeleteBook(username, bookname string) (*Response, error)

func (*Controller) DeleteUser added in v1.1.5

func (c *Controller) DeleteUser(username string) (*Response, error)

func (*Controller) Dump added in v1.3.3

func (c *Controller) Dump(dumpUser string) (*DumpResponse, error)

func (*Controller) EmailAddress added in v1.5.1

func (c *Controller) EmailAddress(addr carddav.AddressObject) (string, error)

func (*Controller) EmailAddressList added in v1.5.1

func (c *Controller) EmailAddressList(addrs *[]carddav.AddressObject) (*[]string, error)

func (*Controller) GetAccounts added in v1.3.3

func (c *Controller) GetAccounts() (*UserAccountsResponse, error)

func (*Controller) GetBook added in v1.4.4

func (c *Controller) GetBook(username, bookname string) (*Book, error)

func (*Controller) GetBooks added in v1.1.5

func (c *Controller) GetBooks(username string) (*BooksResponse, error)

func (*Controller) GetPassword added in v1.1.5

func (c *Controller) GetPassword(username string) (*AccountResponse, error)

func (*Controller) GetStatus added in v1.1.5

func (c *Controller) GetStatus() (*StatusResponse, error)

func (*Controller) GetUptime added in v1.1.5

func (c *Controller) GetUptime() (*Response, error)

func (*Controller) GetUserBooks added in v1.4.4

func (c *Controller) GetUserBooks() (*UserBooksResponse, error)

func (*Controller) GetUsers added in v1.1.5

func (c *Controller) GetUsers() (*UsersResponse, error)

func (*Controller) Initialize added in v1.1.5

func (c *Controller) Initialize() (*Response, error)

func (*Controller) QueryAddress added in v1.1.5

func (c *Controller) QueryAddress(username, bookname, email string) (*AddressResponse, error)

func (*Controller) RequestShutdown added in v1.1.5

func (c *Controller) RequestShutdown() (*Response, error)

func (*Controller) Reset added in v1.1.5

func (c *Controller) Reset() (*Response, error)

func (*Controller) Restore added in v1.3.3

func (c *Controller) Restore(dump *ConfigDump, restoreUser string) (*Response, error)

func (*Controller) ScanAddress added in v1.1.5

func (c *Controller) ScanAddress(username, email string) (*BooksResponse, error)

return books containing address

func (*Controller) SetAccounts added in v1.3.3

func (c *Controller) SetAccounts(request *UserAccountsRequest) (*UserAccountsResponse, error)

type DumpResponse added in v1.3.3

type DumpResponse struct {
	Response
	Dump ConfigDump
}

type ErrorMessage

type ErrorMessage struct {
	Error string `json:"error"`
}

type ErrorResponse

type ErrorResponse struct {
	Response
	Detail string `json:"detail"`
}

type Response

type Response struct {
	Success bool   `json:"success"`
	User    string `json:"user"`
	Message string `json:"message"`
	Request string `json:"request"`
}

type StatusResponse

type StatusResponse struct {
	Response
	Status map[string]any `json:"status"`
}

type User

type User struct {
	UserName    string `json:"username"`
	DisplayName string `json:"displayname"`
	URI         string `json:"uri"`
}

type UserAccountsRequest added in v1.3.3

type UserAccountsRequest struct {
	Accounts map[string]string `json:"accounts"`
}

type UserAccountsResponse added in v1.3.3

type UserAccountsResponse struct {
	Response
	Accounts map[string]string `json:"accounts"`
}

type UserBooksResponse added in v1.4.4

type UserBooksResponse struct {
	Response
	UserBooks map[string][]string
}

type UserDump added in v1.3.3

type UserDump struct {
	Password string
	Books    map[string][]string
}

type UsersResponse

type UsersResponse struct {
	Response
	Users []User `json:"users"`
}

Jump to

Keyboard shortcuts

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