Skip to content

Notebooks

albert.resources.notebooks

Attributes:

Name Type Description
ListContent
NotebookBlock
NotebookContent
allowed_notebook_contents

ListContent

ListContent = Annotated[
    NumberedListContent | BulletedListContent,
    Field(discriminator="style"),
]

NotebookBlock

NotebookBlock = Annotated[
    _NotebookBlockUnion, Field(discriminator="type")
]

ListBlockStyle

Bases: str, Enum

The style of a list block.

Attributes:

Name Type Description
ORDERED str

A numbered list.

UNORDERED str

A bulleted list.

ORDERED

ORDERED = 'ordered'

UNORDERED

UNORDERED = 'unordered'

BlockType

Bases: str, Enum

The type of a notebook content block.

Attributes:

Name Type Description
PARAGRAPH str

A block of free text.

LIST str

A bulleted or numbered list.

HEADER str

A section heading.

CHECKLIST str

A list of checkable items.

IMAGE str

An embedded image.

ATTACHES str

An attached file.

KETCHER str

A chemical structure drawn in the Ketcher editor.

TABLE str

A tabular grid of cells.

WORD str

A Microsoft Word document (wire value msdocx).

EXCEL str

A Microsoft Excel workbook (wire value msxlsx).

POWERPOINT str

A Microsoft PowerPoint presentation (wire value mspptx).

REPORT str

An embedded Albert report.

LIVE_CANVAS str

An embedded Artifact (wire value liveCanvas).

PARAGRAPH

PARAGRAPH = 'paragraph'

LIST

LIST = 'list'

HEADER

HEADER = 'header'

CHECKLIST

CHECKLIST = 'checklist'

IMAGE

IMAGE = 'image'

ATTACHES

ATTACHES = 'attaches'

KETCHER

KETCHER = 'ketcher'

TABLE

TABLE = 'table'

WORD

WORD = 'msdocx'

EXCEL

EXCEL = 'msxlsx'

POWERPOINT

POWERPOINT = 'mspptx'

REPORT

REPORT = 'report'

LIVE_CANVAS

LIVE_CANVAS = 'liveCanvas'

NotebookCopyType

Bases: str, Enum

The kind of copy to perform when copying a notebook.

Attributes:

Name Type Description
TEMPLATE str

Copy into a notebook template.

TASK str

Copy into a task.

PROJECT str

Copy into a project.

RESTORE_TEMPLATE str

Restore a notebook from a template.

GEN_TASK_TEMPLATE str

Copy into a general task template.

TEMPLATE

TEMPLATE = 'template'

TASK

TASK = 'Task'

PROJECT

PROJECT = 'Project'

RESTORE_TEMPLATE

RESTORE_TEMPLATE = 'restoreTemplate'

GEN_TASK_TEMPLATE

GEN_TASK_TEMPLATE = 'genTaskTemplate'

BaseBlock

Bases: BaseAlbertModel

Common fields shared by every notebook block.

Show JSON schema:
{
  "description": "Common fields shared by every notebook block.",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    }
  },
  "title": "BaseBlock",
  "type": "object"
}

Fields:

id

id: str

The block's unique identifier. Generated automatically (a UUID) if not provided.

version

version: datetime | None = None

The version timestamp of the block, set by Albert.

HeaderContent

Bases: BaseAlbertModel

The content of a header block.

Show JSON schema:
{
  "description": "The content of a header block.",
  "properties": {
    "level": {
      "description": "The heading level (1 is the largest heading).",
      "minimum": 1,
      "title": "Level",
      "type": "integer"
    },
    "text": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "The heading text.",
      "title": "Text"
    }
  },
  "required": [
    "level",
    "text"
  ],
  "title": "HeaderContent",
  "type": "object"
}

Fields:

level

level: int

The heading level (1 is the largest heading).

text

text: str | None

The heading text.

HeaderBlock

Bases: BaseBlock

A section heading in a notebook.

Example

from albert.resources.notebooks import HeaderBlock, HeaderContent

block = HeaderBlock(content=HeaderContent(level=1, text="Procedure"))
Show JSON schema:
{
  "$defs": {
    "HeaderContent": {
      "description": "The content of a header block.",
      "properties": {
        "level": {
          "description": "The heading level (1 is the largest heading).",
          "minimum": 1,
          "title": "Level",
          "type": "integer"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The heading text.",
          "title": "Text"
        }
      },
      "required": [
        "level",
        "text"
      ],
      "title": "HeaderContent",
      "type": "object"
    }
  },
  "description": "A section heading in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import HeaderBlock, HeaderContent\n\n    block = HeaderBlock(content=HeaderContent(level=1, text=\"Procedure\"))\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "header",
      "default": "header",
      "description": "Always [`HEADER`][albert.resources.notebooks.BlockType.HEADER].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/HeaderContent",
      "description": "The heading level and text."
    }
  },
  "required": [
    "content"
  ],
  "title": "HeaderBlock",
  "type": "object"
}

Fields:

type

Always HEADER.

content

content: HeaderContent

The heading level and text.

ParagraphContent

Bases: BaseAlbertModel

The content of a paragraph block.

Show JSON schema:
{
  "description": "The content of a paragraph block.",
  "properties": {
    "text": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "The paragraph text.",
      "title": "Text"
    }
  },
  "required": [
    "text"
  ],
  "title": "ParagraphContent",
  "type": "object"
}

Fields:

text

text: str | None

The paragraph text.

ParagraphBlock

Bases: BaseBlock

A block of free text in a notebook.

Example

from albert.resources.notebooks import ParagraphBlock, ParagraphContent

block = ParagraphBlock(content=ParagraphContent(text="Weighed 1.2 g."))
Show JSON schema:
{
  "$defs": {
    "ParagraphContent": {
      "description": "The content of a paragraph block.",
      "properties": {
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The paragraph text.",
          "title": "Text"
        }
      },
      "required": [
        "text"
      ],
      "title": "ParagraphContent",
      "type": "object"
    }
  },
  "description": "A block of free text in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import ParagraphBlock, ParagraphContent\n\n    block = ParagraphBlock(content=ParagraphContent(text=\"Weighed 1.2 g.\"))\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "paragraph",
      "default": "paragraph",
      "description": "Always [`PARAGRAPH`][albert.resources.notebooks.BlockType.PARAGRAPH].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/ParagraphContent",
      "description": "The paragraph text."
    }
  },
  "required": [
    "content"
  ],
  "title": "ParagraphBlock",
  "type": "object"
}

Fields:

content

The paragraph text.

ChecklistItem

Bases: BaseAlbertModel

A single entry in a checklist block.

Show JSON schema:
{
  "description": "A single entry in a checklist block.",
  "properties": {
    "checked": {
      "description": "Whether the item is checked.",
      "title": "Checked",
      "type": "boolean"
    },
    "text": {
      "description": "The item's label text.",
      "title": "Text",
      "type": "string"
    }
  },
  "required": [
    "checked",
    "text"
  ],
  "title": "ChecklistItem",
  "type": "object"
}

Fields:

checked

checked: bool

Whether the item is checked.

text

text: str

The item's label text.

ChecklistContent

Bases: BaseAlbertModel

The content of a checklist block.

Show JSON schema:
{
  "$defs": {
    "ChecklistItem": {
      "description": "A single entry in a checklist block.",
      "properties": {
        "checked": {
          "description": "Whether the item is checked.",
          "title": "Checked",
          "type": "boolean"
        },
        "text": {
          "description": "The item's label text.",
          "title": "Text",
          "type": "string"
        }
      },
      "required": [
        "checked",
        "text"
      ],
      "title": "ChecklistItem",
      "type": "object"
    }
  },
  "description": "The content of a checklist block.",
  "properties": {
    "items": {
      "description": "The checklist entries, in order.",
      "items": {
        "$ref": "#/$defs/ChecklistItem"
      },
      "title": "Items",
      "type": "array"
    }
  },
  "required": [
    "items"
  ],
  "title": "ChecklistContent",
  "type": "object"
}

Fields:

items

The checklist entries, in order.

ChecklistBlock

Bases: BaseBlock

A list of checkable items in a notebook.

Example

from albert.resources.notebooks import (
    ChecklistBlock,
    ChecklistContent,
    ChecklistItem,
)

block = ChecklistBlock(
    content=ChecklistContent(
        items=[ChecklistItem(text="Calibrate scale", checked=False)]
    )
)
Show JSON schema:
{
  "$defs": {
    "ChecklistContent": {
      "description": "The content of a checklist block.",
      "properties": {
        "items": {
          "description": "The checklist entries, in order.",
          "items": {
            "$ref": "#/$defs/ChecklistItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "items"
      ],
      "title": "ChecklistContent",
      "type": "object"
    },
    "ChecklistItem": {
      "description": "A single entry in a checklist block.",
      "properties": {
        "checked": {
          "description": "Whether the item is checked.",
          "title": "Checked",
          "type": "boolean"
        },
        "text": {
          "description": "The item's label text.",
          "title": "Text",
          "type": "string"
        }
      },
      "required": [
        "checked",
        "text"
      ],
      "title": "ChecklistItem",
      "type": "object"
    }
  },
  "description": "A list of checkable items in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import (\n        ChecklistBlock,\n        ChecklistContent,\n        ChecklistItem,\n    )\n\n    block = ChecklistBlock(\n        content=ChecklistContent(\n            items=[ChecklistItem(text=\"Calibrate scale\", checked=False)]\n        )\n    )\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "checklist",
      "default": "checklist",
      "description": "Always [`CHECKLIST`][albert.resources.notebooks.BlockType.CHECKLIST].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/ChecklistContent",
      "description": "The checklist items."
    }
  },
  "required": [
    "content"
  ],
  "title": "ChecklistBlock",
  "type": "object"
}

Fields:

content

The checklist items.

is_checked

is_checked(*, target_text: str) -> bool | None

Return the checked state of a checklist item by its text.

Parameters:

Name Type Description Default
target_text str

The label text of the checklist entry to look up.

required

Returns:

Type Description
bool | None

The checked state of the matching entry, or None if no entry has the given text.

Source code in src/albert/resources/notebooks.py
def is_checked(self, *, target_text: str) -> bool | None:
    """Return the checked state of a checklist item by its text.

    Parameters
    ----------
    target_text : str
        The label text of the checklist entry to look up.

    Returns
    -------
    bool | None
        The checked state of the matching entry, or ``None`` if no entry has
        the given text.
    """
    # loop items
    for i in self.content.items:
        if i.text == target_text:
            # return check state
            return i.checked

    # return None if no match
    return

AttachesContent

Bases: BaseAlbertModel

The content of a file attachment block.

Provide either file_path (a local file to upload) or file_key (an already-uploaded file) when building the block.

Show JSON schema:
{
  "description": "The content of a file attachment block.\n\nProvide either ``file_path`` (a local file to upload) or ``file_key`` (an\nalready-uploaded file) when building the block.",
  "properties": {
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The display title of the attachment. Defaults to the file name.",
      "title": "Title"
    },
    "namespace": {
      "default": "result",
      "description": "The file storage namespace. Defaults to ``\"result\"``.",
      "title": "Namespace",
      "type": "string"
    },
    "fileKey": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The storage key of the uploaded file on Albert.",
      "title": "Filekey"
    },
    "mimeType": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The MIME type of the file (e.g. ``\"application/pdf\"``). Inferred from the file name if not set.",
      "title": "Mimetype"
    },
    "file_path": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "format": "path",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Path to a local file to upload. Not stored on the server.",
      "title": "File Path"
    },
    "signedURL": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A temporary download URL for the file, populated by Albert. Read-only.",
      "title": "Signedurl"
    }
  },
  "title": "AttachesContent",
  "type": "object"
}

Fields:

title

title: str | None = None

The display title of the attachment. Defaults to the file name.

namespace

namespace: str = 'result'

The file storage namespace. Defaults to "result".

file_key

file_key: str | None = None

The storage key of the uploaded file on Albert.

format

format: str | None = None

The MIME type of the file (e.g. "application/pdf"). Inferred from the file name if not set.

file_path

file_path: str | Path | None = None

Path to a local file to upload. Not stored on the server.

signed_url

signed_url: str | None = None

A temporary download URL for the file, populated by Albert. Read-only.

AttachesBlock

Bases: BaseBlock

An attached file in a notebook.

Example

from albert.resources.notebooks import AttachesBlock, AttachesContent

block = AttachesBlock(
    content=AttachesContent(file_path="/path/to/spectrum.pdf")
)
Show JSON schema:
{
  "$defs": {
    "AttachesContent": {
      "description": "The content of a file attachment block.\n\nProvide either ``file_path`` (a local file to upload) or ``file_key`` (an\nalready-uploaded file) when building the block.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the attachment. Defaults to the file name.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the uploaded file on Albert.",
          "title": "Filekey"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The MIME type of the file (e.g. ``\"application/pdf\"``). Inferred from the file name if not set.",
          "title": "Mimetype"
        },
        "file_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Path to a local file to upload. Not stored on the server.",
          "title": "File Path"
        },
        "signedURL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A temporary download URL for the file, populated by Albert. Read-only.",
          "title": "Signedurl"
        }
      },
      "title": "AttachesContent",
      "type": "object"
    }
  },
  "description": "An attached file in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import AttachesBlock, AttachesContent\n\n    block = AttachesBlock(\n        content=AttachesContent(file_path=\"/path/to/spectrum.pdf\")\n    )\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "attaches",
      "default": "attaches",
      "description": "Always [`ATTACHES`][albert.resources.notebooks.BlockType.ATTACHES].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/AttachesContent",
      "description": "The attachment details."
    }
  },
  "required": [
    "content"
  ],
  "title": "AttachesBlock",
  "type": "object"
}

