Skip to content

How to work with typed blocks by design? #16

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

Open
Tracked by #13
broderix opened this issue Feb 11, 2022 · 2 comments
Open
Tracked by #13

How to work with typed blocks by design? #16

broderix opened this issue Feb 11, 2022 · 2 comments

Comments

@broderix
Copy link

broderix commented Feb 11, 2022

Hi, please explain how you design work with typed Block (e.g. Paragraph) after retrieve Page?

  NotionResponse resBlocks =
      await notion.blocks.list(block_id: 'YYYYYYYYY');
  Pagination paging = resBlocks.content;
  for (Block block in paging.blocks) {
    if (block.isParagraph) {
      //<-- HOW TO GET Paragraph Object ?
    }
  }
`
@jonathangomz
Copy link
Owner

Right now only can be obtained from jsonContent attribute :(

NotionResponse resBlocks =
      await notion.blocks.list(block_id: 'YYYYYYYYY');
Pagination paging = resBlocks.content;
for (Block block in paging.blocks) {
  if (block.isParagraph) {
    print(block.jsonContent);
  }
}

I don't like a lot of things in this package, so I'm doing it again almost from scratch breaking my mind in the process. I will think about a way to solve this problem for this new version.

Thanks for letting me know and sorry for all my mess here hehe

@broderix
Copy link
Author

Thanks, it's clear now.
Dude, the code is great, don't worry. It would be worse if it didn't exist at all.
Let's try to fix the current one and support those who already use it.
May the force be with you)

@jonathangomz jonathangomz mentioned this issue Feb 25, 2022
33 tasks
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