api

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: GPL-3.0 Imports: 9 Imported by: 7

Documentation

Index

Constants

View Source
const (
	JournalCalendar    JournalType = "CALENDAR"
	JournalAddressBook             = "ADDRESS_BOOK"
	JournalTasks                   = "TASKS"
)
View Source
const APIUrl = "https://api.etesync.com"

APIUrl is the default URL

Variables

View Source
var (
	// ErrInvalidCredentials denotes invalid credentials when trying to get a API token
	ErrInvalidCredentials = errors.New("invalid credentials")
)

Functions

func DeriveKey

func DeriveKey(email string, password []byte) ([]byte, error)

Types

type Client

type Client interface {
	Journals() (Journals, error)
	Journal(uid string) (*Journal, error)
	JournalEntries(uid string, last *string) (Entries, error)
}

type Entries

type Entries []*Entry

type Entry

type Entry struct {
	UID     string `json:"uid"`
	Content string `json:"content"`
}

func (*Entry) GetContent

func (e *Entry) GetContent(cipher *crypto.Cipher) (*EntryContent, error)

func (*Entry) SetContent

func (e *Entry) SetContent(c *EntryContent, cipher *crypto.Cipher) error

type EntryContent

type EntryContent struct {
	Action  string
	Content string
}

type HTTPClient

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

HTTPClient is a EteSync API Client

func NewClient

func NewClient(u, p string) (*HTTPClient, error)

NewClient returns a new HTTPClient given a username and password

func NewClientWithURL

func NewClientWithURL(u, p, url string) (*HTTPClient, error)

NewClientWithURL returns a new HTTPClient given a username, password and a custom server URL

func (*HTTPClient) Journal

func (c *HTTPClient) Journal(uid string) (*Journal, error)

func (*HTTPClient) JournalEntries

func (c *HTTPClient) JournalEntries(uid string, last *string) (Entries, error)

func (*HTTPClient) Journals

func (c *HTTPClient) Journals() (Journals, error)

Journals retrieves the available journals

func (*HTTPClient) WithDebug

func (c *HTTPClient) WithDebug() *HTTPClient

WithDebug returns a copy of the client with debug enabled When debug is enabled HTTP request and responses are logged

type Journal

type Journal struct {
	Version  int    `json:"version"`
	UID      string `json:"uid"`
	Content  string `json:"content"`
	Owner    string `json:"owner"`
	Key      string `json:"key"`
	ReadOnly bool   `json:"readOnly"`
}

func (*Journal) GetContent

func (j *Journal) GetContent(cipher *crypto.Cipher) (*JournalContent, error)

type JournalContent

type JournalContent struct {
	Type        JournalType `json:"type"`
	Version     int         `json:"version"`
	Selected    bool        `json:"selected"`
	DisplayName string      `json:"displayName"`
	Color       int         `json:"color"`
}

type JournalType

type JournalType string

type Journals

type Journals []*Journal

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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