rmapi-js
    Preparing search index...

    Interface RemarkableApi

    the api for accessing remarkable functions

    There are roughly two types of functions.

    • high-level api functions that provide simple access with a single round trip based on the web api
    • low-level wrapped functions that take more round trips, but provide more control and may be faster since they can be cached.

    Most of these functions validate the return values so that typescript is accurate. However, sometimes those return values are more strict than the "true" underlying types. If this happens, please submit a an issue. In the mean time, you should be able to use the low level api to work around any restrictive validation.

    interface RemarkableApi {
        raw: RawRemarkableApi;
        bulkDelete(
            hashes: readonly string[],
            refresh?: boolean,
        ): Promise<HashesEntry>;
        bulkMove(
            hashes: readonly string[],
            parent: string,
            refresh?: boolean,
        ): Promise<HashesEntry>;
        clearCache(): void;
        createFolder(
            visibleName: string,
            opts?: UploadOptions,
            refresh?: boolean,
        ): Promise<SimpleEntry>;
        delete(hash: string, refresh?: boolean): Promise<HashEntry>;
        dumpCache(): string;
        getContent(hash: string): Promise<Content>;
        getDocument(hash: string): Promise<Uint8Array<ArrayBufferLike>>;
        getEpub(hash: string): Promise<Uint8Array<ArrayBufferLike>>;
        getMetadata(hash: string): Promise<Metadata>;
        getPdf(hash: string): Promise<Uint8Array<ArrayBufferLike>>;
        listIds(refresh?: boolean): Promise<SimpleEntry[]>;
        listItems(refresh?: boolean): Promise<Entry[]>;
        move(hash: string, parent: string, refresh?: boolean): Promise<HashEntry>;
        pruneCache(refresh?: boolean): Promise<void>;
        putEpub(
            visibleName: string,
            buffer: Uint8Array,
            opts?: PutOptions,
        ): Promise<SimpleEntry>;
        putPdf(
            visibleName: string,
            buffer: Uint8Array,
            opts?: PutOptions,
        ): Promise<SimpleEntry>;
        rename(
            hash: string,
            visibleName: string,
            refresh?: boolean,
        ): Promise<HashEntry>;
        stared(
            hash: string,
            stared: boolean,
            refresh?: boolean,
        ): Promise<HashEntry>;
        updateCollection(
            hash: string,
            content: Partial<CollectionContent>,
            refresh?: boolean,
        ): Promise<HashEntry>;
        updateDocument(
            hash: string,
            content: Partial<DocumentContent>,
            refresh?: boolean,
        ): Promise<HashEntry>;
        updateTemplate(
            hash: string,
            content: Partial<TemplateContent>,
            refresh?: boolean,
        ): Promise<HashEntry>;
        uploadEpub(
            visibleName: string,
            buffer: Uint8Array,
            opts?: UploadOptions,
        ): Promise<SimpleEntry>;
        uploadPdf(
            visibleName: string,
            buffer: Uint8Array,
            opts?: UploadOptions,
        ): Promise<SimpleEntry>;
    }
    Index

    Properties

    scoped access to the raw low-level api

    Methods

    • delete many entries

      Parameters

      • hashes: readonly string[]

        the hashes of the entries to delete

      • Optionalrefresh: boolean

      Returns Promise<HashesEntry>

      await api.bulkDelete([file.hash]);
      
    • move many entries

      Parameters

      • hashes: readonly string[]

        an array of entry hashes to move

      • parent: string

        the directory id to move the entries to, "" (root) and "trash" are special ids

      • Optionalrefresh: boolean

      Returns Promise<HashesEntry>

      await api.bulkMove([file.hash], dir.id);
      
    • completely delete the cache

      If the cache is causing memory issues, you can clear it, but this will hurt performance.

      Returns void

    • delete an entry

      Parameters

      • hash: string

        the hash of the entry to delete

      • Optionalrefresh: boolean

      Returns Promise<HashEntry>

      await api.delete(file.hash);
      
    • get the current cache value as a string

      You can use this to warm start a new instance of remarkable with any previously cached results.

      Returns string

    • get the content metadata from an item hash

      This takes the high level item hash, e.g. the hashes you get from listItems or listIds.

      Parameters

      • hash: string

        the hash of the item to get content for

      Returns Promise<Content>

      the content

      If this fails validation and you still want to get the content, you can use the low-level api to get the raw text of the .content file in the RawListEntry for this hash.

    • get the entire contents of a remarkable document

      This gets every file of associated with a document, and puts them into a zip archive.

      Parameters

      • hash: string

        the hash of the document to get the contents for (e.g. the hash received from listItems)

      Returns Promise<Uint8Array<ArrayBufferLike>>

      This is an experimental feature, that works for downloading the raw version of the document, but this format isn't understood enoguh to reput this on a different remarkable, so that functionality is currently disabled.

    • get the epub associated with a document hash

      This returns the raw input epub if a document was created from an epub.

      Parameters

      • hash: string

        the hash of the document to get the pdf for (e.g. the hash received from listItems)

      Returns Promise<Uint8Array<ArrayBufferLike>>

      the epub bytes

    • get the metadata from an item hash

      This takes the high level item hash, e.g. the hashes you get from listItems or listIds.

      Parameters

      • hash: string

        the hash of the item to get metadata for

      Returns Promise<Metadata>

      the metadata

      If this fails validation and you still want to get the content, you can use the low-level api to get the raw text of the .metadata file in the RawListEntry for this hash.

    • get the pdf associated with a document hash

      This returns the raw input pdf, not the rendered pdf with any markup.

      Parameters

      • hash: string

        the hash of the document to get the pdf for (e.g. the hash received from listItems)

      Returns Promise<Uint8Array<ArrayBufferLike>>

      the pdf bytes

    • similar to listItems but backed by the low level api

      Parameters

      • Optionalrefresh: boolean

        if true, refresh the root hash before listing

      Returns Promise<SimpleEntry[]>

    • list all items

      Items include both collections and documents. Documents that are in folders will have their parent set to something other than "" or "trash", but everything will be returned by this function.

      Parameters

      • Optionalrefresh: boolean

        if true, refresh the root hash before listing

      Returns Promise<Entry[]>

      a list of all items with some metadata

      await api.listItems();
      

      This is now backed by the low level api, and you may notice some performance degradation if not taking advantage of the cache.

    • move an entry

      Parameters

      • hash: string

        the hash of the file to move

      • parent: string

        the id of the directory to move the entry to, "" (root) and "trash" are special parents

      • Optionalrefresh: boolean

      Returns Promise<HashEntry>

      await api.move(doc.hash, dir.id);
      
    • prune the cache so that it contains only reachable hashes

      The cache is append only, so it can grow without bound, even as hashes become unreachable. In the future, this may have better cache management to track this in real time, but for now, you can call this method, to keep it from growing continuously.

      Parameters

      • Optionalrefresh: boolean

        whether to refresh the root hash before pruning

      Returns Promise<void>

      This won't necessarily reduce the cache size. In order to see if hashes are reachable we first have to search through all existing entry lists.

    • use the low-level api to add an epub document

      Since this uses the low-level api, it provides more options than uploadEpub, but is a little more finicky. Notably, it may throw a GenerationError if the generation doesn't match the current server generation, requiring you to retry until it works.

      Parameters

      • visibleName: string

        the name to display on the reMarkable

      • buffer: Uint8Array

        the raw epub

      • Optionalopts: PutOptions

        put options

      Returns Promise<SimpleEntry>

      the entry for the newly inserted document

      GenerationError if the generation doesn't match the current server generation

    • use the low-level api to add a pdf document

      Since this uses the low-level api, it provides more options than uploadPdf, but is a little more finicky. Notably, it may throw a GenerationError if the generation doesn't match the current server generation, requiring you to retry until it works.

      Parameters

      • visibleName: string

        the name to display on the reMarkable

      • buffer: Uint8Array

        the raw pdf

      • Optionalopts: PutOptions

        put options

      Returns Promise<SimpleEntry>

      the entry for the newly inserted document

      GenerationError if the generation doesn't match the current server generation

    • rename an entry

      Parameters

      • hash: string

        the hash of the entry to rename

      • visibleName: string

        the new name to assign

      • Optionalrefresh: boolean

      Returns Promise<HashEntry>

      await api.rename(file.hash, "new name");
      
    • set if an entry is stared

      Parameters

      • hash: string

        the hash of the entry to rename

      • stared: boolean

        whether the entry should be stared or not

      • Optionalrefresh: boolean

      Returns Promise<HashEntry>

      await api.stared(file.hash, true);
      
    • update content metadata for a collection

      Parameters

      • hash: string

        the hash of the file to update

      • content: Partial<CollectionContent>

        the fields of content to update

      • Optionalrefresh: boolean

      Returns Promise<HashEntry>

      await api.updateCollection(doc.hash, { textAlignment: "left" });
      
    • update content metadata for a document

      Parameters

      • hash: string

        the hash of the file to update

      • content: Partial<DocumentContent>

        the fields of content to update

      • Optionalrefresh: boolean

      Returns Promise<HashEntry>

      await api.updateDocument(doc.hash, { textAlignment: "left" });
      
    • update content metadata for a template

      Parameters

      • hash: string

        the hash of the file to update

      • content: Partial<TemplateContent>

        the fields of content to update

      • Optionalrefresh: boolean

      Returns Promise<HashEntry>

      await api.updateTemplate(doc.hash, { textAlignment: "left" });
      
    • upload an epub

      Parameters

      • visibleName: string

        the name to show for the uploaded epub

      • buffer: Uint8Array

        the epub contents

      • Optionalopts: UploadOptions

      Returns Promise<SimpleEntry>

      await api.uploadEpub("My EPub", ...);
      

      this is now simply a less powerful version of putEpub.

    • upload a pdf

      Parameters

      • visibleName: string

        the name to show for the uploaded epub

      • buffer: Uint8Array

        the epub contents

      • Optionalopts: UploadOptions

      Returns Promise<SimpleEntry>

      await api.uploadPdf("My PDF", ...);
      

      this is now simply a less powerful version of putPdf.