Iterator
iterator
¶
Iterator classes for working with paginated API responses.
MAX_PAGE_SIZE = 100
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
BlockList
¶
A list of Block objects returned by the Notion API.
block: Any = Field(default_factory=dict)
class-attribute
instance-attribute
¶
DatabaseList
¶
A list of Database objects returned by the Notion API.
database: Any = Field(default_factory=dict)
class-attribute
instance-attribute
¶
EndpointIterator(endpoint: Callable[..., Any | Awaitable[Any]])
¶
Functor to iterate over results from a paginated API response.
has_more: bool | None = None
class-attribute
instance-attribute
¶
next_cursor: str | None = None
class-attribute
instance-attribute
¶
page_num: int = -1
class-attribute
instance-attribute
¶
total_items: int = -1
class-attribute
instance-attribute
¶
__call__(**kwargs: Any) -> Iterator[NotionObject]
¶
Return a generator for this endpoint using the given parameters.
ObjectList
¶
A paginated list of objects returned by the Notion API.
More details in the Notion API.
PageList
¶
A list of Page objects returned by the Notion API.
page: Any = Field(default_factory=dict)
class-attribute
instance-attribute
¶
PageOrDatabaseList
¶
A list of Page or Database objects returned by the Notion API.
page_or_database: Any = Field(default_factory=dict)
class-attribute
instance-attribute
¶
PropertyItemList
¶
A paginated list of property items returned by the Notion API.
Property item lists contain one or more pages of basic property items. These types do not typically match the schema for corresponding property values.
UserList
¶
A list of User objects returned by the Notion API.
user: Any = Field(default_factory=dict)
class-attribute
instance-attribute
¶
convert_to_notion_obj(obj: dict[str, Any]) -> Block | Page | Database | PropertyItem | User | GenericObject
¶
Convert a dictionary to the corresponding subtype of Notion Object.
Used in the ObjectList below the convert the results from the Notion API.