diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableRowUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableRowUpdateBlock.cs new file mode 100644 index 00000000..c228de66 --- /dev/null +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableRowUpdateBlock.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class TableRowUpdateBlock : UpdateBlock, IUpdateBlock + { + [JsonProperty("table_row")] + public Info TableRow { get; set; } + + public class Info + { + [JsonProperty("cells")] + public IEnumerable> Cells { get; set; } + } + } +} diff --git a/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableUpdateBlock.cs b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableUpdateBlock.cs new file mode 100644 index 00000000..ef0e8933 --- /dev/null +++ b/Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/TableUpdateBlock.cs @@ -0,0 +1,19 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class TableUpdateBlock : UpdateBlock, IUpdateBlock + { + [JsonProperty("table")] + public Info Table { get; set; } + + public class Info + { + [JsonProperty("has_column_header")] + public bool HasColumnHeader { get; set; } + + [JsonProperty("has_row_header")] + public bool HasRowHeader { get; set; } + } + } +} diff --git a/Src/Notion.Client/Models/Blocks/BlockType.cs b/Src/Notion.Client/Models/Blocks/BlockType.cs index 6ebec8f1..f3181b22 100644 --- a/Src/Notion.Client/Models/Blocks/BlockType.cs +++ b/Src/Notion.Client/Models/Blocks/BlockType.cs @@ -91,6 +91,12 @@ public enum BlockType [EnumMember(Value = "synced_block")] SyncedBlock, + [EnumMember(Value = "table")] + Table, + + [EnumMember(Value = "table_row")] + TableRow, + [EnumMember(Value = "unsupported")] Unsupported } diff --git a/Src/Notion.Client/Models/Blocks/IBlock.cs b/Src/Notion.Client/Models/Blocks/IBlock.cs index a7e925d1..f3c89d88 100644 --- a/Src/Notion.Client/Models/Blocks/IBlock.cs +++ b/Src/Notion.Client/Models/Blocks/IBlock.cs @@ -28,6 +28,8 @@ namespace Notion.Client [JsonSubtypes.KnownSubType(typeof(ParagraphBlock), BlockType.Paragraph)] [JsonSubtypes.KnownSubType(typeof(PDFBlock), BlockType.PDF)] [JsonSubtypes.KnownSubType(typeof(QuoteBlock), BlockType.Quote)] + [JsonSubtypes.KnownSubType(typeof(TableBlock), BlockType.Table)] + [JsonSubtypes.KnownSubType(typeof(TableRowBlock), BlockType.TableRow)] [JsonSubtypes.KnownSubType(typeof(TableOfContentsBlock), BlockType.TableOfContents)] [JsonSubtypes.KnownSubType(typeof(TemplateBlock), BlockType.Template)] [JsonSubtypes.KnownSubType(typeof(ToDoBlock), BlockType.ToDo)] diff --git a/Src/Notion.Client/Models/Blocks/TableBlock.cs b/Src/Notion.Client/Models/Blocks/TableBlock.cs new file mode 100644 index 00000000..dd20d94b --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/TableBlock.cs @@ -0,0 +1,27 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class TableBlock : Block, IColumnChildrenBlock, INonColumnBlock + { + public override BlockType Type => BlockType.Table; + + [JsonProperty("table")] + public TableInfo Table { get; set; } + + public class TableInfo + { + [JsonProperty("table_width")] + public int TableWidth { get; set; } + + [JsonProperty("has_column_header")] + public bool HasColumnHeader { get; set; } + + [JsonProperty("has_row_header")] + public bool HasRowHeader { get; set; } + + [JsonProperty("children")] + public TableRowBlock Children { get; set; } + } + } +} diff --git a/Src/Notion.Client/Models/Blocks/TableRowBlock.cs b/Src/Notion.Client/Models/Blocks/TableRowBlock.cs new file mode 100644 index 00000000..e7214e6c --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/TableRowBlock.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class TableRowBlock : Block, IColumnChildrenBlock, INonColumnBlock + { + public override BlockType Type => BlockType.TableRow; + + [JsonProperty("table_row")] + public Info TableRow { get; set; } + + public class Info + { + [JsonProperty("cells")] + public IEnumerable> Cells { get; set; } + } + } +}