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:
17
block.go
17
block.go
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user