Skip to content

Commit

Permalink
Merge pull request #1225 from hussachai/enterprise_install
Browse files Browse the repository at this point in the history
Add is_enterprise_install flag for org wide installation support
  • Loading branch information
parsley42 authored Feb 10, 2024
2 parents 9cc451b + b13e91d commit fd5d171
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
23 changes: 12 additions & 11 deletions oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ type OAuthResponse struct {

// OAuthV2Response ...
type OAuthV2Response struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
Scope string `json:"scope"`
BotUserID string `json:"bot_user_id"`
AppID string `json:"app_id"`
Team OAuthV2ResponseTeam `json:"team"`
IncomingWebhook OAuthResponseIncomingWebhook `json:"incoming_webhook"`
Enterprise OAuthV2ResponseEnterprise `json:"enterprise"`
AuthedUser OAuthV2ResponseAuthedUser `json:"authed_user"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
Scope string `json:"scope"`
BotUserID string `json:"bot_user_id"`
AppID string `json:"app_id"`
Team OAuthV2ResponseTeam `json:"team"`
IncomingWebhook OAuthResponseIncomingWebhook `json:"incoming_webhook"`
Enterprise OAuthV2ResponseEnterprise `json:"enterprise"`
IsEnterpriseInstall bool `json:"is_enterprise_install"`
AuthedUser OAuthV2ResponseAuthedUser `json:"authed_user"`
RefreshToken string `json:"refresh_token"`
ExpiresIn int `json:"expires_in"`
SlackResponse
}

Expand Down
30 changes: 16 additions & 14 deletions slash.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@ import (

// SlashCommand contains information about a request of the slash command
type SlashCommand struct {
Token string `json:"token"`
TeamID string `json:"team_id"`
TeamDomain string `json:"team_domain"`
EnterpriseID string `json:"enterprise_id,omitempty"`
EnterpriseName string `json:"enterprise_name,omitempty"`
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
UserID string `json:"user_id"`
UserName string `json:"user_name"`
Command string `json:"command"`
Text string `json:"text"`
ResponseURL string `json:"response_url"`
TriggerID string `json:"trigger_id"`
APIAppID string `json:"api_app_id"`
Token string `json:"token"`
TeamID string `json:"team_id"`
TeamDomain string `json:"team_domain"`
EnterpriseID string `json:"enterprise_id,omitempty"`
EnterpriseName string `json:"enterprise_name,omitempty"`
IsEnterpriseInstall bool `json:"is_enterprise_install"`
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
UserID string `json:"user_id"`
UserName string `json:"user_name"`
Command string `json:"command"`
Text string `json:"text"`
ResponseURL string `json:"response_url"`
TriggerID string `json:"trigger_id"`
APIAppID string `json:"api_app_id"`
}

// SlashCommandParse will parse the request of the slash command
Expand All @@ -32,6 +33,7 @@ func SlashCommandParse(r *http.Request) (s SlashCommand, err error) {
s.TeamDomain = r.PostForm.Get("team_domain")
s.EnterpriseID = r.PostForm.Get("enterprise_id")
s.EnterpriseName = r.PostForm.Get("enterprise_name")
s.IsEnterpriseInstall = r.PostForm.Get("is_enterprise_install") == "true"
s.ChannelID = r.PostForm.Get("channel_id")
s.ChannelName = r.PostForm.Get("channel_name")
s.UserID = r.PostForm.Get("user_id")
Expand Down

0 comments on commit fd5d171

Please sign in to comment.