Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript definitions #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

programmarchy
Copy link

Adds TypeScript definitions for this module.

@digibake digibake mentioned this pull request Dec 3, 2021
@anilkumarbp
Copy link

Thanks for the contribution @programmarchy 👍

@programmarchy
Copy link
Author

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
Copy link

anilkumarbp commented Dec 3, 2021

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 !

refresh_token: string;
expires_in: number;
x_refresh_token_expires_in: number;
id_token: string;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this property be optional?
I.e. it'd be there when open_id is in the scope

@joshnies
Copy link

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

@programmarchy
Copy link
Author

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
Copy link

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 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants