Skip to content

Commit 6238e4b

Browse files
Add support for ColumnList & Column block types ✨
1 parent 4959a9d commit 6238e4b

28 files changed

+137
-32
lines changed

Src/Notion.Client/Models/Blocks/AudioBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Notion.Client
44
{
5-
public class AudioBlock : Block
5+
public class AudioBlock : Block, IColumnChildrenBlock, INonColumnBlock
66
{
77
public override BlockType Type => BlockType.Audio;
88

Src/Notion.Client/Models/Blocks/BlockType.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ public enum BlockType
7676
[EnumMember(Value = "quote")]
7777
Quote,
7878

79+
[EnumMember(Value = "column")]
80+
Column,
81+
82+
[EnumMember(Value = "column_list")]
83+
ColumnList,
84+
7985
[EnumMember(Value = "unsupported")]
8086
Unsupported
8187
}

Src/Notion.Client/Models/Blocks/BookmarkBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Notion.Client
55
{
6-
public class BookmarkBlock : Block
6+
public class BookmarkBlock : Block, IColumnChildrenBlock, INonColumnBlock
77
{
88
public override BlockType Type => BlockType.Bookmark;
99

Src/Notion.Client/Models/Blocks/BreadcrumbBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Notion.Client
44
{
5-
public class BreadcrumbBlock : Block
5+
public class BreadcrumbBlock : Block, IColumnChildrenBlock, INonColumnBlock
66
{
77
public override BlockType Type => BlockType.Breadcrumb;
88

Src/Notion.Client/Models/Blocks/BulletedListItemBlock.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Notion.Client
55
{
6-
public class BulletedListItemBlock : Block
6+
public class BulletedListItemBlock : Block, IColumnChildrenBlock, INonColumnBlock
77
{
88
public override BlockType Type => BlockType.BulletedListItem;
99

@@ -16,7 +16,7 @@ public class Info
1616
public IEnumerable<RichTextBase> Text { get; set; }
1717

1818
[JsonProperty("children")]
19-
public IEnumerable<Block> Children { get; set; }
19+
public IEnumerable<INonColumnBlock> Children { get; set; }
2020
}
2121
}
2222
}

Src/Notion.Client/Models/Blocks/CalloutBlock.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Notion.Client
55
{
6-
public class CalloutBlock : Block
6+
public class CalloutBlock : Block, IColumnChildrenBlock, INonColumnBlock
77
{
88
public override BlockType Type => BlockType.Callout;
99

@@ -19,7 +19,7 @@ public class Info
1919
public IPageIcon Icon { get; set; }
2020

2121
[JsonProperty("children")]
22-
public IEnumerable<Block> Children { get; set; }
22+
public IEnumerable<INonColumnBlock> Children { get; set; }
2323
}
2424
}
2525
}

Src/Notion.Client/Models/Blocks/ChildDatabaseBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Notion.Client
44
{
5-
public class ChildDatabaseBlock : Block
5+
public class ChildDatabaseBlock : Block, IColumnChildrenBlock, INonColumnBlock
66
{
77
public override BlockType Type => BlockType.ChildDatabase;
88

Src/Notion.Client/Models/Blocks/ChildPageBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Notion.Client
44
{
5-
public class ChildPageBlock : Block
5+
public class ChildPageBlock : Block, IColumnChildrenBlock, INonColumnBlock
66
{
77
public override BlockType Type => BlockType.ChildPage;
88

Src/Notion.Client/Models/Blocks/CodeBlock.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace Notion.Client
55
{
6-
public class CodeBlock : Block
6+
public class CodeBlock : Block, IColumnChildrenBlock, INonColumnBlock
77
{
88
public override BlockType Type => BlockType.Code;
99

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Collections.Generic;
2+
using Newtonsoft.Json;
3+
4+
namespace Notion.Client
5+
{
6+
public class ColumnBlock : Block
7+
{
8+
public override BlockType Type => BlockType.Column;
9+
10+
[JsonProperty("column")]
11+
public Info Column { get; set; }
12+
13+
public class Info
14+
{
15+
[JsonProperty("children")]
16+
public IEnumerable<IColumnChildrenBlock> Children { get; set; }
17+
}
18+
}
19+
20+
public class ColumnListBlock : Block, INonColumnBlock
21+
{
22+
public override BlockType Type => BlockType.ColumnList;
23+
24+
[JsonProperty("column_list")]
25+
public Info ColumnList { get; set; }
26+
27+
public class Info
28+
{
29+
[JsonProperty("children")]
30+
public IEnumerable<ColumnBlock> Children { get; set; }
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)