-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Request type hints #259
Comments
Hey, thanks for the kind words. :) 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 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. |
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("luca@example.com")
that creates the right dict for you{"email": "luca@example.com"}
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: