1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-24 04:46:50 +02:00

Add asset repository and refactor asset service (#540)

* build endpoint to get asset count by month

* Added asset repository

* Added create asset

* get asset by device ID

* Added test for existing methods

* Refactor additional endpoint

* Refactor database api to get curated locations and curated objects

* Refactor get search properties

* Fixed cookies parsing for websocket

* Added API to get asset count by time group

* Remove unused code
This commit is contained in:
Alex
2022-08-26 22:53:37 -07:00
committed by GitHub
parent 6b7c97c02a
commit f980a2f27a
33 changed files with 1321 additions and 138 deletions

View File

@ -298,10 +298,57 @@ class AssetApi {
return null;
}
/// Performs an HTTP 'GET /asset/searchTerm' operation and returns the [Response].
/// Performs an HTTP 'GET /asset/count-by-date' operation and returns the [Response].
/// Parameters:
///
/// * [GetAssetCountByTimeGroupDto] getAssetCountByTimeGroupDto (required):
Future<Response> getAssetCountByTimeGroupWithHttpInfo(GetAssetCountByTimeGroupDto getAssetCountByTimeGroupDto,) async {
// ignore: prefer_const_declarations
final path = r'/asset/count-by-date';
// ignore: prefer_final_locals
Object? postBody = getAssetCountByTimeGroupDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [GetAssetCountByTimeGroupDto] getAssetCountByTimeGroupDto (required):
Future<AssetCountByTimeGroupResponseDto?> getAssetCountByTimeGroup(GetAssetCountByTimeGroupDto getAssetCountByTimeGroupDto,) async {
final response = await getAssetCountByTimeGroupWithHttpInfo(getAssetCountByTimeGroupDto,);
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), 'AssetCountByTimeGroupResponseDto',) as AssetCountByTimeGroupResponseDto;
}
return null;
}
/// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response].
Future<Response> getAssetSearchTermsWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/asset/searchTerm';
final path = r'/asset/search-terms';
// ignore: prefer_final_locals
Object? postBody;
@ -398,10 +445,10 @@ class AssetApi {
return null;
}
/// Performs an HTTP 'GET /asset/allLocation' operation and returns the [Response].
/// Performs an HTTP 'GET /asset/curated-locations' operation and returns the [Response].
Future<Response> getCuratedLocationsWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/asset/allLocation';
final path = r'/asset/curated-locations';
// ignore: prefer_final_locals
Object? postBody;
@ -442,10 +489,10 @@ class AssetApi {
return null;
}
/// Performs an HTTP 'GET /asset/allObjects' operation and returns the [Response].
/// Performs an HTTP 'GET /asset/curated-objects' operation and returns the [Response].
Future<Response> getCuratedObjectsWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/asset/allObjects';
final path = r'/asset/curated-objects';
// ignore: prefer_final_locals
Object? postBody;