fetchDevices by projectUuid

This commit is contained in:
mohammad
2025-02-20 16:02:25 +03:00
parent 0b45d61b25
commit 8393ec353a
4 changed files with 34 additions and 8 deletions

View File

@ -27,7 +27,23 @@ class HomeManagementAPI {
return list;
}
static Future<List<DeviceModel>> fetchDevicesByUnitId(String projectUuid) async {
static Future<List<DeviceModel>> fetchDevices(projectUuid) async {
List<DeviceModel> list = [];
await _httpService.get(
path: ApiEndpoints.devices.replaceAll("{projectUuid}", projectUuid),
showServerMessage: false,
expectedResponseModel: (json) {
json.forEach((value) {
list.add(DeviceModel.fromJson(value));
});
});
return list;
}
static Future<List<DeviceModel>> fetchDevicesByUnitId(
String projectUuid) async {
List<DeviceModel> list = [];
try {
@ -62,8 +78,12 @@ class HomeManagementAPI {
return list;
}
static Future<Map<String, dynamic>> assignDeviceToRoom(String communityId,
String spaceId, String subSpaceId, String deviceId, String projectId) async {
static Future<Map<String, dynamic>> assignDeviceToRoom(
String communityId,
String spaceId,
String subSpaceId,
String deviceId,
String projectId) async {
try {
final response = await _httpService.post(
path: ApiEndpoints.assignDeviceToRoom
@ -82,8 +102,12 @@ class HomeManagementAPI {
}
}
static Future<Map<String, dynamic>> unAssignDeviceToRoom(String communityId,
String spaceId, String subSpaceId, String deviceId, String projectId) async {
static Future<Map<String, dynamic>> unAssignDeviceToRoom(
String communityId,
String spaceId,
String subSpaceId,
String deviceId,
String projectId) async {
try {
final response = await _httpService.delete(
path: ApiEndpoints.assignDeviceToRoom