1
0
mirror of https://github.com/dstotijn/go-notion.git synced 2025-06-08 23:46:12 +02:00

feat: add table block support (#24)

This commit is contained in:
saltbo 2022-02-01 00:55:58 +08:00 committed by GitHub
parent 97f740c22e
commit 63149ba664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"