move_email endpoint

This commit is contained in:
Juan Marulanda De Los Rios 2025-05-07 16:17:43 -04:00
parent b5cb5b99fb
commit b2fd9d16cc

View File

@ -143,10 +143,32 @@ class ApiService {
return content; return content;
} }
// void _addMailBox async(BuildContext context){ Future<bool> moveEmail(String fromFolder, String uID, String toFolder) async {
// //add email folder var url = Uri.http('$ip:$port', 'move_email');
// showDialog(context: context, builder: builder) Map<String, String> requestBody = {
// } 'from': fromFolder,
'uid': uID,
'to': toFolder,
};
try {
var response = await http.post(
url,
headers: {
'Content-Type': 'application/json',
},
body: jsonEncode(requestBody),
);
if (response.statusCode == 200) {
print('response body ${response.body}');
return true;
} else {
print('error ');
}
} catch (e) {
print(e);
}
return false;
}
Future<List<String>> fetchFolders() async { Future<List<String>> fetchFolders() async {
try { try {
@ -176,7 +198,7 @@ class ApiService {
print('response body: ${response.body}'); print('response body: ${response.body}');
} else { } else {
print('Error: ${response.statusCode}, response body: ${response.body}'); print('Error: ${response.statusCode}, response body: ${response.body}');
} }
} catch (e) { } catch (e) {
print('error making post req: $e'); print('error making post req: $e');
} }