import { EmitterSubscription } from 'react-native'; import { PipelineProfile, SpokestackConfig, SpokestackNLUResult, TTSFormat, TraceLevel } from './types'; interface SpokestackType { PipelineProfile: typeof PipelineProfile; TraceLevel: typeof TraceLevel; TTSFormat: typeof TTSFormat; /** * Initialize the speech pipeline; required for all other methods. * * The first 2 args are your Spokestack credentials * available for free from https://spokestack.io. * Avoid hardcoding these in your app. * There are several ways to include * environment variables in your code. * * Using process.env: * https://babeljs.io/docs/en/babel-plugin-transform-inline-environment-variables/ * * Using a local .env file ignored by git: * https://github.com/goatandsheep/react-native-dotenv * https://github.com/luggit/react-native-config * * See SpokestackConfig for all available options. * * @example * ```js * import Spokestack from 'react-native-spokestack' * * // ... * * await Spokestack.initialize(process.env.CLIENT_ID, process.env.CLIENT_SECRET, { * pipeline: { * profile: Spokestack.PipelineProfile.PTT_NATIVE_ASR * } * }) * ``` */ initialize(clientId: string, clientSecret: string, config?: SpokestackConfig): Promise; /** * Destroys the speech pipeline, removes all listeners, and frees up all resources. * This can be called before re-initializing the pipeline. * A good place to call this is in `componentWillUnmount`. * * @example * ```js * componentWillUnmount() { * Spokestack.destroy() * } * ``` */ destroy(): Promise; /** * Start the speech pipeline. * The speech pipeline starts in the `deactivate` state. * * @example * ```js * import Spokestack from 'react-native-spokestack` * * // ... * * Spokestack.initialize(process.env.CLIENT_ID, process.env.CLIENT_SECRET) * .then(Spokestack.start) * ``` */ start(): Promise; /** * Stop the speech pipeline. * This effectively stops ASR, VAD, and wakeword. * * @example * ```js * import Spokestack from 'react-native-spokestack` * * // ... * * await Spokestack.stop() * ``` */ stop(): Promise; /** * Manually activate the speech pipeline. * This is necessary when using a PTT profile. * VAD profiles can also activate ASR without the need * to call this method. * * @example * ```js * import Spokestack from 'react-native-spokestack` * * // ... * *