deployFilesAgent method
Future<Response>
deployFilesAgent(
- String agentId,
- dynamic file_configs
)
Implementation
Future<http.Response> deployFilesAgent(String agentId, dynamic file_configs) async {
print('------${file_configs}');
final response = await http.post(
Uri.parse('$baseUrl2/deployZohoAgent?workspaceId=$workspaceId&agentId=${agentId}'),
headers: {
'Authorization': 'Bearer $token',
'Content-Type': 'application/json',
},
// body: json.encode( {
// 'agent_configs': {
// 'name': agent.name,
// 'description': agent.description,
// 'type': 'Sales',
// 'image': agent.agentConfigs?.image,
// 'display_name': agent.agentConfigs?.displayName,
// 'colors': agent.agentConfigs?.colors ?? {},
// },
// 'file_configs': file_configs,
// }),
body: json.encode(file_configs),
);
if (response.statusCode == 200 || response.statusCode == 201) {
print('------${response.body}');
final Map<String, dynamic> data = json.decode(response.body);
return response;
} else {
print('Error status code: ${response.statusCode}');
print('Error response body: ${response.body}');
throw Exception('Failed to create agent');
}
}