oauth-jsclient icon indicating copy to clipboard operation
oauth-jsclient copied to clipboard

Add TypeScript definitions

Open programmarchy opened this issue 3 years ago • 6 comments

Adds TypeScript definitions for this module.

programmarchy avatar Nov 22 '21 14:11 programmarchy

Thanks for the contribution @programmarchy 👍

anilkumarbp avatar Dec 03 '21 22:12 anilkumarbp

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.

programmarchy avatar Dec 03 '21 23:12 programmarchy

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 !

anilkumarbp avatar Dec 03 '21 23:12 anilkumarbp

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

joshnies avatar Nov 28 '22 19:11 joshnies

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.

programmarchy avatar Nov 28 '22 19:11 programmarchy

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 !

joshnies avatar Nov 28 '22 20:11 joshnies