finished get scene details

This commit is contained in:
ashrafzarkanisala
2024-06-30 01:54:08 +03:00
parent 043e8c1e2d
commit 6584b894c4
17 changed files with 1428 additions and 520 deletions

View File

@ -1,5 +1,6 @@
import 'package:syncrow_app/features/scene/model/create_scene_model.dart';
import 'package:syncrow_app/features/scene/model/scene_model.dart';
import 'package:syncrow_app/features/scene/model/scene_details_model.dart';
import 'package:syncrow_app/features/scene/model/scenes_model.dart';
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
import 'package:syncrow_app/services/api/http_service.dart';
@ -23,15 +24,15 @@ class SceneApi {
}
}
static Future<List<SceneModel>> getScenesByUnitId(String unitId) async {
static Future<List<ScenesModel>> getScenesByUnitId(String unitId) async {
try {
final response = await _httpService.get(
path: ApiEndpoints.getUnitScenes.replaceAll('{unitUuid}', unitId),
showServerMessage: false,
expectedResponseModel: (json) {
List<SceneModel> scenes = [];
List<ScenesModel> scenes = [];
for (var scene in json) {
scenes.add(SceneModel.fromJson(scene));
scenes.add(ScenesModel.fromJson(scene));
}
return scenes;
},
@ -54,4 +55,23 @@ class SceneApi {
rethrow;
}
}
//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;
}
}
//deleteScene
//updateScene
}