refactor: use GET/Query for report fetch

Signed-off-by: izzy <me@insrt.uk>
This commit is contained in:
izzy
2026-02-12 10:54:19 +00:00
parent 5ed0ff41e3
commit fbdeb0409e
12 changed files with 103 additions and 227 deletions

View File

@@ -173,7 +173,7 @@ Class | Method | HTTP request | Description
*LibrariesApi* | [**validate**](doc//LibrariesApi.md#validate) | **POST** /libraries/{id}/validate | Validate library settings
*MaintenanceAdminApi* | [**deleteIntegrityReport**](doc//MaintenanceAdminApi.md#deleteintegrityreport) | **DELETE** /admin/integrity/report/{id} | Delete integrity report item
*MaintenanceAdminApi* | [**detectPriorInstall**](doc//MaintenanceAdminApi.md#detectpriorinstall) | **GET** /admin/maintenance/detect-install | Detect existing install
*MaintenanceAdminApi* | [**getIntegrityReport**](doc//MaintenanceAdminApi.md#getintegrityreport) | **POST** /admin/integrity/report | Get integrity report by type
*MaintenanceAdminApi* | [**getIntegrityReport**](doc//MaintenanceAdminApi.md#getintegrityreport) | **GET** /admin/integrity/report | Get integrity report by type
*MaintenanceAdminApi* | [**getIntegrityReportCsv**](doc//MaintenanceAdminApi.md#getintegrityreportcsv) | **GET** /admin/integrity/report/{type}/csv | Export integrity report by type as CSV
*MaintenanceAdminApi* | [**getIntegrityReportFile**](doc//MaintenanceAdminApi.md#getintegrityreportfile) | **GET** /admin/integrity/report/{id}/file | Download flagged file
*MaintenanceAdminApi* | [**getIntegrityReportSummary**](doc//MaintenanceAdminApi.md#getintegrityreportsummary) | **GET** /admin/integrity/summary | Get integrity report summary
@@ -435,7 +435,6 @@ Class | Method | HTTP request | Description
- [FoldersResponse](doc//FoldersResponse.md)
- [FoldersUpdate](doc//FoldersUpdate.md)
- [ImageFormat](doc//ImageFormat.md)
- [IntegrityGetReportDto](doc//IntegrityGetReportDto.md)
- [IntegrityReportDto](doc//IntegrityReportDto.md)
- [IntegrityReportResponseDto](doc//IntegrityReportResponseDto.md)
- [IntegrityReportSummaryResponseDto](doc//IntegrityReportSummaryResponseDto.md)

View File

@@ -170,7 +170,6 @@ part 'model/facial_recognition_config.dart';
part 'model/folders_response.dart';
part 'model/folders_update.dart';
part 'model/image_format.dart';
part 'model/integrity_get_report_dto.dart';
part 'model/integrity_report_dto.dart';
part 'model/integrity_report_response_dto.dart';
part 'model/integrity_report_summary_response_dto.dart';

View File

@@ -121,24 +121,38 @@ class MaintenanceAdminApi {
///
/// Parameters:
///
/// * [IntegrityGetReportDto] integrityGetReportDto (required):
Future<Response> getIntegrityReportWithHttpInfo(IntegrityGetReportDto integrityGetReportDto,) async {
/// * [IntegrityReportType] type (required):
///
/// * [String] cursor:
/// Cursor for pagination
///
/// * [num] limit:
/// Number of items per page
Future<Response> getIntegrityReportWithHttpInfo(IntegrityReportType type, { String? cursor, num? limit, }) async {
// ignore: prefer_const_declarations
final apiPath = r'/admin/integrity/report';
// ignore: prefer_final_locals
Object? postBody = integrityGetReportDto;
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
if (cursor != null) {
queryParams.addAll(_queryParams('', 'cursor', cursor));
}
if (limit != null) {
queryParams.addAll(_queryParams('', 'limit', limit));
}
queryParams.addAll(_queryParams('', 'type', type));
const contentTypes = <String>[];
return apiClient.invokeAPI(
apiPath,
'POST',
'GET',
queryParams,
postBody,
headerParams,
@@ -153,9 +167,15 @@ class MaintenanceAdminApi {
///
/// Parameters:
///
/// * [IntegrityGetReportDto] integrityGetReportDto (required):
Future<IntegrityReportResponseDto?> getIntegrityReport(IntegrityGetReportDto integrityGetReportDto,) async {
final response = await getIntegrityReportWithHttpInfo(integrityGetReportDto,);
/// * [IntegrityReportType] type (required):
///
/// * [String] cursor:
/// Cursor for pagination
///
/// * [num] limit:
/// Number of items per page
Future<IntegrityReportResponseDto?> getIntegrityReport(IntegrityReportType type, { String? cursor, num? limit, }) async {
final response = await getIntegrityReportWithHttpInfo(type, cursor: cursor, limit: limit, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}

View File

@@ -386,8 +386,6 @@ class ApiClient {
return FoldersUpdate.fromJson(value);
case 'ImageFormat':
return ImageFormatTypeTransformer().decode(value);
case 'IntegrityGetReportDto':
return IntegrityGetReportDto.fromJson(value);
case 'IntegrityReportDto':
return IntegrityReportDto.fromJson(value);
case 'IntegrityReportResponseDto':

View File

@@ -1,134 +0,0 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class IntegrityGetReportDto {
/// Returns a new [IntegrityGetReportDto] instance.
IntegrityGetReportDto({
this.cursor,
this.limit,
required this.type,
});
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? cursor;
/// Minimum value: 1
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
num? limit;
IntegrityReportType type;
@override
bool operator ==(Object other) => identical(this, other) || other is IntegrityGetReportDto &&
other.cursor == cursor &&
other.limit == limit &&
other.type == type;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(cursor == null ? 0 : cursor!.hashCode) +
(limit == null ? 0 : limit!.hashCode) +
(type.hashCode);
@override
String toString() => 'IntegrityGetReportDto[cursor=$cursor, limit=$limit, type=$type]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.cursor != null) {
json[r'cursor'] = this.cursor;
} else {
// json[r'cursor'] = null;
}
if (this.limit != null) {
json[r'limit'] = this.limit;
} else {
// json[r'limit'] = null;
}
json[r'type'] = this.type;
return json;
}
/// Returns a new [IntegrityGetReportDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static IntegrityGetReportDto? fromJson(dynamic value) {
upgradeDto(value, "IntegrityGetReportDto");
if (value is Map) {
final json = value.cast<String, dynamic>();
return IntegrityGetReportDto(
cursor: mapValueOfType<String>(json, r'cursor'),
limit: num.parse('${json[r'limit']}'),
type: IntegrityReportType.fromJson(json[r'type'])!,
);
}
return null;
}
static List<IntegrityGetReportDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <IntegrityGetReportDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = IntegrityGetReportDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, IntegrityGetReportDto> mapFromJson(dynamic json) {
final map = <String, IntegrityGetReportDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = IntegrityGetReportDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of IntegrityGetReportDto-objects as value to a dart map
static Map<String, List<IntegrityGetReportDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<IntegrityGetReportDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = IntegrityGetReportDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'type',
};
}