Fields:

type

Always ATTACHES.

content

content: AttachesContent

The attachment details.

ImageContent

Bases: BaseAlbertModel

The content of an image block.

Provide either file_path (a local image to upload) or file_key (an already-uploaded image) when building the block.

Show JSON schema:
{
  "description": "The content of an image block.\n\nProvide either ``file_path`` (a local image to upload) or ``file_key`` (an\nalready-uploaded image) when building the block.",
  "properties": {
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The caption or title of the image.",
      "title": "Title"
    },
    "namespace": {
      "default": "result",
      "description": "The file storage namespace. Defaults to ``\"result\"``.",
      "title": "Namespace",
      "type": "string"
    },
    "stretched": {
      "default": false,
      "description": "Whether the image is stretched to full width.",
      "title": "Stretched",
      "type": "boolean"
    },
    "withBackground": {
      "default": false,
      "description": "Whether the image is shown with a background.",
      "title": "Withbackground",
      "type": "boolean"
    },
    "withBorder": {
      "default": false,
      "description": "Whether the image is shown with a border.",
      "title": "Withborder",
      "type": "boolean"
    },
    "fileKey": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The storage key of the uploaded image on Albert.",
      "title": "Filekey"
    },
    "mimeType": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The MIME type of the image (e.g. ``\"image/png\"``). Inferred from the file name if not set.",
      "title": "Mimetype"
    },
    "file_path": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "format": "path",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Path to a local image to upload. Not stored on the server.",
      "title": "File Path"
    },
    "signedURL": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A temporary download URL for the image, populated by Albert. Read-only.",
      "title": "Signedurl"
    }
  },
  "title": "ImageContent",
  "type": "object"
}

Fields:

title

title: str | None = None

The caption or title of the image.

namespace

namespace: str = 'result'

The file storage namespace. Defaults to "result".

stretched

stretched: bool = False

Whether the image is stretched to full width.

with_background

with_background: bool = False

Whether the image is shown with a background.

with_border

with_border: bool = False

Whether the image is shown with a border.

file_key

file_key: str | None = None

The storage key of the uploaded image on Albert.

format

format: str | None = None

The MIME type of the image (e.g. "image/png"). Inferred from the file name if not set.

file_path

file_path: str | Path | None = None

Path to a local image to upload. Not stored on the server.

signed_url

signed_url: str | None = None

A temporary download URL for the image, populated by Albert. Read-only.

ImageBlock

Bases: BaseBlock

An embedded image in a notebook.

Example

from albert.resources.notebooks import ImageBlock, ImageContent

block = ImageBlock(content=ImageContent(file_path="/path/to/plot.png"))
Show JSON schema:
{
  "$defs": {
    "ImageContent": {
      "description": "The content of an image block.\n\nProvide either ``file_path`` (a local image to upload) or ``file_key`` (an\nalready-uploaded image) when building the block.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The caption or title of the image.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "stretched": {
          "default": false,
          "description": "Whether the image is stretched to full width.",
          "title": "Stretched",
          "type": "boolean"
        },
        "withBackground": {
          "default": false,
          "description": "Whether the image is shown with a background.",
          "title": "Withbackground",
          "type": "boolean"
        },
        "withBorder": {
          "default": false,
          "description": "Whether the image is shown with a border.",
          "title": "Withborder",
          "type": "boolean"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the uploaded image on Albert.",
          "title": "Filekey"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The MIME type of the image (e.g. ``\"image/png\"``). Inferred from the file name if not set.",
          "title": "Mimetype"
        },
        "file_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Path to a local image to upload. Not stored on the server.",
          "title": "File Path"
        },
        "signedURL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A temporary download URL for the image, populated by Albert. Read-only.",
          "title": "Signedurl"
        }
      },
      "title": "ImageContent",
      "type": "object"
    }
  },
  "description": "An embedded image in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import ImageBlock, ImageContent\n\n    block = ImageBlock(content=ImageContent(file_path=\"/path/to/plot.png\"))\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "image",
      "default": "image",
      "description": "Always [`IMAGE`][albert.resources.notebooks.BlockType.IMAGE].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/ImageContent",
      "description": "The image details."
    }
  },
  "required": [
    "content"
  ],
  "title": "ImageBlock",
  "type": "object"
}

Fields:

type

Always IMAGE.

content

content: ImageContent

The image details.

KetcherContent

Bases: BaseAlbertModel

The content of a Ketcher chemical-structure block.

When creating a new Ketcher block, set smiles to the structure's SMILES string; the remaining fields are populated by Albert. Existing Ketcher blocks cannot be edited in place.

Show JSON schema:
{
  "description": "The content of a Ketcher chemical-structure block.\n\nWhen creating a new Ketcher block, set ``smiles`` to the structure's SMILES\nstring; the remaining fields are populated by Albert. Existing Ketcher blocks\ncannot be edited in place.",
  "properties": {
    "synthesisId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the synthesis backing the drawing (format ``SYN...``). Set by Albert when the block is created.",
      "title": "Synthesisid"
    },
    "id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The internal content ID.",
      "title": "Id"
    },
    "blockId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the block this content belongs to.",
      "title": "Blockid"
    },
    "data": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The raw Ketcher canvas data.",
      "title": "Data"
    },
    "fileKey": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The storage key of the rendered structure.",
      "title": "Filekey"
    },
    "s3Key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The storage key of the associated synthesis canvas.",
      "title": "S3Key"
    },
    "png": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "A PNG rendering of the structure.",
      "title": "Png"
    },
    "stateType": {
      "default": "project",
      "description": "The state context of the drawing. Defaults to ``\"project\"``.",
      "title": "Statetype",
      "type": "string"
    },
    "smiles": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The SMILES string describing the chemical structure.",
      "title": "Smiles"
    }
  },
  "title": "KetcherContent",
  "type": "object"
}

Fields:

synthesis_id

synthesis_id: SynthesisId | None = None

The ID of the synthesis backing the drawing (format SYN...). Set by Albert when the block is created.

id

id: str | None = None

The internal content ID.

block_id

block_id: str | None = None

The ID of the block this content belongs to.

data

data: str | None = None

The raw Ketcher canvas data.

file_key

file_key: str | None = None

The storage key of the rendered structure.

s3_key

s3_key: str | None = None

The storage key of the associated synthesis canvas.

png

png: str | None = None

A PNG rendering of the structure.

state_type

state_type: str = 'project'

The state context of the drawing. Defaults to "project".

smiles

smiles: str | None = None

The SMILES string describing the chemical structure.

KetcherBlock

Bases: BaseBlock

A chemical structure drawn in the Ketcher editor.

Example

from albert.resources.notebooks import KetcherBlock, KetcherContent

block = KetcherBlock(content=KetcherContent(smiles="CCO"))
Show JSON schema:
{
  "$defs": {
    "KetcherContent": {
      "description": "The content of a Ketcher chemical-structure block.\n\nWhen creating a new Ketcher block, set ``smiles`` to the structure's SMILES\nstring; the remaining fields are populated by Albert. Existing Ketcher blocks\ncannot be edited in place.",
      "properties": {
        "synthesisId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the synthesis backing the drawing (format ``SYN...``). Set by Albert when the block is created.",
          "title": "Synthesisid"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The internal content ID.",
          "title": "Id"
        },
        "blockId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the block this content belongs to.",
          "title": "Blockid"
        },
        "data": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The raw Ketcher canvas data.",
          "title": "Data"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the rendered structure.",
          "title": "Filekey"
        },
        "s3Key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the associated synthesis canvas.",
          "title": "S3Key"
        },
        "png": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A PNG rendering of the structure.",
          "title": "Png"
        },
        "stateType": {
          "default": "project",
          "description": "The state context of the drawing. Defaults to ``\"project\"``.",
          "title": "Statetype",
          "type": "string"
        },
        "smiles": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The SMILES string describing the chemical structure.",
          "title": "Smiles"
        }
      },
      "title": "KetcherContent",
      "type": "object"
    }
  },
  "description": "A chemical structure drawn in the Ketcher editor.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import KetcherBlock, KetcherContent\n\n    block = KetcherBlock(content=KetcherContent(smiles=\"CCO\"))\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "ketcher",
      "default": "ketcher",
      "description": "Always [`KETCHER`][albert.resources.notebooks.BlockType.KETCHER].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/KetcherContent",
      "description": "The structure details, typically built from a SMILES string."
    }
  },
  "required": [
    "content"
  ],
  "title": "KetcherBlock",
  "type": "object"
}

Fields:

type

Always KETCHER.

content

content: KetcherContent

The structure details, typically built from a SMILES string.

TableContent

Bases: BaseAlbertModel

The content of a table block.

Show JSON schema:
{
  "description": "The content of a table block.",
  "properties": {
    "content": {
      "description": "The table cells as a list of rows, each row a list of cell values.",
      "items": {
        "items": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "type": "array"
      },
      "title": "Content",
      "type": "array"
    },
    "withHeadings": {
      "default": false,
      "description": "Whether the first row should be treated as column headings.",
      "title": "Withheadings",
      "type": "boolean"
    }
  },
  "required": [
    "content"
  ],
  "title": "TableContent",
  "type": "object"
}

Fields:

content

content: list[list[str | None]]

The table cells as a list of rows, each row a list of cell values.

with_headings

with_headings: bool = False

Whether the first row should be treated as column headings.

TableBlock

Bases: BaseBlock

A tabular grid of cells in a notebook.

Example

from albert.resources.notebooks import TableBlock, TableContent

block = TableBlock(
    content=TableContent(
        content=[["Trial", "Yield"], ["1", "82%"]],
        with_headings=True,
    )
)
Show JSON schema:
{
  "$defs": {
    "TableContent": {
      "description": "The content of a table block.",
      "properties": {
        "content": {
          "description": "The table cells as a list of rows, each row a list of cell values.",
          "items": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array"
          },
          "title": "Content",
          "type": "array"
        },
        "withHeadings": {
          "default": false,
          "description": "Whether the first row should be treated as column headings.",
          "title": "Withheadings",
          "type": "boolean"
        }
      },
      "required": [
        "content"
      ],
      "title": "TableContent",
      "type": "object"
    }
  },
  "description": "A tabular grid of cells in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import TableBlock, TableContent\n\n    block = TableBlock(\n        content=TableContent(\n            content=[[\"Trial\", \"Yield\"], [\"1\", \"82%\"]],\n            with_headings=True,\n        )\n    )\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "table",
      "default": "table",
      "description": "Always [`TABLE`][albert.resources.notebooks.BlockType.TABLE].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/TableContent",
      "description": "The table cells."
    }
  },
  "required": [
    "content"
  ],
  "title": "TableBlock",
  "type": "object"
}

Fields:

type

Always TABLE.

content

content: TableContent

The table cells.

to_df

to_df(*, infer_header: bool = True) -> DataFrame

Convert the table block's content to a pandas DataFrame.

Parameters:

Name Type Description Default
infer_header bool

If True, use the first row as column names (with HTML formatting stripped) and drop it from the data.

True

Returns:

Type Description
DataFrame

The block's content as a pandas DataFrame.

Source code in src/albert/resources/notebooks.py
def to_df(self, *, infer_header: bool = True) -> DataFrame:
    """Convert the table block's content to a pandas DataFrame.

    Parameters
    ----------
    infer_header : bool, default True
        If ``True``, use the first row as column names (with HTML formatting
        stripped) and drop it from the data.

    Returns
    -------
    DataFrame
        The block's content as a pandas DataFrame.
    """

    # convert to df
    df = DataFrame(self.content.content)

    if infer_header:
        # clean df -> column name w/o formatting
        df.columns = df.iloc[0, :]
        df.columns = [re.sub(r"<.*?>", "", x) for x in df.columns]
        # discard first
        df = df.iloc[1:, :].reset_index(drop=True)

    # return df
    return df

NotebookListItem

Bases: BaseAlbertModel

A single entry in a list block, which may itself contain nested entries.

Show JSON schema:
{
  "$defs": {
    "NotebookListItem": {
      "description": "A single entry in a list block, which may itself contain nested entries.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The item's text.",
          "title": "Content"
        },
        "items": {
          "description": "Nested sub-items beneath this entry.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "content"
      ],
      "title": "NotebookListItem",
      "type": "object"
    }
  },
  "$ref": "#/$defs/NotebookListItem"
}

Fields:

content

content: str | None

The item's text.

items

Nested sub-items beneath this entry.

BulletedListContent

Bases: BaseAlbertModel

The content of a bulleted (unordered) list block.

Show JSON schema:
{
  "$defs": {
    "NotebookListItem": {
      "description": "A single entry in a list block, which may itself contain nested entries.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The item's text.",
          "title": "Content"
        },
        "items": {
          "description": "Nested sub-items beneath this entry.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "content"
      ],
      "title": "NotebookListItem",
      "type": "object"
    }
  },
  "description": "The content of a bulleted (unordered) list block.",
  "properties": {
    "items": {
      "description": "The list entries, in order.",
      "items": {
        "$ref": "#/$defs/NotebookListItem"
      },
      "title": "Items",
      "type": "array"
    },
    "style": {
      "const": "unordered",
      "default": "unordered",
      "description": "Always [`UNORDERED`][albert.resources.notebooks.ListBlockStyle.UNORDERED].",
      "title": "Style",
      "type": "string"
    }
  },
  "required": [
    "items"
  ],
  "title": "BulletedListContent",
  "type": "object"
}

