Skip to content

Core

core

Core classes and functions for the Ultimate Notion API.

GT = TypeVar('GT', bound=obj_core.GenericObject) module-attribute

InvalidAPIUsageError(message='This part of the API is not intended to be used in this manner')

Raised when the API is used in an invalid way.

message = message instance-attribute

ObjRefWrapper

Wrapper for objects that have an obj_ref attribute.

Note: This allows us to define Mixin classes that require the obj_ref attribute.

obj_ref: GT instance-attribute

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

Convert objects from the obj-based API to the high-level API and vice versa.

obj_ref: GT = obj_api_type.build(*args, **kwargs) instance-attribute

__init_subclass__(wraps: type[GT], **kwargs: Any)

__new__(*args, **kwargs) -> Self

wrap_obj_ref(obj_ref: GT) -> Self classmethod

Wraps low-level obj_ref from Notion API into a high-level (hl) object of Ultimate Notion.

get_active_session() -> Session

Return the current active session or raise an exception.

Avoids cyclic imports when used within the package itself. For internal use mostly.

get_repr(obj: Any, /, *, name: Any = None, desc: Any = None) -> str

Default representation, i.e. repr(...), used by us for consistency.

get_url(object_id: UUID | str) -> str

Return the URL for the object with the given id.