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

🚀 Feature: Add return types to @novu/node #6611

Open
2 tasks done
KamalAman opened this issue Oct 3, 2024 · 6 comments
Open
2 tasks done

🚀 Feature: Add return types to @novu/node #6611

KamalAman opened this issue Oct 3, 2024 · 6 comments
Assignees
Labels

Comments

@KamalAman
Copy link

🔖 Feature description

It seems like @novu/node returns AxiosResponse<any, any> for all of the network requests. Subscriber.ts

Can we get it to be with proper return types?

Your api is well documented https://docs.novu.co/api-reference/subscribers/get-subscriber.

🎤 Why is this feature needed ?

I need proper types when developing or else everything goes to hell.

✌️ How do you aim to achieve this?

You should be able to return codegen to generate all of the response types and the methods as well

I've used hay-api before, and its really simple: https://heyapi.vercel.app/openapi-ts/get-started.html
Just hook this script into your build process, it will generate a services.gen.ts with proper types. It'll generate the .ts. api based your openapi schema. Call those functions instead of axios directly.

import { defineConfig } from '@hey-api/openapi-ts';

export default defineConfig({
  client: '@hey-api/client-fetch',
  input: 'path/to/openapi.json',
  output: 'libs/node/src/generated',
}); 

🔄️ Additional Information

No response

👀 Have you spent some time to check if this feature request has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

Yes I am willing to submit a PR!

Copy link

linear bot commented Oct 3, 2024

@github-actions github-actions bot added the triage label Oct 3, 2024
@pritam0721
Copy link

@KamalAman can I work on these ?

@KamalAman
Copy link
Author

KamalAman commented Oct 6, 2024

Yeah for sure! Let me know if you need any feedback, but once you select the codegen, the rest should be pretty easy to just call the appropriate method. You will probably want to keep the fetcher standardized to axios.

@jainpawan21
Copy link
Member

@KamalAman

Thanks for the feedback. I agree, node sdk should have types as well. We are working on this.

@jainpawan21
Copy link
Member

@KamalAman can I work on these ?

@pritam0721

I would recommend you to look into other issues, as it will be handled by our team

@jainpawan21 jainpawan21 self-assigned this Oct 7, 2024
@pritam0721
Copy link

@jainpawan21 thank you for the info man and I wil .

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

No branches or pull requests

3 participants