You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to have some helpers like EmailValue("[email protected]") that creates the right dict for you {"email": "[email protected]"} and eventually when reading a page it would include also "type": "email"
What do you think? Happy to come up with a PR
Luca
The text was updated successfully, but these errors were encountered:
I understand the appeal but I don't think a custom "language" (i.e. custom objects implemented in this library and only there) would be easier to understand and use than Notion's one. Happy to change my mind though, feel free to share your arguments.
Did you have a look at libraries that build on top of notion-sdk-py, such as notion-objects?
Hey indeed what I meant is what notion object is doing, I'll try it. Personally I don't need the full object mapping, I'd just use the Text objects and similar.
Btw I get you don't want to make the library heavier adding those objects, though I think that it would give better static type checking to the library, instead of incurring to runtime errors. Personally I spent some time to figure out the rich text format. An alternative to using objects as notion objects is doing, could be using TypedDict to have typechecking and autocomplete in the IDE.
Fair enough. Just like I already agreed that we could have type hints for the responses if someone is willing to add them and maintain them (c.f. #199, #242), it probably makes sense that I also agree on type hints for the requests. :)
I’m still unsure about the shape it should take, but so far I’m mostly leaning toward using typed dicts.
ramnes
changed the title
Add Page properties helpers
Request type hints
Mar 10, 2025
Hey thanks for the amazing library!
I'm using notion sdk to create and modify pages and I find hard to write properties in the right format as explained in Notion API docs https://developers.notion.com/reference/page-property-values this is my snippet of code:
It would be nice to have some helpers like
EmailValue("[email protected]")
that creates the right dict for you{"email": "[email protected]"}
and eventually when reading a page it would include also"type": "email"
What do you think? Happy to come up with a PR
Luca
The text was updated successfully, but these errors were encountered: