-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding event payloads from bolt-js as a starting point. fixes #…
- Loading branch information
Showing
28 changed files
with
2,080 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export interface BotProfile { | ||
id: string; | ||
name: string; | ||
app_id: string; | ||
team_id: string; | ||
icons: { | ||
[size: string]: string; | ||
}; | ||
updated: number; | ||
deleted: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface StatusEmojiDisplayInfo { | ||
emoji_name?: string; | ||
display_alias?: string; | ||
display_url?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
import { Block, KnownBlock } from '../block-kit/blocks'; | ||
import { BotProfile } from '../common/bot-profile'; | ||
import { MessageAttachment } from '../message-attachments'; | ||
import { View } from '../views'; | ||
|
||
export interface AppRequestedEvent { | ||
type: 'app_requested'; | ||
app_request: { | ||
id: string; | ||
app: { | ||
id: string; | ||
name: string; | ||
description: string; | ||
help_url: string; | ||
privacy_policy_url: string; | ||
app_homepage_url: string; | ||
app_directory_url: string; | ||
is_app_directory_approved: boolean; | ||
is_internal: boolean; | ||
additional_info: string; | ||
icons?: { | ||
image_32?: string; | ||
image_36?: string; | ||
image_48?: string; | ||
image_64?: string; | ||
image_72?: string; | ||
image_96?: string; | ||
image_128?: string; | ||
image_192?: string; | ||
image_512?: string; | ||
image_1024?: string; | ||
image_original?: string; | ||
} | ||
}; | ||
}; | ||
previous_resolution: { | ||
status: 'approved' | 'restricted'; | ||
scopes: { | ||
name: string; | ||
description: string; | ||
is_dangerous: boolean; | ||
token_type: 'bot' | 'user' | 'app' | null; | ||
}; | ||
} | null; | ||
is_user_app_collaborator: boolean; | ||
user: { | ||
id: string; | ||
name: string; | ||
email: string; | ||
}; | ||
team: { | ||
id: string; | ||
name: string; | ||
domain: string; | ||
}; | ||
scopes: { | ||
name: string; | ||
description: string; | ||
is_dangerous: boolean; | ||
token_type: 'bot' | 'user' | 'app' | null; | ||
}; | ||
message: string; | ||
date_created: number; | ||
} | ||
|
||
export interface AppHomeOpenedEvent { | ||
type: 'app_home_opened'; | ||
user: string; | ||
channel: string; | ||
tab?: 'home' | 'messages'; | ||
view?: View; | ||
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; | ||
} | ||
|
||
// TODO: 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 { | ||
type: 'app_mention'; | ||
subtype?: string; | ||
bot_id?: string; | ||
bot_profile?: BotProfile; | ||
username?: string; | ||
team?: string; | ||
// user_team, source_team, and user_profile | ||
// can exist when the user who mentioned this bot is in a different workspace/org | ||
user_team?: string; | ||
source_team?: string; | ||
user_profile?: { | ||
name: string; | ||
first_name: string; | ||
real_name: string; | ||
display_name: string; | ||
team: string; | ||
is_restricted?: boolean; | ||
is_ultra_restricted?: boolean; | ||
avatar_hash?: string; | ||
image_72?: string; | ||
}; | ||
user?: string; | ||
text: string; | ||
attachments?: MessageAttachment[]; | ||
blocks?: (KnownBlock | Block)[]; | ||
// TODO: Add more properties once the types library has a file object definition | ||
files?: { id: string }[]; | ||
upload?: boolean; | ||
display_as_bot?: boolean; | ||
edited?: { | ||
user: string; | ||
ts: string; | ||
}; | ||
ts: string; | ||
channel: string; | ||
event_ts: string; | ||
thread_ts?: string; | ||
client_msg_id?: string; | ||
} | ||
|
||
export interface AppRateLimitedEvent { | ||
type: 'app_rate_limited'; | ||
token: string; | ||
team_id: string; | ||
minute_rate_limited: number; | ||
api_app_id: string; | ||
} | ||
|
||
// TODO: this event doesn't use the envelope. write test cases to make sure its works without breaking, and figure out | ||
// what exceptions need to be made to the related types to make this work | ||
// https://api.slack.com/events/app_rate_limited | ||
// export interface AppRateLimitedEvent { | ||
// } | ||
|
||
export interface AppUninstalledEvent { | ||
type: 'app_uninstalled'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export interface CallRejectedEvent { | ||
type: 'call_rejected'; | ||
call_id: string; | ||
user_id: string; | ||
channel_id: string; | ||
external_unique_id: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export interface MemberJoinedChannelEvent { | ||
type: 'member_joined_channel'; | ||
user: string; | ||
channel: string; | ||
channel_type: string; | ||
team: string; | ||
inviter?: string; | ||
event_ts: string; | ||
} | ||
|
||
export interface MemberLeftChannelEvent { | ||
type: 'member_left_channel'; | ||
user: string; | ||
channel: string; | ||
channel_type: string; | ||
team: string; | ||
event_ts: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
export interface ChannelArchiveEvent { | ||
type: 'channel_archive'; | ||
channel: string; | ||
user: string; | ||
is_moved?: number; | ||
event_ts: string; | ||
} | ||
|
||
export interface ChannelCreatedEvent { | ||
type: 'channel_created'; | ||
event_ts: string; | ||
channel: { | ||
id: string; | ||
is_channel: boolean; | ||
name: string; | ||
name_normalized: string; | ||
created: number; | ||
creator: string; // user ID | ||
is_shared: boolean; | ||
is_org_shared: boolean; | ||
context_team_id: string, | ||
is_archived: boolean; | ||
is_frozen: boolean, | ||
is_general: boolean, | ||
is_group: boolean, | ||
is_private: boolean, | ||
is_ext_shared: boolean, | ||
is_im: boolean, | ||
is_mpim: boolean, | ||
is_pending_ext_shared: boolean, | ||
}; | ||
} | ||
|
||
export interface ChannelDeletedEvent { | ||
type: 'channel_deleted'; | ||
channel: string; | ||
} | ||
|
||
export interface ChannelHistoryChangedEvent { | ||
type: 'channel_history_changed'; | ||
latest: string; | ||
ts: string; | ||
event_ts: string; | ||
} | ||
|
||
export interface ChannelIDChangedEvent { | ||
type: 'channel_id_changed'; | ||
old_channel_id: string; | ||
new_channel_id: string; | ||
event_ts: string; | ||
} | ||
|
||
export interface ChannelLeftEvent { | ||
type: 'channel_left'; | ||
channel: string; | ||
actor_id: string; | ||
event_ts: string; | ||
} | ||
|
||
export interface ChannelRenameEvent { | ||
type: 'channel_rename'; | ||
channel: { | ||
id: string; | ||
name: string; | ||
name_normalized: string; | ||
created: number; | ||
is_channel: boolean; | ||
is_mpim: boolean; | ||
}; | ||
event_ts: string; | ||
} | ||
|
||
export interface ChannelSharedEvent { | ||
type: 'channel_shared'; | ||
connected_team_id: string; | ||
channel: string; | ||
event_ts: string; | ||
} | ||
|
||
export interface ChannelUnarchiveEvent { | ||
type: 'channel_unarchive'; | ||
channel: string; | ||
user: string; | ||
event_ts: string; | ||
} | ||
|
||
export interface ChannelUnsharedEvent { | ||
type: 'channel_unshared'; | ||
previously_connected_team_id: string; | ||
channel: string; | ||
is_ext_shared: boolean; | ||
event_ts: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export interface DNDUpdatedEvent { | ||
type: 'dnd_updated'; | ||
user: string; | ||
dnd_status: { | ||
dnd_enabled: boolean; | ||
next_dnd_start_ts: number; | ||
next_dnd_end_ts: number; | ||
snooze_enabled: boolean; | ||
snooze_endtime: number; | ||
snooze_remaining: number; | ||
}; | ||
event_ts: string; | ||
} | ||
|
||
export interface DNDUpdatedUserEvent { | ||
type: 'dnd_updated_user'; | ||
user: string; | ||
dnd_status: { | ||
dnd_enabled: boolean; | ||
next_dnd_start_ts: number; | ||
next_dnd_end_ts: number; | ||
}; | ||
event_ts: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface EmailDomainChangedEvent { | ||
type: 'email_domain_changed'; | ||
email_domain: string; | ||
event_ts: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// TODO: breaking change: this should probably be broken into its two subtypes | ||
export interface EmojiChangedEvent { | ||
type: 'emoji_changed'; | ||
subtype: 'add' | 'remove' | 'rename'; | ||
names?: string[]; // only for remove | ||
name?: string; // only for add | ||
value?: string; // only for add | ||
old_name?: string; | ||
new_name?: string; | ||
event_ts: string; | ||
} |
Oops, something went wrong.