TranscriptionResult.fromResponseBody constructor

TranscriptionResult.fromResponseBody(
  1. String body,
  2. String responseFormat
)

Implementation

factory TranscriptionResult.fromResponseBody(String body, String responseFormat) {
  switch (responseFormat) {
    case 'json':
    case 'verbose_json':
      return TranscriptionResult._(
        json: jsonDecode(body) as Map<String, dynamic>,
      );
    default: // text, srt, vtt …
      return TranscriptionResult._(text: body);
  }
}