Skip to content

Commit

Permalink
Support organizationId
Browse files Browse the repository at this point in the history
  • Loading branch information
alisherry committed Apr 26, 2024
1 parent 30d2d94 commit 1c29a2f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/events/events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,20 @@ describe('Event', () => {
listMetadata: {},
});
});

it(`requests Events with a valid organization id`, async () => {
fetchOnce(eventsListResponse);

const list = await workos.events.listEvents({
events: ['connection.activated'],
organizationId: 'org_1234',
});

expect(list).toEqual({
object: 'list',
data: [event],
listMetadata: {},
});
});
});
});
2 changes: 2 additions & 0 deletions src/events/interfaces/list-events-options.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface ListEventOptions {
rangeEnd?: string;
limit?: number;
after?: string;
organizationId?: string;
}

export interface SerializedListEventOptions {
Expand All @@ -14,4 +15,5 @@ export interface SerializedListEventOptions {
range_end?: string;
limit?: number;
after?: string;
organization_id?: string;
}
1 change: 1 addition & 0 deletions src/events/serializers/list-event-options.serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const serializeListEventOptions = (
options: ListEventOptions,
): SerializedListEventOptions => ({
events: options.events,
organization_id: options.organizationId,
range_start: options.rangeStart,
range_end: options.rangeEnd,
limit: options.limit,
Expand Down

0 comments on commit 1c29a2f

Please sign in to comment.