launchdarkly/api-client-typescript

How is this meant to be consumed?

Opened this issue · 2 comments

Hey, thanks for publishing this client. But how is it meant to be consumed? The repo doesn't have a package.json file, which prevents it from being installed as a git dependency and I also couldn't find it on npm.

I thought maybe you intend users to vendor the api.ts file, but then I realized that it actually has some dependencies. Installing those and crossing fingers that they line up sounds very brittle.

Hi @mathiswiehl ,

You're absolutely right that this client is not easily consumable right now. This client, along with all of our other api-client-* libraries, are auto-generated based on our OpenAPI spec (formerly known as "Swagger spec") as defined in the ld-openapi repository. We use the Swagger Codegen CLI for generating the clients, and for whatever reason, the CLI's default template for creating typescript package is quite lacking in terms of packaging.

The good news is that we (LaunchDarkly) are aware of the issue and have a pull request open on our private ld-openapi mirror to improve this client's packaging. Once this change is accepted and released, you should be able to depend on this package just like any other package published on NPM.

If you want to use this client in the meantime, what I think you can do is copy the api.ts file to your own your codebase (although I recommend renaming it to launchdarkly-client.ts or something of that sort) and then use it like you would any other locally-defined files. You'll need to ensure that dependencies on bluebird, request, and http are available. Obviously this isn't ideal, and is only meant to be a temporary workaround.

I'll comment here when the changes I described above are available.

Cheers,
@bwoskow-ld

Hi @mathiswiehl ,

Thank you for your patience on this issue. You can now use this library by adding a dependency on the launchdarkly-api-typescript package. Version 5.0.2 is now published to NPM: https://www.npmjs.com/package/launchdarkly-api-typescript, and subsequent versions will be published there from now on.

Cheers,
@bwoskow-ld