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;
}
// void _addMailBox async(BuildContext context){
// //add email folder
// showDialog(context: context, builder: builder)
// }
Future<bool> moveEmail(String fromFolder, String uID, String toFolder) async {
var url = Uri.http('$ip:$port', 'move_email');
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 {
try {
@ -176,7 +198,7 @@ class ApiService {
print('response body: ${response.body}');
} else {
print('Error: ${response.statusCode}, response body: ${response.body}');
}
}
} catch (e) {
print('error making post req: $e');
}