From de8cab86ca92c13e4cc95959151b4af3f57d075c Mon Sep 17 00:00:00 2001 From: bassettb Date: Thu, 27 Oct 2022 05:45:25 -0400 Subject: [PATCH] add block parent (#45) * add block parent * Use consts for parent types in page unmarshal Co-authored-by: David Stotijn --- page.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/page.go b/page.go index 492483c..ee3e059 100644 --- a/page.go +++ b/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 {