mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-14 17:25:47 +00:00
removed try-catch blocks from auth_api.dart, devices_api.dart and spaces_api.dart files
This commit is contained in:
@ -30,52 +30,41 @@ class DevicesAPI {
|
||||
"pageSize": 100,
|
||||
"pageNo": 1
|
||||
};
|
||||
try {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.groups,
|
||||
queryParameters: params,
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) =>
|
||||
DevicesCategoryModel.fromJsonList(json['groups']),
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.groups,
|
||||
queryParameters: params,
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) =>
|
||||
DevicesCategoryModel.fromJsonList(json['groups']),
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> getDeviceStatus(String deviceId) async {
|
||||
try {
|
||||
final response = await _httpService.get(
|
||||
path: '${ApiEndpoints.deviceStatus}/$deviceId/functions/status',
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
final response = await _httpService.get(
|
||||
path: '${ApiEndpoints.deviceStatus}/$deviceId/functions/status',
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
static Future<List<DeviceModel>> getDevicesByRoomId(int roomId) async {
|
||||
try {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.devicesByRoom,
|
||||
queryParameters: {"roomId": roomId, "pageSize": 10},
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
List<DeviceModel> devices = [];
|
||||
for (var device in json['devices']) {
|
||||
devices.add(DeviceModel.fromJson(device));
|
||||
}
|
||||
return devices;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.devicesByRoom,
|
||||
queryParameters: {"roomId": roomId, "pageSize": 10},
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
List<DeviceModel> devices = [];
|
||||
for (var device in json['devices']) {
|
||||
devices.add(DeviceModel.fromJson(device));
|
||||
}
|
||||
return devices;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user