rename and delete api calls
This commit is contained in:
parent
c09f4e7a11
commit
a65c973dc7
@ -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
|
||||
@ -182,6 +182,31 @@ class ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
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> deleteFolder(String folderName) async {
|
||||
var url = Uri.http('$ip:$port', 'delete_folder');
|
||||
|
||||
@ -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 = '''
|
||||
|
Loading…
Reference in New Issue
Block a user