getAttachments static method

Future<List<Attachment>> getAttachments()

Implementation

static Future<List<Attachment>> getAttachments() async {
  List<Attachment> attachments = [];
  ChatController 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.conversationAttachmentsUrl(idAssistant, idConversation),
      RequestType.get,
      headers: {"Conversation-Token": conversationToken},
      onSuccess: (response) {
        attachments = attachmentsFromMap(jsonEncode(response.data));
      },
      onError: (e) {},
    );
    return attachments;
  }
  return attachments;
}