mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Add schedule saving functionality and update schedule events
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:core';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_reports.dart';
|
||||
@ -386,4 +387,34 @@ class DevicesManagementApi {
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<bool> postSchedule({
|
||||
required String category,
|
||||
required String deviceId,
|
||||
required String time,
|
||||
required String code,
|
||||
required bool value,
|
||||
required List<String> days,
|
||||
}) async {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.saveSchedule.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
body: jsonEncode(
|
||||
{
|
||||
'category': category,
|
||||
'time': time,
|
||||
'function': {
|
||||
'code': code,
|
||||
'value': value,
|
||||
},
|
||||
'days': days
|
||||
},
|
||||
),
|
||||
expectedResponseModel: (json) {
|
||||
return json['success'] ?? false;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user