Skip to content

Commit 17486fb

Browse files
authored
add invitation accepted, revoked events (#1343)
## Description Adds support for `invitation.accepted` and `invitation.revoked` events ## Documentation Does this require changes to the WorkOS Docs? E.g. the [API Reference](https://workos.com/docs/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.
1 parent 6c52aac commit 17486fb

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/common/interfaces/event.interface.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,16 +343,35 @@ export interface EmailVerificationCreatedEventResponse
343343
data: EmailVerificationEventResponse;
344344
}
345345

346+
export interface InvitationAcceptedEvent extends EventBase {
347+
event: 'invitation.accepted';
348+
data: InvitationEvent;
349+
}
346350
export interface InvitationCreatedEvent extends EventBase {
347351
event: 'invitation.created';
348352
data: InvitationEvent;
349353
}
350354

355+
export interface InvitationRevokedEvent extends EventBase {
356+
event: 'invitation.revoked';
357+
data: InvitationEvent;
358+
}
359+
360+
export interface InvitationAcceptedEventResponse extends EventResponseBase {
361+
event: 'invitation.accepted';
362+
data: InvitationEventResponse;
363+
}
364+
351365
export interface InvitationCreatedEventResponse extends EventResponseBase {
352366
event: 'invitation.created';
353367
data: InvitationEventResponse;
354368
}
355369

370+
export interface InvitationRevokedEventResponse extends EventResponseBase {
371+
event: 'invitation.revoked';
372+
data: InvitationEventResponse;
373+
}
374+
356375
export interface MagicAuthCreatedEvent extends EventBase {
357376
event: 'magic_auth.created';
358377
data: MagicAuthEvent;
@@ -641,7 +660,9 @@ export type Event =
641660
| DsyncUserUpdatedEvent
642661
| DsyncUserDeletedEvent
643662
| EmailVerificationCreatedEvent
663+
| InvitationAcceptedEvent
644664
| InvitationCreatedEvent
665+
| InvitationRevokedEvent
645666
| MagicAuthCreatedEvent
646667
| PasswordResetCreatedEvent
647668
| PasswordResetSucceededEvent
@@ -694,7 +715,9 @@ export type EventResponse =
694715
| DsyncUserUpdatedEventResponse
695716
| DsyncUserDeletedEventResponse
696717
| EmailVerificationCreatedEventResponse
718+
| InvitationAcceptedEventResponse
697719
| InvitationCreatedEventResponse
720+
| InvitationRevokedEventResponse
698721
| MagicAuthCreatedEventResponse
699722
| PasswordResetCreatedEventResponse
700723
| PasswordResetSucceededEventResponse

src/common/serializers/event.serializer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ export const deserializeEvent = (event: EventResponse): Event => {
115115
event: event.event,
116116
data: deserializeEmailVerificationEvent(event.data),
117117
};
118+
case 'invitation.accepted':
118119
case 'invitation.created':
120+
case 'invitation.revoked':
119121
return {
120122
...eventBase,
121123
event: event.event,

0 commit comments

Comments
 (0)