cloudflare / node-cloudflare

Node.js API for Client API
https://cloudflare.github.io/node-cloudflare/
Other
335 stars 92 forks source link

Implement TypeScript Client #62

Closed terinjokes closed 7 months ago

terinjokes commented 4 years ago

To help aid in better documentation and autocomplete in editors (#59), I'd like to begin to using TypeScript. Packages pushed to npm would be compiled to JavaScript and include the "*.d.ts" files.

This is mostly a tracking ticket for this work.

mastermunj commented 4 years ago

Hi @terinjokes,

I've attempted creating a TypeScript client for Cloudflare API. As of now only user & user-token APIs are created and test cases are added for the same as well.

I know the code needs quite a lot of work for being better organized & tested, however, I wanted to share it with you in case if it makes sense to use it as a base or maybe if there's a way I could contribute towards the approach you are going ahead with.

The approach I have taken is

maxpain commented 4 years ago

Any news?

depombo commented 3 years ago

Any news?

Ditto

terinjokes commented 3 years ago

We should have TypeScript support in the next major version of this client, which is redesigned to be easier to update.

I'll accept contributions to this version.

robd commented 3 years ago

Not sure if this work is still planned, but for folks coming to this issue, another alternative is Pulumi which has typescript bindings (plus other languages) https://www.pulumi.com/docs/intro/cloud-providers/cloudflare/

terinjokes commented 3 years ago

Yep, still planned.

rawpixel-vincent commented 2 years ago

Not sure if it's related but currently the client initialization causes a type error:

Value of type 'typeof Cloudflare' is not callable. Did you mean to include 'new'?ts(2348)

with the code:

const cloudflare = require('cloudflare')({
    email: 'email',
    key: 'key',
  });

Couldn't find a workaround.

Maus3rSR commented 1 year ago

Hello !

We are in 2023, Im starting implementing Cloudflare API and before writing from scratch I jumped here. It seems to not really be updated ?

Without typescript and an SDK up to date I think it preferable to write from scratch.

Any news ?

terinjokes commented 1 year ago

I'm in the proccess of generating clients we can better support from our new OpenAPI schemas. I don't have any news on when they'll be available, but it is being worked on.

Dennis4720 commented 1 year ago

I also need to use the API preferably with typescript support. Please let me know when there's an ETA =).

colearendt commented 9 months ago

@terinjokes Any progress on new OpenAPI generated clients? Has that work stagnated?

For reference: OpenAPI schemas are here: https://github.com/cloudflare/api-schemas