Skip to content

Commit

Permalink
Merge pull request #324 from notion-dotnet/323-add-support-for-link_p…
Browse files Browse the repository at this point in the history
…review-block-type

Add support for link_preview block type
  • Loading branch information
KoditkarVedant authored Sep 14, 2022
2 parents 1eb0428 + bf9aac5 commit ed18e1a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Src/Notion.Client/Models/Blocks/BlockType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public enum BlockType
[EnumMember(Value = "table_row")]
TableRow,

[EnumMember(Value = "link_preview")]
LinkPreview,

[EnumMember(Value = "unsupported")]
Unsupported
}
Expand Down
1 change: 1 addition & 0 deletions Src/Notion.Client/Models/Blocks/IBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace Notion.Client
[JsonSubtypes.KnownSubType(typeof(HeadingTwoBlock), BlockType.Heading_2)]
[JsonSubtypes.KnownSubType(typeof(HeadingThreeeBlock), BlockType.Heading_3)]
[JsonSubtypes.KnownSubType(typeof(ImageBlock), BlockType.Image)]
[JsonSubtypes.KnownSubType(typeof(LinkPreviewBlock), BlockType.LinkPreview)]
[JsonSubtypes.KnownSubType(typeof(LinkToPageBlock), BlockType.LinkToPage)]
[JsonSubtypes.KnownSubType(typeof(NumberedListItemBlock), BlockType.NumberedListItem)]
[JsonSubtypes.KnownSubType(typeof(ParagraphBlock), BlockType.Paragraph)]
Expand Down
16 changes: 16 additions & 0 deletions Src/Notion.Client/Models/Blocks/LinkPreviewBlock.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Newtonsoft.Json;

namespace Notion.Client
{
public class LinkPreviewBlock : Block, IColumnChildrenBlock, INonColumnBlock
{
public override BlockType Type => BlockType.LinkPreview;

[JsonProperty("link_preview")] public Data LinkPreview { get; set; }

public class Data
{
[JsonProperty("url")] public string Url { get; set; }
}
}
}

0 comments on commit ed18e1a

Please sign in to comment.