Skip to content

Commit 68dab1a

Browse files
authored
feat: add search app feature to the app manifest (#210)
feat: add search app feature to manifest
1 parent 2d3ed3d commit 68dab1a

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

internal/shared/types/app_manifest.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ type AppFeatures struct {
7575
UnfurlDomains []string `json:"unfurl_domains,omitempty" yaml:"unfurl_domains,flow,omitempty"`
7676
ManifestShortcutsItems []ManifestShortcutsItem `json:"shortcuts,omitempty" yaml:"shortcuts,flow,omitempty"`
7777
ManifestSlashCommandsItems []ManifestSlashCommandsItem `json:"slash_commands,omitempty" yaml:"slash_commands,flow,omitempty"`
78+
Search *Search `json:"search,omitempty" yaml:"search,flow,omitempty"`
7879
}
7980

8081
type AssistantView struct {
@@ -252,6 +253,13 @@ type ManifestSlashCommandsItem struct {
252253
UsageHint string `json:"usage_hint,omitempty" yaml:"usage_hint,omitempty"`
253254
}
254255

256+
// Search contains the search function of an app.
257+
type Search struct {
258+
SearchFunctionCallbackID string `json:"search_function_callback_id,omitempty" yaml:"search_function_callback_id,omitempty"`
259+
SearchFiltersFunctionCallbackID string `json:"search_filters_function_callback_id,omitempty" yaml:"search_filters_function_callback_id,omitempty"`
260+
EnableAIAnswers *bool `json:"enable_ai_answers,omitempty" yaml:"enable_ai_answers,omitempty"`
261+
}
262+
255263
// Workflow defines the structure of a workflow in the app manifest.
256264
type Workflow struct {
257265
Title string `json:"title" yaml:"title"`

internal/shared/types/app_manifest_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,19 @@ func Test_AppManifest_AppFeatures(t *testing.T) {
166166
},
167167
want: `{"app_home":{},"assistant_view":{"assistant_description":"magic","suggested_prompts":[{"title":"visit the beach","message":"what is glass"}]},"bot_user":{"display_name":"einstein"}}`,
168168
},
169+
"includes search when provided": {
170+
features: AppFeatures{
171+
BotUser: BotUser{
172+
DisplayName: "kubrick",
173+
},
174+
Search: &Search{
175+
SearchFunctionCallbackID: "movie_search",
176+
SearchFiltersFunctionCallbackID: "movie_filters",
177+
EnableAIAnswers: &truth,
178+
},
179+
},
180+
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}}`,
181+
},
169182
}
170183
for name, tt := range tests {
171184
t.Run(name, func(t *testing.T) {

0 commit comments

Comments
 (0)