push routine details model and api settup

This commit is contained in:
ashrafzarkanisala
2024-11-27 21:03:19 +03:00
parent cf817fd5dc
commit 9b5ddc4dc8
8 changed files with 499 additions and 188 deletions

View File

@ -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 {