trilium_alchemy.core.branch

Class index

Canonical

Branch

Encapsulates a branch, a parent-child association between notes.

Symbols

class trilium_alchemy.core.branch.Branch(parent: Note = None, child: Note = None, prefix: str = '', expanded: bool = False, session: Session = None, **kwargs)
Parameters:
parent: Note = None

Parent note

child: Note = None

Child note

prefix: str = ''

Branch specific title prefix for child note

expanded: bool = False

True if child note (as a folder) appears expanded in UI

kwargs

Internal only

Bases:

trilium_alchemy.core.entity.entity.OrderedEntity

Aliases:

trilium_alchemy.Branch
trilium_alchemy.core.Branch

Encapsulates a branch, a parent-child association between notes.

Implicitly created by operations documented in Note and Branches. Can also be explicitly created and added to a note using its += operator:

# add child note with prefix
note += Branch(child=Note(title="Child note"), prefix="Child branch prefix")

# add parent note (cloning the note) with prefix
note += Branch(parent=session.root, prefix="Parent branch prefix")
property branch_id: str | None

Getter for branchId, or None if not created yet.

property parent: Note | None

Getter/setter for branch’s parent note.

property child: Note | None

Getter/setter for branch’s child note.

property prefix: str

Getter/setter for branch prefix.

property expanded: bool

Getter/setter for whether child note (as a folder) appears expanded in UI.

property utc_date_modified: str

UTC modified datetime, e.g. 2021-12-31 19:18:11.939Z.

property position: int

Getter for position of this branch.

Note

This is maintained automatically based on the order of this branch in its parent note’s Note.branches.children list.

property state: State

Inherited from: trilium_alchemy.core.entity.BaseEntity

Current state.

property session: Session

Inherited from: trilium_alchemy.core.entity.BaseEntity

Session to which this entity belongs.

property str_short: str

Inherited from: trilium_alchemy.core.entity.BaseEntity

Get a short description of this entity.

property str_summary: str

Inherited from: trilium_alchemy.core.entity.BaseEntity

Get a summary of this entity, including its current state and model values.

flush()

Inherited from: trilium_alchemy.core.entity.BaseEntity

Commit changes to Trilium for this entity and its dependencies.

invalidate()

Inherited from: trilium_alchemy.core.entity.BaseEntity

Discard cached contents and user-provided data for this object. Upon next access, data will be fetched from Trilium.

delete()

Inherited from: trilium_alchemy.core.entity.BaseEntity

Mark this entity for pending delete.

refresh()

Inherited from: trilium_alchemy.core.entity.BaseEntity

Update value from Trilium, discarding any local changes.