Conversation
There was a problem hiding this comment.
Greptile Summary
This PR adds support for two new invitation lifecycle events: invitation.accepted and invitation.revoked. The changes extend the existing event system to provide complete coverage of invitation state changes beyond just the previously supported invitation.created event.
The implementation follows the established architectural pattern in the WorkOS Python SDK where each event type requires corresponding classes across three key files:
-
Event Types Definition (
event_type.py): Adds the literal string types"invitation.accepted"and"invitation.revoked"to theEventTypeunion, maintaining alphabetical ordering -
Event Model Classes (
event.py): CreatesInvitationAcceptedEventandInvitationRevokedEventclasses that extendEventModel[InvitationCommon]with appropriate literal event discriminators, and includes them in the mainEventunion type -
Webhook Model Classes (
webhook.py): ImplementsInvitationAcceptedWebhookandInvitationRevokedWebhookclasses that extendWebhookModel[InvitationCommon]with matching literal types, and integrates them into theWebhookdiscriminated union
The changes maintain type safety through proper use of literal types and discriminated unions, ensuring that applications can handle these invitation lifecycle events in a type-safe manner. Both new event types use InvitationCommon as their payload type, which is appropriate since they represent state changes of the same invitation entity rather than different data structures.
Confidence score: 5/5
- This PR is safe to merge with minimal risk as it follows established patterns perfectly
- Score reflects consistent implementation across all required files with proper type safety maintained
- No files require special attention as all changes follow the existing architectural patterns
3 files reviewed, no comments
Description
Adds support for
invitation.acceptedandinvitation.revokedeventsDocumentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.