Fields:

items

The list entries, in order.

NumberedListContent

Bases: BaseAlbertModel

The content of a numbered (ordered) list block.

Show JSON schema:
{
  "$defs": {
    "NotebookListItem": {
      "description": "A single entry in a list block, which may itself contain nested entries.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The item's text.",
          "title": "Content"
        },
        "items": {
          "description": "Nested sub-items beneath this entry.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "content"
      ],
      "title": "NotebookListItem",
      "type": "object"
    }
  },
  "description": "The content of a numbered (ordered) list block.",
  "properties": {
    "items": {
      "description": "The list entries, in order.",
      "items": {
        "$ref": "#/$defs/NotebookListItem"
      },
      "title": "Items",
      "type": "array"
    },
    "style": {
      "const": "ordered",
      "default": "ordered",
      "description": "Always [`ORDERED`][albert.resources.notebooks.ListBlockStyle.ORDERED].",
      "title": "Style",
      "type": "string"
    }
  },
  "required": [
    "items"
  ],
  "title": "NumberedListContent",
  "type": "object"
}

Fields:

items

The list entries, in order.

style

Always ORDERED.

ListBlock

Bases: BaseBlock

A bulleted or numbered list in a notebook.

Example

from albert.resources.notebooks import (
    ListBlock,
    BulletedListContent,
    NotebookListItem,
)

block = ListBlock(
    content=BulletedListContent(
        items=[NotebookListItem(content="First step")]
    )
)
Show JSON schema:
{
  "$defs": {
    "BulletedListContent": {
      "description": "The content of a bulleted (unordered) list block.",
      "properties": {
        "items": {
          "description": "The list entries, in order.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        },
        "style": {
          "const": "unordered",
          "default": "unordered",
          "description": "Always [`UNORDERED`][albert.resources.notebooks.ListBlockStyle.UNORDERED].",
          "title": "Style",
          "type": "string"
        }
      },
      "required": [
        "items"
      ],
      "title": "BulletedListContent",
      "type": "object"
    },
    "NotebookListItem": {
      "description": "A single entry in a list block, which may itself contain nested entries.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The item's text.",
          "title": "Content"
        },
        "items": {
          "description": "Nested sub-items beneath this entry.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "content"
      ],
      "title": "NotebookListItem",
      "type": "object"
    },
    "NumberedListContent": {
      "description": "The content of a numbered (ordered) list block.",
      "properties": {
        "items": {
          "description": "The list entries, in order.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        },
        "style": {
          "const": "ordered",
          "default": "ordered",
          "description": "Always [`ORDERED`][albert.resources.notebooks.ListBlockStyle.ORDERED].",
          "title": "Style",
          "type": "string"
        }
      },
      "required": [
        "items"
      ],
      "title": "NumberedListContent",
      "type": "object"
    }
  },
  "description": "A bulleted or numbered list in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import (\n        ListBlock,\n        BulletedListContent,\n        NotebookListItem,\n    )\n\n    block = ListBlock(\n        content=BulletedListContent(\n            items=[NotebookListItem(content=\"First step\")]\n        )\n    )\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "list",
      "default": "list",
      "description": "Always [`LIST`][albert.resources.notebooks.BlockType.LIST].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "description": "The list entries and style.",
      "discriminator": {
        "mapping": {
          "ordered": "#/$defs/NumberedListContent",
          "unordered": "#/$defs/BulletedListContent"
        },
        "propertyName": "style"
      },
      "oneOf": [
        {
          "$ref": "#/$defs/NumberedListContent"
        },
        {
          "$ref": "#/$defs/BulletedListContent"
        }
      ],
      "title": "Content"
    }
  },
  "required": [
    "content"
  ],
  "title": "ListBlock",
  "type": "object"
}

Fields:

type

Always LIST.

content

content: ListContent

The list entries and style.

OfficeContent

Bases: BaseAlbertModel

The content of a Microsoft Office block (Word, Excel, or PowerPoint).

Office blocks are created with empty content; Albert generates the backing document and populates title and file_key.

Show JSON schema:
{
  "description": "The content of a Microsoft Office block (Word, Excel, or PowerPoint).\n\nOffice blocks are created with empty content; Albert generates the backing\ndocument and populates ``title`` and ``file_key``.",
  "properties": {
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The display title of the Office document. Set by Albert when the document is created.",
      "title": "Title"
    },
    "namespace": {
      "default": "result",
      "description": "The file storage namespace. Defaults to ``\"result\"``.",
      "title": "Namespace",
      "type": "string"
    },
    "fileKey": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The storage key of the Office document on Albert. Set by Albert when the document is created.",
      "title": "Filekey"
    }
  },
  "title": "OfficeContent",
  "type": "object"
}

Fields:

title

title: str | None = None

The display title of the Office document. Set by Albert when the document is created.

namespace

namespace: str = 'result'

The file storage namespace. Defaults to "result".

file_key

file_key: str | None = None

The storage key of the Office document on Albert. Set by Albert when the document is created.

WordBlock

Bases: BaseBlock

A Microsoft Word document embedded in a notebook.

Example

from albert.resources.notebooks import WordBlock

block = WordBlock()
Show JSON schema:
{
  "$defs": {
    "OfficeContent": {
      "description": "The content of a Microsoft Office block (Word, Excel, or PowerPoint).\n\nOffice blocks are created with empty content; Albert generates the backing\ndocument and populates ``title`` and ``file_key``.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the Office document. Set by Albert when the document is created.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the Office document on Albert. Set by Albert when the document is created.",
          "title": "Filekey"
        }
      },
      "title": "OfficeContent",
      "type": "object"
    }
  },
  "description": "A Microsoft Word document embedded in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import WordBlock\n\n    block = WordBlock()\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "msdocx",
      "default": "msdocx",
      "description": "Always [`WORD`][albert.resources.notebooks.BlockType.WORD].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/OfficeContent",
      "description": "The Word document details."
    }
  },
  "title": "WordBlock",
  "type": "object"
}

Fields:

type

Always WORD.

content

content: OfficeContent

The Word document details.

ExcelBlock

Bases: BaseBlock

A Microsoft Excel workbook embedded in a notebook.

Example

from albert.resources.notebooks import ExcelBlock

block = ExcelBlock()
Show JSON schema:
{
  "$defs": {
    "OfficeContent": {
      "description": "The content of a Microsoft Office block (Word, Excel, or PowerPoint).\n\nOffice blocks are created with empty content; Albert generates the backing\ndocument and populates ``title`` and ``file_key``.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the Office document. Set by Albert when the document is created.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the Office document on Albert. Set by Albert when the document is created.",
          "title": "Filekey"
        }
      },
      "title": "OfficeContent",
      "type": "object"
    }
  },
  "description": "A Microsoft Excel workbook embedded in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import ExcelBlock\n\n    block = ExcelBlock()\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "msxlsx",
      "default": "msxlsx",
      "description": "Always [`EXCEL`][albert.resources.notebooks.BlockType.EXCEL].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/OfficeContent",
      "description": "The Excel workbook details."
    }
  },
  "title": "ExcelBlock",
  "type": "object"
}

Fields:

type

Always EXCEL.

content

content: OfficeContent

The Excel workbook details.

PowerPointBlock

Bases: BaseBlock

A Microsoft PowerPoint presentation embedded in a notebook.

Example

from albert.resources.notebooks import PowerPointBlock

block = PowerPointBlock()
Show JSON schema:
{
  "$defs": {
    "OfficeContent": {
      "description": "The content of a Microsoft Office block (Word, Excel, or PowerPoint).\n\nOffice blocks are created with empty content; Albert generates the backing\ndocument and populates ``title`` and ``file_key``.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the Office document. Set by Albert when the document is created.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the Office document on Albert. Set by Albert when the document is created.",
          "title": "Filekey"
        }
      },
      "title": "OfficeContent",
      "type": "object"
    }
  },
  "description": "A Microsoft PowerPoint presentation embedded in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import PowerPointBlock\n\n    block = PowerPointBlock()\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "mspptx",
      "default": "mspptx",
      "description": "Always [`POWERPOINT`][albert.resources.notebooks.BlockType.POWERPOINT].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/OfficeContent",
      "description": "The PowerPoint presentation details."
    }
  },
  "title": "PowerPointBlock",
  "type": "object"
}

Fields:

content

content: OfficeContent

The PowerPoint presentation details.

ReportContent

Bases: BaseAlbertModel

The content of a report block.

Report blocks embed an Albert report in a notebook. The API stores the content as a free-form object, so unknown fields are preserved on the model.

Show JSON schema:
{
  "additionalProperties": true,
  "description": "The content of a report block.\n\nReport blocks embed an Albert report in a notebook. The API stores the\ncontent as a free-form object, so unknown fields are preserved on the model.",
  "properties": {},
  "title": "ReportContent",
  "type": "object"
}

Config:

  • extra: allow

model_config

model_config = ConfigDict(extra='allow')

ReportBlock

Bases: BaseBlock

An Albert report embedded in a notebook.

Example

from albert.resources.notebooks import ReportBlock

block = ReportBlock()
Show JSON schema:
{
  "$defs": {
    "ReportContent": {
      "additionalProperties": true,
      "description": "The content of a report block.\n\nReport blocks embed an Albert report in a notebook. The API stores the\ncontent as a free-form object, so unknown fields are preserved on the model.",
      "properties": {},
      "title": "ReportContent",
      "type": "object"
    }
  },
  "description": "An Albert report embedded in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import ReportBlock\n\n    block = ReportBlock()\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "report",
      "default": "report",
      "description": "Always [`REPORT`][albert.resources.notebooks.BlockType.REPORT].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/ReportContent",
      "description": "The report block payload."
    }
  },
  "title": "ReportBlock",
  "type": "object"
}

Fields:

type

Always REPORT.

content

content: ReportContent

The report block payload.

LiveCanvasContent

Bases: BaseAlbertModel

The content of an Artifact block.

The block points at an Artifact; the Artifact's own content is stored and versioned separately. Unknown fields are preserved on the model so a read-modify-write round trip sends the block back unchanged.

Show JSON schema:
{
  "additionalProperties": true,
  "description": "The content of an Artifact block.\n\nThe block points at an Artifact; the Artifact's own content is stored and\nversioned separately. Unknown fields are preserved on the model so a\nread-modify-write round trip sends the block back unchanged.",
  "properties": {
    "canvasId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the embedded Artifact (format ``CNV...``).",
      "title": "Canvasid"
    },
    "shareId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the share that places the Artifact in this notebook.",
      "title": "Shareid"
    },
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Artifact title shown on the block, when cached.",
      "title": "Title"
    }
  },
  "title": "LiveCanvasContent",
  "type": "object"
}

Config:

  • extra: allow

Fields:

model_config

model_config = ConfigDict(extra='allow')

canvas_id

canvas_id: str | None = None

The ID of the embedded Artifact (format CNV...).

share_id

share_id: str | None = None

The ID of the share that places the Artifact in this notebook.

title

title: str | None = None

The Artifact title shown on the block, when cached.

LiveCanvasBlock

Bases: BaseBlock

An Artifact embedded in a notebook.

Artifact blocks are placed by sharing an Artifact to a notebook. Read them to find which Artifact is embedded; keep them in the blocks list unchanged when saving notebook content so the embed is not removed.

Example

from albert.resources.notebooks import LiveCanvasBlock

notebook = client.notebooks.get_by_id(id="NTB123")
artifacts = [b for b in notebook.blocks if isinstance(b, LiveCanvasBlock)]
Show JSON schema:
{
  "$defs": {
    "LiveCanvasContent": {
      "additionalProperties": true,
      "description": "The content of an Artifact block.\n\nThe block points at an Artifact; the Artifact's own content is stored and\nversioned separately. Unknown fields are preserved on the model so a\nread-modify-write round trip sends the block back unchanged.",
      "properties": {
        "canvasId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the embedded Artifact (format ``CNV...``).",
          "title": "Canvasid"
        },
        "shareId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the share that places the Artifact in this notebook.",
          "title": "Shareid"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Artifact title shown on the block, when cached.",
          "title": "Title"
        }
      },
      "title": "LiveCanvasContent",
      "type": "object"
    }
  },
  "description": "An Artifact embedded in a notebook.\n\nArtifact blocks are placed by sharing an Artifact to a notebook. Read them to\nfind which Artifact is embedded; keep them in the ``blocks`` list unchanged\nwhen saving notebook content so the embed is not removed.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import LiveCanvasBlock\n\n    notebook = client.notebooks.get_by_id(id=\"NTB123\")\n    artifacts = [b for b in notebook.blocks if isinstance(b, LiveCanvasBlock)]\n    ```",
  "properties": {
    "albertId": {
      "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
      "title": "Albertid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the block, set by Albert.",
      "title": "Version"
    },
    "blockType": {
      "const": "liveCanvas",
      "default": "liveCanvas",
      "description": "Always [`LIVE_CANVAS`][albert.resources.notebooks.BlockType.LIVE_CANVAS].",
      "title": "Blocktype",
      "type": "string"
    },
    "content": {
      "$ref": "#/$defs/LiveCanvasContent",
      "description": "The embedded Artifact reference."
    }
  },
  "title": "LiveCanvasBlock",
  "type": "object"
}

Fields:

content

The embedded Artifact reference.

NotebookSearchItem

Bases: BaseAlbertModel

A block-level notebook search hit.

