intuit / oauth-jsclient

Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
https://developer.intuit.com/
Apache License 2.0
120 stars 154 forks source link

Add TypeScript definitions #121

Closed programmarchy closed 1 month ago

programmarchy commented 2 years ago

Adds TypeScript definitions for this module.

anilkumarbp commented 2 years ago

Thanks for the contribution @programmarchy 👍

programmarchy commented 2 years ago

You're welcome. I tried to make the existing definitions as accurate as possible based on the JS code. However, it's worth noting there are a couple definitions missing, e.g. makeApiRequest. I didn't need them, so didn't bother, but if this has a chance to be merged I could help add them.

anilkumarbp commented 2 years ago

Thanks @programmarchy . I will discuss this with my team next week and keep you posted should I need help with the release. Appreciate your help !

joshnies commented 1 year ago

Any updates on this? We could really use this in 2022...

programmarchy commented 1 year ago

Any updates on this? We could really use this in 2022...

@joshnies There's little point to this library, in my opinion. You're better off using an OAuth2 client like client-oauth2 to get the tokens you need for API requests. That's all this library really does, except for the makeApiCall function which is fairly useless anyway.

If you're interested, here's a snippet from a TypeScript API client I created: https://gist.github.com/programmarchy/080075d3aaea8cf001c354a2584ca1e8

Fair warning, though: you'll have to "fill in the blanks" for certain things like token storage. Also, the types are not fully fleshed out since I only created types for API endpoints that I needed for my projects. You're welcome to repurpose it for your needs, though.

joshnies commented 1 year ago

There's little point to this library, in my opinion. You're better off using an OAuth2 client like client-oauth2 to get the tokens you need for API requests. That's all this library really does, except for the makeApiCall function which is fairly useless anyway.

Roger, I'll check it out, thanks @programmarchy !