notion-dotnet / notion-sdk-net

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

Add support for Template block #210

Closed KoditkarVedant closed 2 years ago

KoditkarVedant commented 2 years ago

Notion has added support for adding and retrieving template block types. Using this block type, developers can now create template that duplicates the its children blocks.

Below is an example request body for the append block children endpoint containing a template block type.

Template block type used in request body

{
    "children": [
        {
            "type": "template",
            "template": {
                "text": [
                    {
                        "type": "text",
                        "text": {
                            "content": "Create callout template"
                        }
                    }
                ],
                "children": [
                    {
                        "callout": {
                            "text": [
                                {
                                    "type": "text",
                                    "text": {
                                        "content": "Placeholder callout text"
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

Notion API changelog: https://developers.notion.com/changelog/synced-block-link-to-page-and-template-block-types-are-now-supported-in-the-api