mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
push schedule apis
This commit is contained in:
@ -3,6 +3,7 @@ import 'package:syncrow_web/pages/device_managment/all_devices/models/device_rep
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_status.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/factory_reset_model.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/water_heater/models/schedule_entry.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/water_heater/models/schedule_model.dart';
|
||||
import 'package:syncrow_web/pages/visitor_password/model/device_model.dart';
|
||||
import 'package:syncrow_web/services/api/http_service.dart';
|
||||
@ -179,7 +180,7 @@ class DevicesManagementApi {
|
||||
}
|
||||
|
||||
Future<bool> addScheduleRecord(
|
||||
ScheduleModel sendSchedule, String uuid) async {
|
||||
ScheduleEntry sendSchedule, String uuid) async {
|
||||
try {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.scheduleByDeviceId.replaceAll('{deviceUuid}', uuid),
|
||||
@ -200,14 +201,14 @@ class DevicesManagementApi {
|
||||
String uuid, String category) async {
|
||||
try {
|
||||
final response = await HTTPService().get(
|
||||
path: ApiEndpoints.scheduleByDeviceId
|
||||
path: ApiEndpoints.getScheduleByDeviceId
|
||||
.replaceAll('{deviceUuid}', uuid)
|
||||
.replaceAll('{category}', category),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
List<ScheduleModel> schedules = [];
|
||||
for (var schedule in json['schedules']) {
|
||||
schedules.add(ScheduleModel.fromJson(schedule));
|
||||
for (var schedule in json) {
|
||||
schedules.add(ScheduleModel.fromMap(schedule));
|
||||
}
|
||||
return schedules;
|
||||
},
|
||||
@ -225,7 +226,7 @@ class DevicesManagementApi {
|
||||
required String scheduleId}) async {
|
||||
try {
|
||||
final response = await HTTPService().put(
|
||||
path: ApiEndpoints.scheduleByDeviceId
|
||||
path: ApiEndpoints.updateScheduleByDeviceId
|
||||
.replaceAll('{deviceUuid}', uuid)
|
||||
.replaceAll('{scheduleUuid}', scheduleId),
|
||||
body: {
|
||||
@ -246,7 +247,7 @@ class DevicesManagementApi {
|
||||
Future<bool> deleteScheduleRecord(String uuid, String scheduleId) async {
|
||||
try {
|
||||
final response = await HTTPService().delete(
|
||||
path: ApiEndpoints.scheduleByDeviceId
|
||||
path: ApiEndpoints.deleteScheduleByDeviceId
|
||||
.replaceAll('{deviceUuid}', uuid)
|
||||
.replaceAll('{scheduleUuid}', scheduleId),
|
||||
showServerMessage: true,
|
||||
|
Reference in New Issue
Block a user