requestAudio method
Like request for a POST that answers with audio: the bytes and the response headers. Throws OryksaException on errors (unlike tts, which returns null).
Implementation
Future<OryksaAudio> requestAudio(String path, Object body) async {
Future<OryksaAudio> run(bool force) async {
final r = await oryksaBytesResponse(_http, _base, await _tok(force), path, body, timeout: timeout);
return OryksaAudio(r.bodyBytes, headers: {for (final e in r.headers.entries) e.key.toLowerCase(): e.value});
}
try {
return await run(false);
} on OryksaException catch (e) {
if ((e.code == 'session_expired' || e.status == 401) && _getToken != null) return run(true);
rethrow;
}
}