Skip to content

Commit

Permalink
Merge branch 'main' into docs-custom-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lukegalbraithrussell authored Jul 3, 2024
2 parents 8380f12 + 044e3c5 commit c4a8688
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/mocha": "^10.0.1",
"@types/node": "20.14.8",
"@types/node": "20.14.9",
"@types/sinon": "^7.0.11",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.0",
Expand Down
124 changes: 112 additions & 12 deletions src/types/events/base-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { MessageEvent as AllMessageEvents, MessageMetadataEvent as AllMessageMet
*/
export type SlackEvent =
| AppRequestedEvent
| AppInstalledEvent
| AppDeletedEvent
| AppUninstalledTeamEvent
| AppHomeOpenedEvent
| AppMentionEvent
| AppRateLimitedEvent
Expand Down Expand Up @@ -59,14 +62,15 @@ export type SlackEvent =
| PinRemovedEvent
| ReactionAddedEvent
| ReactionRemovedEvent
| SharedChannelInviteReceived
| SharedChannelInviteAccepted
| SharedChannelInviteApproved
| SharedChannelInviteDeclined
| SharedChannelInviteReceivedEvent
| SharedChannelInviteAcceptedEvent
| SharedChannelInviteApprovedEvent
| SharedChannelInviteDeclinedEvent
| SharedChannelInviteRequestedEvent
| StarAddedEvent
| StarRemovedEvent
| SubteamCreated
| SubteamMembersChanged
| SubteamCreatedEvent
| SubteamMembersChangedEvent
| SubteamSelfAddedEvent
| SubteamSelfRemovedEvent
| SubteamUpdatedEvent
Expand Down Expand Up @@ -182,6 +186,38 @@ export interface AppHomeOpenedEvent {
event_ts: string;
}

export interface AppInstalledEvent {
type: 'app_installed';
app_id: string;
app_name: string;
app_owner_id: string;
user_id: string;
team_id: string;
team_domain: string;
event_ts: string;
}

export interface AppDeletedEvent {
type: 'app_deleted';
app_id: string;
app_name: string;
app_owner_id: string;
team_id: string;
team_domain: string;
event_ts: string;
}

export interface AppUninstalledTeamEvent {
type: 'app_uninstalled_team';
app_id: string;
app_name: string;
app_owner_id: string;
team_id: string;
team_domain: string;
user_id: string;
event_ts: string;
}

// NOTE: this is essentially the same as the `message` event, except for the type and that this uses `event_ts` instead
// of `ts`
export interface AppMentionEvent {
Expand Down Expand Up @@ -740,7 +776,7 @@ export interface SharedChannelItem {
is_im: boolean;
name: string;
}
export interface SharedChannelInviteAccepted {
export interface SharedChannelInviteAcceptedEvent {
type: 'shared_channel_invite_accepted';
approval_required: boolean;
invite: SharedChannelInviteItem;
Expand All @@ -749,8 +785,13 @@ export interface SharedChannelInviteAccepted {
accepting_user: SharedChannelUserItem;
event_ts: string;
}
// TODO: (breaking change) for backward-compatibility; remove non-Event-suffix type in next major version.
/**
* @deprecated Will be removed in next major version. Use the `SharedChannelInviteAcceptedEvent` interface instead.
*/
export type SharedChannelInviteAccepted = SharedChannelInviteAcceptedEvent;

export interface SharedChannelInviteApproved {
export interface SharedChannelInviteApprovedEvent {
type: 'shared_channel_invite_approved';
invite: SharedChannelInviteItem;
channel: SharedChannelItem;
Expand All @@ -759,8 +800,13 @@ export interface SharedChannelInviteApproved {
approving_user: SharedChannelUserItem;
event_ts: string;
}
// TODO: (breaking change) for backward-compatibility; remove non-Event-suffix type in next major version.
/**
* @deprecated Will be removed in next major version. Use the `SharedChannelInviteApprovedEvent` interface instead.
*/
export type SharedChannelInviteApproved = SharedChannelInviteApprovedEvent;

export interface SharedChannelInviteDeclined {
export interface SharedChannelInviteDeclinedEvent {
type: 'shared_channel_invite_declined';
invite: SharedChannelInviteItem;
channel: SharedChannelItem;
Expand All @@ -769,13 +815,57 @@ export interface SharedChannelInviteDeclined {
declining_user: SharedChannelUserItem;
event_ts: string;
}
// TODO: (breaking change) for backward-compatibility; remove non-Event-suffix type in next major version.
/**
* @deprecated Will be removed in next major version. Use the `SharedChannelInviteDeclinedEvent` interface instead.
*/
export type SharedChannelInviteDeclined = SharedChannelInviteDeclinedEvent;

export interface SharedChannelInviteReceived {
export interface SharedChannelInviteReceivedEvent {
type: 'shared_channel_invite_received';
invite: SharedChannelInviteItem;
channel: SharedChannelItem;
event_ts: string;
}
// TODO: (breaking change) for backward-compatibility; remove non-Event-suffix type in next major version.
/**
* @deprecated Will be removed in next major version. Use the `SharedChannelInviteReceivedEvent` interface instead.
*/
export type SharedChannelInviteReceived = SharedChannelInviteReceivedEvent;

export interface SharedChannelInviteRequestedEvent {
type: 'shared_channel_invite_requested';
actor: {
id: string;
name: string;
is_bot: boolean;
team_id: string;
timezone: string;
real_name: string;
display_name: string;
};
channel_id: string;
event_type: 'slack#/events/shared_channel_invite_requested';
channel_name: string;
channel_type: 'public' | 'private';
target_users: [{ email: string; invite_id: string }];
teams_in_channel: [
{
id: string;
icon: { image_34: string; image_default: boolean };
name: string;
domain: string;
is_verified: boolean;
date_created: number;
avatar_base_url: string;
requires_sponsorship: boolean;
},
];
is_external_limited: boolean;
channel_date_created: number;
channel_message_latest_counted_timestamp: number;
event_ts: string;
}

export interface StarAddedEvent {
type: 'star_added';
Expand Down Expand Up @@ -820,13 +910,18 @@ interface Subteam {
channel_count?: number;
}

export interface SubteamCreated {
export interface SubteamCreatedEvent {
type: 'subteam_created';
subteam: Subteam;
event_ts: string;
}
// TODO: (breaking change) for backward-compatibility; remove non-Event-suffix type in next major version.
/**
* @deprecated Will be removed in next major version. Use the `SubteamCreatedEvent` interface instead.
*/
export type SubteamCreated = SubteamCreatedEvent;

export interface SubteamMembersChanged {
export interface SubteamMembersChangedEvent {
type: 'subteam_members_changed';
subteam_id: string;
team_id: string;
Expand All @@ -838,6 +933,11 @@ export interface SubteamMembersChanged {
removed_users_count?: number;
event_ts: string;
}
// TODO: (breaking change) for backward-compatibility; remove non-Event-suffix type in next major version.
/**
* @deprecated Will be removed in next major version. Use the `SubteamMembersChangedEvent` interface instead.
*/
export type SubteamMembersChanged = SubteamMembersChangedEvent;

export interface SubteamSelfAddedEvent {
type: 'subteam_self_added';
Expand Down

0 comments on commit c4a8688

Please sign in to comment.