Optional
clientAPIVersionversion of client SDK, set by the API
Optional
commandA keycode that can be used to interact with this Search Provider.
Optional
descriptionA short description of the Search Provider.
Optional
dispatchIf set, focusing on a search result will trigger onResultDispatch callback.
Optional
hiddenA flag to indicate this provider will not be displayed as a command.
An icon that a UI can display for the Search Provider.
A unique ID used to identify the search provider.
Optional
identityThe OpenFin identity that registered this search provider.
Optional
inputThe placeholder string to be displayed in a UI when targeting this specific Search Provider.
Optional
listA title to display above the result list in a UI when targeting this specific Search Provider.
Optional
logoLogo to show render when targeting this specific Search Provider.
Optional
Experimental
scoreThe order to sort the score in. The default is ascending
.
A UI friendly title for the search provider.
Optional
onCallback that is invoked when ever a search result returned by this provider is interacted with from a Workspace component. (clicked, pressed enter, hotkey pressed, etc.)
import { getAvailableCommands } from './my-commands';
const onResultDispatch = async(result: CLIDispatchedSearchResult): Promise<void> => {
try {
//Grab the command corresponding to the result
const availableCommands = await getAvailableCommands();
const commandToExecute = availableCommands.find((command) => command.key === result.key);
if (commandToExecute != undefined) {
await commandToExecute.action();
}
} catch (err) {
//Handle the error
log.error('Error trying to action show command %s', err, result.key);
}
}
the search result with the action that was selected by the user.
Function that is called when a search request is triggered due to user input.
import { getAllData, getResultsByQuery } from './get-all-data';
const onUserInput = async({ query }): Promise<CLISearchResponse> => {
if (!query) {
return getAllData();
}
// Provide an implementation to fetch query-filtered search results
return getResultsByQuery(query);
}
describes search request.
can be used to stream search results back to the requesting Workspace component.
an object that contains the search results to render in the requesting Workspace component.
A CLI provider responds to search requests from Home UI. Exposes search features that are specifically supported by Home.
Sample HomeProvider definition.
Example
*Sample HomeProvider definition.
Import required dependencies.
Create provider object to configure
Home
.Register home
provider
object.Show Home.