Refactor API endpoint for getting device reports and fix the record title

This commit is contained in:
mohammad
2025-05-12 10:18:02 +03:00
parent adb42f95e8
commit 0a4ec1c6de
6 changed files with 24 additions and 7 deletions

View File

@ -126,8 +126,7 @@ abstract class ApiEndpoints {
static const String gatewayApi = '/devices/gateway/{gatewayUuid}/devices';
static const String deviceFunctionsStatus =
'/devices/{deviceUuid}/functions/status';
static const String powerClamp =
'/devices/{deviceUuid}/functions/status';
static const String powerClamp = '/devices/{deviceUuid}/functions/status';
///Device Permission Module
//POST
@ -233,4 +232,6 @@ abstract class ApiEndpoints {
static const String getPermission = '/permission/{roleUuid}';
static const String getAllDevices =
'/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/devices';
static const String getReportLogs = '/devices/{uuid}/report-logs?code={code}';
}

View File

@ -569,6 +569,22 @@ class DevicesAPI {
return response;
}
static Future<DeviceReport> getReports(
String uuid,
String code,
) async {
final response = await HTTPService().get(
path: ApiEndpoints.getReportLogs
.replaceAll('{uuid}', uuid)
.replaceAll('{code}', code),
showServerMessage: false,
expectedResponseModel: (json) {
return DeviceReport.fromJson(json);
},
);
return response;
}
static Future<List<DeviceModel>> getAllDevices({
required String communityUuid,
required String spaceUuid,