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

feat(js-client): add type definitions #6009

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

CalebBarnes
Copy link

@CalebBarnes CalebBarnes commented Jan 9, 2025

Add type definitions for dynamic client methods by defining the NetlifyAPI class as an interface that inherits mapped types from @netlify/open-api.

Summary

Not having types is annoying, but lets try not to break things.

Screenshots

Using return types from @netlify/open-api:
image

Support both snake_case and camelCase params:
image

Support combined path and query params:
image


For us to review and ship your PR efficiently, please perform the following steps:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures
    we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or
    something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures
    your code follows our style guide and passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

Add type definitions for dynamic client methods by defining the
NetlifyAPI class as an interface that inherits mapped types.
The api client methods will assign these to the correct places but just
accept the params as a single object.
The api response for accessToken can possibly be undefined but we were
only allowing string or null before.
…itions

Since the API client allows using camelCased params we need to allow
these to keep backwards compatibility.
@CalebBarnes CalebBarnes marked this pull request as ready for review January 9, 2025 23:41
@CalebBarnes CalebBarnes requested a review from a team as a code owner January 9, 2025 23:41
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.

1 participant