PaystackOSS / paystack-node

Paystack API Node Client Library
MIT License
9 stars 2 forks source link

[FEAT] Type definition for webhook events #5

Open waptik opened 1 year ago

waptik commented 1 year ago

Is your feature request related to a problem? Please describe. As for right now, there doesn't to be any type definition for webhook events inside this library that will help validate the incoming webhook events.

Describe the solution you'd like It'd be great to have a built-in type definition for webhook events in this library. This will save us time of having to manually write our own.

Describe alternatives you've considered What i've been doing so far is to model the types of each events(charge.success as for now) based on received webhook response or often time cross check supported-events

Additional context None

damilola-paystack commented 1 year ago

Interesting request @waptik. This isn't something we've considered adding to the library, however, do you mind sharing how you'd like this to work? Using the charge.success as an example, how would you want to parse an event in your webhook function if types are available?

orimdominic commented 1 year ago

@damilola-paystack I think @waptik means having types like what we have here in Stripe Events

waptik commented 1 year ago

@damilola-paystack I think @waptik means having types like what we have here in Stripe Events

Yup, this is exactly what I meant. I saw it being used in a project and I thought it'd be great to have the same thing here as part of the library.

damilola-paystack commented 1 year ago

Got it @orimdominic @waptik. I'll look into adding this in an upcoming version. You could also make this your first contribution if you are up for it 😀.