deleteIntent method
Delete an intent of this bot.
{intents} is the list of intents that you want to delete.
Implementation
Future<void> deleteIntent({
required List<BotIntent> intents,
}) async {
try {
Uri url = Uri.parse("${GetIt.I<BotnoiClient>().endpoint}/developer/platform-api/intent");
http.Response response = await http.delete(
url,
headers: _getHeader,
body: jsonEncode({
"bot_id": _bot.id,
"ids": intents.map((e) => e.id).toList(),
}),
);
if (response.statusCode == 200 || response.statusCode == 204) {
GetIt.I<BotnoiClient>().finishedSuccessfully();
return;
}
GetIt.I<BotnoiClient>().finishedFailed();
GetIt.I<BotnoiClient>().error.add(response.reasonPhrase ?? "ERROR");
} catch (e) {
GetIt.I<BotnoiClient>().finishedFailed();
GetIt.I<BotnoiClient>().error.add(e.toString());
}
}