Skip to content

Commit

Permalink
Merge pull request #966 from crisp-dev/new_events
Browse files Browse the repository at this point in the history
Added more Slack events
  • Loading branch information
kanata2 committed Sep 16, 2021
2 parents 4981f65 + 1f136fa commit 12a91b0
Showing 1 changed file with 117 additions and 0 deletions.
117 changes: 117 additions & 0 deletions slackevents/inner_events.go
Expand Up @@ -54,6 +54,46 @@ type ChannelCreatedEvent struct {
EventTimestamp string `json:"event_ts"`
}

// ChannelDeletedEvent represents the Channel deleted event
type ChannelDeletedEvent struct {
Type string `json:"type"`
Channel string `json:"channel"`
}

// ChannelArchiveEvent represents the Channel archive event
type ChannelArchiveEvent struct {
Type string `json:"type"`
Channel string `json:"channel"`
User string `json:"user"`
}

// ChannelUnarchiveEvent represents the Channel unarchive event
type ChannelUnarchiveEvent struct {
Type string `json:"type"`
Channel string `json:"channel"`
User string `json:"user"`
}

// ChannelLeftEvent represents the Channel left event
type ChannelLeftEvent struct {
Type string `json:"type"`
Channel string `json:"channel"`
}

// ChannelRenameEvent represents the Channel rename event
type ChannelRenameEvent struct {
Type string `json:"type"`
Channel ChannelRenameInfo `json:"channel"`
}

// ChannelIDChangedEvent represents the Channel identifier changed event
type ChannelIDChangedEvent struct {
Type string `json:"type"`
OldChannelID string `json:"old_channel_id"`
NewChannelID string `json:"new_channel_id"`
EventTimestamp string `json:"event_ts"`
}

// ChannelCreatedInfo represents the information associated with the Channel created event
type ChannelCreatedInfo struct {
ID string `json:"id"`
Expand All @@ -63,6 +103,50 @@ type ChannelCreatedInfo struct {
Creator string `json:"creator"`
}

// ChannelRenameInfo represents the information associated with the Channel rename event
type ChannelRenameInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Created int `json:"created"`
}

// GroupDeletedEvent represents the Group deleted event
type GroupDeletedEvent struct {
Type string `json:"type"`
Channel string `json:"channel"`
}

// GroupArchiveEvent represents the Group archive event
type GroupArchiveEvent struct {
Type string `json:"type"`
Channel string `json:"channel"`
}

// GroupUnarchiveEvent represents the Group unarchive event
type GroupUnarchiveEvent struct {
Type string `json:"type"`
Channel string `json:"channel"`
}

// GroupLeftEvent represents the Group left event
type GroupLeftEvent struct {
Type string `json:"type"`
Channel string `json:"channel"`
}

// GroupRenameEvent represents the Group rename event
type GroupRenameEvent struct {
Type string `json:"type"`
Channel GroupRenameInfo `json:"channel"`
}

// GroupRenameInfo represents the information associated with the Group rename event
type GroupRenameInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Created int `json:"created"`
}

// GridMigrationFinishedEvent An enterprise grid migration has finished on this workspace.
type GridMigrationFinishedEvent struct {
Type string `json:"type"`
Expand Down Expand Up @@ -328,6 +412,28 @@ const (
AppUninstalled = "app_uninstalled"
// ChannelCreated is sent when a new channel is created.
ChannelCreated = "channel_created"
// ChannelDeleted is sent when a channel is deleted.
ChannelDeleted = "channel_deleted"
// ChannelArchive is sent when a channel is archived.
ChannelArchive = "channel_archive"
// ChannelUnarchive is sent when a channel is unarchived.
ChannelUnarchive = "channel_unarchive"
// ChannelLeft is sent when a channel is left.
ChannelLeft = "channel_left"
// ChannelRename is sent when a channel is rename.
ChannelRename = "channel_rename"
// ChannelIDChanged is sent when a channel identifier is changed.
ChannelIDChanged = "channel_id_changed"
// GroupDeleted is sent when a group is deleted.
GroupDeleted = "group_deleted"
// GroupArchive is sent when a group is archived.
GroupArchive = "group_archive"
// GroupUnarchive is sent when a group is unarchived.
GroupUnarchive = "group_unarchive"
// GroupLeft is sent when a group is left.
GroupLeft = "group_left"
// GroupRename is sent when a group is renamed.
GroupRename = "group_rename"
// GridMigrationFinished An enterprise grid migration has finished on this workspace.
GridMigrationFinished = "grid_migration_finished"
// GridMigrationStarted An enterprise grid migration has started on this workspace.
Expand Down Expand Up @@ -362,6 +468,17 @@ var EventsAPIInnerEventMapping = map[string]interface{}{
AppHomeOpened: AppHomeOpenedEvent{},
AppUninstalled: AppUninstalledEvent{},
ChannelCreated: ChannelCreatedEvent{},
ChannelDeleted: ChannelDeletedEvent{},
ChannelArchive: ChannelArchiveEvent{},
ChannelUnarchive: ChannelUnarchiveEvent{},
ChannelLeft: ChannelLeftEvent{},
ChannelRename: ChannelRenameEvent{},
ChannelIDChanged: ChannelIDChangedEvent{},
GroupDeleted: GroupDeletedEvent{},
GroupArchive: GroupArchiveEvent{},
GroupUnarchive: GroupUnarchiveEvent{},
GroupLeft: GroupLeftEvent{},
GroupRename: GroupRenameEvent{},
GridMigrationFinished: GridMigrationFinishedEvent{},
GridMigrationStarted: GridMigrationStartedEvent{},
LinkShared: LinkSharedEvent{},
Expand Down

0 comments on commit 12a91b0

Please sign in to comment.