Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: webhook event types #58

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
240 changes: 240 additions & 0 deletions lib/sdk/utilities/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,243 @@
is_default: boolean;
code: string;
}

export type WebhookSource = 'admin' | 'api' | 'user';
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved

export interface UserCreatedWebhookEvent {
data: {
user: {
email: string | null;
first_name: string;
id: string;
last_name: string;
phone: string | null;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: 'user.created';
}

export interface UserUpdatedWebhookEvent {
data: {
user: {
email: string;
first_name: string;
id: string;
is_password_reset_requested: boolean;
is_suspended: boolean;
last_name: string;
organizations: {

Check failure on line 71 in lib/sdk/utilities/types.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Array type using 'T[]' is forbidden for non-simple types. Use 'Array<T>' instead
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
code: string;
permissions: {

Check failure on line 73 in lib/sdk/utilities/types.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Array type using 'T[]' is forbidden for non-simple types. Use 'Array<T>' instead
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
id: string;
key: string;
}[] | null;
roles: any[] | null;
}[];
phone: string | null;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: 'user.updated';
}
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved

export interface UserDeletedWebhookEvent {
data: {
user: {
id: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: 'user.deleted';
}

export interface UserAuthenticatedWebhookEvent {
data: {
user: {
id: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: 'user.authenticated';
}

export interface UserAuthenticationFailedWebhookEvent {
data: {
user: {
id: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: 'user.authentication_failed';
}

export interface AccessRequestCreatedWebhookEvent {
data: {
access_request: {
email: string;
first_name: string;
last_name: string;
user_id: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "access_request.created";

Check failure on line 136 in lib/sdk/utilities/types.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Strings must use singlequote
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}

export interface OrganizationCreatedWebhookEvent {
data: {
organization: {
code: string;
external_id: string | null;
handle: string;
name: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "organization.created";

Check failure on line 151 in lib/sdk/utilities/types.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Strings must use singlequote
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}

export interface OrganizationUpdatedWebhookEvent {
data: {
organization: {
code: string;
external_id: string | null;
handle: string;
is_allow_registrations: boolean;
name: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "organization.updated";

Check failure on line 167 in lib/sdk/utilities/types.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Strings must use singlequote
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}

export interface OrganizationDeletedWebhookEvent {
data: {
organization: {
code: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "organization.deleted";

Check failure on line 179 in lib/sdk/utilities/types.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Strings must use singlequote
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}

export interface PermissionCreatedWebhookEvent {
data: {
permission: {
description: string;
id: string;
key: string;
name: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "permission.created";

Check failure on line 194 in lib/sdk/utilities/types.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Strings must use singlequote
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}

export interface PermissionUpdatedWebhookEvent {
data: {
permission: {
description: string;
id: string;
key: string;
name: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "permission.updated";

Check failure on line 209 in lib/sdk/utilities/types.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Strings must use singlequote
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}

export interface PermissionDeletedWebhookEvent {
data: {
permission: {
id: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "permission.deleted";

Check failure on line 221 in lib/sdk/utilities/types.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Strings must use singlequote
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}

export interface RoleCreatedWebhookEvent {
data: {
role: {
description: string;
id: string;
is_default_role: boolean;
key: string;
name: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "role.created";

Check failure on line 237 in lib/sdk/utilities/types.ts

View workflow job for this annotation

GitHub Actions / main (18.x)

Strings must use singlequote
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}

export interface RoleUpdatedWebhookEvent {
data: {
role: {
description: string;
id: string;
is_default_role: boolean;
key: string;
name: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "role.updated";
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}

export interface RoleDeletedWebhookEvent {
data: {
role: {
id: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "role.deleted";
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}

export interface SubscriberCreatedWebhookEvent {
data: {
subscriber: {
email: string;
first_name: string;
id: string;
last_name: string;
user_id: string;
};
};
event_id: string;
source: WebhookSource;
timestamp: string;
type: "subscriber.created";
DanielRivers marked this conversation as resolved.
Show resolved Hide resolved
}
Loading