schedule for one gang and two gang and three gange

This commit is contained in:
mohammad
2024-09-18 12:59:28 +03:00
parent ddaf36797d
commit 42b5ff105f
24 changed files with 1872 additions and 631 deletions

View File

@ -1,11 +1,11 @@
import 'dart:async';
import 'dart:convert';
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';
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 '../../features/devices/model/create_temporary_password_model.dart';
class DevicesAPI {
@ -280,11 +280,20 @@ class DevicesAPI {
required List<String> days,
}) async {
print( {
"category": category,
"time": time,
"function":{
"code": code,
"value":value,
},
"days": days
});
final response = await _httpService.post(
path: ApiEndpoints.deleteTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
path: ApiEndpoints.saveSchedule.replaceAll('{deviceUuid}', deviceId),
showServerMessage: false,
body:
{
jsonEncode({
"category": category,
"time": time,
"function":{
@ -292,7 +301,54 @@ class DevicesAPI {
"value":value,
},
"days": days
},),
expectedResponseModel: (json) {
return json;
},
);
return response;
}
static Future getSchedule({
required String category,
required String deviceId,
}) async {
final response = await _httpService.get(
path: ApiEndpoints.getSchedule.replaceAll('{deviceUuid}', deviceId).replaceAll('{category}', category),
showServerMessage: false,
expectedResponseModel: (json) {
return json;
},
);
return response;
}
static Future<bool> changeSchedule({
required String deviceUuid,
required String scheduleId,
required bool enable,
}) async {
final response = await _httpService.put(
path: ApiEndpoints.changeSchedule.replaceAll('{deviceUuid}', deviceUuid),
body: {
"scheduleId": scheduleId,
"enable": enable
},
expectedResponseModel: (json) {
print('object===-=-=-$json');
return json['success'];
},
);
return response;
}
static Future deleteSchedule({
required String deviceUuid,
required String scheduleId,
}) async {
print( ApiEndpoints.deleteSchedule.replaceAll('{deviceUuid}', deviceUuid).replaceAll('{scheduleId}', scheduleId));
final response = await _httpService.delete(
path: ApiEndpoints.deleteSchedule.replaceAll('{deviceUuid}', deviceUuid).replaceAll('{scheduleId}', scheduleId),
expectedResponseModel: (json) {
return json;
},