notion-dotnet / notion-sdk-net

A Notion SDK for .Net
MIT License
181 stars 46 forks source link

Parents are now always direct parents; a parent field has been added to block. #259

Closed KoditkarVedant closed 2 years ago

KoditkarVedant commented 2 years ago

Previously, when accessing the parent of a database or page, that parent was always either a page, database, or workspace. This is un-faithful to the actual data model of Notion, where the parent may also be another block; for example, you can nest a page under a toggle block.

The parent field for page and database has been changed so that it is now always the direct parent of that page or database, and a new parent type has been added: block_id.

Additionally, a parent field has been added to the block object. Together, these changes allow you to fully traverse Notion’s tree.

To emulate the previous behavior of retrieving the page, database, or space parent, you may traverse up the tree using the retrieve a block endpoint. If the parent ≠ one of those types, retrieve the parent block until it is.

Notion changelog: https://developers.notion.com/changelog/releasing-notion-version-2022-06-28