⚠️ Add strongly typed EventNotifications#3168
Merged
xavdid-stripe merged 13 commits intomasterfrom Sep 25, 2025
Merged
Conversation
jar-stripe
reviewed
Sep 19, 2025
xavdid-stripe
commented
Sep 19, 2025
jar-stripe
reviewed
Sep 24, 2025
Contributor
Author
|
(ignore red CI; docker hub is having a problem so all tests are down. Everything besides compat was good before i merged master back into this and trigger the CI run.) |
jar-stripe
reviewed
Sep 25, 2025
Contributor
jar-stripe
left a comment
There was a problem hiding this comment.
One more change; sorry I missed this earlier!
jar-stripe
approved these changes
Sep 25, 2025
This was referenced Oct 2, 2025
This was referenced Oct 6, 2025
This was referenced Oct 23, 2025
This was referenced Oct 30, 2025
This was referenced Nov 13, 2025
This was referenced Nov 20, 2025
This was referenced Dec 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why?
As part of the Next-Gen Event Handling project, we're adding fully typed classes to represent all the
thin eventsEvent Notifications a user could receive. There are also helper methods that help with the event handling experience.What?
test-oneGetConcreteTypeto the type registry (though we probably don't need it; see note)See Also
DEVSDK-2662
Changelog
We've overhauled how V2 Events are handled in the SDK! This approach should provide a lot more information at authoring and compile time, leading to more robust integrations. As part of this process, there are a number of changes to be aware of.
EventNotificationclasses to every v2Event. For example, there's now aV1BillingMeterErrorReportTriggeredEventNotificationto match the existingV1BillingMeterErrorReportTriggeredEvent. Each notification class defines afetchEvent()method to retrieve its corresponding event. For events with related objects, there's afetchRelatedObject()method that performs the API call and casts the response to the correct type.StripeClient.parseThinEventtoStripeClient.parseEventNotificationand remove theStripe.ThinEventclass.Stripe.V2.Core.EventNotification(which is the shared base class that all of the more specificStripe.Events.*EventNotificationclasses share) instead ofStripe.ThinEvent. When applicable, these event notifications will have therelatedObjectproperty and afetchRelatedObject()function. They also have afetchEvent()method to retrieve their correspondingStripe.Event.*Eventinstance.Stripe.Events.UnknownEventNotificationinstead of a more specific type. It has both therelatedObjectproperty and theFetchRelatedObject()function (but they may be/returnnull)