OryksaClient class

In-app client. Uses a short-lived session token (oryk_cs_...) created by YOUR server with POST /v1/sessions. The secret API key never goes into the app.

Pass getToken so the client can ask your server for a new token when the current one expires.

Constructors

OryksaClient({String? token, Future<String> getToken()?, String baseUrl = oryksaDefaultBase, Client? httpClient, Duration timeout = const Duration(seconds: 60)})
Creates the client with a token, a getToken callback, or both.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timeout → Duration
Time limit for each request.
final

Methods

agent() → Future<OryksaAgent>
Name, photo, greeting and suggestions of the AI employee.
close() → void
Closes the underlying HTTP client.
messages() → Future<List<OryksaMessage>>
Messages of this conversation.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(String message, {OryksaAppContext? appContext, bool voice = false, bool whisper = false, Map<String, dynamic>? voiceStats}) → Future<OryksaReply>
Sends a message. The status is pending when the AI needs a few more seconds: use sendAndWait to wait for the text.
sendAndWait(String message, {Duration maxWait = const Duration(seconds: 40), OryksaAppContext? appContext}) → Future<String?>
Sends a message and waits for the reply text (up to maxWait).
sendAndWaitReply(String message, {Duration maxWait = const Duration(seconds: 40), OryksaAppContext? appContext, bool voice = false, bool whisper = false, Map<String, dynamic>? voiceStats}) → Future<OryksaReply>
Like sendAndWait, but returns the whole OryksaReply (with OryksaReply.speech when voice is on).
toString() → String
A string representation of this object.
inherited
transcribe(Uint8List wav) → Future<String?>
Turns the customer's voice into text. wav is 16 kHz mono PCM16 WAV, up to 15 seconds. Returns '' when nothing was said and null when it failed.
tts(String text, {bool whisper = false}) → Future<Uint8List?>
The AI's voice (ElevenLabs, the voice chosen in ORYKSA) for one reply of this conversation, as MP3 bytes. Returns null when the voice is not available: then show the text only (never a robot voice).
voiceStats(Map<String, dynamic> stats) → Future<void>
Reports a voice turn that produced no message (nothing heard, a cut with nothing said).

Operators

operator ==(Object other) → bool
The equality operator.
inherited