nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: jomei/notionapi
Pull request #60 (2022-02-23 22:13:47)

Add Children to Heading Blocks
Toggle Headings were recently added. With them, the heading blocks now
also can have children. This adds a children field to the heading block.

Requesting a toggle heading has the `has_children` set to true.


Patch:
diff --git a/block.go b/block.go
index d7f7544..9439d65 100644
--- a/block.go
+++ b/block.go
@@ -208,7 +208,8 @@ type Heading1Block struct {
 }
 
 type Heading struct {
-	Text []RichText `json:"text"`
+	Text     []RichText `json:"text"`
+	Children Blocks     `json:"children,omitempty"`
 }
 
 type Heading2Block struct {


Test patch:
diff --git a/block_test.go b/block_test.go
index c043b79..428a6a7 100644
--- a/block_test.go
+++ b/block_test.go
@@ -78,13 +78,15 @@ func TestBlockClient(t *testing.T) {
 								Type:   notionapi.BlockTypeHeading2,
 							},
 							Heading2: struct {
-								Text []notionapi.RichText `json:"text"`
+								Text     []notionapi.RichText `json:"text"`
+								Children notionapi.Blocks     `json:"children,omitempty"`
 							}{[]notionapi.RichText{
 								{
 									Type: notionapi.ObjectTypeText,
 									Text: notionapi.Text{Content: "Hello"},
 								},
-							}},
+							}, nil,
+							},
 						},
 					},
 				},
diff --git a/page_test.go b/page_test.go
index 6647c28..7bb4ae4 100644
--- a/page_test.go
+++ b/page_test.go
@@ -402,7 +402,8 @@ func TestPageCreateRequest_MarshallJSON(t *testing.T) {
 							Type:   notionapi.BlockTypeHeading2,
 						},
 						Heading2: struct {
-							Text []notionapi.RichText `json:"text"`
+							Text     []notionapi.RichText `json:"text"`
+							Children notionapi.Blocks     `json:"children,omitempty"`
 						}{
 							Text: []notionapi.RichText{
 								{
Repository: jomei/notionapi
Pull request #130 (2023-04-04 15:28:52)

Added is_toggleable field to Heading block
Ref: https://developers.notion.com/reference/block#headings


Patch:
diff --git a/block.go b/block.go
index 8f33a9f..601ef15 100644
--- a/block.go
+++ b/block.go
@@ -254,9 +254,10 @@ type Heading1Block struct {
 }
 
 type Heading struct {
-	RichText []RichText `json:"rich_text"`
-	Children Blocks     `json:"children,omitempty"`
-	Color    string     `json:"color,omitempty"`
+	RichText     []RichText `json:"rich_text"`
+	Children     Blocks     `json:"children,omitempty"`
+	Color        string     `json:"color,omitempty"`
+	IsToggleable bool       `json:"is_toggleable,omitempty"`
 }
 
 type Heading2Block struct {


Test patch:
diff --git a/block_test.go b/block_test.go
index dcb7f3f..4d3c359 100644
--- a/block_test.go
+++ b/block_test.go
@@ -78,15 +78,16 @@ func TestBlockClient(t *testing.T) {
 								Type:   notionapi.BlockTypeHeading2,
 							},
 							Heading2: struct {
-								RichText []notionapi.RichText `json:"rich_text"`
-								Children notionapi.Blocks     `json:"children,omitempty"`
-								Color    string               `json:"color,omitempty"`
+								RichText     []notionapi.RichText `json:"rich_text"`
+								Children     notionapi.Blocks     `json:"children,omitempty"`
+								Color        string               `json:"color,omitempty"`
+								IsToggleable bool                 `json:"is_toggleable,omitempty"`
 							}{[]notionapi.RichText{
 								{
 									Type: notionapi.ObjectTypeText,
 									Text: &notionapi.Text{Content: "Hello"},
 								},
-							}, nil, "",
+							}, nil, "", false,
 							},
 						},
 					},