Skip to content

Commit

Permalink
add block parent (#45)
Browse files Browse the repository at this point in the history
* add block parent

* Use consts for parent types in page unmarshal

Co-authored-by: David Stotijn <[email protected]>
  • Loading branch information
bassettb and dstotijn authored Oct 27, 2022
1 parent ebaecd3 commit de8cab8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions page.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit de8cab8

Please sign in to comment.