rmapi-js
    Preparing search index...

    Class LibraryTemplate

    a template item of the library, as it was when handed out, whose definition its .template holds; named apart from Template, the definition itself

    definition reads the definition with the edits not yet sent, and putDefinition queues the edits made with its setters. The next sync merges them field by field with the account's copy, where of a field both changed the later change wins. A sync stores each template's definition, so it reads offline. An edit returns it as it is after; one of an item purged since throws a NotHeldError.

    const template = library.template(id);
    if (template !== undefined) {
    const definition = await template.definition();
    definition.setAuthor("me");
    await template.putDefinition(definition);
    }

    Hierarchy

    • LibraryItem
      • LibraryTemplate
    Index
    • get accountSizeBytes(): bigint

      the size of all its files, as the account reports it

      Returns bigint

    • get hash(): string | undefined

      the hash the account lists it at, or undefined if no fetch has seen it

      Returns string | undefined

    • get id(): string

      the id, which finds the item again

      Returns string

    • get modifiedAt(): Date

      when it was last renamed or read

      Returns Date

    • get name(): string

      the name shown on the device

      Returns string

    • get starred(): boolean

      whether it is starred

      Returns boolean

    • get top(): Top

      where following its parents up ends

      Returns Top

    • get unreadable(): boolean

      whether the last sync could not read it as the account holds it, so it shows as it was last read, or, never read, with only what its .metadata and file list give; an app should show it with a warning

      Returns boolean

    • everything inside it, through folders, each once, as purgeAll would purge it now; none for a document or a template

      Returns Entry[]

    • the file named name in its index, such as <id>.content, if the account lists it

      Parameters

      • name: string

      Returns EntryFile | undefined

    • the size of its files the store holds, in bytes

      Returns Promise<bigint>

    • move it, including into and out of the trash, and return it as it is now

      Parameters

      Returns this

    • purge it for good; what is inside a folder stays and becomes stray

      Returns void

    • purge it and everything inside it, returning the ids queued to purge

      Returns string[]

    • queue the edits made to definition since it was read or last put, take them as made, and return it as it is now; until this settles, an edit of definition or another put of it throws a PutRunningError

      Parameters

      Returns Promise<LibraryTemplate>

    • rename it, and return it as it is now

      Parameters

      • name: string

      Returns this

    • move it out of the trash to the root, and return it as it is now

      Returns this

    • move it out of the trash into folder, and return it as it is now

      Parameters

      Returns this

    • star or unstar it, and return it as it is now

      Parameters

      • starred: boolean

      Returns this

    • fetch each file the account lists for it into the platform's store, unless it holds it, so it reads offline; throws for the first that failed

      Returns Promise<void>

    • move it to the trash, and return it as it is now

      Returns this