1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-17 15:37:42 +02:00

feat(server): add memories statistics resource (#19035)

This commit is contained in:
Jonathan Gilbert
2025-06-10 23:47:46 +10:00
committed by GitHub
parent 16745e77d4
commit e88bd74fd2
12 changed files with 352 additions and 17 deletions

View File

@ -206,6 +206,78 @@ class MemoriesApi {
return null;
}
/// Performs an HTTP 'GET /memories/statistics' operation and returns the [Response].
/// Parameters:
///
/// * [DateTime] for_:
///
/// * [bool] isSaved:
///
/// * [bool] isTrashed:
///
/// * [MemoryType] type:
Future<Response> memoriesStatisticsWithHttpInfo({ DateTime? for_, bool? isSaved, bool? isTrashed, MemoryType? type, }) async {
// ignore: prefer_const_declarations
final apiPath = r'/memories/statistics';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (for_ != null) {
queryParams.addAll(_queryParams('', 'for', for_));
}
if (isSaved != null) {
queryParams.addAll(_queryParams('', 'isSaved', isSaved));
}
if (isTrashed != null) {
queryParams.addAll(_queryParams('', 'isTrashed', isTrashed));
}
if (type != null) {
queryParams.addAll(_queryParams('', 'type', type));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
apiPath,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [DateTime] for_:
///
/// * [bool] isSaved:
///
/// * [bool] isTrashed:
///
/// * [MemoryType] type:
Future<MemoryStatisticsResponseDto?> memoriesStatistics({ DateTime? for_, bool? isSaved, bool? isTrashed, MemoryType? type, }) async {
final response = await memoriesStatisticsWithHttpInfo( for_: for_, isSaved: isSaved, isTrashed: isTrashed, type: type, );
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MemoryStatisticsResponseDto',) as MemoryStatisticsResponseDto;
}
return null;
}
/// Performs an HTTP 'DELETE /memories/{id}/assets' operation and returns the [Response].
/// Parameters:
///