mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
push routine details model and api settup
This commit is contained in:
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/routiens/models/create_scene_and_autoamtion/create_automation_model.dart';
|
||||
import 'package:syncrow_web/pages/routiens/models/create_scene_and_autoamtion/create_scene_model.dart';
|
||||
import 'package:syncrow_web/pages/routiens/models/icon_model.dart';
|
||||
import 'package:syncrow_web/pages/routiens/models/routine_details_model.dart';
|
||||
import 'package:syncrow_web/pages/routiens/models/routine_model.dart';
|
||||
import 'package:syncrow_web/services/api/http_service.dart';
|
||||
import 'package:syncrow_web/utils/constants/api_const.dart';
|
||||
@ -67,9 +68,9 @@ class SceneApi {
|
||||
return response;
|
||||
}
|
||||
|
||||
//get scene by unit id
|
||||
//get scenes by community id and space id
|
||||
|
||||
static Future<List<ScenesModel>> getScenesByUnitId(
|
||||
static Future<List<ScenesModel>> getScenesByUnitId(
|
||||
String unitId, String communityId,
|
||||
{showInDevice = false}) async {
|
||||
try {
|
||||
@ -95,25 +96,6 @@ 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 {
|
||||
@ -148,21 +130,21 @@ class SceneApi {
|
||||
// }
|
||||
// }
|
||||
|
||||
// //automation details
|
||||
// static Future<SceneDetailsModel> getAutomationDetails(
|
||||
// String automationId) async {
|
||||
// try {
|
||||
// final response = await _httpService.get(
|
||||
// path: ApiEndpoints.getAutomationDetails
|
||||
// .replaceAll('{automationId}', automationId),
|
||||
// showServerMessage: false,
|
||||
// expectedResponseModel: (json) => SceneDetailsModel.fromJson(json),
|
||||
// );
|
||||
// return response;
|
||||
// } catch (e) {
|
||||
// rethrow;
|
||||
// }
|
||||
// }
|
||||
//automation details
|
||||
static Future<RoutineDetailsModel> getAutomationDetails(
|
||||
String automationId) async {
|
||||
try {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.getAutomationDetails
|
||||
.replaceAll('{automationId}', automationId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) => RoutineDetailsModel.fromJson(json),
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
//
|
||||
// //updateAutomationStatus
|
||||
// static Future<bool> updateAutomationStatus(String automationId,
|
||||
@ -180,20 +162,19 @@ class SceneApi {
|
||||
// }
|
||||
// }
|
||||
|
||||
// //getScene
|
||||
//
|
||||
// static Future<SceneDetailsModel> getSceneDetails(String sceneId) async {
|
||||
// try {
|
||||
// final response = await _httpService.get(
|
||||
// path: ApiEndpoints.getScene.replaceAll('{sceneId}', sceneId),
|
||||
// showServerMessage: false,
|
||||
// expectedResponseModel: (json) => SceneDetailsModel.fromJson(json),
|
||||
// );
|
||||
// return response;
|
||||
// } catch (e) {
|
||||
// rethrow;
|
||||
// }
|
||||
// }
|
||||
//getScene
|
||||
static Future<RoutineDetailsModel> getSceneDetails(String sceneId) async {
|
||||
try {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.getScene.replaceAll('{sceneId}', sceneId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) => RoutineDetailsModel.fromJson(json),
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
//
|
||||
// //update Scene
|
||||
// static updateScene(CreateSceneModel createSceneModel, String sceneId) async {
|
||||
|
Reference in New Issue
Block a user