mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 03:44:55 +00:00
fetchDevices by projectUuid
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user