client

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHANGE_VERSION = "cv"
	AUTH_TOKEN     = "tok"
)

storage keys

View Source
const API_KEY = "26864ab5d6fd4a37b80343439f107350"

from official Simplenote application

View Source
const APP_ID = "chalk-bump-f49"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.6.0

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

func NewClient

func NewClient() (*Client, error)

func (*Client) Authenticate added in v1.6.0

func (client *Client) Authenticate() error

retrieve user authentication token

func (*Client) Clear added in v1.6.0

func (client *Client) Clear() error

clear and remove all data

func (*Client) Connect added in v1.6.0

func (client *Client) Connect(ctx context.Context) error

connect to the server websocket

func (*Client) Disconnect added in v1.6.0

func (client *Client) Disconnect() error

disconnect from the server websocket

func (*Client) GetLocalDiffs added in v1.6.0

func (client *Client) GetLocalDiffs() []NoteChange

func (*Client) GetNoteName added in v1.14.0

func (client *Client) GetNoteName(noteID NoteID, content string) string

given a note id and content string, returns a unique note name identifier if one does not already exist in storage

func (*Client) OpenBucket added in v1.6.0

func (client *Client) OpenBucket(bucketName string, ctx context.Context) error

authorize access to a given bucket

func (*Client) OpenProjectDir added in v1.6.0

func (client *Client) OpenProjectDir() error

func (*Client) RefetchSync added in v1.6.0

func (client *Client) RefetchSync(ctx context.Context) error

initial sync to load (or reload) all notes

func (*Client) Sync added in v1.6.0

func (client *Client) Sync(ctx context.Context) error

sync client notes

func (*Client) Upload added in v1.6.0

func (client *Client) Upload(ctx context.Context, diffs []NoteChange) error

upload and sync local diffs with server

type Note

type Note struct {
	// do not store ID, it will be used as the map key
	Version int    `json:"v"`
	Name    string `json:"n"`
}

type NoteChange added in v1.13.0

type NoteChange s.Change[NoteDiff]

type NoteDiff

type NoteDiff struct {
	Tags             j.JSONDiff[[]string] `json:"tags,omitempty"`
	Deleted          j.BoolJSONDiff       `json:"deleted,omitempty"`
	ShareURL         j.StringJSONDiff     `json:"shareURL,omitempty"`
	PublishURL       j.StringJSONDiff     `json:"publishURL,omitempty"`
	Content          j.StringJSONDiff     `json:"content,omitempty"`
	SystemTags       j.JSONDiff[[]string] `json:"systemTags,omitempty"`
	ModificationDate j.Float32JSONDiff    `json:"modificationDate,omitempty"`
	CreationDate     j.Float32JSONDiff    `json:"creationDate,omitempty"`
}

type NoteID added in v1.12.0

type NoteID string

type NoteResponse added in v1.12.0

type NoteResponse struct {
	Tags             []string `json:"tags"`
	Deleted          bool     `json:"deleted"`
	ShareURL         string   `json:"shareURL"`
	PublishURL       string   `json:"publishURL"`
	Content          string   `json:"content"`
	SystemTags       []string `json:"systemTags"`
	ModificationDate float32  `json:"modificationDate"`
	CreationDate     float32  `json:"creationDate"`
}

Jump to

Keyboard shortcuts

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