1
0
mirror of https://github.com/dstotijn/go-notion.git synced 2025-06-15 00:05:04 +02:00

Add tests for "append block children" endpoint

This commit is contained in:
David Stotijn
2021-05-22 23:37:52 +02:00
parent ebabf2cf70
commit 00a77fe3a4
2 changed files with 193 additions and 2 deletions

View File

@ -1,6 +1,9 @@
package notion
import "time"
import (
"encoding/json"
"time"
)
// Block represents content on the Notion platform.
// See: https://developers.notion.com/reference/block
@ -20,7 +23,7 @@ type Block struct {
NumberedListItem *RichTextBlock `json:"numbered_list_item,omitempty"`
ToDo *ToDo `json:"to_do,omitempty"`
Toggle *RichTextBlock `json:"toggle,omitempty"`
ChildPage *ChildPage `json:"rich_text,omitempty"`
ChildPage *ChildPage `json:"child_page,omitempty"`
}
type RichTextBlock struct {
@ -67,3 +70,13 @@ type BlockChildrenResponse struct {
HasMore bool `json:"has_more"`
NextCursor *string `json:"next_cursor"`
}
// MarshalJSON implements json.Marshaler.
func (b Block) MarshalJSON() ([]byte, error) {
type blockAlias Block
alias := blockAlias(b)
alias.Object = "block"
return json.Marshal(alias)
}