/*! * Copyright 2017 - 2020 by ChartIQ, Inc. * All rights reserved. */ import { StandardErrorCallback, StandardPromise } from "../types"; /** * Register a provider with the search service. * * `{ status : "success" }` is resolved or called back when successful. * * ```javascript * FSBL.Clients.SearchClient.register({ * name: "MyProvider", * searchCallback: searchApplications, * itemActionCallback: itemActionCallback, * providerActionTitle: providerActionTitle, * providerActionCallback:providerActionCallback * }, * (err, response) => { * //provider has been registered * }); * ``` * @param params - Params object * @param params.name - The name of the provider. * @param params.searchCallback - A function called when a search is initialized. * @param params.itemActionCallback - A function that is called when an item action is fired. * @param params.providerActionCallback - A function that is called when a provider action is fired. * @param params.providerActionTitle - The title of the provider action. * @param cb - Callback to be invoked when the provider is registered. */ export declare const register: (params: { name: string; searchCallback: Function; itemActionCallback?: Function; providerActionCallback?: Function; providerActionTitle?: string | null; }, cb?: StandardErrorCallback<{ status: string; }>) => StandardPromise<{ status: string; }>; /** * Remove a provider. This can only be done from the window that registered the provider. * * ```javascript * FSBL.Clients.SearchClient.unregister({ name: "MyProvider" }, function(){ }); * ``` * @param params * @param params.name - The name of the provider to be removed. * @param cb The callback to be invoked after the method completes successfully. */ export declare const unregister: (params: { name: string; }, cb?: Function) => Promise; /** * This initiates a search. * * The promise will resolve when the search has been successfully initiated but results are only returned on * the callback handler. This callback handler may be called *multiple times*. Each time, the complete set of * search results is returned. There is no indication when all results have returned. * * ```javascript * FSBL.Clients.SearchClient.search({ * text: "Chart", * (err, response) => { * //Search results will be returned here * }); * ``` * @param params - Params object * @param params.text - The text to be searched * @param params.windowName Optional. Will be set to the window which is invoking the API method. * @param cb - Callback to be called as search results for each provider are returned. Results are combined as they come in. * So every response will have the complete list of results that have been returned. Example: You have two providers; provider one returns results first: you'll have an array with just provider one's data. Once provider * two returns, you'll have results for provider one and provider two. */ export declare const search: (params: { text: string; windowName?: string; }, cb: Function) => Promise; /** * Call this when you want to trigger an action associated to a returned item. There can be multiple actions associated with a result item and only one should be fired at a time. * * ```javascript * FSBL.Clients.SearchClient.invokeItemAction(resultItem, action); * ``` * @param item - This is the search result item. * @param action - The action object * @param action.name - The name of the action that you would like to fire. */ export declare const invokeItemAction: (item: any, action: { name: string; }) => void; /** * Call this when you want to trigger an action associated with a provider. * Not all providers register an action handler. * * ```javascript * FSBL.Clients.SearchClient.invokeProviderAction(provider); * ``` * @param provider Object containing the information needed to trigger an action. * @param provider.channel The channel identifier which is being requested to conduct it's action */ export declare const invokeProviderAction: (provider: { channel: string; }) => void; /** * @ignore */ export declare const SearchClient: { /** * For backward compatibility * @private * @deprecated */ initialize: () => void; /** * For backward compatibility * @private * @deprecated */ onReady: (cb?: any) => void; invokeProviderAction: (provider: { channel: string; }) => void; invokeItemAction: (item: any, action: { name: string; }) => void; search: (params: { text: string; windowName?: string; }, cb: Function) => Promise; unregister: (params: { name: string; }, cb?: Function) => Promise; register: (params: { name: string; searchCallback: Function; itemActionCallback?: Function; providerActionCallback?: Function; providerActionTitle?: string | null; }, cb?: StandardErrorCallback<{ status: string; }>) => StandardPromise<{ status: string; }>; }; /** * @ignore */ export default SearchClient; //# sourceMappingURL=searchClient.d.ts.map