Returned by search, each hit represents a single matching content block rather than a full notebook. Use get_by_id or get_block_by_id to retrieve full notebook content.

Show JSON schema:
{
  "$defs": {
    "AuditFields": {
      "description": "The audit fields for a resource",
      "properties": {
        "by": {
          "default": null,
          "title": "By",
          "type": "string"
        },
        "byName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Byname"
        },
        "at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "At"
        }
      },
      "title": "AuditFields",
      "type": "object"
    },
    "Status": {
      "description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n    The resource is fully operational and visible in normal operations.\nINACTIVE : str\n    The resource is hidden from normal operations and disabled from use.",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    }
  },
  "description": "A block-level notebook search hit.\n\nReturned by\n[`search`][albert.collections.notebooks.NotebookCollection.search],\neach hit represents a single matching content block rather than a full\nnotebook. Use\n[`get_by_id`][albert.collections.notebooks.NotebookCollection.get_by_id]\nor [`get_block_by_id`][albert.collections.notebooks.NotebookCollection.get_block_by_id]\nto retrieve full notebook content.",
  "properties": {
    "blockId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the matching block.",
      "title": "Blockid"
    },
    "notebookId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the notebook containing the matching block (format ``NTB...``).",
      "title": "Notebookid"
    },
    "projectId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The notebook parent entity ID returned by search (often a project, but may be a task or template).",
      "title": "Projectid"
    },
    "blockType": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The type of the matching block (for example, ``paragraph``, ``ketcher``, or ``table``).",
      "title": "Blocktype"
    },
    "content": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The block payload. The shape varies by block type.",
      "title": "Content"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The notebook name, when indexed.",
      "title": "Name"
    },
    "status": {
      "anyOf": [
        {
          "$ref": "#/$defs/Status"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The notebook status."
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit information for when the notebook was created."
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit information for when the notebook was last updated."
    }
  },
  "title": "NotebookSearchItem",
  "type": "object"
}

Fields:

block_id

block_id: str | None = None

The ID of the matching block.

notebook_id

notebook_id: NotebookId | None = None

The ID of the notebook containing the matching block (format NTB...).

project_id

project_id: str | None = None

The notebook parent entity ID returned by search (often a project, but may be a task or template).

block_type

block_type: str | None = None

The type of the matching block (for example, paragraph, ketcher, or table).

content

content: Any | None = None

The block payload. The shape varies by block type.

name

name: str | None = None

The notebook name, when indexed.

status

status: Status | None = None

The notebook status.

created

created: AuditFields | None = None

Audit information for when the notebook was created.

updated

updated: AuditFields | None = None

Audit information for when the notebook was last updated.

Bases: BaseAlbertModel

A link from a notebook to another Albert entity.

Show JSON schema:
{
  "$defs": {
    "EntityLink": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Category"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLink",
      "type": "object"
    }
  },
  "description": "A link from a notebook to another Albert entity.",
  "properties": {
    "id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the link (format ``LNK...``).",
      "title": "Id"
    },
    "Child": {
      "$ref": "#/$defs/EntityLink",
      "description": "The linked entity."
    }
  },
  "required": [
    "Child"
  ],
  "title": "NotebookLink",
  "type": "object"
}

Fields:

id

id: LinkId | None = None

The ID of the link (format LNK...).

child

child: EntityLink

The linked entity.

Notebook

Bases: BaseResource

An electronic lab notebook (ELN) in Albert.

A Notebook is an ordered document of content blocks (paragraphs, headers, checklists, tables, images, attachments, lists, Ketcher chemical drawings, Microsoft Office documents, embedded reports, and embedded Artifacts) attached to a parent Project, Task, or custom template. Notebooks are created empty and then populated block-by-block; see NotebookCollection for the workflow.

Example

from albert.resources.notebooks import Notebook

