push display scenes and automations

This commit is contained in:
ashrafzarkanisala
2024-11-27 19:41:43 +03:00
parent 69e2295180
commit cf817fd5dc
13 changed files with 141 additions and 282 deletions

View File

@ -69,14 +69,21 @@ class SceneApi {
//get scene by unit id
static Future<List<ScenesModel>> getScenesByUnitId(String unitId) async {
static Future<List<ScenesModel>> getScenesByUnitId(
String unitId, String communityId,
{showInDevice = false}) async {
try {
final response = await _httpService.get(
path: ApiEndpoints.getSpaceScenes.replaceAll('{unitUuid}', unitId),
path: ApiEndpoints.getUnitScenes
.replaceAll('{spaceUuid}', unitId)
.replaceAll('{communityUuid}', communityId),
queryParameters: {'showInHomePage': showInDevice},
showServerMessage: false,
expectedResponseModel: (json) {
final scenesJson = json['data'] as List;
List<ScenesModel> scenes = [];
for (var scene in json) {
for (var scene in scenesJson) {
scenes.add(ScenesModel.fromJson(scene));
}
return scenes;
@ -88,6 +95,25 @@ class SceneApi {
}
}
// static Future<List<ScenesModel>> getScenesByUnitId(String unitId) async {
// try {
// final response = await _httpService.get(
// path: ApiEndpoints.getSpaceScenes.replaceAll('{unitUuid}', unitId),
// showServerMessage: false,
// expectedResponseModel: (json) {
// List<ScenesModel> scenes = [];
// for (var scene in json) {
// scenes.add(ScenesModel.fromJson(scene));
// }
// return scenes;
// },
// );
// return response;
// } catch (e) {
// rethrow;
// }
// }
//getAutomation
static Future<List<ScenesModel>> getAutomationByUnitId(String unitId) async {