profile changes

This commit is contained in:
mohammad
2024-07-16 14:05:54 +03:00
parent ce2f419828
commit 8a4a158af5
19 changed files with 1199 additions and 131 deletions

View File

@ -0,0 +1,59 @@
import 'dart:async';
import 'dart:io';
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/model/function_model.dart';
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
import 'package:syncrow_app/services/api/http_service.dart';
import '../../features/devices/model/create_temporary_password_model.dart';
class ProfileApi {
static final HTTPService _httpService = HTTPService();
static Future<Map<String, dynamic>> saveName(
String newName, String userId) async {
try {
final response = await _httpService.post(
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', userId),
body: newName,
showServerMessage: false,
expectedResponseModel: (json) {
return json;
},
);
return response;
} catch (e) {
rethrow;
}
}
static Future<Map<String, dynamic>> saveImage(
File newName, String userId) async {
try {
final response = await _httpService.post(
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', userId),
body: newName,
showServerMessage: false,
expectedResponseModel: (json) {
return json;
},
);
return response;
} catch (e) {
rethrow;
}
}
static Future fetchUserInfo(String userId) async {
final response = await _httpService.get(
path: ApiEndpoints.groupBySpace.replaceAll('{unitUuid}', userId),
// queryParameters: params,
showServerMessage: false,
expectedResponseModel: (json) => DevicesCategoryModel.fromJsonList(json),
);
return response;
}
}