notebook = Notebook(name="Trial 1 log", parent_id="PRO123")
Show JSON schema:
{
  "$defs": {
    "AttachesBlock": {
      "description": "An attached file in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import AttachesBlock, AttachesContent\n\n    block = AttachesBlock(\n        content=AttachesContent(file_path=\"/path/to/spectrum.pdf\")\n    )\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "attaches",
          "default": "attaches",
          "description": "Always [`ATTACHES`][albert.resources.notebooks.BlockType.ATTACHES].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/AttachesContent",
          "description": "The attachment details."
        }
      },
      "required": [
        "content"
      ],
      "title": "AttachesBlock",
      "type": "object"
    },
    "AttachesContent": {
      "description": "The content of a file attachment block.\n\nProvide either ``file_path`` (a local file to upload) or ``file_key`` (an\nalready-uploaded file) when building the block.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the attachment. Defaults to the file name.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the uploaded file on Albert.",
          "title": "Filekey"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The MIME type of the file (e.g. ``\"application/pdf\"``). Inferred from the file name if not set.",
          "title": "Mimetype"
        },
        "file_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Path to a local file to upload. Not stored on the server.",
          "title": "File Path"
        },
        "signedURL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A temporary download URL for the file, populated by Albert. Read-only.",
          "title": "Signedurl"
        }
      },
      "title": "AttachesContent",
      "type": "object"
    },
    "AuditFields": {
      "description": "The audit fields for a resource",
      "properties": {
        "by": {
          "default": null,
          "title": "By",
          "type": "string"
        },
        "byName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Byname"
        },
        "at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "At"
        }
      },
      "title": "AuditFields",
      "type": "object"
    },
    "BulletedListContent": {
      "description": "The content of a bulleted (unordered) list block.",
      "properties": {
        "items": {
          "description": "The list entries, in order.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        },
        "style": {
          "const": "unordered",
          "default": "unordered",
          "description": "Always [`UNORDERED`][albert.resources.notebooks.ListBlockStyle.UNORDERED].",
          "title": "Style",
          "type": "string"
        }
      },
      "required": [
        "items"
      ],
      "title": "BulletedListContent",
      "type": "object"
    },
    "ChecklistBlock": {
      "description": "A list of checkable items in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import (\n        ChecklistBlock,\n        ChecklistContent,\n        ChecklistItem,\n    )\n\n    block = ChecklistBlock(\n        content=ChecklistContent(\n            items=[ChecklistItem(text=\"Calibrate scale\", checked=False)]\n        )\n    )\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "checklist",
          "default": "checklist",
          "description": "Always [`CHECKLIST`][albert.resources.notebooks.BlockType.CHECKLIST].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/ChecklistContent",
          "description": "The checklist items."
        }
      },
      "required": [
        "content"
      ],
      "title": "ChecklistBlock",
      "type": "object"
    },
    "ChecklistContent": {
      "description": "The content of a checklist block.",
      "properties": {
        "items": {
          "description": "The checklist entries, in order.",
          "items": {
            "$ref": "#/$defs/ChecklistItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "items"
      ],
      "title": "ChecklistContent",
      "type": "object"
    },
    "ChecklistItem": {
      "description": "A single entry in a checklist block.",
      "properties": {
        "checked": {
          "description": "Whether the item is checked.",
          "title": "Checked",
          "type": "boolean"
        },
        "text": {
          "description": "The item's label text.",
          "title": "Text",
          "type": "string"
        }
      },
      "required": [
        "checked",
        "text"
      ],
      "title": "ChecklistItem",
      "type": "object"
    },
    "EntityLink": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        },
        "category": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Category"
        }
      },
      "required": [
        "id"
      ],
      "title": "EntityLink",
      "type": "object"
    },
    "ExcelBlock": {
      "description": "A Microsoft Excel workbook embedded in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import ExcelBlock\n\n    block = ExcelBlock()\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "msxlsx",
          "default": "msxlsx",
          "description": "Always [`EXCEL`][albert.resources.notebooks.BlockType.EXCEL].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/OfficeContent",
          "description": "The Excel workbook details."
        }
      },
      "title": "ExcelBlock",
      "type": "object"
    },
    "HeaderBlock": {
      "description": "A section heading in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import HeaderBlock, HeaderContent\n\n    block = HeaderBlock(content=HeaderContent(level=1, text=\"Procedure\"))\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "header",
          "default": "header",
          "description": "Always [`HEADER`][albert.resources.notebooks.BlockType.HEADER].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/HeaderContent",
          "description": "The heading level and text."
        }
      },
      "required": [
        "content"
      ],
      "title": "HeaderBlock",
      "type": "object"
    },
    "HeaderContent": {
      "description": "The content of a header block.",
      "properties": {
        "level": {
          "description": "The heading level (1 is the largest heading).",
          "minimum": 1,
          "title": "Level",
          "type": "integer"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The heading text.",
          "title": "Text"
        }
      },
      "required": [
        "level",
        "text"
      ],
      "title": "HeaderContent",
      "type": "object"
    },
    "ImageBlock": {
      "description": "An embedded image in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import ImageBlock, ImageContent\n\n    block = ImageBlock(content=ImageContent(file_path=\"/path/to/plot.png\"))\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "image",
          "default": "image",
          "description": "Always [`IMAGE`][albert.resources.notebooks.BlockType.IMAGE].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/ImageContent",
          "description": "The image details."
        }
      },
      "required": [
        "content"
      ],
      "title": "ImageBlock",
      "type": "object"
    },
    "ImageContent": {
      "description": "The content of an image block.\n\nProvide either ``file_path`` (a local image to upload) or ``file_key`` (an\nalready-uploaded image) when building the block.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The caption or title of the image.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "stretched": {
          "default": false,
          "description": "Whether the image is stretched to full width.",
          "title": "Stretched",
          "type": "boolean"
        },
        "withBackground": {
          "default": false,
          "description": "Whether the image is shown with a background.",
          "title": "Withbackground",
          "type": "boolean"
        },
        "withBorder": {
          "default": false,
          "description": "Whether the image is shown with a border.",
          "title": "Withborder",
          "type": "boolean"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the uploaded image on Albert.",
          "title": "Filekey"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The MIME type of the image (e.g. ``\"image/png\"``). Inferred from the file name if not set.",
          "title": "Mimetype"
        },
        "file_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Path to a local image to upload. Not stored on the server.",
          "title": "File Path"
        },
        "signedURL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A temporary download URL for the image, populated by Albert. Read-only.",
          "title": "Signedurl"
        }
      },
      "title": "ImageContent",
      "type": "object"
    },
    "KetcherBlock": {
      "description": "A chemical structure drawn in the Ketcher editor.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import KetcherBlock, KetcherContent\n\n    block = KetcherBlock(content=KetcherContent(smiles=\"CCO\"))\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "ketcher",
          "default": "ketcher",
          "description": "Always [`KETCHER`][albert.resources.notebooks.BlockType.KETCHER].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/KetcherContent",
          "description": "The structure details, typically built from a SMILES string."
        }
      },
      "required": [
        "content"
      ],
      "title": "KetcherBlock",
      "type": "object"
    },
    "KetcherContent": {
      "description": "The content of a Ketcher chemical-structure block.\n\nWhen creating a new Ketcher block, set ``smiles`` to the structure's SMILES\nstring; the remaining fields are populated by Albert. Existing Ketcher blocks\ncannot be edited in place.",
      "properties": {
        "synthesisId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the synthesis backing the drawing (format ``SYN...``). Set by Albert when the block is created.",
          "title": "Synthesisid"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The internal content ID.",
          "title": "Id"
        },
        "blockId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the block this content belongs to.",
          "title": "Blockid"
        },
        "data": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The raw Ketcher canvas data.",
          "title": "Data"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the rendered structure.",
          "title": "Filekey"
        },
        "s3Key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the associated synthesis canvas.",
          "title": "S3Key"
        },
        "png": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A PNG rendering of the structure.",
          "title": "Png"
        },
        "stateType": {
          "default": "project",
          "description": "The state context of the drawing. Defaults to ``\"project\"``.",
          "title": "Statetype",
          "type": "string"
        },
        "smiles": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The SMILES string describing the chemical structure.",
          "title": "Smiles"
        }
      },
      "title": "KetcherContent",
      "type": "object"
    },
    "ListBlock": {
      "description": "A bulleted or numbered list in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import (\n        ListBlock,\n        BulletedListContent,\n        NotebookListItem,\n    )\n\n    block = ListBlock(\n        content=BulletedListContent(\n            items=[NotebookListItem(content=\"First step\")]\n        )\n    )\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "list",
          "default": "list",
          "description": "Always [`LIST`][albert.resources.notebooks.BlockType.LIST].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "description": "The list entries and style.",
          "discriminator": {
            "mapping": {
              "ordered": "#/$defs/NumberedListContent",
              "unordered": "#/$defs/BulletedListContent"
            },
            "propertyName": "style"
          },
          "oneOf": [
            {
              "$ref": "#/$defs/NumberedListContent"
            },
            {
              "$ref": "#/$defs/BulletedListContent"
            }
          ],
          "title": "Content"
        }
      },
      "required": [
        "content"
      ],
      "title": "ListBlock",
      "type": "object"
    },
    "LiveCanvasBlock": {
      "description": "An Artifact embedded in a notebook.\n\nArtifact blocks are placed by sharing an Artifact to a notebook. Read them to\nfind which Artifact is embedded; keep them in the ``blocks`` list unchanged\nwhen saving notebook content so the embed is not removed.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import LiveCanvasBlock\n\n    notebook = client.notebooks.get_by_id(id=\"NTB123\")\n    artifacts = [b for b in notebook.blocks if isinstance(b, LiveCanvasBlock)]\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "liveCanvas",
          "default": "liveCanvas",
          "description": "Always [`LIVE_CANVAS`][albert.resources.notebooks.BlockType.LIVE_CANVAS].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/LiveCanvasContent",
          "description": "The embedded Artifact reference."
        }
      },
      "title": "LiveCanvasBlock",
      "type": "object"
    },
    "LiveCanvasContent": {
      "additionalProperties": true,
      "description": "The content of an Artifact block.\n\nThe block points at an Artifact; the Artifact's own content is stored and\nversioned separately. Unknown fields are preserved on the model so a\nread-modify-write round trip sends the block back unchanged.",
      "properties": {
        "canvasId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the embedded Artifact (format ``CNV...``).",
          "title": "Canvasid"
        },
        "shareId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the share that places the Artifact in this notebook.",
          "title": "Shareid"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Artifact title shown on the block, when cached.",
          "title": "Title"
        }
      },
      "title": "LiveCanvasContent",
      "type": "object"
    },
    "NotebookLink": {
      "description": "A link from a notebook to another Albert entity.",
      "properties": {
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the link (format ``LNK...``).",
          "title": "Id"
        },
        "Child": {
          "$ref": "#/$defs/EntityLink",
          "description": "The linked entity."
        }
      },
      "required": [
        "Child"
      ],
      "title": "NotebookLink",
      "type": "object"
    },
    "NotebookListItem": {
      "description": "A single entry in a list block, which may itself contain nested entries.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The item's text.",
          "title": "Content"
        },
        "items": {
          "description": "Nested sub-items beneath this entry.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "content"
      ],
      "title": "NotebookListItem",
      "type": "object"
    },
    "NumberedListContent": {
      "description": "The content of a numbered (ordered) list block.",
      "properties": {
        "items": {
          "description": "The list entries, in order.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        },
        "style": {
          "const": "ordered",
          "default": "ordered",
          "description": "Always [`ORDERED`][albert.resources.notebooks.ListBlockStyle.ORDERED].",
          "title": "Style",
          "type": "string"
        }
      },
      "required": [
        "items"
      ],
      "title": "NumberedListContent",
      "type": "object"
    },
    "OfficeContent": {
      "description": "The content of a Microsoft Office block (Word, Excel, or PowerPoint).\n\nOffice blocks are created with empty content; Albert generates the backing\ndocument and populates ``title`` and ``file_key``.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the Office document. Set by Albert when the document is created.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the Office document on Albert. Set by Albert when the document is created.",
          "title": "Filekey"
        }
      },
      "title": "OfficeContent",
      "type": "object"
    },
    "ParagraphBlock": {
      "description": "A block of free text in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import ParagraphBlock, ParagraphContent\n\n    block = ParagraphBlock(content=ParagraphContent(text=\"Weighed 1.2 g.\"))\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "paragraph",
          "default": "paragraph",
          "description": "Always [`PARAGRAPH`][albert.resources.notebooks.BlockType.PARAGRAPH].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/ParagraphContent",
          "description": "The paragraph text."
        }
      },
      "required": [
        "content"
      ],
      "title": "ParagraphBlock",
      "type": "object"
    },
    "ParagraphContent": {
      "description": "The content of a paragraph block.",
      "properties": {
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The paragraph text.",
          "title": "Text"
        }
      },
      "required": [
        "text"
      ],
      "title": "ParagraphContent",
      "type": "object"
    },
    "PowerPointBlock": {
      "description": "A Microsoft PowerPoint presentation embedded in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import PowerPointBlock\n\n    block = PowerPointBlock()\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "mspptx",
          "default": "mspptx",
          "description": "Always [`POWERPOINT`][albert.resources.notebooks.BlockType.POWERPOINT].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/OfficeContent",
          "description": "The PowerPoint presentation details."
        }
      },
      "title": "PowerPointBlock",
      "type": "object"
    },
    "ReportBlock": {
      "description": "An Albert report embedded in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import ReportBlock\n\n    block = ReportBlock()\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "report",
          "default": "report",
          "description": "Always [`REPORT`][albert.resources.notebooks.BlockType.REPORT].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/ReportContent",
          "description": "The report block payload."
        }
      },
      "title": "ReportBlock",
      "type": "object"
    },
    "ReportContent": {
      "additionalProperties": true,
      "description": "The content of a report block.\n\nReport blocks embed an Albert report in a notebook. The API stores the\ncontent as a free-form object, so unknown fields are preserved on the model.",
      "properties": {},
      "title": "ReportContent",
      "type": "object"
    },
    "Status": {
      "description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n    The resource is fully operational and visible in normal operations.\nINACTIVE : str\n    The resource is hidden from normal operations and disabled from use.",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    },
    "TableBlock": {
      "description": "A tabular grid of cells in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import TableBlock, TableContent\n\n    block = TableBlock(\n        content=TableContent(\n            content=[[\"Trial\", \"Yield\"], [\"1\", \"82%\"]],\n            with_headings=True,\n        )\n    )\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "table",
          "default": "table",
          "description": "Always [`TABLE`][albert.resources.notebooks.BlockType.TABLE].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/TableContent",
          "description": "The table cells."
        }
      },
      "required": [
        "content"
      ],
      "title": "TableBlock",
      "type": "object"
    },
    "TableContent": {
      "description": "The content of a table block.",
      "properties": {
        "content": {
          "description": "The table cells as a list of rows, each row a list of cell values.",
          "items": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array"
          },
          "title": "Content",
          "type": "array"
        },
        "withHeadings": {
          "default": false,
          "description": "Whether the first row should be treated as column headings.",
          "title": "Withheadings",
          "type": "boolean"
        }
      },
      "required": [
        "content"
      ],
      "title": "TableContent",
      "type": "object"
    },
    "WordBlock": {
      "description": "A Microsoft Word document embedded in a notebook.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import WordBlock\n\n    block = WordBlock()\n    ```",
      "properties": {
        "albertId": {
          "description": "The block's unique identifier. Generated automatically (a UUID) if not provided.",
          "title": "Albertid",
          "type": "string"
        },
        "version": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The version timestamp of the block, set by Albert.",
          "title": "Version"
        },
        "blockType": {
          "const": "msdocx",
          "default": "msdocx",
          "description": "Always [`WORD`][albert.resources.notebooks.BlockType.WORD].",
          "title": "Blocktype",
          "type": "string"
        },
        "content": {
          "$ref": "#/$defs/OfficeContent",
          "description": "The Word document details."
        }
      },
      "title": "WordBlock",
      "type": "object"
    }
  },
  "description": "An electronic lab notebook (ELN) in Albert.\n\nA Notebook is an ordered document of content blocks (paragraphs, headers,\nchecklists, tables, images, attachments, lists, Ketcher chemical drawings,\nMicrosoft Office documents, embedded reports, and embedded Artifacts)\nattached to a parent Project, Task, or custom template. Notebooks are created\nempty and then populated block-by-block; see\n[`NotebookCollection`][albert.collections.notebooks.NotebookCollection] for the workflow.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import Notebook\n\n    notebook = Notebook(name=\"Trial 1 log\", parent_id=\"PRO123\")\n    ```",
  "properties": {
    "status": {
      "anyOf": [
        {
          "$ref": "#/$defs/Status"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The status of the resource, optional."
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit fields for the creation of the resource, optional."
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit fields for the update of the resource, optional."
    },
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The Albert ID of the notebook (format ``NTB...``). Set once the notebook exists on Albert.",
      "title": "Albertid"
    },
    "name": {
      "default": "Untitled Notebook",
      "description": "The notebook's name. Defaults to ``\"Untitled Notebook\"``.",
      "title": "Name",
      "type": "string"
    },
    "parentId": {
      "description": "The entity the notebook is attached to (a Project ``PRO...``, Task ``TAS...``, or custom template ``CTP...``).",
      "title": "Parentid",
      "type": "string"
    },
    "version": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The version timestamp of the notebook, set by Albert.",
      "title": "Version"
    },
    "blocks": {
      "description": "The ordered content blocks of the notebook.",
      "items": {
        "discriminator": {
          "mapping": {
            "attaches": "#/$defs/AttachesBlock",
            "checklist": "#/$defs/ChecklistBlock",
            "header": "#/$defs/HeaderBlock",
            "image": "#/$defs/ImageBlock",
            "ketcher": "#/$defs/KetcherBlock",
            "list": "#/$defs/ListBlock",
            "liveCanvas": "#/$defs/LiveCanvasBlock",
            "msdocx": "#/$defs/WordBlock",
            "mspptx": "#/$defs/PowerPointBlock",
            "msxlsx": "#/$defs/ExcelBlock",
            "paragraph": "#/$defs/ParagraphBlock",
            "report": "#/$defs/ReportBlock",
            "table": "#/$defs/TableBlock"
          },
          "propertyName": "blockType"
        },
        "oneOf": [
          {
            "$ref": "#/$defs/HeaderBlock"
          },
          {
            "$ref": "#/$defs/ParagraphBlock"
          },
          {
            "$ref": "#/$defs/ChecklistBlock"
          },
          {
            "$ref": "#/$defs/AttachesBlock"
          },
          {
            "$ref": "#/$defs/ImageBlock"
          },
          {
            "$ref": "#/$defs/KetcherBlock"
          },
          {
            "$ref": "#/$defs/TableBlock"
          },
          {
            "$ref": "#/$defs/ListBlock"
          },
          {
            "$ref": "#/$defs/WordBlock"
          },
          {
            "$ref": "#/$defs/ExcelBlock"
          },
          {
            "$ref": "#/$defs/PowerPointBlock"
          },
          {
            "$ref": "#/$defs/ReportBlock"
          },
          {
            "$ref": "#/$defs/LiveCanvasBlock"
          }
        ]
      },
      "title": "Blocks",
      "type": "array"
    },
    "links": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/NotebookLink"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Links from this notebook to other Albert entities.",
      "title": "Links"
    }
  },
  "required": [
    "parentId"
  ],
  "title": "Notebook",
  "type": "object"
}

Fields:

id

id: NotebookId | None = None

The Albert ID of the notebook (format NTB...). Set once the notebook exists on Albert.

name

name: str = 'Untitled Notebook'

The notebook's name. Defaults to "Untitled Notebook".

parent_id

The entity the notebook is attached to (a Project PRO..., Task TAS..., or custom template CTP...).

version

version: datetime | None = None

The version timestamp of the notebook, set by Albert.

blocks

The ordered content blocks of the notebook.

links: list[NotebookLink] | None = None

Links from this notebook to other Albert entities.

PutOperation

Bases: str, Enum

The operation to apply to a block when saving notebook content.

Attributes:

Name Type Description
UPDATE str

Create or update the block.

DELETE str

Remove the block from the notebook.

UPDATE

UPDATE = 'update'

DELETE

DELETE = 'delete'

PutBlockDatum

Bases: BaseAlbertModel

