Repository: seratch/notion-sdk-jvm
Pull request #58 (2022-07-06 02:25:34)

Add block parent
This pull requests add parent property to the blocks


Patch:
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/AudioBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/AudioBlock.kt
index 1ff1954..c2cbc08 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/AudioBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/AudioBlock.kt
@@ -19,6 +19,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val audio: Element,
 ) : Block {
 
@@ -31,6 +32,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.Audio,
@@ -40,6 +42,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       audio = audio)
 
   open class Element
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/Block.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/Block.kt
index 7e91e31..632230c 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/Block.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/Block.kt
@@ -1,6 +1,6 @@
 package notion.api.v1.model.blocks
 
-import notion.api.v1.model.common.*
+import notion.api.v1.model.common.WithObjectType
 import notion.api.v1.model.users.User
 
 interface Block : WithObjectType {
@@ -12,6 +12,7 @@ interface Block : WithObjectType {
   var lastEditedBy: User?
   var archived: Boolean?
   var hasChildren: Boolean?
+  var parent: BlockParent?
 
   fun asParagraph(): ParagraphBlock =
       if (type == BlockType.Paragraph) this as ParagraphBlock
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/BlockParent.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/BlockParent.kt
new file mode 100644
index 0000000..34b5ab0
--- /dev/null
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/BlockParent.kt
@@ -0,0 +1,38 @@
+package notion.api.v1.model.blocks
+
+data class BlockParent
+@JvmOverloads
+constructor(
+    val type: BlockParentType? = null,
+    var databaseId: String? = null, // type: database
+    var pageId: String? = null, // type: page
+    var blockId: String? = null, // type: block
+    var workspace: Boolean? = null // type: workspace
+) {
+
+  companion object {
+    @JvmStatic
+    fun database(databaseId: String): BlockParent {
+      // having the `type` property does not work as of May 19, 2021
+      return BlockParent(type = null, databaseId = databaseId)
+    }
+
+    @JvmStatic
+    fun page(pageId: String): BlockParent {
+      // having the `type` property does not work as of May 19, 2021
+      return BlockParent(type = null, pageId = pageId)
+    }
+
+    @JvmStatic
+    fun block(blockId: String): BlockParent {
+      // having the `type` property does not work as of May 19, 2021
+      return BlockParent(type = null, blockId = blockId)
+    }
+
+    @JvmStatic
+    fun workspace(): BlockParent {
+      // having the `type` property does not work as of May 19, 2021
+      return BlockParent(type = null, workspace = true)
+    }
+  }
+}
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/BlockParentType.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/BlockParentType.kt
new file mode 100644
index 0000000..ff0e830
--- /dev/null
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/BlockParentType.kt
@@ -0,0 +1,12 @@
+package notion.api.v1.model.blocks
+
+import com.google.gson.annotations.SerializedName
+
+enum class BlockParentType @JvmOverloads constructor(val value: String) {
+  @SerializedName("database_id") DatabaseId("database_id"),
+  @SerializedName("page_id") PageId("page_id"),
+  @SerializedName("block_id") BlockId("block_id"),
+  @SerializedName("workspace") Workspace("workspace");
+
+  override fun toString(): String = value
+}
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/BookmarkBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/BookmarkBlock.kt
index 2dce430..9fd0831 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/BookmarkBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/BookmarkBlock.kt
@@ -18,11 +18,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val bookmark: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      bookmark: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -30,6 +32,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Bookmark,
@@ -39,7 +42,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      bookmark)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/BreadcrumbBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/BreadcrumbBlock.kt
index 888a7a9..069844d 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/BreadcrumbBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/BreadcrumbBlock.kt
@@ -17,11 +17,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val breadcrumb: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      breadcrumb: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -29,6 +31,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Breadcrumb,
@@ -38,7 +41,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      breadcrumb)
 
   open class Element @JvmOverloads constructor()
 }
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/BulletedListItemBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/BulletedListItemBlock.kt
index 8993b7c..4d0ae52 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/BulletedListItemBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/BulletedListItemBlock.kt
@@ -19,6 +19,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val bulletedListItem: Element,
 ) : Block {
 
@@ -31,6 +32,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.BulletedListItem,
@@ -40,6 +42,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       bulletedListItem = bulletedListItem)
 
   open class Element
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/CalloutBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/CalloutBlock.kt
index 23f9442..2816231 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/CalloutBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/CalloutBlock.kt
@@ -20,11 +20,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val callout: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      callout: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -32,6 +34,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Callout,
@@ -41,7 +44,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      callout)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/ChildDatabaseBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/ChildDatabaseBlock.kt
index eab590e..b7e9dd8 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/ChildDatabaseBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/ChildDatabaseBlock.kt
@@ -17,6 +17,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val childDatabase: Element,
 ) : Block {
 
@@ -29,6 +30,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.ChildDatabase,
@@ -38,6 +40,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       childDatabase = childDatabase,
   )
 
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/ChildPageBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/ChildPageBlock.kt
index 4cce1c2..0df4b8a 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/ChildPageBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/ChildPageBlock.kt
@@ -17,6 +17,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val childPage: Element,
 ) : Block {
 
@@ -29,6 +30,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.ChildPage,
@@ -38,6 +40,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       childPage = childPage)
 
   open class Element @JvmOverloads constructor(var title: String)
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/CodeBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/CodeBlock.kt
index 09e6b98..0e99c19 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/CodeBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/CodeBlock.kt
@@ -18,11 +18,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val code: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      code: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -30,6 +32,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Code,
@@ -39,7 +42,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      code)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/ColumnBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/ColumnBlock.kt
index c32e135..b2f1879 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/ColumnBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/ColumnBlock.kt
@@ -17,11 +17,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val column: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      column: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -29,6 +31,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Column,
@@ -38,7 +41,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      column)
 
   open class Element @JvmOverloads constructor()
 }
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/ColumnListBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/ColumnListBlock.kt
index 969eab0..35419a1 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/ColumnListBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/ColumnListBlock.kt
@@ -17,11 +17,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val columnList: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      columnList: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -29,6 +31,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.ColumnList,
@@ -38,7 +41,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      columnList)
 
   open class Element @JvmOverloads constructor()
 }
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/DividerBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/DividerBlock.kt
index c68fa52..4e701a6 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/DividerBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/DividerBlock.kt
@@ -17,11 +17,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val divider: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      divider: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -29,6 +31,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Divider,
@@ -38,7 +41,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      divider)
 
   open class Element
 }
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/EmbedBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/EmbedBlock.kt
index 7555198..adc8d4d 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/EmbedBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/EmbedBlock.kt
@@ -18,11 +18,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val embed: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      embed: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -30,6 +32,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Embed,
@@ -39,7 +42,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      embed)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/EquationBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/EquationBlock.kt
index a5431c1..7c0c664 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/EquationBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/EquationBlock.kt
@@ -18,11 +18,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val equation: Equation? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      equation: Equation,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -30,6 +32,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Equation,
@@ -39,5 +42,7 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      equation)
 }
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/FileBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/FileBlock.kt
index 0c5edab..0124d40 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/FileBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/FileBlock.kt
@@ -20,11 +20,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val file: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      file: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -32,6 +34,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.File,
@@ -41,7 +44,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      file)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingOneBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingOneBlock.kt
index 63538f8..78072b2 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingOneBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingOneBlock.kt
@@ -19,6 +19,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     @SerializedName("heading_1") val heading1: Element,
 ) : Block {
 
@@ -31,6 +32,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.HeadingOne,
@@ -40,6 +42,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       heading1 = heading1)
 
   open class Element
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingThreeBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingThreeBlock.kt
index 8fe4561..9f42ee2 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingThreeBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingThreeBlock.kt
@@ -19,6 +19,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     @SerializedName("heading_3") val heading3: Element,
 ) : Block {
 
@@ -31,6 +32,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.HeadingThree,
@@ -40,6 +42,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       heading3 = heading3)
 
   open class Element
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingTwoBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingTwoBlock.kt
index 934542b..86705d9 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingTwoBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/HeadingTwoBlock.kt
@@ -19,6 +19,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     @SerializedName("heading_2") val heading2: Element,
 ) : Block {
 
@@ -31,6 +32,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.HeadingTwo,
@@ -40,6 +42,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       heading2 = heading2)
 
   open class Element(
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/ImageBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/ImageBlock.kt
index d9c0c9d..866320b 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/ImageBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/ImageBlock.kt
@@ -20,11 +20,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val image: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      image: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -32,6 +34,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Image,
@@ -41,7 +44,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      image)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/LinkPreviewBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/LinkPreviewBlock.kt
index 05159f4..fdcc21a 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/LinkPreviewBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/LinkPreviewBlock.kt
@@ -17,11 +17,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val linkPreview: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      linkPreview: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -29,6 +31,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.LinkPreview,
@@ -38,7 +41,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      linkPreview)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/LinkToPageBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/LinkToPageBlock.kt
index e0e5df7..e95a67a 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/LinkToPageBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/LinkToPageBlock.kt
@@ -18,11 +18,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val linkToPage: LinkToPage? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      linkToPage: LinkToPage,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -30,6 +32,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.LinkToPage,
@@ -39,5 +42,7 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      linkToPage)
 }
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/NumberedListItemBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/NumberedListItemBlock.kt
index 3e132a6..d067e02 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/NumberedListItemBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/NumberedListItemBlock.kt
@@ -19,6 +19,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val numberedListItem: Element,
 ) : Block {
 
@@ -31,6 +32,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.NumberedListItem,
@@ -40,6 +42,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       numberedListItem = numberedListItem)
 
   open class Element
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/PDFBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/PDFBlock.kt
index 531f11e..bbdbcb8 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/PDFBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/PDFBlock.kt
@@ -20,11 +20,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val pdf: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      pdf: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -32,6 +34,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.PDF,
@@ -41,7 +44,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      pdf)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/ParagraphBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/ParagraphBlock.kt
index 92c1c1a..9752912 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/ParagraphBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/ParagraphBlock.kt
@@ -19,6 +19,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val paragraph: Element,
 ) : Block {
 
@@ -31,6 +32,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.Paragraph,
@@ -40,6 +42,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       paragraph = paragraph)
 
   open class Element
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/QuoteBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/QuoteBlock.kt
index 73d551a..c6cec39 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/QuoteBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/QuoteBlock.kt
@@ -19,11 +19,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val quote: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      quote: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -31,6 +33,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Quote,
@@ -40,7 +43,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      quote)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/SyncedBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/SyncedBlock.kt
index 13d818a..7f813e2 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/SyncedBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/SyncedBlock.kt
@@ -18,11 +18,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val syncedBlock: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      syncedBlock: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -30,6 +32,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.SyncedBlock,
@@ -39,7 +42,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      syncedBlock)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/TableBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/TableBlock.kt
index ec42700..f619dc9 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/TableBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/TableBlock.kt
@@ -17,6 +17,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val table: Element,
 ) : Block {
 
@@ -29,6 +30,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.Table,
@@ -38,6 +40,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       table = table)
 
   open class Element
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/TableOfContentsBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/TableOfContentsBlock.kt
index 27b7c85..82a25ac 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/TableOfContentsBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/TableOfContentsBlock.kt
@@ -18,11 +18,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val tableOfContents: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      tableOfContents: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -30,6 +32,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.TableOfContents,
@@ -39,7 +42,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      tableOfContents)
 
   open class Element @JvmOverloads constructor(var color: BlockColor? = null)
 }
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/TableRowBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/TableRowBlock.kt
index 615ae3b..b075678 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/TableRowBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/TableRowBlock.kt
@@ -18,6 +18,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val tableRow: Element,
 ) : Block {
 
@@ -30,6 +31,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.TableRow,
@@ -39,6 +41,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       tableRow = tableRow)
 
   open class Element
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/TemplateBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/TemplateBlock.kt
index a95ceec..e5230dd 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/TemplateBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/TemplateBlock.kt
@@ -18,11 +18,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val template: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      template: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -30,6 +32,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Template,
@@ -39,7 +42,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      template)
 
   open class Element
   @JvmOverloads
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/ToDoBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/ToDoBlock.kt
index 337b69d..7a72374 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/ToDoBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/ToDoBlock.kt
@@ -19,6 +19,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val toDo: Element,
 ) : Block {
 
@@ -31,6 +32,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.ToDo,
@@ -40,6 +42,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       toDo = toDo)
 
   open class Element
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/ToggleBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/ToggleBlock.kt
index 0ee5d10..8f69c4d 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/ToggleBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/ToggleBlock.kt
@@ -19,6 +19,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val toggle: Element,
 ) : Block {
 
@@ -31,6 +32,7 @@ constructor(
       createdBy: User? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       objectType = ObjectType.Block,
       type = BlockType.Toggle,
@@ -40,6 +42,7 @@ constructor(
       lastEditedTime = lastEditedTime,
       lastEditedBy = lastEditedBy,
       hasChildren = hasChildren,
+      parent = parent,
       toggle = toggle)
 
   open class Element
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/UnsupportedBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/UnsupportedBlock.kt
index 14a6ec3..5f0d31c 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/UnsupportedBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/UnsupportedBlock.kt
@@ -17,6 +17,7 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val unsupported: Element? = null,
 ) : Block {
 
@@ -29,6 +30,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Unsupported,
@@ -38,7 +40,8 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent)
 
   open class Element
 }
