Implemented Ac functionality, and bug fixes

This commit is contained in:
Abdullah Alassaf
2024-05-20 02:40:50 +03:00
parent 0f75c3def1
commit 4257d69768
27 changed files with 733 additions and 451 deletions

View File

@ -10,10 +10,10 @@ class DevicesAPI {
static final HTTPService _httpService = HTTPService();
static Future<Map<String, dynamic>> controlDevice(
DeviceControlModel controlModel) async {
DeviceControlModel controlModel, String deviceId) async {
try {
final response = await _httpService.post(
path: ApiEndpoints.controlDevice,
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', deviceId),
body: controlModel.toJson(),
showServerMessage: false,
expectedResponseModel: (json) {
@ -27,26 +27,20 @@ class DevicesAPI {
}
static Future<List<DevicesCategoryModel>> fetchGroups(String spaceId) async {
Map<String, dynamic> params = {
"homeId": spaceId,
"pageSize": 100,
"pageNo": 1
};
Map<String, dynamic> params = {"homeId": spaceId, "pageSize": 100, "pageNo": 1};
final response = await _httpService.get(
path: ApiEndpoints.groupBySpace.replaceAll("{spaceUuid}", spaceId),
queryParameters: params,
showServerMessage: false,
expectedResponseModel: (json) =>
DevicesCategoryModel.fromJsonList(json['groups']),
expectedResponseModel: (json) => DevicesCategoryModel.fromJsonList(json['groups']),
);
return response;
}
static Future<Map<String, dynamic>> getDeviceStatus(String deviceId) async {
final response = await _httpService.get(
path: ApiEndpoints.deviceFunctionsStatus
.replaceAll('{deviceUuid}', deviceId),
path: ApiEndpoints.deviceFunctionsStatus.replaceAll('{deviceUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json;