feat(server): asset search endpoint (#4931)

* feat(server): GET /assets endpoint

* chore: open api

* chore: use dumb name

* feat: search by make, model, lens, city, state, country

* chore: open api

* chore: pagination validation and tests

* chore: pr feedback
This commit is contained in:
Jason Rasmussen 2023-11-14 17:47:15 -05:00 committed by GitHub
parent 7a8f8e5472
commit 753dab8b3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 3151 additions and 94 deletions

View file

@ -34,6 +34,7 @@ Method | HTTP request | Description
[**restoreTrash**](AssetApi.md#restoretrash) | **POST** /asset/trash/restore |
[**runAssetJobs**](AssetApi.md#runassetjobs) | **POST** /asset/jobs |
[**searchAsset**](AssetApi.md#searchasset) | **POST** /asset/search |
[**searchAssets**](AssetApi.md#searchassets) | **GET** /assets |
[**serveFile**](AssetApi.md#servefile) | **GET** /asset/file/{id} |
[**updateAsset**](AssetApi.md#updateasset) | **PUT** /asset/{id} |
[**updateAssets**](AssetApi.md#updateassets) | **PUT** /asset |
@ -1477,6 +1478,139 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **searchAssets**
> List<AssetResponseDto> searchAssets(id, libraryId, type, order, deviceAssetId, deviceId, checksum, isArchived, isEncoded, isExternal, isFavorite, isMotion, isOffline, isReadOnly, isVisible, withDeleted, withStacked, withExif, withPeople, createdBefore, createdAfter, updatedBefore, updatedAfter, trashedBefore, trashedAfter, takenBefore, takenAfter, originalFileName, originalPath, resizePath, webpPath, encodedVideoPath, city, state, country, make, model, lensModel, page, size)
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = AssetApi();
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final libraryId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final type = ; // AssetTypeEnum |
final order = ; // AssetOrder |
final deviceAssetId = deviceAssetId_example; // String |
final deviceId = deviceId_example; // String |
final checksum = checksum_example; // String |
final isArchived = true; // bool |
final isEncoded = true; // bool |
final isExternal = true; // bool |
final isFavorite = true; // bool |
final isMotion = true; // bool |
final isOffline = true; // bool |
final isReadOnly = true; // bool |
final isVisible = true; // bool |
final withDeleted = true; // bool |
final withStacked = true; // bool |
final withExif = true; // bool |
final withPeople = true; // bool |
final createdBefore = 2013-10-20T19:20:30+01:00; // DateTime |
final createdAfter = 2013-10-20T19:20:30+01:00; // DateTime |
final updatedBefore = 2013-10-20T19:20:30+01:00; // DateTime |
final updatedAfter = 2013-10-20T19:20:30+01:00; // DateTime |
final trashedBefore = 2013-10-20T19:20:30+01:00; // DateTime |
final trashedAfter = 2013-10-20T19:20:30+01:00; // DateTime |
final takenBefore = 2013-10-20T19:20:30+01:00; // DateTime |
final takenAfter = 2013-10-20T19:20:30+01:00; // DateTime |
final originalFileName = originalFileName_example; // String |
final originalPath = originalPath_example; // String |
final resizePath = resizePath_example; // String |
final webpPath = webpPath_example; // String |
final encodedVideoPath = encodedVideoPath_example; // String |
final city = city_example; // String |
final state = state_example; // String |
final country = country_example; // String |
final make = make_example; // String |
final model = model_example; // String |
final lensModel = lensModel_example; // String |
final page = 8.14; // num |
final size = 8.14; // num |
try {
final result = api_instance.searchAssets(id, libraryId, type, order, deviceAssetId, deviceId, checksum, isArchived, isEncoded, isExternal, isFavorite, isMotion, isOffline, isReadOnly, isVisible, withDeleted, withStacked, withExif, withPeople, createdBefore, createdAfter, updatedBefore, updatedAfter, trashedBefore, trashedAfter, takenBefore, takenAfter, originalFileName, originalPath, resizePath, webpPath, encodedVideoPath, city, state, country, make, model, lensModel, page, size);
print(result);
} catch (e) {
print('Exception when calling AssetApi->searchAssets: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **String**| | [optional]
**libraryId** | **String**| | [optional]
**type** | [**AssetTypeEnum**](.md)| | [optional]
**order** | [**AssetOrder**](.md)| | [optional]
**deviceAssetId** | **String**| | [optional]
**deviceId** | **String**| | [optional]
**checksum** | **String**| | [optional]
**isArchived** | **bool**| | [optional]
**isEncoded** | **bool**| | [optional]
**isExternal** | **bool**| | [optional]
**isFavorite** | **bool**| | [optional]
**isMotion** | **bool**| | [optional]
**isOffline** | **bool**| | [optional]
**isReadOnly** | **bool**| | [optional]
**isVisible** | **bool**| | [optional]
**withDeleted** | **bool**| | [optional]
**withStacked** | **bool**| | [optional]
**withExif** | **bool**| | [optional]
**withPeople** | **bool**| | [optional]
**createdBefore** | **DateTime**| | [optional]
**createdAfter** | **DateTime**| | [optional]
**updatedBefore** | **DateTime**| | [optional]
**updatedAfter** | **DateTime**| | [optional]
**trashedBefore** | **DateTime**| | [optional]
**trashedAfter** | **DateTime**| | [optional]
**takenBefore** | **DateTime**| | [optional]
**takenAfter** | **DateTime**| | [optional]
**originalFileName** | **String**| | [optional]
**originalPath** | **String**| | [optional]
**resizePath** | **String**| | [optional]
**webpPath** | **String**| | [optional]
**encodedVideoPath** | **String**| | [optional]
**city** | **String**| | [optional]
**state** | **String**| | [optional]
**country** | **String**| | [optional]
**make** | **String**| | [optional]
**model** | **String**| | [optional]
**lensModel** | **String**| | [optional]
**page** | **num**| | [optional]
**size** | **num**| | [optional]
### Return type
[**List<AssetResponseDto>**](AssetResponseDto.md)
### Authorization
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **serveFile**
> MultipartFile serveFile(id, isThumb, isWeb, key)

14
mobile/openapi/doc/AssetOrder.md generated Normal file
View file

@ -0,0 +1,14 @@
# openapi.model.AssetOrder
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)