Show JSON schema:
{
  "$defs": {
    "AttachesContent": {
      "description": "The content of a file attachment block.\n\nProvide either ``file_path`` (a local file to upload) or ``file_key`` (an\nalready-uploaded file) when building the block.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the attachment. Defaults to the file name.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the uploaded file on Albert.",
          "title": "Filekey"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The MIME type of the file (e.g. ``\"application/pdf\"``). Inferred from the file name if not set.",
          "title": "Mimetype"
        },
        "file_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Path to a local file to upload. Not stored on the server.",
          "title": "File Path"
        },
        "signedURL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A temporary download URL for the file, populated by Albert. Read-only.",
          "title": "Signedurl"
        }
      },
      "title": "AttachesContent",
      "type": "object"
    },
    "BlockType": {
      "description": "The type of a notebook content block.\n\nAttributes\n----------\nPARAGRAPH : str\n    A block of free text.\nLIST : str\n    A bulleted or numbered list.\nHEADER : str\n    A section heading.\nCHECKLIST : str\n    A list of checkable items.\nIMAGE : str\n    An embedded image.\nATTACHES : str\n    An attached file.\nKETCHER : str\n    A chemical structure drawn in the Ketcher editor.\nTABLE : str\n    A tabular grid of cells.\nWORD : str\n    A Microsoft Word document (wire value ``msdocx``).\nEXCEL : str\n    A Microsoft Excel workbook (wire value ``msxlsx``).\nPOWERPOINT : str\n    A Microsoft PowerPoint presentation (wire value ``mspptx``).\nREPORT : str\n    An embedded Albert report.\nLIVE_CANVAS : str\n    An embedded Artifact (wire value ``liveCanvas``).",
      "enum": [
        "paragraph",
        "list",
        "header",
        "checklist",
        "image",
        "attaches",
        "ketcher",
        "table",
        "msdocx",
        "msxlsx",
        "mspptx",
        "report",
        "liveCanvas"
      ],
      "title": "BlockType",
      "type": "string"
    },
    "BulletedListContent": {
      "description": "The content of a bulleted (unordered) list block.",
      "properties": {
        "items": {
          "description": "The list entries, in order.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        },
        "style": {
          "const": "unordered",
          "default": "unordered",
          "description": "Always [`UNORDERED`][albert.resources.notebooks.ListBlockStyle.UNORDERED].",
          "title": "Style",
          "type": "string"
        }
      },
      "required": [
        "items"
      ],
      "title": "BulletedListContent",
      "type": "object"
    },
    "ChecklistContent": {
      "description": "The content of a checklist block.",
      "properties": {
        "items": {
          "description": "The checklist entries, in order.",
          "items": {
            "$ref": "#/$defs/ChecklistItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "items"
      ],
      "title": "ChecklistContent",
      "type": "object"
    },
    "ChecklistItem": {
      "description": "A single entry in a checklist block.",
      "properties": {
        "checked": {
          "description": "Whether the item is checked.",
          "title": "Checked",
          "type": "boolean"
        },
        "text": {
          "description": "The item's label text.",
          "title": "Text",
          "type": "string"
        }
      },
      "required": [
        "checked",
        "text"
      ],
      "title": "ChecklistItem",
      "type": "object"
    },
    "HeaderContent": {
      "description": "The content of a header block.",
      "properties": {
        "level": {
          "description": "The heading level (1 is the largest heading).",
          "minimum": 1,
          "title": "Level",
          "type": "integer"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The heading text.",
          "title": "Text"
        }
      },
      "required": [
        "level",
        "text"
      ],
      "title": "HeaderContent",
      "type": "object"
    },
    "ImageContent": {
      "description": "The content of an image block.\n\nProvide either ``file_path`` (a local image to upload) or ``file_key`` (an\nalready-uploaded image) when building the block.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The caption or title of the image.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "stretched": {
          "default": false,
          "description": "Whether the image is stretched to full width.",
          "title": "Stretched",
          "type": "boolean"
        },
        "withBackground": {
          "default": false,
          "description": "Whether the image is shown with a background.",
          "title": "Withbackground",
          "type": "boolean"
        },
        "withBorder": {
          "default": false,
          "description": "Whether the image is shown with a border.",
          "title": "Withborder",
          "type": "boolean"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the uploaded image on Albert.",
          "title": "Filekey"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The MIME type of the image (e.g. ``\"image/png\"``). Inferred from the file name if not set.",
          "title": "Mimetype"
        },
        "file_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Path to a local image to upload. Not stored on the server.",
          "title": "File Path"
        },
        "signedURL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A temporary download URL for the image, populated by Albert. Read-only.",
          "title": "Signedurl"
        }
      },
      "title": "ImageContent",
      "type": "object"
    },
    "KetcherContent": {
      "description": "The content of a Ketcher chemical-structure block.\n\nWhen creating a new Ketcher block, set ``smiles`` to the structure's SMILES\nstring; the remaining fields are populated by Albert. Existing Ketcher blocks\ncannot be edited in place.",
      "properties": {
        "synthesisId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the synthesis backing the drawing (format ``SYN...``). Set by Albert when the block is created.",
          "title": "Synthesisid"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The internal content ID.",
          "title": "Id"
        },
        "blockId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the block this content belongs to.",
          "title": "Blockid"
        },
        "data": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The raw Ketcher canvas data.",
          "title": "Data"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the rendered structure.",
          "title": "Filekey"
        },
        "s3Key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the associated synthesis canvas.",
          "title": "S3Key"
        },
        "png": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A PNG rendering of the structure.",
          "title": "Png"
        },
        "stateType": {
          "default": "project",
          "description": "The state context of the drawing. Defaults to ``\"project\"``.",
          "title": "Statetype",
          "type": "string"
        },
        "smiles": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The SMILES string describing the chemical structure.",
          "title": "Smiles"
        }
      },
      "title": "KetcherContent",
      "type": "object"
    },
    "LiveCanvasContent": {
      "additionalProperties": true,
      "description": "The content of an Artifact block.\n\nThe block points at an Artifact; the Artifact's own content is stored and\nversioned separately. Unknown fields are preserved on the model so a\nread-modify-write round trip sends the block back unchanged.",
      "properties": {
        "canvasId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the embedded Artifact (format ``CNV...``).",
          "title": "Canvasid"
        },
        "shareId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the share that places the Artifact in this notebook.",
          "title": "Shareid"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Artifact title shown on the block, when cached.",
          "title": "Title"
        }
      },
      "title": "LiveCanvasContent",
      "type": "object"
    },
    "NotebookListItem": {
      "description": "A single entry in a list block, which may itself contain nested entries.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The item's text.",
          "title": "Content"
        },
        "items": {
          "description": "Nested sub-items beneath this entry.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "content"
      ],
      "title": "NotebookListItem",
      "type": "object"
    },
    "NumberedListContent": {
      "description": "The content of a numbered (ordered) list block.",
      "properties": {
        "items": {
          "description": "The list entries, in order.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        },
        "style": {
          "const": "ordered",
          "default": "ordered",
          "description": "Always [`ORDERED`][albert.resources.notebooks.ListBlockStyle.ORDERED].",
          "title": "Style",
          "type": "string"
        }
      },
      "required": [
        "items"
      ],
      "title": "NumberedListContent",
      "type": "object"
    },
    "OfficeContent": {
      "description": "The content of a Microsoft Office block (Word, Excel, or PowerPoint).\n\nOffice blocks are created with empty content; Albert generates the backing\ndocument and populates ``title`` and ``file_key``.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the Office document. Set by Albert when the document is created.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the Office document on Albert. Set by Albert when the document is created.",
          "title": "Filekey"
        }
      },
      "title": "OfficeContent",
      "type": "object"
    },
    "ParagraphContent": {
      "description": "The content of a paragraph block.",
      "properties": {
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The paragraph text.",
          "title": "Text"
        }
      },
      "required": [
        "text"
      ],
      "title": "ParagraphContent",
      "type": "object"
    },
    "PutOperation": {
      "description": "The operation to apply to a block when saving notebook content.\n\nAttributes\n----------\nUPDATE : str\n    Create or update the block.\nDELETE : str\n    Remove the block from the notebook.",
      "enum": [
        "update",
        "delete"
      ],
      "title": "PutOperation",
      "type": "string"
    },
    "ReportContent": {
      "additionalProperties": true,
      "description": "The content of a report block.\n\nReport blocks embed an Albert report in a notebook. The API stores the\ncontent as a free-form object, so unknown fields are preserved on the model.",
      "properties": {},
      "title": "ReportContent",
      "type": "object"
    },
    "TableContent": {
      "description": "The content of a table block.",
      "properties": {
        "content": {
          "description": "The table cells as a list of rows, each row a list of cell values.",
          "items": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array"
          },
          "title": "Content",
          "type": "array"
        },
        "withHeadings": {
          "default": false,
          "description": "Whether the first row should be treated as column headings.",
          "title": "Withheadings",
          "type": "boolean"
        }
      },
      "required": [
        "content"
      ],
      "title": "TableContent",
      "type": "object"
    }
  },
  "properties": {
    "id": {
      "title": "Id",
      "type": "string"
    },
    "operation": {
      "$ref": "#/$defs/PutOperation"
    },
    "blockType": {
      "anyOf": [
        {
          "$ref": "#/$defs/BlockType"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "content": {
      "anyOf": [
        {
          "$ref": "#/$defs/HeaderContent"
        },
        {
          "$ref": "#/$defs/ParagraphContent"
        },
        {
          "$ref": "#/$defs/ChecklistContent"
        },
        {
          "$ref": "#/$defs/AttachesContent"
        },
        {
          "$ref": "#/$defs/ImageContent"
        },
        {
          "$ref": "#/$defs/KetcherContent"
        },
        {
          "$ref": "#/$defs/TableContent"
        },
        {
          "$ref": "#/$defs/BulletedListContent"
        },
        {
          "$ref": "#/$defs/NumberedListContent"
        },
        {
          "$ref": "#/$defs/OfficeContent"
        },
        {
          "$ref": "#/$defs/ReportContent"
        },
        {
          "$ref": "#/$defs/LiveCanvasContent"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Content"
    },
    "previousBlockId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Previousblockid"
    }
  },
  "required": [
    "id",
    "operation"
  ],
  "title": "PutBlockDatum",
  "type": "object"
}

Fields:

Validators:

id

id: str

operation

operation: PutOperation

type

type: BlockType | None = None

content

content: NotebookContent | None = None

previous_block_id

previous_block_id: str | None = None

content_matches_type

content_matches_type() -> PutBlockDatum
Source code in src/albert/resources/notebooks.py
@model_validator(mode="after")
def content_matches_type(self) -> PutBlockDatum:
    if self.content is None:
        return self  # skip check if there's no content

    content_type = allowed_notebook_contents.get(self.type)
    if content_type and not isinstance(self.content, content_type):
        msg = f"The content type and block type do not match. [content_type={type(self.content)}, block_type={self.type}]"
        raise AlbertException(msg)
    return self

model_dump

model_dump(**kwargs) -> dict[str, Any]

Shallow model_dump to exclude None values (None only removed from top level). This ensures required attrs are not removed.

Source code in src/albert/resources/notebooks.py
def model_dump(self, **kwargs) -> dict[str, Any]:
    """
    Shallow model_dump to exclude None values (None only removed from top level).
    This ensures required attrs are not removed.
    """
    base = super().model_dump(**kwargs)
    return {k: v for k, v in base.items() if v is not None}

PutBlockPayload

Bases: BaseAlbertModel

Show JSON schema:
{
  "$defs": {
    "AttachesContent": {
      "description": "The content of a file attachment block.\n\nProvide either ``file_path`` (a local file to upload) or ``file_key`` (an\nalready-uploaded file) when building the block.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the attachment. Defaults to the file name.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the uploaded file on Albert.",
          "title": "Filekey"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The MIME type of the file (e.g. ``\"application/pdf\"``). Inferred from the file name if not set.",
          "title": "Mimetype"
        },
        "file_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Path to a local file to upload. Not stored on the server.",
          "title": "File Path"
        },
        "signedURL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A temporary download URL for the file, populated by Albert. Read-only.",
          "title": "Signedurl"
        }
      },
      "title": "AttachesContent",
      "type": "object"
    },
    "BlockType": {
      "description": "The type of a notebook content block.\n\nAttributes\n----------\nPARAGRAPH : str\n    A block of free text.\nLIST : str\n    A bulleted or numbered list.\nHEADER : str\n    A section heading.\nCHECKLIST : str\n    A list of checkable items.\nIMAGE : str\n    An embedded image.\nATTACHES : str\n    An attached file.\nKETCHER : str\n    A chemical structure drawn in the Ketcher editor.\nTABLE : str\n    A tabular grid of cells.\nWORD : str\n    A Microsoft Word document (wire value ``msdocx``).\nEXCEL : str\n    A Microsoft Excel workbook (wire value ``msxlsx``).\nPOWERPOINT : str\n    A Microsoft PowerPoint presentation (wire value ``mspptx``).\nREPORT : str\n    An embedded Albert report.\nLIVE_CANVAS : str\n    An embedded Artifact (wire value ``liveCanvas``).",
      "enum": [
        "paragraph",
        "list",
        "header",
        "checklist",
        "image",
        "attaches",
        "ketcher",
        "table",
        "msdocx",
        "msxlsx",
        "mspptx",
        "report",
        "liveCanvas"
      ],
      "title": "BlockType",
      "type": "string"
    },
    "BulletedListContent": {
      "description": "The content of a bulleted (unordered) list block.",
      "properties": {
        "items": {
          "description": "The list entries, in order.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        },
        "style": {
          "const": "unordered",
          "default": "unordered",
          "description": "Always [`UNORDERED`][albert.resources.notebooks.ListBlockStyle.UNORDERED].",
          "title": "Style",
          "type": "string"
        }
      },
      "required": [
        "items"
      ],
      "title": "BulletedListContent",
      "type": "object"
    },
    "ChecklistContent": {
      "description": "The content of a checklist block.",
      "properties": {
        "items": {
          "description": "The checklist entries, in order.",
          "items": {
            "$ref": "#/$defs/ChecklistItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "items"
      ],
      "title": "ChecklistContent",
      "type": "object"
    },
    "ChecklistItem": {
      "description": "A single entry in a checklist block.",
      "properties": {
        "checked": {
          "description": "Whether the item is checked.",
          "title": "Checked",
          "type": "boolean"
        },
        "text": {
          "description": "The item's label text.",
          "title": "Text",
          "type": "string"
        }
      },
      "required": [
        "checked",
        "text"
      ],
      "title": "ChecklistItem",
      "type": "object"
    },
    "HeaderContent": {
      "description": "The content of a header block.",
      "properties": {
        "level": {
          "description": "The heading level (1 is the largest heading).",
          "minimum": 1,
          "title": "Level",
          "type": "integer"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The heading text.",
          "title": "Text"
        }
      },
      "required": [
        "level",
        "text"
      ],
      "title": "HeaderContent",
      "type": "object"
    },
    "ImageContent": {
      "description": "The content of an image block.\n\nProvide either ``file_path`` (a local image to upload) or ``file_key`` (an\nalready-uploaded image) when building the block.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The caption or title of the image.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "stretched": {
          "default": false,
          "description": "Whether the image is stretched to full width.",
          "title": "Stretched",
          "type": "boolean"
        },
        "withBackground": {
          "default": false,
          "description": "Whether the image is shown with a background.",
          "title": "Withbackground",
          "type": "boolean"
        },
        "withBorder": {
          "default": false,
          "description": "Whether the image is shown with a border.",
          "title": "Withborder",
          "type": "boolean"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the uploaded image on Albert.",
          "title": "Filekey"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The MIME type of the image (e.g. ``\"image/png\"``). Inferred from the file name if not set.",
          "title": "Mimetype"
        },
        "file_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Path to a local image to upload. Not stored on the server.",
          "title": "File Path"
        },
        "signedURL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A temporary download URL for the image, populated by Albert. Read-only.",
          "title": "Signedurl"
        }
      },
      "title": "ImageContent",
      "type": "object"
    },
    "KetcherContent": {
      "description": "The content of a Ketcher chemical-structure block.\n\nWhen creating a new Ketcher block, set ``smiles`` to the structure's SMILES\nstring; the remaining fields are populated by Albert. Existing Ketcher blocks\ncannot be edited in place.",
      "properties": {
        "synthesisId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the synthesis backing the drawing (format ``SYN...``). Set by Albert when the block is created.",
          "title": "Synthesisid"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The internal content ID.",
          "title": "Id"
        },
        "blockId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the block this content belongs to.",
          "title": "Blockid"
        },
        "data": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The raw Ketcher canvas data.",
          "title": "Data"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the rendered structure.",
          "title": "Filekey"
        },
        "s3Key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the associated synthesis canvas.",
          "title": "S3Key"
        },
        "png": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A PNG rendering of the structure.",
          "title": "Png"
        },
        "stateType": {
          "default": "project",
          "description": "The state context of the drawing. Defaults to ``\"project\"``.",
          "title": "Statetype",
          "type": "string"
        },
        "smiles": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The SMILES string describing the chemical structure.",
          "title": "Smiles"
        }
      },
      "title": "KetcherContent",
      "type": "object"
    },
    "LiveCanvasContent": {
      "additionalProperties": true,
      "description": "The content of an Artifact block.\n\nThe block points at an Artifact; the Artifact's own content is stored and\nversioned separately. Unknown fields are preserved on the model so a\nread-modify-write round trip sends the block back unchanged.",
      "properties": {
        "canvasId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the embedded Artifact (format ``CNV...``).",
          "title": "Canvasid"
        },
        "shareId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the share that places the Artifact in this notebook.",
          "title": "Shareid"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Artifact title shown on the block, when cached.",
          "title": "Title"
        }
      },
      "title": "LiveCanvasContent",
      "type": "object"
    },
    "NotebookListItem": {
      "description": "A single entry in a list block, which may itself contain nested entries.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The item's text.",
          "title": "Content"
        },
        "items": {
          "description": "Nested sub-items beneath this entry.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "content"
      ],
      "title": "NotebookListItem",
      "type": "object"
    },
    "NumberedListContent": {
      "description": "The content of a numbered (ordered) list block.",
      "properties": {
        "items": {
          "description": "The list entries, in order.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        },
        "style": {
          "const": "ordered",
          "default": "ordered",
          "description": "Always [`ORDERED`][albert.resources.notebooks.ListBlockStyle.ORDERED].",
          "title": "Style",
          "type": "string"
        }
      },
      "required": [
        "items"
      ],
      "title": "NumberedListContent",
      "type": "object"
    },
    "OfficeContent": {
      "description": "The content of a Microsoft Office block (Word, Excel, or PowerPoint).\n\nOffice blocks are created with empty content; Albert generates the backing\ndocument and populates ``title`` and ``file_key``.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the Office document. Set by Albert when the document is created.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the Office document on Albert. Set by Albert when the document is created.",
          "title": "Filekey"
        }
      },
      "title": "OfficeContent",
      "type": "object"
    },
    "ParagraphContent": {
      "description": "The content of a paragraph block.",
      "properties": {
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The paragraph text.",
          "title": "Text"
        }
      },
      "required": [
        "text"
      ],
      "title": "ParagraphContent",
      "type": "object"
    },
    "PutBlockDatum": {
      "properties": {
        "id": {
          "title": "Id",
          "type": "string"
        },
        "operation": {
          "$ref": "#/$defs/PutOperation"
        },
        "blockType": {
          "anyOf": [
            {
              "$ref": "#/$defs/BlockType"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "content": {
          "anyOf": [
            {
              "$ref": "#/$defs/HeaderContent"
            },
            {
              "$ref": "#/$defs/ParagraphContent"
            },
            {
              "$ref": "#/$defs/ChecklistContent"
            },
            {
              "$ref": "#/$defs/AttachesContent"
            },
            {
              "$ref": "#/$defs/ImageContent"
            },
            {
              "$ref": "#/$defs/KetcherContent"
            },
            {
              "$ref": "#/$defs/TableContent"
            },
            {
              "$ref": "#/$defs/BulletedListContent"
            },
            {
              "$ref": "#/$defs/NumberedListContent"
            },
            {
              "$ref": "#/$defs/OfficeContent"
            },
            {
              "$ref": "#/$defs/ReportContent"
            },
            {
              "$ref": "#/$defs/LiveCanvasContent"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Content"
        },
        "previousBlockId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Previousblockid"
        }
      },
      "required": [
        "id",
        "operation"
      ],
      "title": "PutBlockDatum",
      "type": "object"
    },
    "PutOperation": {
      "description": "The operation to apply to a block when saving notebook content.\n\nAttributes\n----------\nUPDATE : str\n    Create or update the block.\nDELETE : str\n    Remove the block from the notebook.",
      "enum": [
        "update",
        "delete"
      ],
      "title": "PutOperation",
      "type": "string"
    },
    "ReportContent": {
      "additionalProperties": true,
      "description": "The content of a report block.\n\nReport blocks embed an Albert report in a notebook. The API stores the\ncontent as a free-form object, so unknown fields are preserved on the model.",
      "properties": {},
      "title": "ReportContent",
      "type": "object"
    },
    "TableContent": {
      "description": "The content of a table block.",
      "properties": {
        "content": {
          "description": "The table cells as a list of rows, each row a list of cell values.",
          "items": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array"
          },
          "title": "Content",
          "type": "array"
        },
        "withHeadings": {
          "default": false,
          "description": "Whether the first row should be treated as column headings.",
          "title": "Withheadings",
          "type": "boolean"
        }
      },
      "required": [
        "content"
      ],
      "title": "TableContent",
      "type": "object"
    }
  },
  "properties": {
    "data": {
      "items": {
        "$ref": "#/$defs/PutBlockDatum"
      },
      "title": "Data",
      "type": "array"
    }
  },
  "required": [
    "data"
  ],
  "title": "PutBlockPayload",
  "type": "object"
}

Fields:

data

model_dump

model_dump(**kwargs) -> dict[str, Any]

model_dump to ensure only top-level None attrs are removed on PutBlockDatum.

Source code in src/albert/resources/notebooks.py
def model_dump(self, **kwargs) -> dict[str, Any]:
    """model_dump to ensure only top-level None attrs are removed on PutBlockDatum."""
    return {"data": [item.model_dump(**kwargs) for item in self.data]}

PostBlockPayload

Bases: BaseAlbertModel

Content and placement for a single new notebook block.

Show JSON schema:
{
  "$defs": {
    "AttachesContent": {
      "description": "The content of a file attachment block.\n\nProvide either ``file_path`` (a local file to upload) or ``file_key`` (an\nalready-uploaded file) when building the block.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the attachment. Defaults to the file name.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the uploaded file on Albert.",
          "title": "Filekey"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The MIME type of the file (e.g. ``\"application/pdf\"``). Inferred from the file name if not set.",
          "title": "Mimetype"
        },
        "file_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Path to a local file to upload. Not stored on the server.",
          "title": "File Path"
        },
        "signedURL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A temporary download URL for the file, populated by Albert. Read-only.",
          "title": "Signedurl"
        }
      },
      "title": "AttachesContent",
      "type": "object"
    },
    "BlockType": {
      "description": "The type of a notebook content block.\n\nAttributes\n----------\nPARAGRAPH : str\n    A block of free text.\nLIST : str\n    A bulleted or numbered list.\nHEADER : str\n    A section heading.\nCHECKLIST : str\n    A list of checkable items.\nIMAGE : str\n    An embedded image.\nATTACHES : str\n    An attached file.\nKETCHER : str\n    A chemical structure drawn in the Ketcher editor.\nTABLE : str\n    A tabular grid of cells.\nWORD : str\n    A Microsoft Word document (wire value ``msdocx``).\nEXCEL : str\n    A Microsoft Excel workbook (wire value ``msxlsx``).\nPOWERPOINT : str\n    A Microsoft PowerPoint presentation (wire value ``mspptx``).\nREPORT : str\n    An embedded Albert report.\nLIVE_CANVAS : str\n    An embedded Artifact (wire value ``liveCanvas``).",
      "enum": [
        "paragraph",
        "list",
        "header",
        "checklist",
        "image",
        "attaches",
        "ketcher",
        "table",
        "msdocx",
        "msxlsx",
        "mspptx",
        "report",
        "liveCanvas"
      ],
      "title": "BlockType",
      "type": "string"
    },
    "BulletedListContent": {
      "description": "The content of a bulleted (unordered) list block.",
      "properties": {
        "items": {
          "description": "The list entries, in order.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        },
        "style": {
          "const": "unordered",
          "default": "unordered",
          "description": "Always [`UNORDERED`][albert.resources.notebooks.ListBlockStyle.UNORDERED].",
          "title": "Style",
          "type": "string"
        }
      },
      "required": [
        "items"
      ],
      "title": "BulletedListContent",
      "type": "object"
    },
    "ChecklistContent": {
      "description": "The content of a checklist block.",
      "properties": {
        "items": {
          "description": "The checklist entries, in order.",
          "items": {
            "$ref": "#/$defs/ChecklistItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "items"
      ],
      "title": "ChecklistContent",
      "type": "object"
    },
    "ChecklistItem": {
      "description": "A single entry in a checklist block.",
      "properties": {
        "checked": {
          "description": "Whether the item is checked.",
          "title": "Checked",
          "type": "boolean"
        },
        "text": {
          "description": "The item's label text.",
          "title": "Text",
          "type": "string"
        }
      },
      "required": [
        "checked",
        "text"
      ],
      "title": "ChecklistItem",
      "type": "object"
    },
    "HeaderContent": {
      "description": "The content of a header block.",
      "properties": {
        "level": {
          "description": "The heading level (1 is the largest heading).",
          "minimum": 1,
          "title": "Level",
          "type": "integer"
        },
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The heading text.",
          "title": "Text"
        }
      },
      "required": [
        "level",
        "text"
      ],
      "title": "HeaderContent",
      "type": "object"
    },
    "ImageContent": {
      "description": "The content of an image block.\n\nProvide either ``file_path`` (a local image to upload) or ``file_key`` (an\nalready-uploaded image) when building the block.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The caption or title of the image.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "stretched": {
          "default": false,
          "description": "Whether the image is stretched to full width.",
          "title": "Stretched",
          "type": "boolean"
        },
        "withBackground": {
          "default": false,
          "description": "Whether the image is shown with a background.",
          "title": "Withbackground",
          "type": "boolean"
        },
        "withBorder": {
          "default": false,
          "description": "Whether the image is shown with a border.",
          "title": "Withborder",
          "type": "boolean"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the uploaded image on Albert.",
          "title": "Filekey"
        },
        "mimeType": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The MIME type of the image (e.g. ``\"image/png\"``). Inferred from the file name if not set.",
          "title": "Mimetype"
        },
        "file_path": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Path to a local image to upload. Not stored on the server.",
          "title": "File Path"
        },
        "signedURL": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A temporary download URL for the image, populated by Albert. Read-only.",
          "title": "Signedurl"
        }
      },
      "title": "ImageContent",
      "type": "object"
    },
    "KetcherContent": {
      "description": "The content of a Ketcher chemical-structure block.\n\nWhen creating a new Ketcher block, set ``smiles`` to the structure's SMILES\nstring; the remaining fields are populated by Albert. Existing Ketcher blocks\ncannot be edited in place.",
      "properties": {
        "synthesisId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the synthesis backing the drawing (format ``SYN...``). Set by Albert when the block is created.",
          "title": "Synthesisid"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The internal content ID.",
          "title": "Id"
        },
        "blockId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the block this content belongs to.",
          "title": "Blockid"
        },
        "data": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The raw Ketcher canvas data.",
          "title": "Data"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the rendered structure.",
          "title": "Filekey"
        },
        "s3Key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the associated synthesis canvas.",
          "title": "S3Key"
        },
        "png": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "A PNG rendering of the structure.",
          "title": "Png"
        },
        "stateType": {
          "default": "project",
          "description": "The state context of the drawing. Defaults to ``\"project\"``.",
          "title": "Statetype",
          "type": "string"
        },
        "smiles": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The SMILES string describing the chemical structure.",
          "title": "Smiles"
        }
      },
      "title": "KetcherContent",
      "type": "object"
    },
    "LiveCanvasContent": {
      "additionalProperties": true,
      "description": "The content of an Artifact block.\n\nThe block points at an Artifact; the Artifact's own content is stored and\nversioned separately. Unknown fields are preserved on the model so a\nread-modify-write round trip sends the block back unchanged.",
      "properties": {
        "canvasId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the embedded Artifact (format ``CNV...``).",
          "title": "Canvasid"
        },
        "shareId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The ID of the share that places the Artifact in this notebook.",
          "title": "Shareid"
        },
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Artifact title shown on the block, when cached.",
          "title": "Title"
        }
      },
      "title": "LiveCanvasContent",
      "type": "object"
    },
    "NotebookListItem": {
      "description": "A single entry in a list block, which may itself contain nested entries.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The item's text.",
          "title": "Content"
        },
        "items": {
          "description": "Nested sub-items beneath this entry.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        }
      },
      "required": [
        "content"
      ],
      "title": "NotebookListItem",
      "type": "object"
    },
    "NumberedListContent": {
      "description": "The content of a numbered (ordered) list block.",
      "properties": {
        "items": {
          "description": "The list entries, in order.",
          "items": {
            "$ref": "#/$defs/NotebookListItem"
          },
          "title": "Items",
          "type": "array"
        },
        "style": {
          "const": "ordered",
          "default": "ordered",
          "description": "Always [`ORDERED`][albert.resources.notebooks.ListBlockStyle.ORDERED].",
          "title": "Style",
          "type": "string"
        }
      },
      "required": [
        "items"
      ],
      "title": "NumberedListContent",
      "type": "object"
    },
    "OfficeContent": {
      "description": "The content of a Microsoft Office block (Word, Excel, or PowerPoint).\n\nOffice blocks are created with empty content; Albert generates the backing\ndocument and populates ``title`` and ``file_key``.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The display title of the Office document. Set by Albert when the document is created.",
          "title": "Title"
        },
        "namespace": {
          "default": "result",
          "description": "The file storage namespace. Defaults to ``\"result\"``.",
          "title": "Namespace",
          "type": "string"
        },
        "fileKey": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The storage key of the Office document on Albert. Set by Albert when the document is created.",
          "title": "Filekey"
        }
      },
      "title": "OfficeContent",
      "type": "object"
    },
    "ParagraphContent": {
      "description": "The content of a paragraph block.",
      "properties": {
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The paragraph text.",
          "title": "Text"
        }
      },
      "required": [
        "text"
      ],
      "title": "ParagraphContent",
      "type": "object"
    },
    "ReportContent": {
      "additionalProperties": true,
      "description": "The content of a report block.\n\nReport blocks embed an Albert report in a notebook. The API stores the\ncontent as a free-form object, so unknown fields are preserved on the model.",
      "properties": {},
      "title": "ReportContent",
      "type": "object"
    },
    "TableContent": {
      "description": "The content of a table block.",
      "properties": {
        "content": {
          "description": "The table cells as a list of rows, each row a list of cell values.",
          "items": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": "array"
          },
          "title": "Content",
          "type": "array"
        },
        "withHeadings": {
          "default": false,
          "description": "Whether the first row should be treated as column headings.",
          "title": "Withheadings",
          "type": "boolean"
        }
      },
      "required": [
        "content"
      ],
      "title": "TableContent",
      "type": "object"
    }
  },
  "description": "Content and placement for a single new notebook block.",
  "properties": {
    "blockType": {
      "$ref": "#/$defs/BlockType",
      "description": "The type of the block to create."
    },
    "content": {
      "anyOf": [
        {
          "$ref": "#/$defs/HeaderContent"
        },
        {
          "$ref": "#/$defs/ParagraphContent"
        },
        {
          "$ref": "#/$defs/ChecklistContent"
        },
        {
          "$ref": "#/$defs/AttachesContent"
        },
        {
          "$ref": "#/$defs/ImageContent"
        },
        {
          "$ref": "#/$defs/KetcherContent"
        },
        {
          "$ref": "#/$defs/TableContent"
        },
        {
          "$ref": "#/$defs/BulletedListContent"
        },
        {
          "$ref": "#/$defs/NumberedListContent"
        },
        {
          "$ref": "#/$defs/OfficeContent"
        },
        {
          "$ref": "#/$defs/ReportContent"
        },
        {
          "$ref": "#/$defs/LiveCanvasContent"
        }
      ],
      "description": "The content of the block. Must match ``type``.",
      "title": "Content"
    },
    "previousBlockId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the block the new block should follow.",
      "title": "Previousblockid"
    }
  },
  "required": [
    "blockType",
    "content"
  ],
  "title": "PostBlockPayload",
  "type": "object"
}

