jomei / notionapi

A Notion API SDK, written in Golang

Home Page:https://pkg.go.dev/github.com/jomei/notionapi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing parent field in Block interface

evanfuller opened this issue · comments

A block returned by the Notion API contains an object field parent, which points to either a parent page reference or parent block reference in the case of nested children.

For example:

{
  "object": "block",
  "id": "fbc4a8e8-302e-4258-a8eb-6a5f5066ddfe",
  "parent": {
    "type": "page_id",
    "page_id": "bdd526b3-fb3e-44c7-ac77-797023bcb73f"
  },
  ...
}

or

{
  "object": "block",
  "id": "7d5aea6a-2c98-4496-a81d-7d1bfbe7fb6b",
  "parent": {
    "type": "block_id",
    "block_id": "fbc4a8e8-302e-4258-a8eb-6a5f5066ddfe"
  },
  ...
}

It would be great if the Block interface had a function to fetch the parent, perhaps something like

type Parent interface {
  GetType() string
  GetID() string
}

type Block interface {
  ...
  GetParent() Parent
}