⚠️ Add strongly typed EventNotifications #1650
Draft
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?
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.
Stripe::ThinEvent
toStripe::EventNotification
StripeClient.parse_thin_event
toStripeClient.parse_event_notification
and changed its method signature accordinglyEventNotification
classes to every v2Event
. For example, there's now aV1BillingMeterErrorReportTriggeredEventNotification
to match the existingV1BillingMeterErrorReportTriggeredEvent
. Each notification class defines afetch_event()
method to retrieve its corresponding event. For events with related objects, there's afetch_related_object()
method that performs the API call and casts the response to the correct type.UnknownEventNotification
to help with handling unknown event types