Fields:

Validators:

type

type: BlockType

The type of the block to create.

content

content: NotebookContent

The content of the block. Must match type.

previous_block_id

previous_block_id: str | None = None

The ID of the block the new block should follow.

content_matches_type

content_matches_type() -> PostBlockPayload
Source code in src/albert/resources/notebooks.py
@model_validator(mode="after")
def content_matches_type(self) -> PostBlockPayload:
    content_type = allowed_notebook_contents.get(self.type)
    if content_type and not isinstance(self.content, content_type):
        msg = f"The content type and block type do not match. [content_type={type(self.content)}, block_type={self.type}]"
        raise AlbertException(msg)
    return self

model_dump

model_dump(**kwargs) -> dict[str, Any]

Serialize the new block while preserving null content values.

Source code in src/albert/resources/notebooks.py
def model_dump(self, **kwargs) -> dict[str, Any]:
    """Serialize the new block while preserving null content values."""
    base = super().model_dump(**kwargs)
    return {key: value for key, value in base.items() if value is not None}

NotebookVersion

Bases: BaseAlbertModel

A saved version of a Notebook.

Returned by get_versions. Restore one with restore_version.

Show JSON schema:
{
  "$defs": {
    "AuditFields": {
      "description": "The audit fields for a resource",
      "properties": {
        "by": {
          "default": null,
          "title": "By",
          "type": "string"
        },
        "byName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Byname"
        },
        "at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "At"
        }
      },
      "title": "AuditFields",
      "type": "object"
    }
  },
  "description": "A saved version of a [`Notebook`][albert.resources.notebooks.Notebook].\n\nReturned by\n[`get_versions`][albert.collections.notebooks.NotebookCollection.get_versions].\nRestore one with\n[`restore_version`][albert.collections.notebooks.NotebookCollection.restore_version].",
  "properties": {
    "albertId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the saved version.",
      "title": "Albertid"
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit information for when the version was saved."
    }
  },
  "title": "NotebookVersion",
  "type": "object"
}

