Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions internal/shared/types/app_manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ type AppFeatures struct {
ManifestShortcutsItems []ManifestShortcutsItem `json:"shortcuts,omitempty" yaml:"shortcuts,flow,omitempty"`
ManifestSlashCommandsItems []ManifestSlashCommandsItem `json:"slash_commands,omitempty" yaml:"slash_commands,flow,omitempty"`
Search *Search `json:"search,omitempty" yaml:"search,flow,omitempty"`
RichPreviews *RichPreviews `json:"rich_previews,omitempty" yaml:"rich_previews,flow,omitempty"`
}

type RichPreviews struct {
EntityTypes []string `json:"entity_types,omitempty" yaml:"entity_types,flow,omitempty"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 though: The omitempty attribute worries me with slices since it's not obvious how to keep an empty list of entity types, but I notice the API errors in that case so no worries!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, this is the common struggle of matching the API defaults with Golang language rules. Seems like we'll want to keep the omitempty to align with the API.

}

type AssistantView struct {
Expand Down
11 changes: 11 additions & 0 deletions internal/shared/types/app_manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ func Test_AppManifest_AppFeatures(t *testing.T) {
},
want: `{"app_home":{},"bot_user":{"display_name":"kubrick"},"search":{"search_function_callback_id":"movie_search","search_filters_function_callback_id":"movie_filters","enable_ai_answers":true}}`,
},
"includes Work Objects settings when provided": {
features: AppFeatures{
BotUser: BotUser{
DisplayName: "business_bot",
},
RichPreviews: &RichPreviews{
EntityTypes: []string{"slack#/entities/file"},
},
Comment on lines +187 to +189
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📠 praise: Thanks for including test, as always!

},
want: `{"app_home":{},"bot_user":{"display_name":"business_bot"},"rich_previews":{"entity_types":["slack#/entities/file"]}}`,
},
}
for name, tt := range tests {
t.Run(name, func(t *testing.T) {
Expand Down
Loading