Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common interface for Block, Page, and Database #162

Open
pierce-m opened this issue Oct 2, 2023 · 1 comment
Open

Common interface for Block, Page, and Database #162

pierce-m opened this issue Oct 2, 2023 · 1 comment

Comments

@pierce-m
Copy link
Contributor

pierce-m commented Oct 2, 2023

It would be very helpful to abstract these objects away in a comment interface, as currently in our code we use a lot of switch/case such as

switch obj.Type{
  case "block":
    return obj.CreatedAt
  case "page":
    return obj.CreatedAt
}

It would be much nicer to be able to do

obj.GetCreatedAt()

simplifying the client code greatly. It seems Blocks have a common Block interface, I am wondering if we can create a common interface shared between Blocks, Pages, and Databases to access these common fields?

@jomei
Copy link
Owner

jomei commented Oct 3, 2023

Hi!
Why not, looks easy to implement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants