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

Add Enterprise Grid related property #969

Merged
merged 1 commit into from Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions interactions.go
Expand Up @@ -53,6 +53,7 @@ type InteractionCallback struct {
APIAppID string `json:"api_app_id"`
BlockID string `json:"block_id"`
Container Container `json:"container"`
Enterprise Enterprise `json:"enterprise"`
DialogSubmissionCallback
ViewSubmissionCallback
ViewClosedCallback
Expand Down Expand Up @@ -128,6 +129,11 @@ type Container struct {
IsAppUnfurl bool `json:"is_app_unfurl"`
}

type Enterprise struct {
ID string `json:"id"`
Name string `json:"name"`
}

// ActionCallback is a convenience struct defined to allow dynamic unmarshalling of
// the "actions" value in Slack's JSON response, which varies depending on block type
type ActionCallbacks struct {
Expand Down
13 changes: 7 additions & 6 deletions slackevents/outer_events.go
Expand Up @@ -8,12 +8,13 @@ import (

// EventsAPIEvent is the base EventsAPIEvent
type EventsAPIEvent struct {
Token string `json:"token"`
TeamID string `json:"team_id"`
Type string `json:"type"`
APIAppID string `json:"api_app_id"`
Data interface{}
InnerEvent EventsAPIInnerEvent
Token string `json:"token"`
TeamID string `json:"team_id"`
Type string `json:"type"`
APIAppID string `json:"api_app_id"`
EnterpriseID string `json:"enterprise_id"`
Data interface{}
InnerEvent EventsAPIInnerEvent
}

// EventsAPIURLVerificationEvent received when configuring a EventsAPI driven app
Expand Down
12 changes: 12 additions & 0 deletions slackevents/parsers.go
Expand Up @@ -39,6 +39,7 @@ func parseOuterEvent(rawE json.RawMessage) (EventsAPIEvent, error) {
"",
"unmarshalling_error",
"",
"",
&slack.UnmarshallingErrorEvent{ErrorObj: err},
EventsAPIInnerEvent{},
}, err
Expand All @@ -52,6 +53,7 @@ func parseOuterEvent(rawE json.RawMessage) (EventsAPIEvent, error) {
"",
"unmarshalling_error",
"",
"",
&slack.UnmarshallingErrorEvent{ErrorObj: err},
EventsAPIInnerEvent{},
}, err
Expand All @@ -61,6 +63,7 @@ func parseOuterEvent(rawE json.RawMessage) (EventsAPIEvent, error) {
e.TeamID,
e.Type,
e.APIAppID,
e.EnterpriseID,
cbEvent,
EventsAPIInnerEvent{},
}, nil
Expand All @@ -73,6 +76,7 @@ func parseOuterEvent(rawE json.RawMessage) (EventsAPIEvent, error) {
"",
"unmarshalling_error",
"",
"",
&slack.UnmarshallingErrorEvent{ErrorObj: err},
EventsAPIInnerEvent{},
}, err
Expand All @@ -82,6 +86,7 @@ func parseOuterEvent(rawE json.RawMessage) (EventsAPIEvent, error) {
e.TeamID,
e.Type,
e.APIAppID,
e.EnterpriseID,
urlVE,
EventsAPIInnerEvent{},
}, nil
Expand All @@ -97,6 +102,7 @@ func parseInnerEvent(e *EventsAPICallbackEvent) (EventsAPIEvent, error) {
e.TeamID,
"unmarshalling_error",
e.APIAppID,
"",
&slack.UnmarshallingErrorEvent{ErrorObj: err},
EventsAPIInnerEvent{},
}, err
Expand All @@ -108,6 +114,7 @@ func parseInnerEvent(e *EventsAPICallbackEvent) (EventsAPIEvent, error) {
e.TeamID,
iE.Type,
e.APIAppID,
"",
nil,
EventsAPIInnerEvent{},
}, fmt.Errorf("Inner Event does not exist! %s", iE.Type)
Expand All @@ -121,6 +128,7 @@ func parseInnerEvent(e *EventsAPICallbackEvent) (EventsAPIEvent, error) {
e.TeamID,
"unmarshalling_error",
e.APIAppID,
"",
&slack.UnmarshallingErrorEvent{ErrorObj: err},
EventsAPIInnerEvent{},
}, err
Expand All @@ -130,6 +138,7 @@ func parseInnerEvent(e *EventsAPICallbackEvent) (EventsAPIEvent, error) {
e.TeamID,
e.Type,
e.APIAppID,
"",
e,
EventsAPIInnerEvent{iE.Type, recvEvent},
}, nil
Expand Down Expand Up @@ -196,6 +205,7 @@ func ParseEvent(rawEvent json.RawMessage, opts ...Option) (EventsAPIEvent, error
"",
"unmarshalling_error",
"",
"",
&slack.UnmarshallingErrorEvent{ErrorObj: err},
EventsAPIInnerEvent{},
}, err
Expand All @@ -210,6 +220,7 @@ func ParseEvent(rawEvent json.RawMessage, opts ...Option) (EventsAPIEvent, error
"",
"unmarshalling_error",
"",
"",
&slack.UnmarshallingErrorEvent{ErrorObj: err},
EventsAPIInnerEvent{},
}, err
Expand All @@ -219,6 +230,7 @@ func ParseEvent(rawEvent json.RawMessage, opts ...Option) (EventsAPIEvent, error
e.TeamID,
e.Type,
e.APIAppID,
e.EnterpriseID,
urlVerificationEvent,
EventsAPIInnerEvent{},
}, nil
Expand Down