Skip to content

Objects

objects

Functionality for general Notion objects like texts, files, options, etc.

T = TypeVar('T', bound=objs.RichTextObject) module-attribute

Emoji(emoji: str)

Emoji object which behaves like str.

obj_ref = objs.EmojiObject.build(emoji) instance-attribute

__eq__(other: object) -> bool

__hash__()

__repr__() -> str

__str__() -> str

from_code(shortcode: str) -> Emoji classmethod

Create an Emoji object from a :shortcode:, e.g. 😄

to_code() -> str

Represent the emoji as :shortcode:, e.g. 😄

Equation(*args: Any, **kwargs: Any)

An Equation object.

File(*, url: str, name: str | None = None)

A web resource e.g. for the files property.

name: str | None property

obj_ref: objs.FileObject = objs.ExternalFile.build(url=url, name=name) instance-attribute

url: str property

__eq__(other: object) -> bool

__hash__()

__repr__() -> str

__str__() -> str

wrap_obj_ref(obj_ref: objs.FileObject) -> File classmethod

Mention(*args: Any, **kwargs: Any)

A Mention object.

type: str property

Type of the mention, e.g. user, page, etc.

Option(name: str, *, color: Color = Color.DEFAULT)

Option for select & multi-select property.

id: str property

ID of the option.

name: str property

Name of the option.

__eq__(other: object) -> bool

__hash__() -> int

__repr__() -> str

__str__() -> str

description() -> str

Description of the option.

OptionGroup(*args: Any, **kwargs: Any)

Group of options for status property.

name: str property

Name of the option group.

options: list[Option] property

Options within this option group.

__repr__() -> str

__str__() -> str

wrap_obj_ref(obj_ref, /, *, options: list[Option] | None = None) -> OptionGroup classmethod

Convienence constructor for the group of options.

OptionNS

Option namespace to simplify working with (Multi-)Select options.

to_list() -> list[Option] classmethod

Convert the enum to a list as needed by the (Multi)Select column types.

RichText(plain_text: str)

User-facing class holding several RichTexts.

obj_ref: list[objs.RichTextObject] property

__eq__(other: object) -> bool

__hash__()

from_markdown(text: str) -> RichText classmethod

Create RichTextList by parsing the markdown.

from_plain_text(text: str) -> RichText classmethod

Create RichTextList from plain text.

This method is a more explicit alias for the default constructor.

to_markdown() -> str

Convert the list of RichText objects to markdown.

to_plain_text() -> str

Return rich text as plaintext

This method is a more explicit variant then just using the object.

wrap_obj_ref(obj_refs: list[objs.RichTextObject] | None) -> RichText classmethod

RichTextBase(*args: Any, **kwargs: Any)

Super class for text, equation and mentions of various kinds.

is_equation: bool property

is_mention: bool property

is_text: bool property

Text(*args: Any, **kwargs: Any)

A Text object.

User(*args: Any, **kwargs: Any)

avatar_url property

email: str | None property

id property

is_bot: bool property

is_person: bool property

name property

__eq__(other: object) -> bool

__hash__() -> int

__repr__() -> str

__str__()

wrap_obj_ref(obj_ref: objs.User) -> User classmethod

wrap_icon(icon_obj: objs.FileObject | objs.EmojiObject | None) -> File | Emoji | None

Wrap the icon object into the corresponding class.