mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
push display scenes and automations
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user