mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-08-25 18:09:41 +00:00
@ -12,8 +12,7 @@ class AccessMangApi {
|
||||
|
||||
void _validateEndpoints() {
|
||||
if (!ApiEndpoints.getDevices.contains('{projectId}')) {
|
||||
throw Exception(
|
||||
"Endpoint 'getDevices' must contain '{projectId}' placeholder.");
|
||||
throw Exception("Endpoint 'getDevices' must contain '{projectId}' placeholder.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,8 +22,8 @@ class AccessMangApi {
|
||||
path: ApiEndpoints.visitorPassword,
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
final List<dynamic> jsonData = json['data'] ?? [];
|
||||
final passwordList = jsonData.map((jsonItem) {
|
||||
List<dynamic> jsonData = json['data'] ?? [];
|
||||
List<PasswordModel> passwordList = jsonData.map((jsonItem) {
|
||||
return PasswordModel.fromJson(jsonItem);
|
||||
}).toList();
|
||||
return passwordList;
|
||||
@ -47,8 +46,8 @@ class AccessMangApi {
|
||||
},
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
final List<dynamic> jsonData = json['data'] ?? [];
|
||||
final deviceList = jsonData.map((jsonItem) {
|
||||
List<dynamic> jsonData = json['data'] ?? [];
|
||||
List<DeviceModel> deviceList = jsonData.map((jsonItem) {
|
||||
return DeviceModel.fromJson(jsonItem);
|
||||
}).toList();
|
||||
return deviceList;
|
||||
@ -70,13 +69,13 @@ class AccessMangApi {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.visitorPassword,
|
||||
body: jsonEncode({
|
||||
'email': email,
|
||||
'passwordName': passwordName,
|
||||
'password': password,
|
||||
'devicesUuid': devicesUuid,
|
||||
'effectiveTime': effectiveTime,
|
||||
'invalidTime': invalidTime,
|
||||
'operationType': 'ONLINE_ONE_TIME',
|
||||
"email": email,
|
||||
"passwordName": passwordName,
|
||||
"password": password,
|
||||
"devicesUuid": devicesUuid,
|
||||
"effectiveTime": effectiveTime,
|
||||
"invalidTime": invalidTime,
|
||||
"operationType": "ONLINE_ONE_TIME",
|
||||
}),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
@ -94,18 +93,17 @@ class AccessMangApi {
|
||||
String? passwordName,
|
||||
List<Schedule>? scheduleList,
|
||||
List<String>? devicesUuid}) async {
|
||||
final body = <String, dynamic>{
|
||||
'email': email,
|
||||
'devicesUuid': devicesUuid,
|
||||
'passwordName': passwordName,
|
||||
'password': password,
|
||||
'effectiveTime': effectiveTime,
|
||||
'invalidTime': invalidTime,
|
||||
'operationType': 'ONLINE_MULTIPLE_TIME',
|
||||
Map<String, dynamic> body = {
|
||||
"email": email,
|
||||
"devicesUuid": devicesUuid,
|
||||
"passwordName": passwordName,
|
||||
"password": password,
|
||||
"effectiveTime": effectiveTime,
|
||||
"invalidTime": invalidTime,
|
||||
"operationType": "ONLINE_MULTIPLE_TIME",
|
||||
};
|
||||
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.visitorPassword,
|
||||
@ -125,10 +123,10 @@ class AccessMangApi {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.visitorPassword,
|
||||
body: jsonEncode({
|
||||
'operationType': 'OFFLINE_ONE_TIME',
|
||||
'email': email,
|
||||
'passwordName': passwordName,
|
||||
'devicesUuid': devicesUuid
|
||||
"operationType": "OFFLINE_ONE_TIME",
|
||||
"email": email,
|
||||
"passwordName": passwordName,
|
||||
"devicesUuid": devicesUuid
|
||||
}),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
@ -147,12 +145,12 @@ class AccessMangApi {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.visitorPassword,
|
||||
body: jsonEncode({
|
||||
'email': email,
|
||||
'devicesUuid': devicesUuid,
|
||||
'passwordName': passwordName,
|
||||
'effectiveTime': effectiveTime,
|
||||
'invalidTime': invalidTime,
|
||||
'operationType': 'OFFLINE_MULTIPLE_TIME',
|
||||
"email": email,
|
||||
"devicesUuid": devicesUuid,
|
||||
"passwordName": passwordName,
|
||||
"effectiveTime": effectiveTime,
|
||||
"invalidTime": invalidTime,
|
||||
"operationType": "OFFLINE_MULTIPLE_TIME",
|
||||
}),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
|
Reference in New Issue
Block a user