import { ChattyHostConnection } from '@looker/chatty'; /** * Extension event used for chatty communication */ export declare enum ExtensionEvent { /** * Notification from host to client */ EXTENSION_HOST_NOTIFICATION = "EXTENSION_NOTIFICATION", /** * Process request from client. This is actually a sendAndRecieve request */ EXTENSION_API_REQUEST = "EXTENSION_API_REQUEST" } /** * Request types used by the underlying API. The ENTENSION_API_REQUEST delegates * work based upon the request type */ export declare enum ExtensionRequestType { /** * Verify that the host exists and is working correctly. Host is the Looker window * instance that owns the client IFRAME. */ VERIFY_HOST = "VERIFY_HOST", /** * Execute a call on the Looker CORE SDK */ INVOKE_CORE_SDK = "INVOKE_CORE_SDK", /** * Update title */ UPDATE_TITLE = "UPDATE_TITLE", /** * Update location */ UPDATE_LOCATION = "UPDATE_LOCATION", /** * Location route changed */ ROUTE_CHANGED = "ROUTE_CHANGED" } /** * The message that is associated with the Chatty EXTENSION_API_REQUEST event */ export interface ExtensionRequest { /** * Extension request type */ type: ExtensionRequestType; /** * Optional payload assocoayed with extension request type */ payload?: InvokeCoreSdkRequest | undefined; } export interface InvokeCoreSdkRequest { apiMethodName?: string; httpMethod?: string; path?: string; body?: any; params?: any; options?: any; } export interface UpdateTitleRequest { title: string; } export interface UpdateLocationRequest { url: string; state?: any; } export interface ExtensionHostApi { handleNotification(message: ExtensionNotification): any | void; verifyHostConnection(): Promise; invokeCoreSdkByName(methodName: string, body?: any, params?: any, options?: any): Promise; invokeCoreSdkByPath(httpMethod: string, path: string, body?: any, params?: any, authenticator?: any, options?: any): Promise; updateTitle(title: string): void; updateLocation(url: string, state?: any, target?: string): void; openBrowserWindow(url: string, target?: string): void; clientRouteChanged(route: string): void; } export interface ExtensionClientApi { handleRequest(message: ExtensionRequest): any | void; } export interface RouteChangeRequest { route: string; } /** * Notification type */ export declare enum ExtensionNotificationType { /** * Initialize message sent when chatty host and client have established * communication */ INITIALIZE = "INITIALIZE" } /** * Initialize notification payload */ export interface InitializeNotification { route?: string; } /** * Extension notification */ export interface ExtensionNotification { type: ExtensionNotificationType; payload?: InitializeNotification | undefined; } /** * Extension host configuration */ export interface ExtensionHostConfiguration { initializedCallback?: () => void; restoreRoute?: boolean; setInitialRoute?: (route: string) => void; } export interface ExtensionHostApiConfiguration extends ExtensionHostConfiguration { chattyHost: ChattyHostConnection; }