Documentation ¶
Overview ¶
Package rmapi implements reMarkable api, as described in https://github.com/splitbrain/ReMarkableAPI/wiki.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RootDisplayName = "<ROOT>"
RootDisplayName is the display name to be used by the root directory.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { RefreshToken string Logger logger.Logger // contains filtered or unexported fields }
Client defines a reMarkable API client.
You can get it either by using Register with a new token, or construct directly from refresh token stored previously.
func Register ¶
func Register(ctx context.Context, args RegisterArgs) (*Client, error)
Register registers a new token with reMarkable API server.
Upon success, it returns a *Client with RefreshToken set.
func (*Client) AutoRefresh ¶
AutoRefresh refreshes the token when needed.
func (*Client) ListDirs ¶
ListDirs lists all the directories user created on their reMarkable account.
The returned map is in format of <id> -> <display name>. When error is nil, the map is guaranteed to have at least an entry of "" -> RootDisplayName.
type ContentArgs ¶
type ContentArgs struct {
Font string
}
ContentArgs defines the args to population InitialContent.
type FileType ¶
type FileType int
FileType is an enum type defining the file type on reMarkable.
It's either epub or pdf.
const ( FileTypeEpub FileType FileTypePdf )
FileType values.
func (FileType) InitialContent ¶
func (ft FileType) InitialContent(args ContentArgs) (string, error)
InitialContent returns the initial .content file for the given FileType.
type ItemInfo ¶
type ItemInfo struct { ID string `json:"ID,omitempty"` Type string `json:"Type,omitempty"` Name string `json:"VissibleName,omitempty"` Parent string `json:"Parent,omitempty"` Version int `json:"Version,omitempty"` UploadURL string `json:"BlobURLPut,omitempty"` ModifiedClient time.Time `json:"ModifiedClient,omitempty"` // responses only Message string `json:"Message,omitempty"` Success *bool `json:"Success,omitempty"` }
ItemInfo defines the json format of an item metadata.
Some of the fields are only used in requests and some of the fields are only used in responses, as a result it's important for all of them to have omitempty json tag.
func (ItemInfo) ToMetadata ¶
func (i ItemInfo) ToMetadata() ItemMetadata
ToMetadata converts ItemInfo into ItemMetadata
type ItemMetadata ¶
type ItemMetadata struct { Type string `json:"type"` Name string `json:"visibleName"` Parent string `json:"parent"` Version int `json:"version"` LastModified TimestampMillisecond `json:"lastModified"` }
ItemMetadata defines the json format for the .metadata files.
type RegisterArgs ¶
type RegisterArgs struct { // A token got from either https://my.remarkable.com/connect/desktop or // https://my.remarkable.com/connect/mobile, usually with length of 8. Token string // A description of this device, usually something like "desktop-linux", // "mobile-android". Description string }
RegisterArgs defines args to be used with Register.
type TimestampMillisecond ¶ added in v0.1.1
TimestampMillisecond is used to marshal timestamp into milliseconds since unix epoch in json.
func (TimestampMillisecond) MarshalJSON ¶ added in v0.1.1
func (ts TimestampMillisecond) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
It converts time into milliseconds since unix epoch, but omits any sub-second precision.
type UploadArgs ¶
type UploadArgs struct { ID string Title string Data io.Reader Type FileType // Optional ParentID string ContentArgs ContentArgs }
UploadArgs defines the args used by Upload function.