mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
formatted all files.
This commit is contained in:
@ -29,7 +29,7 @@ class SceneApi {
|
||||
debugPrint('create scene response: $response');
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
final String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
@ -52,7 +52,7 @@ class SceneApi {
|
||||
debugPrint('create automation response: $response');
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
final String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
@ -63,7 +63,7 @@ class SceneApi {
|
||||
path: ApiEndpoints.getIconScene,
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
List<IconModel> iconsList = [];
|
||||
final iconsList = <IconModel>[];
|
||||
json.forEach((element) {
|
||||
iconsList.add(IconModel.fromJson(element));
|
||||
});
|
||||
@ -89,8 +89,8 @@ class SceneApi {
|
||||
expectedResponseModel: (json) {
|
||||
final scenesJson = json['data'] as List;
|
||||
|
||||
List<ScenesModel> scenes = [];
|
||||
for (var scene in scenesJson) {
|
||||
final scenes = <ScenesModel>[];
|
||||
for (final scene in scenesJson) {
|
||||
scenes.add(ScenesModel.fromJson(scene, isAutomation: false));
|
||||
}
|
||||
return scenes;
|
||||
@ -114,8 +114,8 @@ class SceneApi {
|
||||
.replaceAll('{projectId}', projectId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
List<ScenesModel> scenes = [];
|
||||
for (var scene in json) {
|
||||
final scenes = <ScenesModel>[];
|
||||
for (final scene in json) {
|
||||
scenes.add(ScenesModel.fromJson(scene, isAutomation: true));
|
||||
}
|
||||
return scenes;
|
||||
@ -158,7 +158,8 @@ class SceneApi {
|
||||
}
|
||||
|
||||
//update Scene
|
||||
static updateScene(CreateSceneModel createSceneModel, String sceneId) async {
|
||||
static Future updateScene(
|
||||
CreateSceneModel createSceneModel, String sceneId) async {
|
||||
try {
|
||||
final response = await _httpService.put(
|
||||
path: ApiEndpoints.updateScene.replaceAll('{sceneId}', sceneId),
|
||||
@ -170,14 +171,14 @@ class SceneApi {
|
||||
);
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
final String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
//update automation
|
||||
static updateAutomation(CreateAutomationModel createAutomationModel,
|
||||
static Future updateAutomation(CreateAutomationModel createAutomationModel,
|
||||
String automationId, String projectId) async {
|
||||
try {
|
||||
final response = await _httpService.put(
|
||||
@ -192,7 +193,7 @@ class SceneApi {
|
||||
);
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
final String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
@ -226,7 +227,7 @@ class SceneApi {
|
||||
);
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
final String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
@ -247,7 +248,7 @@ class SceneApi {
|
||||
);
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
String errorMessage =
|
||||
final String errorMessage =
|
||||
e.response?.data['error']['message'][0] ?? 'something went wrong';
|
||||
throw APIException(errorMessage);
|
||||
}
|
||||
@ -295,8 +296,8 @@ class SceneApi {
|
||||
.replaceAll('{projectId}', projectId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
List<ScenesModel> scenes = [];
|
||||
for (var scene in json) {
|
||||
final scenes = <ScenesModel>[];
|
||||
for (final scene in json) {
|
||||
scenes.add(ScenesModel.fromJson(scene));
|
||||
}
|
||||
return scenes;
|
||||
|
Reference in New Issue
Block a user