Skip to content

Commit aec0659

Browse files
Merge pull request #217 from notion-dotnet/208-add-support-for-synced-block
Add support for Syncedblock type ✨
2 parents cb6b5c7 + 049b503 commit aec0659

File tree

5 files changed

+63
-2
lines changed

5 files changed

+63
-2
lines changed

Src/Notion.Client/Api/Blocks/RequestParams/BlocksUpdateParameters/UpdateBlocks/AudioUpdateBlock.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Newtonsoft.Json;
1+
using System.Collections.Generic;
2+
using Newtonsoft.Json;
23

34
namespace Notion.Client
45
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Newtonsoft.Json;
2+
3+
namespace Notion.Client
4+
{
5+
public class SyncedBlockUpdateBlock : UpdateBlock, IUpdateBlock
6+
{
7+
[JsonProperty("synced_block")]
8+
public Data SyncedBlock { get; set; }
9+
10+
public class Data
11+
{
12+
[JsonProperty("synced_from")]
13+
public SyncedFromBlockId SyncedFrom { get; set; }
14+
15+
public class SyncedFromBlockId
16+
{
17+
[JsonProperty("block_id")]
18+
public string BlockId { get; set; }
19+
}
20+
}
21+
}
22+
}

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

+3
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ public enum BlockType
8888
[EnumMember(Value = "link_to_page")]
8989
LinkToPage,
9090

91+
[EnumMember(Value = "synced_block")]
92+
SyncedBlock,
93+
9194
[EnumMember(Value = "unsupported")]
9295
Unsupported
9396
}

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ public interface ITemplateChildrendBlock : IBlock
44
{
55
}
66

7-
public interface IColumnChildrenBlock : IBlock, ITemplateChildrendBlock
7+
public interface ISyncedBlockChildren : IBlock
8+
{
9+
}
10+
11+
public interface IColumnChildrenBlock : IBlock, ITemplateChildrendBlock, ISyncedBlockChildren
812
{
913
}
1014

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System.Collections.Generic;
2+
using Newtonsoft.Json;
3+
4+
namespace Notion.Client
5+
{
6+
public class SyncedBlockBlock : Block, IColumnChildrenBlock, INonColumnBlock
7+
{
8+
public override BlockType Type => BlockType.SyncedBlock;
9+
10+
[JsonProperty("synced_block")]
11+
public Data SyncedBlock { get; set; }
12+
13+
public class Data
14+
{
15+
[JsonProperty("synced_from")]
16+
public SyncedFromBlockId SyncedFrom { get; set; }
17+
18+
[JsonProperty("children")]
19+
public IEnumerable<ISyncedBlockChildren> Children { get; set; }
20+
21+
public class SyncedFromBlockId
22+
{
23+
[JsonProperty("type")]
24+
public string Type { get; set; }
25+
26+
[JsonProperty("block_id")]
27+
public string BlockId { get; set; }
28+
}
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)