deleteTranscription method
Deletes transcription by ID
id - transcription ID
Returns true if transcription deleted successfully
Implementation
Future<bool> deleteTranscription({required String id}) async {
try {
final originalHeaders = Map<String, dynamic>.from(_dio.options.headers);
_dio.options.headers = {
'x-gladia-key': apiKey,
'Content-Type': 'application/json',
};
final response = await _dio.delete('v2/pre-recorded/$id');
_dio.options.headers = originalHeaders;
if (response.data == null) {
throw GladiaApiException(message: 'Empty response from server');
}
return true;
} on DioException catch (e) {
throw GladiaApiException.fromDioError(e);
} catch (e) {
if (e is GladiaApiException) {
rethrow;
}
throw GladiaApiException(message: e.toString());
}
}