Skip to content

Conversation

@stacurry
Copy link
Contributor

Description

Adds support for invitation.accepted and invitation.revoked events

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@stacurry stacurry requested a review from a team as a code owner August 19, 2025 22:10
@stacurry stacurry requested a review from ericroberts August 19, 2025 22:10
@linear
Copy link

linear bot commented Aug 19, 2025

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Event Types Definition (event_type.py): Adds the literal string types "invitation.accepted" and "invitation.revoked" to the EventType union, maintaining alphabetical ordering

  2. Event Model Classes (event.py): Creates InvitationAcceptedEvent and InvitationRevokedEvent classes that extend EventModel[InvitationCommon] with appropriate literal event discriminators, and includes them in the main Event union type

  3. Webhook Model Classes (webhook.py): Implements InvitationAcceptedWebhook and InvitationRevokedWebhook classes that extend WebhookModel[InvitationCommon] with matching literal types, and integrates them into the Webhook discriminated 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

Edit Code Review Bot Settings | Greptile

@stacurry stacurry merged commit 0108479 into main Aug 20, 2025
6 checks passed
@stacurry stacurry deleted the auth-5070-invite-events branch August 20, 2025 14:54
@stacurry stacurry mentioned this pull request Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants