mirror of
https://github.com/dstotijn/go-notion.git
synced 2025-06-17 00:07:45 +02:00
Add tests for "create page" endpoint
This commit is contained in:
4
page.go
4
page.go
@ -23,7 +23,7 @@ type Page struct {
|
||||
}
|
||||
|
||||
type PageParent struct {
|
||||
Type ParentType `json:"type"`
|
||||
Type ParentType `json:"type,omitempty"`
|
||||
|
||||
PageID *string `json:"page_id,omitempty"`
|
||||
DatabaseID *string `json:"database_id,omitempty"`
|
||||
@ -109,10 +109,8 @@ func (p CreatePageParams) MarshalJSON() ([]byte, error) {
|
||||
var parent PageParent
|
||||
|
||||
if p.DatabasePageProperties != nil {
|
||||
parent.Type = "database_id"
|
||||
parent.DatabaseID = StringPtr(p.ParentID)
|
||||
} else if p.Title != nil {
|
||||
parent.Type = "page_id"
|
||||
parent.PageID = StringPtr(p.ParentID)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user