mirror of
https://github.com/dstotijn/go-notion.git
synced 2024-11-24 08:42:26 +02:00
add block parent (#45)
* add block parent * Use consts for parent types in page unmarshal Co-authored-by: David Stotijn <dstotijn@gmail.com>
This commit is contained in:
parent
ebaecd3a42
commit
de8cab86ca
8
page.go
8
page.go
@ -276,16 +276,18 @@ func (p *Page) UnmarshalJSON(b []byte) error {
|
||||
page := dto.PageAlias
|
||||
|
||||
switch dto.Parent.Type {
|
||||
case "workspace":
|
||||
case ParentTypeWorkspace:
|
||||
fallthrough
|
||||
case "page_id":
|
||||
case ParentTypeBlock:
|
||||
fallthrough
|
||||
case ParentTypePage:
|
||||
var props PageProperties
|
||||
err := json.Unmarshal(dto.Properties, &props)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
page.Properties = props
|
||||
case "database_id":
|
||||
case ParentTypeDatabase:
|
||||
var props DatabasePageProperties
|
||||
err := json.Unmarshal(dto.Properties, &props)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user