patchAttachmentSelected static method
Implementation
static Future<Attachment?> patchAttachmentSelected(
String idAttachment, bool selected) async {
Attachment? attachment;
PupauChatController chatController = Get.find();
String idConversation = chatController.conversation.value?.id ?? "";
String idAssistant = chatController.assistant.value?.id ?? "";
String conversationToken =
chatController.conversation.value?.token ?? "";
if (idAssistant != "" && idConversation != "" && conversationToken != "") {
await ApiService.call(
ApiUrls.conversationAttachmentUrl(
idAssistant, idConversation, idAttachment),
RequestType.patch,
data: {"selected": selected},
headers: {
"Conversation-Token": conversationToken,
},
onSuccess: (response) => attachment = Attachment.fromMap(response.data),
onError: (e) => showErrorSnackbar(
"${Strings.apiErrorGeneric.tr} ${Strings.attachmentUploadFailed.tr}"),
);
return attachment;
}
return null;
}