From 63149ba6644479473bb887337e28352f5ed7d03e Mon Sep 17 00:00:00 2001 From: saltbo Date: Tue, 1 Feb 2022 00:55:58 +0800 Subject: [PATCH] feat: add table block support (#24) --- block.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/block.go b/block.go index e482dc4..da4af31 100644 --- a/block.go +++ b/block.go @@ -41,6 +41,8 @@ type Block struct { Breadcrumb *Breadcrumb `json:"breadcrumb,omitempty"` ColumnList *ColumnList `json:"column_list,omitempty"` Column *Column `json:"column,omitempty"` + Table *Table `json:"table,omitempty"` + TableRow *TableRow `json:"table_row,omitempty"` LinkPreview *LinkPreview `json:"link_preview,omitempty"` LinkToPage *LinkToPage `json:"link_to_page,omitempty"` SyncedBlock *SyncedBlock `json:"synced_block,omitempty"` @@ -104,6 +106,17 @@ type Column struct { Children []Block `json:"children,omitempty"` } +type Table struct { + TableWidth int `json:"table_width"` + HasColumnHeader bool `json:"has_column_header"` + HasRowHeader bool `json:"has_row_header"` + Children []Block `json:"children,omitempty"` +} + +type TableRow struct { + Cells [][]RichText `json:"cells"` +} + type LinkToPage struct { Type LinkToPageType `json:"type"` @@ -166,6 +179,8 @@ const ( BlockTypeBreadCrumb BlockType = "breadcrumb" BlockTypeColumnList BlockType = "column_list" BlockTypeColumn BlockType = "column" + BlockTypeTable BlockType = "table" + BlockTypeTableRow BlockType = "table_row" BlockTypeLinkPreview BlockType = "link_preview" BlockTypeLinkToPage BlockType = "link_to_page" BlockTypeSyncedBlock BlockType = "synced_block"