1
0
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:
bassettb 2022-10-27 05:45:25 -04:00 committed by GitHub
parent ebaecd3a42
commit de8cab86ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {