Implemented smart door animation

This commit is contained in:
Abdullah Alassaf
2024-08-26 16:45:50 +03:00
parent 611c515173
commit dcc98445d7
6 changed files with 147 additions and 159 deletions
+23 -17
View File
@@ -46,6 +46,17 @@ class DevicesAPI {
}
}
static Future<bool> openDoorLock(String deviceId) async {
final response = await _httpService.post(
path: ApiEndpoints.openDoorLock.replaceAll('{doorLockUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json['success'] ?? false;
},
);
return response;
}
static Future<List<DevicesCategoryModel>> fetchGroups(String spaceId) async {
// Map<String, dynamic> params = {"homeId": spaceId, "pageSize": 100, "pageNo": 1};
@@ -69,17 +80,13 @@ class DevicesAPI {
return response;
}
static Future<Map<String, dynamic>> renamePass({
required String name,
required String doorLockUuid,
required String passwordId}) async {
static Future<Map<String, dynamic>> renamePass(
{required String name, required String doorLockUuid, required String passwordId}) async {
final response = await _httpService.put(
path: ApiEndpoints.renamePassword
.replaceAll('{doorLockUuid}', doorLockUuid)
.replaceAll('{passwordId}', passwordId),
body: {
"name": name
},
body: {"name": name},
expectedResponseModel: (json) {
return json;
},
@@ -156,9 +163,11 @@ class DevicesAPI {
return response;
}
static Future getTemporaryPasswords(String deviceId, ) async {
static Future getTemporaryPasswords(
String deviceId,
) async {
final response = await _httpService.get(
path: ApiEndpoints.getTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
path: ApiEndpoints.getTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
return json;
@@ -196,7 +205,8 @@ class DevicesAPI {
required String effectiveTime,
required String invalidTime,
required String deviceId,
List<Schedule>? scheduleList,}) async {
List<Schedule>? scheduleList,
}) async {
Map<String, dynamic> body = {
"name": name,
"password": password,
@@ -216,7 +226,7 @@ class DevicesAPI {
return response;
}
static Future generateOneTimePassword({deviceId}) async {
static Future generateOneTimePassword({deviceId}) async {
try {
final response = await _httpService.post(
path: ApiEndpoints.addOneTimeTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
@@ -231,15 +241,12 @@ class DevicesAPI {
}
}
static Future generateMultiTimePassword({deviceId,effectiveTime,invalidTime}) async {
static Future generateMultiTimePassword({deviceId, effectiveTime, invalidTime}) async {
try {
final response = await _httpService.post(
path: ApiEndpoints.addMultipleTimeTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
showServerMessage: true,
body: {
"effectiveTime": effectiveTime,
"invalidTime": invalidTime
},
body: {"effectiveTime": effectiveTime, "invalidTime": invalidTime},
expectedResponseModel: (json) {
return json;
},
@@ -263,5 +270,4 @@ class DevicesAPI {
);
return response;
}
}