-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #401 from notion-dotnet/chore/219-add-separate-req…
…uest-model-for-blocks-api Add separate request model for blocks api
- Loading branch information
Showing
39 changed files
with
793 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
Src/Notion.Client/Models/Blocks/Request/AudioBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class AudioBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("audio")] | ||
public FileObject Audio { get; set; } | ||
|
||
public override BlockType Type => BlockType.Audio; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Src/Notion.Client/Models/Blocks/Request/BlockObjectRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
|
||
namespace Notion.Client | ||
{ | ||
public abstract class BlockObjectRequest : IBlockObjectRequest | ||
{ | ||
public ObjectType Object => ObjectType.Block; | ||
|
||
public string Id { get; set; } | ||
|
||
public virtual BlockType Type { get; set; } | ||
|
||
public DateTime CreatedTime { get; set; } | ||
|
||
public DateTime LastEditedTime { get; set; } | ||
|
||
public virtual bool HasChildren { get; set; } | ||
|
||
public PartialUser CreatedBy { get; set; } | ||
|
||
public PartialUser LastEditedBy { get; set; } | ||
|
||
/// <summary> | ||
/// Information about the block's parent. | ||
/// </summary> | ||
public IBlockParent Parent { get; set; } | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Src/Notion.Client/Models/Blocks/Request/BookmarkBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class BookmarkBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("bookmark")] | ||
public Info Bookmark { get; set; } | ||
|
||
public override BlockType Type => BlockType.Bookmark; | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("url")] | ||
public string Url { get; set; } | ||
|
||
[JsonProperty("caption")] | ||
public IEnumerable<RichTextBase> Caption { get; set; } | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Src/Notion.Client/Models/Blocks/Request/BreadcrumbBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class BreadcrumbBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("breadcrumb")] | ||
public Data Breadcrumb { get; set; } | ||
|
||
public override BlockType Type => BlockType.Breadcrumb; | ||
|
||
public class Data | ||
{ | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Src/Notion.Client/Models/Blocks/Request/BulletedListItemBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class BulletedListItemBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("bulleted_list_item")] | ||
public Info BulletedListItem { get; set; } | ||
|
||
public override BlockType Type => BlockType.BulletedListItem; | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("rich_text")] | ||
public IEnumerable<RichTextBase> RichText { get; set; } | ||
|
||
[JsonProperty("color")] | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public Color? Color { get; set; } | ||
|
||
[JsonProperty("children")] | ||
public IEnumerable<INonColumnBlockRequest> Children { get; set; } | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Src/Notion.Client/Models/Blocks/Request/CalloutBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class CalloutBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("callout")] | ||
public Info Callout { get; set; } | ||
|
||
public override BlockType Type => BlockType.Callout; | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("rich_text")] | ||
public IEnumerable<RichTextBase> RichText { get; set; } | ||
|
||
[JsonProperty("icon")] | ||
public IPageIcon Icon { get; set; } | ||
|
||
[JsonProperty("color")] | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public Color? Color { get; set; } | ||
|
||
[JsonProperty("children")] | ||
public IEnumerable<INonColumnBlockRequest> Children { get; set; } | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Src/Notion.Client/Models/Blocks/Request/ChildDatabaseBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class ChildDatabaseBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("child_database")] | ||
public Info ChildDatabase { get; set; } | ||
|
||
public override BlockType Type => BlockType.ChildDatabase; | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("title")] | ||
public string Title { get; set; } | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Src/Notion.Client/Models/Blocks/Request/ChildPageBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class ChildPageBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("child_page")] | ||
public Info ChildPage { get; set; } | ||
|
||
public override BlockType Type => BlockType.ChildPage; | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("title")] | ||
public string Title { get; set; } | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Src/Notion.Client/Models/Blocks/Request/CodeBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class CodeBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("code")] | ||
public Info Code { get; set; } | ||
|
||
public override BlockType Type => BlockType.Code; | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("rich_text")] | ||
public IEnumerable<RichTextBase> RichText { get; set; } | ||
|
||
[JsonProperty("language")] | ||
public string Language { get; set; } | ||
|
||
[JsonProperty("caption")] | ||
public IEnumerable<RichTextBase> Caption { get; set; } | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
Src/Notion.Client/Models/Blocks/Request/ColumnBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ColumnBlockRequest : BlockObjectRequest | ||
{ | ||
public override BlockType Type => BlockType.Column; | ||
|
||
[JsonProperty("column")] | ||
public Info Column { get; set; } | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("children")] | ||
public IEnumerable<IColumnChildrenBlockRequest> Children { get; set; } | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
Src/Notion.Client/Models/Blocks/Request/ColumnListBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ColumnListBlockRequest : BlockObjectRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("column_list")] | ||
public Info ColumnList { get; set; } | ||
|
||
public override BlockType Type => BlockType.ColumnList; | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("children")] | ||
public IEnumerable<ColumnBlockRequest> Children { get; set; } | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
Src/Notion.Client/Models/Blocks/Request/DividerBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class DividerBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("divider")] | ||
public Data Divider { get; set; } | ||
|
||
public override BlockType Type => BlockType.Divider; | ||
|
||
public class Data | ||
{ | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Src/Notion.Client/Models/Blocks/Request/EmbedBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class EmbedBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("embed")] | ||
public Info Embed { get; set; } | ||
|
||
public override BlockType Type => BlockType.Embed; | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("url")] | ||
public string Url { get; set; } | ||
|
||
[JsonProperty("caption")] | ||
public IEnumerable<RichTextBase> Caption { get; set; } | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Src/Notion.Client/Models/Blocks/Request/EquationBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class EquationBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("equation")] | ||
public Info Equation { get; set; } | ||
|
||
public override BlockType Type => BlockType.Equation; | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("expression")] | ||
public string Expression { get; set; } | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Src/Notion.Client/Models/Blocks/Request/FileBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class FileBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("file")] | ||
public FileObject File { get; set; } | ||
|
||
public override BlockType Type => BlockType.File; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Src/Notion.Client/Models/Blocks/Request/HeadingOneBlockRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
namespace Notion.Client | ||
{ | ||
public class HeadingOneBlockRequest : BlockObjectRequest, IColumnChildrenBlockRequest, INonColumnBlockRequest | ||
{ | ||
[JsonProperty("heading_1")] | ||
[SuppressMessage("ReSharper", "InconsistentNaming")] | ||
public Info Heading_1 { get; set; } | ||
|
||
public override BlockType Type => BlockType.Heading_1; | ||
|
||
public class Info | ||
{ | ||
[JsonProperty("rich_text")] | ||
public IEnumerable<RichTextBase> RichText { get; set; } | ||
|
||
[JsonProperty("color")] | ||
[JsonConverter(typeof(StringEnumConverter))] | ||
public Color? Color { get; set; } | ||
|
||
[JsonProperty("is_toggleable")] | ||
public bool IsToggleable { get; set; } | ||
} | ||
} | ||
} |
Oops, something went wrong.