seamapi / javascript-http

JavaScript HTTP client for the Seam API written in TypeScript.
https://javascript-http.seam.vc
MIT License
1 stars 1 forks source link

Generate and use classes for each seam resource #157

Open razor-x opened 3 months ago

razor-x commented 3 months ago

This issue is a draft. The approach is being refined and should not be implemented until after https://github.com/seamapi/javascript-http/issues/73

Currently each method returns an Promise for a SeamHttpRequest which resolves to an object types using the route spec.

This is nice because the types provide the interface without additional codegen. This mostly helps TypeScript consumers.

However, other SDKs wrap all responses in a typed class by generating models. This SDK should follow the same pattern:

  1. This provides a strict interface for JS consumers.
  2. This enables Seam to enforce LTS changes at the SDK level before properties are removed from the API response.

Instead of using a class, we may be able to get a similar result by passing the method args and return though the zod.parse methods.