edam

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package edam handles interaction with the Evernote API, otherwise known as EDAM. Currently, a developer token is required to access an individual Evernote account. Read more at https://dev.evernote.com/doc/.

Index

Constants

View Source
const EvernoteServiceKey = "EVERNOTE_SERVICE"

EvernoteServiceKey is the name of the context key that stores the EDAM credential configuration values.

Variables

This section is empty.

Functions

func MakeEnvFile

func MakeEnvFile(filename string) (err error)

MakeEnvFile initializes a template file to store evernote production and sandbox credentials for later usage as environment variables. If a file already exists, then it exits early with an error.

func NewNotebooksRepo

func NewNotebooksRepo() (entity.LocalRemoteRepo, error)

NewNotebooksRepo constructs a Notebooks repository.

func NewNotesRepo

func NewNotesRepo(rqp *NotesRemoteQueryParams) (entity.LocalRemoteRepo, error)

NewNotesRepo constructs a Notes repository.

func NewTagsRepo

func NewTagsRepo() (entity.LocalRemoteRepo, error)

NewTagsRepo constructs a Tags repository.

Types

type CredentialsConfig

type CredentialsConfig struct {
	EnvFilename string
	ServiceEnv  EvernoteService
}

CredentialsConfig says where to find credentials and which to ones to use.

type EvernoteService

type EvernoteService uint8

EvernoteService enumerates different service environments when interacting with Evernote.

const (
	// EvernoteSandboxService is a cautious default to operate on data in a
	// development environment, entirely separate from the production service.
	EvernoteSandboxService EvernoteService = iota
	// EvernoteProductionService signals that you want to use your production
	// Evernote account using production credentials.
	EvernoteProductionService
)

func (EvernoteService) String

func (d EvernoteService) String() string

type Note

type Note struct {
	*entity.Note
	*entity.ServiceID
}

Note represents a note in an Evernote EDAM API call. It also provides methods to match with a Note in StandardNotes.

func (*Note) HTMLContent

func (n *Note) HTMLContent() (string, error)

func (*Note) LinkValues

func (n *Note) LinkValues() []string

type Notebook

type Notebook struct {
	*entity.Notebook
	*entity.ServiceID
}

Notebook represents a notebook in an Evernote EDAM API call. Though it provides methods to match with a resource in StandardNotes, there is no equivalent to Notebook in StandardNotes; as of this writing, the closest thing is a Tag.

func NewNotebook

func NewNotebook(name string) *Notebook

NewNotebook constructs a basic *Notebook. It doesn't set all possible fields.

func (*Notebook) LinkValues

func (n *Notebook) LinkValues() []string

type Notebooks

type Notebooks struct{}

Notebooks handles input/output for notebooks from the Evernote EDAM API.

func (*Notebooks) FetchRemote

func (n *Notebooks) FetchRemote(ctx context.Context) (out []entity.LinkID, err error)

FetchRemote gets Notebooks from the Evernote EDAM API.

func (*Notebooks) ReadLocal

func (n *Notebooks) ReadLocal(ctx context.Context, r io.Reader) (out []entity.LinkID, err error)

ReadLocal reads and parses notebooks saved in a local JSON file.

type Notes

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

Notes handles input/output for notes from the Evernote EDAM API.

func (*Notes) FetchRemote

func (n *Notes) FetchRemote(ctx context.Context) (out []entity.LinkID, err error)

FetchRemote gets Notes from the Evernote EDAM API. It can automatically perform pagination based on the param argument which should be of the concrete type, NotesQuery. Multiple API calls will be made until there are no more remaining results.

func (*Notes) ReadLocal

func (n *Notes) ReadLocal(ctx context.Context, r io.Reader) (out []entity.LinkID, err error)

ReadLocal reads and parses notes saved in a local JSON file.

type NotesRemoteQueryParams

type NotesRemoteQueryParams struct {
	LoIndex    int
	HiIndex    int
	PageSize   int
	TagIDs     []string
	NotebookID string
	Verbose    bool
}

NotesRemoteQueryParams is a set of named options for listing Evernote notes.

type Tag

type Tag struct {
	*entity.Tag
	*entity.ServiceID
}

Tag represents a tag in an Evernote EDAM API call. It also provides methods to match with a Tag in StandardNotes.

func (*Tag) LinkValues

func (t *Tag) LinkValues() []string

type Tags

type Tags struct{}

Tags handles input/output for tags from the Evernote EDAM API.

func (*Tags) FetchRemote

func (n *Tags) FetchRemote(ctx context.Context) (out []entity.LinkID, err error)

FetchRemote gets Tags from the Evernote EDAM API.

func (*Tags) ReadLocal

func (n *Tags) ReadLocal(ctx context.Context, r io.Reader) (out []entity.LinkID, err error)

ReadLocal reads and parses tags saved in a local JSON file.

Jump to

Keyboard shortcuts

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