remarkablecloud

package module
v0.0.0-...-2da2468 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AuthHost           = "https://webapp-prod.cloud.remarkable.engineering"
	NewDeviceTokenPath = "/token/json/2/device/new"
	NewUserTokenPath   = "/token/json/2/user/new"
)
View Source
var (
	RootURL       = "https://internal.cloud.remarkable.com/sync/v3/root"
	FileURLPrefix = "https://internal.cloud.remarkable.com/sync/v3/files/"

	DebugLogFunc func(string, ...interface{})
)
View Source
var RootListingID = "root.docSchema"

Functions

This section is empty.

Types

type Batch

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

func (*Batch) Commit

func (b *Batch) Commit() (*PutResult, error)

func (*Batch) FSSnapshot

func (b *Batch) FSSnapshot() (fs.FS, error)

func (*Batch) GetAndCacheBlob

func (b *Batch) GetAndCacheBlob(id string) (*http.Response, error)

func (*Batch) List

func (b *Batch) List() ([]Item, error)

func (*Batch) Mkdir

func (b *Batch) Mkdir(p string) (*PutResult, error)

Mkdir creates a directory synced to the device. On success, Mkdir returns the directory ID.

func (*Batch) Put

func (b *Batch) Put(p string, ext string, r io.ReadSeeker) (*PutResult, error)

Add a file to the batch for uploading. p is the name of the file on the device. It can be a path. ext is the file extension. The only values are "epub" and "pdf". r is a ReadSeeker of the actual content.

func (*Batch) PutBlob

func (b *Batch) PutBlob(hashKey, id string, r io.Reader, opts ...PutBlobOption) error

func (*Batch) Remove

func (b *Batch) Remove(name string) (*PutResult, error)

func (*Batch) UpdateRootHash

func (b *Batch) UpdateRootHash(hashKey string)

type Client

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

func New

func New(creds CredentialProvider) *Client

func (*Client) Do

func (c *Client) Do(op string, req *http.Request) (*http.Response, error)

func (*Client) FSSnapshot

func (c *Client) FSSnapshot() (fs.FS, error)

func (*Client) GetBlob

func (c *Client) GetBlob(id string) (*http.Response, error)

func (*Client) List

func (c *Client) List() ([]Item, error)

func (*Client) NewBatch

func (c *Client) NewBatch() (*Batch, error)

func (*Client) PutRoot

func (c *Client) PutRoot(root RootMetadata) (*RootMetadata, error)

func (*Client) RawPutBlob

func (c *Client) RawPutBlob(r RawPubBlobRequest, opts ...PutBlobOption) error

type CredentialProvider

type CredentialProvider interface {
	Token() string // returns the current refresh token
}

func NewStaticTokenProvider

func NewStaticTokenProvider(deviceToken, userToken string) CredentialProvider

type Item

type Item struct {
	ID               string `json:"__pms_id"`
	Hash             string `json:"__pms_hash"`
	Deleted          bool   `json:"deleted"`
	LastModified     string `json:"lastModified"`
	LastOpened       string `json:"lastOpened"`
	LastOpenedPage   int    `json:"lastOpenedPage"`
	Metadatamodified bool   `json:"metadatamodified"`
	Modified         bool   `json:"modified"`
	Parent           string `json:"parent"`
	Pinned           bool   `json:"pinned"`
	Synced           bool   `json:"synced"`
	Type             string `json:"type"`
	Version          int    `json:"version"`
	Name             string `json:"visibleName"`
}

type PutBlobOption

type PutBlobOption func(opt *putBlobOptions)

type PutResult

type PutResult struct {
	OldRootHash string
	NewRootHash string
	DocID       string
}

type RawPubBlobRequest

type RawPubBlobRequest struct {
	// Sha256 of the content
	Key string
	// Remarkable filename (uuid.extension)
	Filename   string
	ParentHash string
	Content    io.ReadSeeker
}

type RootMetadata

type RootMetadata struct {
	Hash          string `json:"hash"`
	Generation    int64  `json:"generation"`
	SchemaVersion int64  `json:"schemaVersion,omitempty"`
	Broadcast     bool   `json:"broadcast,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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