diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/RollupConfigPropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/RollupConfigPropertySchema.cs index 0a4227b3..e4065344 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/RollupConfigPropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesCreateParameters/PropertySchema/RollupConfigPropertySchema.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Converters; namespace Notion.Client diff --git a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RelationUpdatePropertySchema.cs b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RelationUpdatePropertySchema.cs index a101b8a2..2091df91 100644 --- a/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RelationUpdatePropertySchema.cs +++ b/Src/Notion.Client/Api/Databases/RequestParams/DatabasesUpdateParameters/PropertySchema/RelationUpdatePropertySchema.cs @@ -1,4 +1,4 @@ -using System; +using System; using Newtonsoft.Json; namespace Notion.Client diff --git a/Src/Notion.Client/Models/Blocks/Block.cs b/Src/Notion.Client/Models/Blocks/Block.cs index 2018ff40..fa821cb1 100644 --- a/Src/Notion.Client/Models/Blocks/Block.cs +++ b/Src/Notion.Client/Models/Blocks/Block.cs @@ -5,15 +5,24 @@ namespace Notion.Client { [JsonConverter(typeof(JsonSubtypes), "type")] + [JsonSubtypes.KnownSubType(typeof(BookmarkBlock), BlockType.Bookmark)] [JsonSubtypes.KnownSubType(typeof(BulletedListItemBlock), BlockType.BulletedListItem)] [JsonSubtypes.KnownSubType(typeof(ChildPageBlock), BlockType.ChildPage)] + [JsonSubtypes.KnownSubType(typeof(ChildDatabaseBlock), BlockType.ChildDatabase)] + [JsonSubtypes.KnownSubType(typeof(CodeBlock), BlockType.Code)] + [JsonSubtypes.KnownSubType(typeof(EmbedBlock), BlockType.Embed)] + [JsonSubtypes.KnownSubType(typeof(EquationBlock), BlockType.Equation)] + [JsonSubtypes.KnownSubType(typeof(FileBlock), BlockType.File)] [JsonSubtypes.KnownSubType(typeof(HeadingOneBlock), BlockType.Heading_1)] [JsonSubtypes.KnownSubType(typeof(HeadingTwoBlock), BlockType.Heading_2)] [JsonSubtypes.KnownSubType(typeof(HeadingThreeeBlock), BlockType.Heading_3)] + [JsonSubtypes.KnownSubType(typeof(ImageBlock), BlockType.Image)] [JsonSubtypes.KnownSubType(typeof(NumberedListItemBlock), BlockType.NumberedListItem)] [JsonSubtypes.KnownSubType(typeof(ParagraphBlock), BlockType.Paragraph)] + [JsonSubtypes.KnownSubType(typeof(PDFBlock), BlockType.PDF)] [JsonSubtypes.KnownSubType(typeof(ToDoBlock), BlockType.ToDo)] [JsonSubtypes.KnownSubType(typeof(ToggleBlock), BlockType.Toggle)] + [JsonSubtypes.KnownSubType(typeof(VideoBlock), BlockType.Video)] [JsonSubtypes.KnownSubType(typeof(UnsupportedBlock), BlockType.Unsupported)] public class Block : IObject { diff --git a/Src/Notion.Client/Models/Blocks/BlockType.cs b/Src/Notion.Client/Models/Blocks/BlockType.cs index 24c07566..1c37f205 100644 --- a/Src/Notion.Client/Models/Blocks/BlockType.cs +++ b/Src/Notion.Client/Models/Blocks/BlockType.cs @@ -31,6 +31,33 @@ public enum BlockType [EnumMember(Value = "child_page")] ChildPage, + [EnumMember(Value = "code")] + Code, + + [EnumMember(Value = "child_database")] + ChildDatabase, + + [EnumMember(Value = "embed")] + Embed, + + [EnumMember(Value = "image")] + Image, + + [EnumMember(Value = "video")] + Video, + + [EnumMember(Value = "file")] + File, + + [EnumMember(Value = "pdf")] + PDF, + + [EnumMember(Value = "bookmark")] + Bookmark, + + [EnumMember(Value = "equation")] + Equation, + [EnumMember(Value = "unsupported")] Unsupported } diff --git a/Src/Notion.Client/Models/Blocks/BookmarkBlock.cs b/Src/Notion.Client/Models/Blocks/BookmarkBlock.cs new file mode 100644 index 00000000..f4df3a90 --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/BookmarkBlock.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class BookmarkBlock : Block + { + public override BlockType Type => BlockType.Bookmark; + + [JsonProperty("bookmark")] + public Info Bookmark { get; set; } + + public class Info + { + [JsonProperty("url")] + public string Url { get; set; } + } + } +} diff --git a/Src/Notion.Client/Models/Blocks/ChildDatabaseBlock.cs b/Src/Notion.Client/Models/Blocks/ChildDatabaseBlock.cs new file mode 100644 index 00000000..eb4577b7 --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/ChildDatabaseBlock.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class ChildDatabaseBlock : Block + { + public override BlockType Type => BlockType.ChildDatabase; + + [JsonProperty("child_database")] + public Info ChildDatabase { get; set; } + + public class Info + { + [JsonProperty("title")] + public string Title { get; set; } + } + } +} diff --git a/Src/Notion.Client/Models/Blocks/CodeBlock.cs b/Src/Notion.Client/Models/Blocks/CodeBlock.cs new file mode 100644 index 00000000..58ac5d6a --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/CodeBlock.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class CodeBlock : Block + { + public override BlockType Type => BlockType.Code; + + [JsonProperty("code")] + public Info Code { get; set; } + + public class Info + { + [JsonProperty("text")] + public IEnumerable Text { get; set; } + + [JsonProperty("language")] + public string Language { get; set; } + } + } +} diff --git a/Src/Notion.Client/Models/Blocks/EmbedBlock.cs b/Src/Notion.Client/Models/Blocks/EmbedBlock.cs new file mode 100644 index 00000000..5b3f715f --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/EmbedBlock.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class EmbedBlock : Block + { + public override BlockType Type => BlockType.Embed; + + [JsonProperty("embed")] + public Info Embed { get; set; } + + public class Info + { + [JsonProperty("url")] + public string Url { get; set; } + } + } +} diff --git a/Src/Notion.Client/Models/Blocks/EquationBlock.cs b/Src/Notion.Client/Models/Blocks/EquationBlock.cs new file mode 100644 index 00000000..79585539 --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/EquationBlock.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class EquationBlock : Block + { + public override BlockType Type => BlockType.Equation; + + [JsonProperty("equation")] + public Info Equation { get; set; } + + public class Info + { + [JsonProperty("expression")] + public string Expression { get; set; } + } + } +} diff --git a/Src/Notion.Client/Models/Blocks/FileBlock.cs b/Src/Notion.Client/Models/Blocks/FileBlock.cs new file mode 100644 index 00000000..c06533ed --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/FileBlock.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class FileBlock : Block + { + public override BlockType Type => BlockType.File; + + [JsonProperty("file")] + public FileObject File { get; set; } + } +} diff --git a/Src/Notion.Client/Models/Blocks/ImageBlock.cs b/Src/Notion.Client/Models/Blocks/ImageBlock.cs new file mode 100644 index 00000000..cead4547 --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/ImageBlock.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class ImageBlock : Block + { + public override BlockType Type => BlockType.Image; + + [JsonProperty("image")] + public FileObject Image { get; set; } + } +} diff --git a/Src/Notion.Client/Models/Blocks/PDFBlock.cs b/Src/Notion.Client/Models/Blocks/PDFBlock.cs new file mode 100644 index 00000000..84a3a29f --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/PDFBlock.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class PDFBlock : Block + { + public override BlockType Type => BlockType.PDF; + + [JsonProperty("pdf")] + public FileObject PDF { get; set; } + } +} diff --git a/Src/Notion.Client/Models/Blocks/VideoBlock.cs b/Src/Notion.Client/Models/Blocks/VideoBlock.cs new file mode 100644 index 00000000..49a1a697 --- /dev/null +++ b/Src/Notion.Client/Models/Blocks/VideoBlock.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; + +namespace Notion.Client +{ + public class VideoBlock : Block + { + public override BlockType Type => BlockType.Video; + + [JsonProperty("video")] + public FileObject Video { get; set; } + } +}