mirror of
https://github.com/immich-app/immich.git
synced 2025-11-02 15:17:43 +09:00
feat(server): sort assets randomly from the API 'api/search/metadata' endpoint by including 'order': 'rand' in the API call. (#12741)
feat(server): search metadata random sort order Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
47
mobile/openapi/lib/api/search_api.dart
generated
47
mobile/openapi/lib/api/search_api.dart
generated
@@ -351,6 +351,53 @@ class SearchApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'POST /search/random' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [RandomSearchDto] randomSearchDto (required):
|
||||
Future<Response> searchRandomWithHttpInfo(RandomSearchDto randomSearchDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/search/random';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = randomSearchDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'POST',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [RandomSearchDto] randomSearchDto (required):
|
||||
Future<SearchResponseDto?> searchRandom(RandomSearchDto randomSearchDto,) async {
|
||||
final response = await searchRandomWithHttpInfo(randomSearchDto,);
|
||||
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), 'SearchResponseDto',) as SearchResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'POST /search/smart' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user