Fields:

id

id: str | None = None

The ID of the saved version.

created

created: AuditFields | None = None

Audit information for when the version was saved.

NotebookCopyACL

NotebookCopyACL(**data)

Bases: BaseResource

Access settings applied to a copied notebook.

Warning

Deprecated and will be removed in 2.0. Use ACLContainer instead.

Show JSON schema:
{
  "$defs": {
    "ACL": {
      "description": "A single access rule for a user.",
      "properties": {
        "id": {
          "description": "The id of the user for which this ACL applies",
          "title": "Id",
          "type": "string"
        },
        "fgc": {
          "anyOf": [
            {
              "$ref": "#/$defs/AccessControlLevel"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Fine-Grain Control Level"
        }
      },
      "required": [
        "id"
      ],
      "title": "ACL",
      "type": "object"
    },
    "AccessControlLevel": {
      "description": "Access control levels you can grant users.",
      "enum": [
        "ProjectOwner",
        "ProjectEditor",
        "ProjectViewer",
        "ProjectAllTask",
        "ProjectStrictViewer",
        "ProjectPropertyTask",
        "InventoryOwner",
        "InventoryViewer",
        "CustomTemplateOwner",
        "CustomTemplateViewer",
        "CASFullAccess"
      ],
      "title": "AccessControlLevel",
      "type": "string"
    },
    "AuditFields": {
      "description": "The audit fields for a resource",
      "properties": {
        "by": {
          "default": null,
          "title": "By",
          "type": "string"
        },
        "byName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Byname"
        },
        "at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "At"
        }
      },
      "title": "AuditFields",
      "type": "object"
    },
    "Status": {
      "description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n    The resource is fully operational and visible in normal operations.\nINACTIVE : str\n    The resource is hidden from normal operations and disabled from use.",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    }
  },
  "description": "Access settings applied to a copied notebook.\n\nWarning\n-----\nDeprecated and will be removed in 2.0. Use ``ACLContainer`` instead.",
  "properties": {
    "status": {
      "anyOf": [
        {
          "$ref": "#/$defs/Status"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The status of the resource, optional."
    },
    "Created": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit fields for the creation of the resource, optional."
    },
    "Updated": {
      "anyOf": [
        {
          "$ref": "#/$defs/AuditFields"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Audit fields for the update of the resource, optional."
    },
    "fgclist": {
      "default": null,
      "description": "Specific access rules for users or teams.",
      "items": {
        "$ref": "#/$defs/ACL"
      },
      "title": "Fgclist",
      "type": "array"
    },
    "class": {
      "description": "Default access class (for example, \"restricted\" or \"confidential\").",
      "title": "Class",
      "type": "string"
    }
  },
  "required": [
    "class"
  ],
  "title": "NotebookCopyACL",
  "type": "object"
}

Fields:

Source code in src/albert/resources/notebooks.py
def __init__(self, **data):
    warnings.warn(
        "NotebookCopyACL is deprecated and will be removed in 2.0; use ACLContainer instead.",
        DeprecationWarning,
        stacklevel=find_stack_level(),
    )
    super().__init__(**data)

fgclist

fgclist: list[ACL] = None

Specific access rules for users or teams.

acl_class

acl_class: str

Default access class (for example, "restricted" or "confidential").

NotebookCopyInfo

Bases: BaseAlbertModel

Instructions for copying a notebook into a new parent.

Example

from albert.resources.notebooks import NotebookCopyInfo

info = NotebookCopyInfo(id="NTB123", parent_id="PRO456")
Show JSON schema:
{
  "$defs": {
    "ACL": {
      "description": "A single access rule for a user.",
      "properties": {
        "id": {
          "description": "The id of the user for which this ACL applies",
          "title": "Id",
          "type": "string"
        },
        "fgc": {
          "anyOf": [
            {
              "$ref": "#/$defs/AccessControlLevel"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The Fine-Grain Control Level"
        }
      },
      "required": [
        "id"
      ],
      "title": "ACL",
      "type": "object"
    },
    "ACLContainer": {
      "description": "Access settings with a default class and a list of rules.",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "class": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The default access class (for example, \"restricted\" or \"confidential\").",
          "title": "Class"
        },
        "fgclist": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ACL"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Specific access rules for users or teams.",
          "title": "Fgclist"
        }
      },
      "title": "ACLContainer",
      "type": "object"
    },
    "AccessControlLevel": {
      "description": "Access control levels you can grant users.",
      "enum": [
        "ProjectOwner",
        "ProjectEditor",
        "ProjectViewer",
        "ProjectAllTask",
        "ProjectStrictViewer",
        "ProjectPropertyTask",
        "InventoryOwner",
        "InventoryViewer",
        "CustomTemplateOwner",
        "CustomTemplateViewer",
        "CASFullAccess"
      ],
      "title": "AccessControlLevel",
      "type": "string"
    },
    "AuditFields": {
      "description": "The audit fields for a resource",
      "properties": {
        "by": {
          "default": null,
          "title": "By",
          "type": "string"
        },
        "byName": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Byname"
        },
        "at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "At"
        }
      },
      "title": "AuditFields",
      "type": "object"
    },
    "NotebookCopyACL": {
      "description": "Access settings applied to a copied notebook.\n\nWarning\n-----\nDeprecated and will be removed in 2.0. Use ``ACLContainer`` instead.",
      "properties": {
        "status": {
          "anyOf": [
            {
              "$ref": "#/$defs/Status"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "The status of the resource, optional."
        },
        "Created": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the creation of the resource, optional."
        },
        "Updated": {
          "anyOf": [
            {
              "$ref": "#/$defs/AuditFields"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Audit fields for the update of the resource, optional."
        },
        "fgclist": {
          "default": null,
          "description": "Specific access rules for users or teams.",
          "items": {
            "$ref": "#/$defs/ACL"
          },
          "title": "Fgclist",
          "type": "array"
        },
        "class": {
          "description": "Default access class (for example, \"restricted\" or \"confidential\").",
          "title": "Class",
          "type": "string"
        }
      },
      "required": [
        "class"
      ],
      "title": "NotebookCopyACL",
      "type": "object"
    },
    "Status": {
      "description": "The status of a resource.\n\nAttributes\n----------\nACTIVE : str\n    The resource is fully operational and visible in normal operations.\nINACTIVE : str\n    The resource is hidden from normal operations and disabled from use.",
      "enum": [
        "active",
        "inactive"
      ],
      "title": "Status",
      "type": "string"
    }
  },
  "description": "Instructions for copying a notebook into a new parent.\n\n!!! example\n    ```python\n    from albert.resources.notebooks import NotebookCopyInfo\n\n    info = NotebookCopyInfo(id=\"NTB123\", parent_id=\"PRO456\")\n    ```",
  "properties": {
    "id": {
      "description": "The ID of the source notebook to copy (format ``NTB...``).",
      "title": "Id",
      "type": "string"
    },
    "parentId": {
      "description": "The ID of the destination parent to copy the notebook into.",
      "title": "Parentid",
      "type": "string"
    },
    "notebookName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The name to give the copied notebook.",
      "title": "Notebookname"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "An optional alternative name for the copy.",
      "title": "Name"
    },
    "templateId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The ID of the source custom template (format ``CTP...``). Required when copying with\n[`RESTORE_TEMPLATE`][albert.resources.notebooks.NotebookCopyType.RESTORE_TEMPLATE].",
      "title": "Templateid"
    },
    "ACL": {
      "anyOf": [
        {
          "$ref": "#/$defs/ACLContainer"
        },
        {
          "$ref": "#/$defs/NotebookCopyACL"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Access-control settings to apply to the copy.",
      "title": "Acl"
    }
  },
  "required": [
    "id",
    "parentId"
  ],
  "title": "NotebookCopyInfo",
  "type": "object"
}

Fields:

id

The ID of the source notebook to copy (format NTB...).

parent_id

parent_id: str

The ID of the destination parent to copy the notebook into.

notebook_name

notebook_name: str | None = None

The name to give the copied notebook.

name

name: str | None = None

An optional alternative name for the copy.

template_id

template_id: CustomTemplateId | None = None

The ID of the source custom template (format CTP...). Required when copying with RESTORE_TEMPLATE.

acl

acl: ACLContainer | NotebookCopyACL | None = None

Access-control settings to apply to the copy.