1
0
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:
David Stotijn
2021-05-19 22:21:53 +02:00
parent 063bb045e4
commit 55aa9db5c7
3 changed files with 285 additions and 4 deletions

View File

@ -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)
}