Builder

A fluent builder interface for creating a tray configuration.

data class Builder(orientation: TrayConfig.Orientation, haptic: Boolean, sayGreeting: Boolean, greeting: String, ttsMode: SynthesisRequest.Mode, voice: String, clientId: String?, clientSecret: String?, properties: HashMap<String, Any>, logLevel: Int, wakewordModelURL: String?, nluURL: String?, refreshModels: Boolean, editTranscript: (String) -> String?, listener: SpokestackTrayListener?, transcriptEditor: TranscriptEditor?)

Constructors

Builder
Link copied to clipboard
fun Builder(orientation: TrayConfig.Orientation, haptic: Boolean, sayGreeting: Boolean, greeting: String, ttsMode: SynthesisRequest.Mode, voice: String, clientId: String?, clientSecret: String?, properties: HashMap<String, Any>, logLevel: Int, wakewordModelURL: String?, nluURL: String?, refreshModels: Boolean, editTranscript: (String) -> String?, listener: SpokestackTrayListener?, transcriptEditor: TranscriptEditor?)

Functions

build
Link copied to clipboard

Create a finalized Spokestack Tray configuration from the current state of this builder.

fun build(): TrayConfig
copy
Link copied to clipboard
fun copy(orientation: TrayConfig.Orientation, haptic: Boolean, sayGreeting: Boolean, greeting: String, ttsMode: SynthesisRequest.Mode, voice: String, clientId: String?, clientSecret: String?, properties: HashMap<String, Any>, logLevel: Int, wakewordModelURL: String?, nluURL: String?, refreshModels: Boolean, editTranscript: (String) -> String?, listener: SpokestackTrayListener?, transcriptEditor: TranscriptEditor?): TrayConfig.Builder
credentials
Link copied to clipboard

Set the Spokestack credentials to be used by the tray.

fun credentials(clientId: String, clientSecret: String): TrayConfig.Builder
equals
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
greeting
Link copied to clipboard

Set the message displayed and/or read to the user when the tray opens for the first time.

fun greeting(value: String): TrayConfig.Builder
haptic
Link copied to clipboard

Set whether haptic feedback should be sent when the tray opens.

fun haptic(value: Boolean): TrayConfig.Builder
hashCode
Link copied to clipboard
open override fun hashCode(): Int
logLevel
Link copied to clipboard

Set the level at which a registered SpokestackTrayListener will receive log events.

fun logLevel(value: Int): TrayConfig.Builder
nluURL
Link copied to clipboard

Set the URL to the directory containing NLU files. If omitted, NLU will be unavailable at runtime.

fun nluURL(value: String?): TrayConfig.Builder
orientation
Link copied to clipboard

Set the tray's orientation, which determines the mic button's initial position and the opening direction of the tray.

fun orientation(value: TrayConfig.Orientation): TrayConfig.Builder
refreshModels
Link copied to clipboard

Set whether wakeword and NLU models should be unconditionally redownloaded on launch. Defaults to false.

fun refreshModels(value: Boolean): TrayConfig.Builder
sayGreeting
Link copied to clipboard

Set whether the greeting message, if one exists, should be synthesized and read to the user as well as displayed.

fun sayGreeting(value: Boolean): TrayConfig.Builder
toString
Link copied to clipboard
open override fun toString(): String
ttsMode
Link copied to clipboard

Set the synthesis mode to use for TTS requests.

fun ttsMode(value: SynthesisRequest.Mode): TrayConfig.Builder
ttsVoice
Link copied to clipboard

Set the voice to use for TTS synthesis. Defaults to a free Spokestack voice.

fun ttsVoice(value: String): TrayConfig.Builder
wakewordModelURL
Link copied to clipboard

Set the URL to the directory containing wakeword model files. If omitted, wakeword activation will be unavailable at runtime.

fun wakewordModelURL(value: String?): TrayConfig.Builder
withListener
Link copied to clipboard

Register a listener to receive events from both Spokestack and the tray. This is the only way an application will be notified about speech recognition and/or NLU results.

fun withListener(listener: SpokestackTrayListener): TrayConfig.Builder
withProperty
Link copied to clipboard

Add a property to the underlying Spokestack configuration.

fun withProperty(key: String, value: Any): TrayConfig.Builder
withSpokestackBuilder
Link copied to clipboard

Use a custom Spokestack builder for this configuration. Any properties set via withProperty will be honored in the final construction.

fun withSpokestackBuilder(value: Spokestack.Builder): TrayConfig.Builder
withTranscriptEditor
Link copied to clipboard

Register a transcript editor to be applied to ASR results before they are sent to the NLU for classification. This can be useful for, e.g., correcting domain-specific terminology that ASR consistently misrecognizes.

fun withTranscriptEditor(editor: TranscriptEditor): TrayConfig.Builder

Properties

spokestackBuilder
Link copied to clipboard
var spokestackBuilder: Spokestack.Builder