rename and delete api calls

This commit is contained in:
Juan Marulanda De Los Rios 2025-04-24 17:01:19 -04:00
parent c09f4e7a11
commit a65c973dc7

View File

@ -122,8 +122,8 @@ class ApiService {
if (response.statusCode == 200) {
content += response.body;
try {
List<AttachmentInfo> attachments = await getAttachmentsInfo(
emailFolder, id);
List<AttachmentInfo> attachments =
await getAttachmentsInfo(emailFolder, id);
for (var attachment in attachments) {
//TODO: for each attachment creaate at the bottom a widget for each individual one
threadAttachments
@ -164,6 +164,31 @@ class ApiService {
Map<String, String> requestBody = {'name': folderName};
try {
var response = await http.post(
url,
headers: {
'Content-Type': 'application/json',
},
body: jsonEncode(requestBody),
);
if (response.statusCode == 200) {
print('response body: ${response.body}');
} else {
print('Error: ${response.statusCode}, response body: ${response.body}');
}
} catch (e) {
print('error making post req: $e');
}
}
Future<void> renameFolder(String oldFolder, String newFolder) async {
var url = Uri.http('$ip:$port', 'rename_folder');
Map<String, String> requestBody = {
'old_name': oldFolder,
'new_name': newFolder,
};
try {
var response = await http.post(
url,
@ -268,7 +293,6 @@ class ApiService {
//leads to problems as for a) the html is added one right after the other in one iframe, b)
// if it was multiple iframes then the scrolling to jump would not work as expected
print("marker called");
// JavaScript code embedded as a string
String jsCode = '''
@ -379,7 +403,7 @@ class _EmailViewState extends State<EmailView> {
String currentContent = widget.emailContent;
viewTypeId = "iframe-${DateTime.now().millisecondsSinceEpoch}";
_registerViewFactory(currentContent);
_markerPositionsFuture = ApiService().getMarkerPosition();
_markerPositionsFuture = ApiService().getMarkerPosition();
}
void _registerViewFactory(String currentContent) {