RealtimeTranslationInputAudioBufferAppendEvent.fromJson constructor
Creates from JSON.
Implementation
factory RealtimeTranslationInputAudioBufferAppendEvent.fromJson(
Map<String, dynamic> json,
) {
if (json['type'] != 'session.input_audio_buffer.append') {
throw FormatException(
'RealtimeTranslationInputAudioBufferAppendEvent.fromJson expected type '
'"session.input_audio_buffer.append", got ${json['type']}',
);
}
if (json['audio'] == null) {
throw const FormatException(
'RealtimeTranslationInputAudioBufferAppendEvent.fromJson missing '
'required "audio" field',
);
}
return RealtimeTranslationInputAudioBufferAppendEvent(
audio: json['audio'] as String,
eventId: json['event_id'] as String?,
);
}