augnitosdk
Version:
AugnitoSDK lets you make use of the Speech Recognition AI. You can edit, format and complete reports at the speed of human speech, with the best-in-class accuracy
130 lines (129 loc) • 5.12 kB
TypeScript
import { AugnitoConfig } from './config/AugnitoConfig';
import { AugnitoMobileConfig } from './config/AugnitoMobileConfig';
import { ActionRecipe } from './recipe/ActionRecipe';
import { AugnitoSocketResponse } from './support/AugnitoSocketResponse';
import { AugnitoMobile } from './AugnitoMobile';
import { FactoryAPI } from './api/FactoryAPI';
import { IConfiguration } from './config/IConfiguration ';
import { AugnitoSDKErrorMessage } from './support/AugnitoSDKErrorMessage';
import { PhilipsMicConfig } from './config/PhilipsMicConfig';
import { PhilipsMicClient } from './client/PhilipsMicClient';
/**
* Augnito Manager
* @description Handles the connection with the Speech API Server. Only one instance of the class should be created
*/
export declare class Augnito {
private _logTag;
/** Web Client */
private _webClient;
private _sdkMobileConfig;
/** Mobile Client */
private _augnitoMobile;
/** Web Worker */
private _worker;
private enableLogs;
private isConnected;
private shouldPreInitialiseMic;
private forceStopAudio;
private config;
private _factoryAPI;
private _editorHandler;
private recorderIns;
private _notificationClient;
/**
* @callback Callback partial results
* @description optional callback
*/
onPartialResult?: (text: string) => void;
/**
* Callback to process Final Results
* @description A final result is called when text has been processed by the Speech Server
*/
onFinalResult?: (finalText: Partial<ActionRecipe>) => boolean;
/**
* Callback to intercept Commands
*/
onCommandResult?: (command: Partial<ActionRecipe>) => boolean;
/**
* Callback for status changed
* @description Mandatory field
*/
onStateChanged?: (isConnected: boolean) => void;
/**
* Callback to intercept Session Events
*/
onSessionEvent?: (data: AugnitoSocketResponse) => void;
/**
* Iddle Callback: When the Mic is iddle for 5 minutes
* @description Mandatory field
*/
onIdleMic?: () => void;
/**
* Callback triggered when trying to start the connection, but it fails because it is already opened.
* It can happen if the client has more than one tab opened.
* This error will ALSO come through on the onError handler if you don't have a handler attached to this callback.
* @param isWebClient If true, the error was raised from the Web Client; otherwise from the mobile client
*/
onMicrophoneOnError?: (isWebClient: boolean) => void;
/**
* Callback triggered when an error occurs within the Augnito SDK
* @param error An object containing the error type and error message
*/
onError?: (error: AugnitoSDKErrorMessage) => void;
constructor(config: AugnitoConfig);
/**
* Toggles the Speech API connection
* @description if already connected, it will stop the web socket; otherwise, it will start a new connection
*/
toggleListening(shouldPauseResume?: boolean): void;
/**
* Returns the status of the web socket.
* @returns true if connected; otherwise false
*/
/**
* Returns the Generated Value for the QR Code (If and only if the DeviceId was provided)
*/
getQRCode(): string | undefined;
navigateToNextField(): void;
navigateToPreviousField(): void;
getCursorPosition(): any;
setCursorAtPosition(position: number): void;
setCursorAtDocumentEnd(): void;
/**
* Dispose all resources.
*/
dispose(): void;
/**
* Creates a web socket for getting notifications from client mobile application
* @description To be used with Augnito Mobile SDK
* @param config Mobile config
*/
initMobileClient(config?: AugnitoMobileConfig): AugnitoMobile;
initPhilipMicClient(config: PhilipsMicConfig): PhilipsMicClient;
/**
* Sends a request to close all opened connections.
* To be used in case the Augnito client is instantiated in multiple tabs
*/
requestMicOff(): void;
addCustomCommand(commandName: string, callbackParameter: any, callbackFunction: any): void;
setAnchoredEditor(editor: Element | undefined, editorName: string | null): void;
/** Returns an Abstract Factory to create different API Clients */
get apisFactory(): FactoryAPI;
/** Returns an IConfiguration that can be used to set for application properties */
get configuration(): IConfiguration | null;
private stopAudio;
private onPartialResultsCallback;
private onFinalResultsCallback;
private onCommandResultsCallback;
private interfaceCommand;
private onErrorCallback;
private onIdleMicCallback;
private onStateChangeCallback;
private onSocketFinalResult;
private onSessionEventCallback;
private onMicrophoneOnErrorCallback;
private createSDKConfig;
private createWorker;
private handleBeforeUnloadEvent;
private handleStorageChangeEvent;
}