downloadKbFile static method
Implementation
static Future<void> downloadKbFile(String fileId, String fileName,
String assistandId, String conversationId, bool isMarketplace) async {
String url = ApiUrls.fileDownloadUrl(assistandId, conversationId, fileId, isMarketplace: isMarketplace);
await ApiService.call(url, RequestType.get,
onSuccess: (response) async {
String downloadUrl = response.data["signedUrl"];
Directory downloadDirectory = await getDownloadDirectory();
String fullPath = "${downloadDirectory.path}/$fileName";
await ApiService.download(
url: downloadUrl,
savePath: fullPath,
onSuccess: () => showFeedbackSnackbar(
Strings.fileDownloadSuccess.tr, Symbols.download),
onError: (e) => showErrorSnackbar(Strings.fileDownloadFail.tr),
);
});
}