diff --git a/core/src/main/kotlin/notion/api/v1/model/blocks/VideoBlock.kt b/core/src/main/kotlin/notion/api/v1/model/blocks/VideoBlock.kt
index 1f0e900..8ff2488 100644
--- a/core/src/main/kotlin/notion/api/v1/model/blocks/VideoBlock.kt
+++ b/core/src/main/kotlin/notion/api/v1/model/blocks/VideoBlock.kt
@@ -19,11 +19,13 @@ constructor(
     override var lastEditedBy: User? = null,
     override var hasChildren: Boolean? = null,
     override var archived: Boolean? = null,
+    override var parent: BlockParent? = null,
     val video: Element? = null,
 ) : Block {
 
   // for other JVM languages
   constructor(
+      video: Element,
       id: String? = UUID.randomUUID().toString(),
       hasChildren: Boolean? = null,
       createdTime: String? = null,
@@ -31,6 +33,7 @@ constructor(
       archived: Boolean? = null,
       lastEditedTime: String? = null,
       lastEditedBy: User? = null,
+      parent: BlockParent? = null,
   ) : this(
       ObjectType.Block,
       BlockType.Video,
@@ -40,7 +43,9 @@ constructor(
       lastEditedTime,
       lastEditedBy,
       hasChildren,
-      archived)
+      archived,
+      parent,
+      video)
 
   open class Element
   @JvmOverloads


Test patch:
diff --git a/core/src/test/kotlin/tests/java_compatibility/BlocksTest.java b/core/src/test/kotlin/tests/java_compatibility/BlocksTest.java
index e4ef306..5f867f6 100644
--- a/core/src/test/kotlin/tests/java_compatibility/BlocksTest.java
+++ b/core/src/test/kotlin/tests/java_compatibility/BlocksTest.java
@@ -23,6 +23,7 @@ public class BlocksTest {
                 "2021-05-01",
                 null,
                 "2021-05-02",
+                null,
                 null
         );
         assertNotNull(block);