mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 01:35:23 +00:00
Merge branch 'dev' into feat/update-additional-device-endpoints
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||
@ -8,7 +7,6 @@ import 'package:syncrow_app/features/devices/model/device_report_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/function_model.dart';
|
||||
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
||||
import 'package:syncrow_app/services/api/http_service.dart';
|
||||
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||
import '../../features/devices/model/create_temporary_password_model.dart';
|
||||
|
||||
class DevicesAPI {
|
||||
@ -39,7 +37,7 @@ class DevicesAPI {
|
||||
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
|
||||
body: {"deviceName": deviceName},
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
return json['data'];
|
||||
},
|
||||
);
|
||||
return response;
|
||||
@ -92,7 +90,7 @@ class DevicesAPI {
|
||||
.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
return json['data'];
|
||||
},
|
||||
);
|
||||
return response;
|
||||
@ -101,7 +99,7 @@ class DevicesAPI {
|
||||
static Future<Map<String, dynamic>> getPowerClampStatus(
|
||||
String deviceId) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.powerClamp.replaceAll('{powerClampUuid}', deviceId),
|
||||
path: ApiEndpoints.deviceFunctionsStatus.replaceAll('{powerClampUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
@ -132,7 +130,7 @@ class DevicesAPI {
|
||||
path: ApiEndpoints.deviceFunctions.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
final functions = FunctionModel.fromJson(json);
|
||||
final functions = FunctionModel.fromJson(json['data']);
|
||||
return functions;
|
||||
});
|
||||
return response;
|
||||
@ -188,7 +186,7 @@ class DevicesAPI {
|
||||
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
return json['data'];
|
||||
});
|
||||
return response;
|
||||
}
|
||||
@ -264,7 +262,7 @@ class DevicesAPI {
|
||||
if (json == null || json.isEmpty || json == []) {
|
||||
return devices;
|
||||
}
|
||||
for (var device in json['devices']) {
|
||||
for (var device in json['data']['devices']) {
|
||||
devices.add(DeviceModel.fromJson(device));
|
||||
}
|
||||
return devices;
|
||||
|
Reference in New Issue
Block a user