Skip to content

Add support for Column List and Column Block #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
KoditkarVedant opened this issue Nov 4, 2021 · 0 comments · Fixed by #205
Closed

Add support for Column List and Column Block #190

KoditkarVedant opened this issue Nov 4, 2021 · 0 comments · Fixed by #205
Labels
enhancement New feature or request help wanted Extra attention is needed up for grabs
Milestone

Comments

@KoditkarVedant
Copy link
Contributor

Notion has added support for column_list and column block types.

You can now add Column Lists and Columns to pages and other block types.

  • Column Lists are parent blocks for column children. They can only contain children of type column.
  • Columns are parent blocks for any supported block children, excluding columns. They can only be appended to column_lists.

When initially creating a column_list block via Append block children, the column list must have at least 2 columns, and those columns must have at least one child each.

When fetching content for a column_list, first fetch the the column children via Retrieve block children. Then fetch the children for each column block.

Below is an example request body for appending column_list and nested column children.

{
  "children": [
    {
      "object": "block",
      "type": "column_list",
      "column_list": {
        "children": [
          {
            "object": "block",
            "type": "column",
            "column": {
              "children": [
                {
                  "object": "block",
                  "type": "paragraph",
                  "paragraph": {
                    "text": [
                      {
                        "type": "text",
                        "text": {
                          "content": "some text here"
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          {
            "object": "block",
            "type": "column",
            "column": {
              "children": [
                {
                  "object": "block",
                  "type": "paragraph",
                  "paragraph": {
                    "text": [
                      {
                        "type": "text",
                        "text": {
                          "content": "some text here"
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
  ]
}

Below is an example response of appending column_list children.

{
    "object": "list",
    "results": [
        {
            "object": "block",
            "id": "ca042aa7-2e23-4541-8059-abff360d6752",
            "created_time": "2021-10-25T17:00:00.000Z",
            "last_edited_time": "2021-10-25T17:00:00.000Z",
            "has_children": true,
            "archived": false,
            "type": "column_list",
            "column_list": {}
        }
    ],
    "next_cursor": null,
    "has_more": false
}

Below is an example request body for appending column children. Note that the parent that is being added to must be a block of type column_list.

{
    "children": [
        {
            "object": "block",
            "type": "column",
            "column": {
                "children": [
                    {
                        "object": "block",
                        "type": "paragraph",
                        "paragraph": {
                            "text": [
                                {
                                    "type": "text",
                                    "text": {
                                        "content": "some text here"
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

Below is an example response of appending column children.

{
    "object": "list",
    "results": [
        {
            "object": "block",
            "id": "f40c3a13-30d1-4594-bd6f-cdbc15b2c006",
            "created_time": "2021-10-25T21:25:00.000Z",
            "last_edited_time": "2021-10-25T21:25:00.000Z",
            "has_children": true,
            "archived": false,
            "type": "column",
            "column": {}
        }
    ],
    "next_cursor": null,
    "has_more": false
}

Notion Api changelog: https://developers.notion.com/changelog/column-list-and-column-support

@KoditkarVedant KoditkarVedant added enhancement New feature or request up for grabs labels Nov 4, 2021
@KoditkarVedant KoditkarVedant added this to the 2.2.1 milestone Nov 4, 2021
@KoditkarVedant KoditkarVedant added the help wanted Extra attention is needed label Nov 5, 2021
@KoditkarVedant KoditkarVedant linked a pull request Dec 11, 2021 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed up for grabs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant