Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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<IEnumerable<RichTextTextInput>> Cells { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -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; }
}
}
}
6 changes: 6 additions & 0 deletions Src/Notion.Client/Models/Blocks/BlockType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions Src/Notion.Client/Models/Blocks/IBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
27 changes: 27 additions & 0 deletions Src/Notion.Client/Models/Blocks/TableBlock.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
}
19 changes: 19 additions & 0 deletions Src/Notion.Client/Models/Blocks/TableRowBlock.cs
Original file line number Diff line number Diff line change
@@ -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<IEnumerable<RichTextText>> Cells { get; set; }
}
}
}