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

Add all named endpoints and types #20

Merged
merged 1 commit into from May 13, 2021
Merged

Conversation

aoberoi
Copy link
Contributor

@aoberoi aoberoi commented May 13, 2021

This change adds named methods to the Client class for each of the endpoints in the Notion API. It follows the pattern established in #1.

Fixes #13

Future work

It's clear that the type definitions are not ideal. I intentionally avoided complex type constructs such as conditional types and heavy use of generics because the eventual goal is to generate these types from an OpenAPI format. If we used these more complex types now, it's very unlikely we could generate something which kept stability in the type names. TypeScript is just more expressive than OpenAPI and JSON Schema.

Another shortcoming is that there isn't a good separation between "input" types and "output" types. This matters in situations where a method accepts, for example, a Block in its parameters. At call time, a block won't have properties like id - those are assigned by the server. However, the Block type has id set as a non-optional property. This is a real issue and should be handled in a bugfix.

@aoberoi aoberoi merged commit dc71996 into main May 13, 2021
@aoberoi aoberoi deleted the add-all-endpoints-and-types branch May 13, 2021 09:10
rhart92 pushed a commit that referenced this pull request Oct 3, 2023
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

Successfully merging this pull request may close these issues.

Add remaining named methods and types
1 participant