download method
Corresponds to: POST /projects/:project_id/storage/download
Implementation
Future<Uint8List> download({required String projectId, required String path}) async {
final encodedProjectId = Uri.encodeComponent(projectId);
final uri = Uri.parse('$baseUrl/projects/$encodedProjectId/storage/download').replace(queryParameters: {"path": path});
final response = await httpClient.get(uri);
if (response.statusCode == 404) {
throw NotFoundException("file was not found");
}
if (response.statusCode >= 400) {
throw MeshagentException(
'Request failed.'
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
return response.bodyBytes;
}