Skip to content

Commit

Permalink
Merge pull request #307 from notion-dotnet/259-fix-block-parent-parsing
Browse files Browse the repository at this point in the history
Fix Block parent parsing 🔨
  • Loading branch information
KoditkarVedant authored Aug 20, 2022
2 parents f2901a8 + f2d0781 commit 97b2983
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion Src/Notion.Client/Models/Blocks/Block.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Notion.Client.Models.Blocks;

namespace Notion.Client
{
Expand Down
1 change: 0 additions & 1 deletion Src/Notion.Client/Models/Blocks/IBlock.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using JsonSubTypes;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Notion.Client.Models.Blocks;

namespace Notion.Client
{
Expand Down
4 changes: 2 additions & 2 deletions Src/Notion.Client/Models/Blocks/IBlockParent.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using JsonSubTypes;
using Newtonsoft.Json;

namespace Notion.Client.Models.Blocks
namespace Notion.Client
{
[JsonConverter(typeof(JsonSubtypes), "type")]
[JsonSubtypes.KnownSubType(typeof(DatabaseParent), ParentType.DatabaseId)]
[JsonSubtypes.KnownSubType(typeof(PageParent), ParentType.PageId)]
[JsonSubtypes.KnownSubType(typeof(WorkspaceParent), ParentType.Workspace)]
[JsonSubtypes.KnownSubType(typeof(BlockParent), ParentType.BlockId)]
public interface IBlockParent
public interface IBlockParent : IParent
{
}
}
2 changes: 1 addition & 1 deletion Src/Notion.Client/Models/Parents/BlockParent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class BlockParent : IPageParent, IDatabaseParent
public class BlockParent : IPageParent, IDatabaseParent, IBlockParent
{
/// <summary>
/// Always has a value "block_id"
Expand Down
2 changes: 1 addition & 1 deletion Src/Notion.Client/Models/Parents/DatabaseParent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class DatabaseParent : IPageParent
public class DatabaseParent : IPageParent, IBlockParent
{
/// <summary>
/// Always "database_id"
Expand Down
2 changes: 1 addition & 1 deletion Src/Notion.Client/Models/Parents/PageParent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Notion.Client
{
public class PageParent : IPageParent, IDatabaseParent
public class PageParent : IPageParent, IDatabaseParent, IBlockParent
{
/// <summary>
/// Always "page_id".
Expand Down
2 changes: 1 addition & 1 deletion Src/Notion.Client/Models/Parents/WorkspaceParent.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Notion.Client
{
public class WorkspaceParent : IPageParent, IDatabaseParent
public class WorkspaceParent : IPageParent, IDatabaseParent, IBlockParent
{
/// <summary>
/// Always "workspace".
Expand Down

0 comments on commit 97b2983

Please sign in to comment.