encodeServerJson static method
Implementation
static String encodeServerJson(RealtimeServerMessage message) =>
switch (message) {
RealtimeConnectionReadyEvent value => value.to.json,
RealtimeSessionStartedEvent value => value.to.json,
RealtimeSessionStateEvent value => value.to.json,
RealtimeSessionStoppedEvent value => value.to.json,
RealtimePongEvent value => value.to.json,
RealtimeErrorEvent value => value.to.json,
RealtimeInputSpeechStartedEvent value => value.to.json,
RealtimeInputSpeechStoppedEvent value => value.to.json,
RealtimeTranscriptUserDeltaEvent value => value.to.json,
RealtimeTranscriptUserFinalEvent value => value.to.json,
RealtimeTranscriptAssistantDeltaEvent value => value.to.json,
RealtimeTranscriptAssistantFinalEvent value => value.to.json,
RealtimeTranscriptAssistantDiscardEvent value => value.to.json,
RealtimeAssistantOutputCompletedEvent value => value.to.json,
RealtimeToolStartedEvent value => value.to.json,
RealtimeToolCompletedEvent value => value.to.json,
RealtimeToolCallEvent value => value.to.json,
_ => throw const FormatException(
"Unsupported realtime server message.",
),
};