This commit is contained in:
ashrafzarkanisala
2024-10-08 11:48:35 +03:00
parent c06f3d5a58
commit 66f6b1cba9
25 changed files with 258 additions and 422 deletions

View File

@ -68,8 +68,7 @@ class DevicesManagementApi {
}
}
Future<bool> deviceBatchControl(
List<String> uuids, String code, dynamic value) async {
Future<bool> deviceBatchControl(List<String> uuids, String code, dynamic value) async {
try {
final body = {
'devicesUuid': uuids,
@ -93,8 +92,7 @@ class DevicesManagementApi {
}
}
static Future<List<DeviceModel>> getDevicesByGatewayId(
String gatewayId) async {
static Future<List<DeviceModel>> getDevicesByGatewayId(String gatewayId) async {
final response = await HTTPService().get(
path: ApiEndpoints.gatewayApi.replaceAll('{gatewayUuid}', gatewayId),
showServerMessage: false,
@ -128,9 +126,7 @@ class DevicesManagementApi {
String code,
) async {
final response = await HTTPService().get(
path: ApiEndpoints.getDeviceLogs
.replaceAll('{uuid}', uuid)
.replaceAll('{code}', code),
path: ApiEndpoints.getDeviceLogs.replaceAll('{uuid}', uuid).replaceAll('{code}', code),
showServerMessage: false,
expectedResponseModel: (json) {
return DeviceReport.fromJson(json);
@ -139,8 +135,7 @@ class DevicesManagementApi {
return response;
}
static Future<DeviceReport> getDeviceReportsByDate(String uuid, String code,
[String? from, String? to]) async {
static Future<DeviceReport> getDeviceReportsByDate(String uuid, String code, [String? from, String? to]) async {
final response = await HTTPService().get(
path: ApiEndpoints.getDeviceLogsByDate
.replaceAll('{uuid}', uuid)
@ -179,8 +174,7 @@ class DevicesManagementApi {
}
}
Future<bool> addScheduleRecord(
ScheduleEntry sendSchedule, String uuid) async {
Future<bool> addScheduleRecord(ScheduleEntry sendSchedule, String uuid) async {
try {
final response = await HTTPService().post(
path: ApiEndpoints.scheduleByDeviceId.replaceAll('{deviceUuid}', uuid),
@ -197,13 +191,10 @@ class DevicesManagementApi {
}
}
Future<List<ScheduleModel>> getDeviceSchedules(
String uuid, String category) async {
Future<List<ScheduleModel>> getDeviceSchedules(String uuid, String category) async {
try {
final response = await HTTPService().get(
path: ApiEndpoints.getScheduleByDeviceId
.replaceAll('{deviceUuid}', uuid)
.replaceAll('{category}', category),
path: ApiEndpoints.getScheduleByDeviceId.replaceAll('{deviceUuid}', uuid).replaceAll('{category}', category),
showServerMessage: true,
expectedResponseModel: (json) {
List<ScheduleModel> schedules = [];
@ -220,10 +211,7 @@ class DevicesManagementApi {
}
}
Future<bool> updateScheduleRecord(
{required bool enable,
required String uuid,
required String scheduleId}) async {
Future<bool> updateScheduleRecord({required bool enable, required String uuid, required String scheduleId}) async {
try {
final response = await HTTPService().put(
path: ApiEndpoints.updateScheduleByDeviceId