mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 20:24:54 +00:00
Bug fixes
This commit is contained in:
@ -72,8 +72,7 @@ class DevicesAPI {
|
||||
|
||||
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;
|
||||
@ -83,9 +82,7 @@ class DevicesAPI {
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> renamePass(
|
||||
{required String name,
|
||||
required String doorLockUuid,
|
||||
required String passwordId}) async {
|
||||
{required String name, required String doorLockUuid, required String passwordId}) async {
|
||||
final response = await _httpService.put(
|
||||
path: ApiEndpoints.renamePassword
|
||||
.replaceAll('{doorLockUuid}', doorLockUuid)
|
||||
@ -110,8 +107,7 @@ class DevicesAPI {
|
||||
return response;
|
||||
}
|
||||
|
||||
static Future<List<DeviceModel>> getDeviceByGroupName(
|
||||
String unitId, String groupName) async {
|
||||
static Future<List<DeviceModel>> getDeviceByGroupName(String unitId, String groupName) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.devicesByGroupName
|
||||
.replaceAll('{unitUuid}', unitId)
|
||||
@ -150,8 +146,7 @@ class DevicesAPI {
|
||||
return response;
|
||||
}
|
||||
|
||||
static Future<List<DeviceModel>> getDevicesByGatewayId(
|
||||
String gatewayId) async {
|
||||
static Future<List<DeviceModel>> getDevicesByGatewayId(String gatewayId) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.gatewayApi.replaceAll('{gatewayUuid}', gatewayId),
|
||||
showServerMessage: false,
|
||||
@ -173,8 +168,7 @@ class DevicesAPI {
|
||||
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;
|
||||
@ -185,8 +179,7 @@ class DevicesAPI {
|
||||
|
||||
static Future getOneTimePasswords(String deviceId) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.getOneTimeTemporaryPassword
|
||||
.replaceAll('{doorLockUuid}', deviceId),
|
||||
path: ApiEndpoints.getOneTimeTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
@ -197,8 +190,7 @@ class DevicesAPI {
|
||||
|
||||
static Future getTimeLimitPasswords(String deviceId) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.getMultipleTimeTemporaryPassword
|
||||
.replaceAll('{doorLockUuid}', deviceId),
|
||||
path: ApiEndpoints.getMultipleTimeTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
@ -223,12 +215,10 @@ class DevicesAPI {
|
||||
"invalidTime": invalidTime,
|
||||
};
|
||||
if (scheduleList != null) {
|
||||
body["scheduleList"] =
|
||||
scheduleList.map((schedule) => schedule.toJson()).toList();
|
||||
body["scheduleList"] = scheduleList.map((schedule) => schedule.toJson()).toList();
|
||||
}
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.addTemporaryPassword
|
||||
.replaceAll('{doorLockUuid}', deviceId),
|
||||
path: ApiEndpoints.addTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
|
||||
body: body,
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) => json,
|
||||
@ -239,8 +229,7 @@ class DevicesAPI {
|
||||
static Future generateOneTimePassword({deviceId}) async {
|
||||
try {
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.addOneTimeTemporaryPassword
|
||||
.replaceAll('{doorLockUuid}', deviceId),
|
||||
path: ApiEndpoints.addOneTimeTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
@ -252,12 +241,10 @@ 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),
|
||||
path: ApiEndpoints.addMultipleTimeTemporaryPassword.replaceAll('{doorLockUuid}', deviceId),
|
||||
showServerMessage: true,
|
||||
body: {"effectiveTime": effectiveTime, "invalidTime": invalidTime},
|
||||
expectedResponseModel: (json) {
|
||||
@ -379,28 +366,33 @@ class DevicesAPI {
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
static Future deviceController({
|
||||
static Future deviceBatchController({
|
||||
List<String>? devicesUuid,
|
||||
String? code,
|
||||
bool? value,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.controlBatch,
|
||||
body: {"devicesUuid": devicesUuid, "code": code, "value": value},
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
print('json-=-=-=-=-=--=${json}');
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
}
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.controlBatch,
|
||||
body: {"devicesUuid": devicesUuid, "code": code, "value": value},
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Future deviceBatchStatus({
|
||||
List<String>? devicesUuid,
|
||||
}) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.statusBatch,
|
||||
queryParameters: {"devicesUuid": devicesUuid},
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user