joplin

package
v0.0.0-...-9c65561 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package joplin implements a REST API client compatible with Joplin's API.

The API is documented here: https://github.com/laurent22/joplin/blob/master/readme/api.md

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Host is the host component of the URL, normally this should be
	// 'localhost'.
	Host string

	// Port is the port number on which Joplin's API is exposed. Normally
	// this should be 41184.
	Port int

	// Token should be the Joplin API token retrieved from the settings
	// interface by the user.
	Token string
}

Client stores all configuration and state needed to interact with the Joplin API.

func (*Client) BuildURL

func (c *Client) BuildURL(endpoint string, parameters map[string]string) string

BuildURL generates a URL for a given API endpoint. The token is always included but additional parameters can also be added. For example, to set the "fields" parameter, you might pass map[string]string{"fields": "body, id, title"}.

parameters may be nil.

func (*Client) GetAllNotes

func (c *Client) GetAllNotes() ([]Note, error)

GetAllNotes returns a list of all notes

func (*Client) GetAllTags

func (c *Client) GetAllTags() ([]Tag, error)

GetAllTags returns a list of all tags.

func (*Client) GetNote

func (c *Client) GetNote(id string) (Note, error)

GetNote returns a single note by it's ID

func (*Client) GetNoteTags

func (c *Client) GetNoteTags(id string) ([]Tag, error)

GetNoteTags gets the tags attached to a particular note by it's ID.

func (*Client) GetNotesWithTag

func (c *Client) GetNotesWithTag(id string) ([]Note, error)

GetNotesWithTag returns a list of all notes that have the given tag ID

func (*Client) Ping

func (c *Client) Ping() (bool, error)

Ping returns true if the response from GET /ping is 'JopinClipperServer', and otherwise false. An error may be returned if one occurs.

type Note

type Note struct {
	ID              string `json: id`
	ParentId        string `json: parent_id`
	Title           string `json: title`
	Body            string `json: body`
	CreatedTime     int    `json: created_time`
	UpdatedTime     int    `json: updated_time`
	IsConflict      int    `json: is_conflict`
	Latitude        string `json: latitude`
	Longitude       string `json: longitude`
	Altitude        string `json: altitude`
	Author          string `json: author`
	SourceURL       string `json: source_url`
	IsTodo          int    `json: is_todo`
	TodoCompleted   int    `json: todo_completed`
	UserCreatedTime int    `json: user_created_time`
	UserUpdatedTime int    `json: user_updated_time`
}

Note represents a Joplin note object.

type Tag

type Tag struct {
	ID              string `json: id`
	Title           string `json: title`
	CreatedTime     int    `json: created_time`
	UpdatedTime     int    `json: updated_time`
	UserCreatedTime int    `json: user_created_time`
	UserUpdatedTime int    `json: user_updated_time`
}

Jump to

Keyboard shortcuts

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