deployHaivaAgent method
Implementation
Future<http.Response> deployHaivaAgent(String agentId) async {
final url = Uri.parse('$baseUrl/deployHaivaAgent').replace(
queryParameters: {
'workspace-id': Constants.workspaceId,
'agent-id': agentId,
},
);
try {
final response = await http.post(
url,
headers: {
'Authorization': authToken!,
'Content-Type': 'application/json',
},
// Add request body here if needed
body: json.encode({
// Add any required body parameters
}),
);
if (response.statusCode == 200) {
print('HAIVA Agent deployed successfully');
return response;
} else {
print('Failed to deploy HAIVA Agent. Status code: ${response.statusCode}');
print('Response body: ${response.body}');
throw Exception('Failed to deploy HAIVA Agent');
}
} catch (e) {
print('Error deploying HAIVA Agent: $e');
throw Exception('Error deploying HAIVA Agent: $e');
}
}