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:
jschwalbe
2024-09-23 12:09:26 -04:00
committed by GitHub
parent a7719a94fc
commit 9f8a7e0bea
15 changed files with 967 additions and 11 deletions

View File

@@ -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:
///