getRaw method
Make a GET request and return raw bytes
Implementation
Future<List<int>> getRaw(String endpoint) async {
if (config.apiKey.isEmpty) {
throw const AuthError('Missing OpenAI API key');
}
try {
final response = await dio.get(
endpoint,
options: Options(responseType: ResponseType.bytes),
);
if (response.statusCode != 200) {
_handleErrorResponse(response, endpoint);
}
return response.data as List<int>;
} on DioException catch (e) {
throw handleDioError(e);
} catch (e) {
throw GenericError('Unexpected error: $e');
}
}