You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-08 23:07:06 +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:
@ -8,6 +8,8 @@ doc/AdminSignupResponseDto.md
|
||||
doc/AlbumApi.md
|
||||
doc/AlbumResponseDto.md
|
||||
doc/AssetApi.md
|
||||
doc/AssetCountByTimeGroupDto.md
|
||||
doc/AssetCountByTimeGroupResponseDto.md
|
||||
doc/AssetFileUploadResponseDto.md
|
||||
doc/AssetResponseDto.md
|
||||
doc/AssetTypeEnum.md
|
||||
@ -27,6 +29,7 @@ doc/DeviceInfoApi.md
|
||||
doc/DeviceInfoResponseDto.md
|
||||
doc/DeviceTypeEnum.md
|
||||
doc/ExifResponseDto.md
|
||||
doc/GetAssetCountByTimeGroupDto.md
|
||||
doc/LoginCredentialDto.md
|
||||
doc/LoginResponseDto.md
|
||||
doc/LogoutResponseDto.md
|
||||
@ -39,6 +42,7 @@ doc/ServerVersionReponseDto.md
|
||||
doc/SignUpDto.md
|
||||
doc/SmartInfoResponseDto.md
|
||||
doc/ThumbnailFormat.md
|
||||
doc/TimeGroupEnum.md
|
||||
doc/UpdateAlbumDto.md
|
||||
doc/UpdateDeviceInfoDto.md
|
||||
doc/UpdateUserDto.md
|
||||
@ -66,6 +70,8 @@ lib/model/add_assets_dto.dart
|
||||
lib/model/add_users_dto.dart
|
||||
lib/model/admin_signup_response_dto.dart
|
||||
lib/model/album_response_dto.dart
|
||||
lib/model/asset_count_by_time_group_dto.dart
|
||||
lib/model/asset_count_by_time_group_response_dto.dart
|
||||
lib/model/asset_file_upload_response_dto.dart
|
||||
lib/model/asset_response_dto.dart
|
||||
lib/model/asset_type_enum.dart
|
||||
@ -83,6 +89,7 @@ lib/model/delete_asset_status.dart
|
||||
lib/model/device_info_response_dto.dart
|
||||
lib/model/device_type_enum.dart
|
||||
lib/model/exif_response_dto.dart
|
||||
lib/model/get_asset_count_by_time_group_dto.dart
|
||||
lib/model/login_credential_dto.dart
|
||||
lib/model/login_response_dto.dart
|
||||
lib/model/logout_response_dto.dart
|
||||
@ -94,6 +101,7 @@ lib/model/server_version_reponse_dto.dart
|
||||
lib/model/sign_up_dto.dart
|
||||
lib/model/smart_info_response_dto.dart
|
||||
lib/model/thumbnail_format.dart
|
||||
lib/model/time_group_enum.dart
|
||||
lib/model/update_album_dto.dart
|
||||
lib/model/update_device_info_dto.dart
|
||||
lib/model/update_user_dto.dart
|
||||
|
@ -79,10 +79,11 @@ Class | Method | HTTP request | Description
|
||||
*AssetApi* | [**downloadFile**](doc//AssetApi.md#downloadfile) | **GET** /asset/download |
|
||||
*AssetApi* | [**getAllAssets**](doc//AssetApi.md#getallassets) | **GET** /asset |
|
||||
*AssetApi* | [**getAssetById**](doc//AssetApi.md#getassetbyid) | **GET** /asset/assetById/{assetId} |
|
||||
*AssetApi* | [**getAssetSearchTerms**](doc//AssetApi.md#getassetsearchterms) | **GET** /asset/searchTerm |
|
||||
*AssetApi* | [**getAssetCountByTimeGroup**](doc//AssetApi.md#getassetcountbytimegroup) | **GET** /asset/count-by-date |
|
||||
*AssetApi* | [**getAssetSearchTerms**](doc//AssetApi.md#getassetsearchterms) | **GET** /asset/search-terms |
|
||||
*AssetApi* | [**getAssetThumbnail**](doc//AssetApi.md#getassetthumbnail) | **GET** /asset/thumbnail/{assetId} |
|
||||
*AssetApi* | [**getCuratedLocations**](doc//AssetApi.md#getcuratedlocations) | **GET** /asset/allLocation |
|
||||
*AssetApi* | [**getCuratedObjects**](doc//AssetApi.md#getcuratedobjects) | **GET** /asset/allObjects |
|
||||
*AssetApi* | [**getCuratedLocations**](doc//AssetApi.md#getcuratedlocations) | **GET** /asset/curated-locations |
|
||||
*AssetApi* | [**getCuratedObjects**](doc//AssetApi.md#getcuratedobjects) | **GET** /asset/curated-objects |
|
||||
*AssetApi* | [**getUserAssetsByDeviceId**](doc//AssetApi.md#getuserassetsbydeviceid) | **GET** /asset/{deviceId} |
|
||||
*AssetApi* | [**searchAsset**](doc//AssetApi.md#searchasset) | **POST** /asset/search |
|
||||
*AssetApi* | [**serveFile**](doc//AssetApi.md#servefile) | **GET** /asset/file |
|
||||
@ -112,6 +113,8 @@ Class | Method | HTTP request | Description
|
||||
- [AddUsersDto](doc//AddUsersDto.md)
|
||||
- [AdminSignupResponseDto](doc//AdminSignupResponseDto.md)
|
||||
- [AlbumResponseDto](doc//AlbumResponseDto.md)
|
||||
- [AssetCountByTimeGroupDto](doc//AssetCountByTimeGroupDto.md)
|
||||
- [AssetCountByTimeGroupResponseDto](doc//AssetCountByTimeGroupResponseDto.md)
|
||||
- [AssetFileUploadResponseDto](doc//AssetFileUploadResponseDto.md)
|
||||
- [AssetResponseDto](doc//AssetResponseDto.md)
|
||||
- [AssetTypeEnum](doc//AssetTypeEnum.md)
|
||||
@ -129,6 +132,7 @@ Class | Method | HTTP request | Description
|
||||
- [DeviceInfoResponseDto](doc//DeviceInfoResponseDto.md)
|
||||
- [DeviceTypeEnum](doc//DeviceTypeEnum.md)
|
||||
- [ExifResponseDto](doc//ExifResponseDto.md)
|
||||
- [GetAssetCountByTimeGroupDto](doc//GetAssetCountByTimeGroupDto.md)
|
||||
- [LoginCredentialDto](doc//LoginCredentialDto.md)
|
||||
- [LoginResponseDto](doc//LoginResponseDto.md)
|
||||
- [LogoutResponseDto](doc//LogoutResponseDto.md)
|
||||
@ -140,6 +144,7 @@ Class | Method | HTTP request | Description
|
||||
- [SignUpDto](doc//SignUpDto.md)
|
||||
- [SmartInfoResponseDto](doc//SmartInfoResponseDto.md)
|
||||
- [ThumbnailFormat](doc//ThumbnailFormat.md)
|
||||
- [TimeGroupEnum](doc//TimeGroupEnum.md)
|
||||
- [UpdateAlbumDto](doc//UpdateAlbumDto.md)
|
||||
- [UpdateDeviceInfoDto](doc//UpdateDeviceInfoDto.md)
|
||||
- [UpdateUserDto](doc//UpdateUserDto.md)
|
||||
|
@ -14,10 +14,11 @@ Method | HTTP request | Description
|
||||
[**downloadFile**](AssetApi.md#downloadfile) | **GET** /asset/download |
|
||||
[**getAllAssets**](AssetApi.md#getallassets) | **GET** /asset |
|
||||
[**getAssetById**](AssetApi.md#getassetbyid) | **GET** /asset/assetById/{assetId} |
|
||||
[**getAssetSearchTerms**](AssetApi.md#getassetsearchterms) | **GET** /asset/searchTerm |
|
||||
[**getAssetCountByTimeGroup**](AssetApi.md#getassetcountbytimegroup) | **GET** /asset/count-by-date |
|
||||
[**getAssetSearchTerms**](AssetApi.md#getassetsearchterms) | **GET** /asset/search-terms |
|
||||
[**getAssetThumbnail**](AssetApi.md#getassetthumbnail) | **GET** /asset/thumbnail/{assetId} |
|
||||
[**getCuratedLocations**](AssetApi.md#getcuratedlocations) | **GET** /asset/allLocation |
|
||||
[**getCuratedObjects**](AssetApi.md#getcuratedobjects) | **GET** /asset/allObjects |
|
||||
[**getCuratedLocations**](AssetApi.md#getcuratedlocations) | **GET** /asset/curated-locations |
|
||||
[**getCuratedObjects**](AssetApi.md#getcuratedobjects) | **GET** /asset/curated-objects |
|
||||
[**getUserAssetsByDeviceId**](AssetApi.md#getuserassetsbydeviceid) | **GET** /asset/{deviceId} |
|
||||
[**searchAsset**](AssetApi.md#searchasset) | **POST** /asset/search |
|
||||
[**serveFile**](AssetApi.md#servefile) | **GET** /asset/file |
|
||||
@ -267,6 +268,53 @@ 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)
|
||||
|
||||
# **getAssetCountByTimeGroup**
|
||||
> AssetCountByTimeGroupResponseDto getAssetCountByTimeGroup(getAssetCountByTimeGroupDto)
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
// 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 getAssetCountByTimeGroupDto = GetAssetCountByTimeGroupDto(); // GetAssetCountByTimeGroupDto |
|
||||
|
||||
try {
|
||||
final result = api_instance.getAssetCountByTimeGroup(getAssetCountByTimeGroupDto);
|
||||
print(result);
|
||||
} catch (e) {
|
||||
print('Exception when calling AssetApi->getAssetCountByTimeGroup: $e\n');
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**getAssetCountByTimeGroupDto** | [**GetAssetCountByTimeGroupDto**](GetAssetCountByTimeGroupDto.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
[**AssetCountByTimeGroupResponseDto**](AssetCountByTimeGroupResponseDto.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[bearer](../README.md#bearer)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **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)
|
||||
|
||||
# **getAssetSearchTerms**
|
||||
> List<String> getAssetSearchTerms()
|
||||
|
||||
|
16
mobile/openapi/doc/AssetCountByTimeGroupDto.md
Normal file
16
mobile/openapi/doc/AssetCountByTimeGroupDto.md
Normal file
@ -0,0 +1,16 @@
|
||||
# openapi.model.AssetCountByTimeGroupDto
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**timeGroup** | **String** | |
|
||||
**count** | **int** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
16
mobile/openapi/doc/AssetCountByTimeGroupResponseDto.md
Normal file
16
mobile/openapi/doc/AssetCountByTimeGroupResponseDto.md
Normal file
@ -0,0 +1,16 @@
|
||||
# openapi.model.AssetCountByTimeGroupResponseDto
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**totalAssets** | **int** | |
|
||||
**groups** | [**List<AssetCountByTimeGroupDto>**](AssetCountByTimeGroupDto.md) | | [default to const []]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
15
mobile/openapi/doc/GetAssetCountByTimeGroupDto.md
Normal file
15
mobile/openapi/doc/GetAssetCountByTimeGroupDto.md
Normal file
@ -0,0 +1,15 @@
|
||||
# openapi.model.GetAssetCountByTimeGroupDto
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:openapi/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**timeGroup** | [**TimeGroupEnum**](TimeGroupEnum.md) | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
14
mobile/openapi/doc/TimeGroupEnum.md
Normal file
14
mobile/openapi/doc/TimeGroupEnum.md
Normal file
@ -0,0 +1,14 @@
|
||||
# openapi.model.TimeGroupEnum
|
||||
|
||||
## 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)
|
||||
|
||||
|
@ -38,6 +38,8 @@ part 'model/add_assets_dto.dart';
|
||||
part 'model/add_users_dto.dart';
|
||||
part 'model/admin_signup_response_dto.dart';
|
||||
part 'model/album_response_dto.dart';
|
||||
part 'model/asset_count_by_time_group_dto.dart';
|
||||
part 'model/asset_count_by_time_group_response_dto.dart';
|
||||
part 'model/asset_file_upload_response_dto.dart';
|
||||
part 'model/asset_response_dto.dart';
|
||||
part 'model/asset_type_enum.dart';
|
||||
@ -55,6 +57,7 @@ part 'model/delete_asset_status.dart';
|
||||
part 'model/device_info_response_dto.dart';
|
||||
part 'model/device_type_enum.dart';
|
||||
part 'model/exif_response_dto.dart';
|
||||
part 'model/get_asset_count_by_time_group_dto.dart';
|
||||
part 'model/login_credential_dto.dart';
|
||||
part 'model/login_response_dto.dart';
|
||||
part 'model/logout_response_dto.dart';
|
||||
@ -66,6 +69,7 @@ part 'model/server_version_reponse_dto.dart';
|
||||
part 'model/sign_up_dto.dart';
|
||||
part 'model/smart_info_response_dto.dart';
|
||||
part 'model/thumbnail_format.dart';
|
||||
part 'model/time_group_enum.dart';
|
||||
part 'model/update_album_dto.dart';
|
||||
part 'model/update_device_info_dto.dart';
|
||||
part 'model/update_user_dto.dart';
|
||||
|
@ -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;
|
||||
|
@ -200,6 +200,10 @@ class ApiClient {
|
||||
return AdminSignupResponseDto.fromJson(value);
|
||||
case 'AlbumResponseDto':
|
||||
return AlbumResponseDto.fromJson(value);
|
||||
case 'AssetCountByTimeGroupDto':
|
||||
return AssetCountByTimeGroupDto.fromJson(value);
|
||||
case 'AssetCountByTimeGroupResponseDto':
|
||||
return AssetCountByTimeGroupResponseDto.fromJson(value);
|
||||
case 'AssetFileUploadResponseDto':
|
||||
return AssetFileUploadResponseDto.fromJson(value);
|
||||
case 'AssetResponseDto':
|
||||
@ -234,6 +238,8 @@ class ApiClient {
|
||||
return DeviceTypeEnumTypeTransformer().decode(value);
|
||||
case 'ExifResponseDto':
|
||||
return ExifResponseDto.fromJson(value);
|
||||
case 'GetAssetCountByTimeGroupDto':
|
||||
return GetAssetCountByTimeGroupDto.fromJson(value);
|
||||
case 'LoginCredentialDto':
|
||||
return LoginCredentialDto.fromJson(value);
|
||||
case 'LoginResponseDto':
|
||||
@ -256,6 +262,8 @@ class ApiClient {
|
||||
return SmartInfoResponseDto.fromJson(value);
|
||||
case 'ThumbnailFormat':
|
||||
return ThumbnailFormatTypeTransformer().decode(value);
|
||||
case 'TimeGroupEnum':
|
||||
return TimeGroupEnumTypeTransformer().decode(value);
|
||||
case 'UpdateAlbumDto':
|
||||
return UpdateAlbumDto.fromJson(value);
|
||||
case 'UpdateDeviceInfoDto':
|
||||
|
@ -67,6 +67,9 @@ String parameterToString(dynamic value) {
|
||||
if (value is ThumbnailFormat) {
|
||||
return ThumbnailFormatTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is TimeGroupEnum) {
|
||||
return TimeGroupEnumTypeTransformer().encode(value).toString();
|
||||
}
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
|
119
mobile/openapi/lib/model/asset_count_by_time_group_dto.dart
Normal file
119
mobile/openapi/lib/model/asset_count_by_time_group_dto.dart
Normal file
@ -0,0 +1,119 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class AssetCountByTimeGroupDto {
|
||||
/// Returns a new [AssetCountByTimeGroupDto] instance.
|
||||
AssetCountByTimeGroupDto({
|
||||
required this.timeGroup,
|
||||
required this.count,
|
||||
});
|
||||
|
||||
String timeGroup;
|
||||
|
||||
int count;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is AssetCountByTimeGroupDto &&
|
||||
other.timeGroup == timeGroup &&
|
||||
other.count == count;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(timeGroup.hashCode) +
|
||||
(count.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AssetCountByTimeGroupDto[timeGroup=$timeGroup, count=$count]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final _json = <String, dynamic>{};
|
||||
_json[r'timeGroup'] = timeGroup;
|
||||
_json[r'count'] = count;
|
||||
return _json;
|
||||
}
|
||||
|
||||
/// Returns a new [AssetCountByTimeGroupDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static AssetCountByTimeGroupDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
// Ensure that the map contains the required keys.
|
||||
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "AssetCountByTimeGroupDto[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "AssetCountByTimeGroupDto[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return AssetCountByTimeGroupDto(
|
||||
timeGroup: mapValueOfType<String>(json, r'timeGroup')!,
|
||||
count: mapValueOfType<int>(json, r'count')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<AssetCountByTimeGroupDto>? listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <AssetCountByTimeGroupDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = AssetCountByTimeGroupDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, AssetCountByTimeGroupDto> mapFromJson(dynamic json) {
|
||||
final map = <String, AssetCountByTimeGroupDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = AssetCountByTimeGroupDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of AssetCountByTimeGroupDto-objects as value to a dart map
|
||||
static Map<String, List<AssetCountByTimeGroupDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<AssetCountByTimeGroupDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = AssetCountByTimeGroupDto.listFromJson(entry.value, growable: growable,);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'timeGroup',
|
||||
'count',
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,119 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class AssetCountByTimeGroupResponseDto {
|
||||
/// Returns a new [AssetCountByTimeGroupResponseDto] instance.
|
||||
AssetCountByTimeGroupResponseDto({
|
||||
required this.totalAssets,
|
||||
this.groups = const [],
|
||||
});
|
||||
|
||||
int totalAssets;
|
||||
|
||||
List<AssetCountByTimeGroupDto> groups;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is AssetCountByTimeGroupResponseDto &&
|
||||
other.totalAssets == totalAssets &&
|
||||
other.groups == groups;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(totalAssets.hashCode) +
|
||||
(groups.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AssetCountByTimeGroupResponseDto[totalAssets=$totalAssets, groups=$groups]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final _json = <String, dynamic>{};
|
||||
_json[r'totalAssets'] = totalAssets;
|
||||
_json[r'groups'] = groups;
|
||||
return _json;
|
||||
}
|
||||
|
||||
/// Returns a new [AssetCountByTimeGroupResponseDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static AssetCountByTimeGroupResponseDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
// Ensure that the map contains the required keys.
|
||||
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "AssetCountByTimeGroupResponseDto[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "AssetCountByTimeGroupResponseDto[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return AssetCountByTimeGroupResponseDto(
|
||||
totalAssets: mapValueOfType<int>(json, r'totalAssets')!,
|
||||
groups: AssetCountByTimeGroupDto.listFromJson(json[r'groups'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<AssetCountByTimeGroupResponseDto>? listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <AssetCountByTimeGroupResponseDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = AssetCountByTimeGroupResponseDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, AssetCountByTimeGroupResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, AssetCountByTimeGroupResponseDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = AssetCountByTimeGroupResponseDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of AssetCountByTimeGroupResponseDto-objects as value to a dart map
|
||||
static Map<String, List<AssetCountByTimeGroupResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<AssetCountByTimeGroupResponseDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = AssetCountByTimeGroupResponseDto.listFromJson(entry.value, growable: growable,);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'totalAssets',
|
||||
'groups',
|
||||
};
|
||||
}
|
||||
|
111
mobile/openapi/lib/model/get_asset_count_by_time_group_dto.dart
Normal file
111
mobile/openapi/lib/model/get_asset_count_by_time_group_dto.dart
Normal file
@ -0,0 +1,111 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class GetAssetCountByTimeGroupDto {
|
||||
/// Returns a new [GetAssetCountByTimeGroupDto] instance.
|
||||
GetAssetCountByTimeGroupDto({
|
||||
required this.timeGroup,
|
||||
});
|
||||
|
||||
TimeGroupEnum timeGroup;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is GetAssetCountByTimeGroupDto &&
|
||||
other.timeGroup == timeGroup;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(timeGroup.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'GetAssetCountByTimeGroupDto[timeGroup=$timeGroup]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final _json = <String, dynamic>{};
|
||||
_json[r'timeGroup'] = timeGroup;
|
||||
return _json;
|
||||
}
|
||||
|
||||
/// Returns a new [GetAssetCountByTimeGroupDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static GetAssetCountByTimeGroupDto? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
// Ensure that the map contains the required keys.
|
||||
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "GetAssetCountByTimeGroupDto[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "GetAssetCountByTimeGroupDto[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return GetAssetCountByTimeGroupDto(
|
||||
timeGroup: TimeGroupEnum.fromJson(json[r'timeGroup'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<GetAssetCountByTimeGroupDto>? listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <GetAssetCountByTimeGroupDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = GetAssetCountByTimeGroupDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, GetAssetCountByTimeGroupDto> mapFromJson(dynamic json) {
|
||||
final map = <String, GetAssetCountByTimeGroupDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = GetAssetCountByTimeGroupDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of GetAssetCountByTimeGroupDto-objects as value to a dart map
|
||||
static Map<String, List<GetAssetCountByTimeGroupDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<GetAssetCountByTimeGroupDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = GetAssetCountByTimeGroupDto.listFromJson(entry.value, growable: growable,);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'timeGroup',
|
||||
};
|
||||
}
|
||||
|
85
mobile/openapi/lib/model/time_group_enum.dart
Normal file
85
mobile/openapi/lib/model/time_group_enum.dart
Normal file
@ -0,0 +1,85 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
|
||||
class TimeGroupEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const TimeGroupEnum._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
static const day = TimeGroupEnum._(r'day');
|
||||
static const month = TimeGroupEnum._(r'month');
|
||||
|
||||
/// List of all possible values in this [enum][TimeGroupEnum].
|
||||
static const values = <TimeGroupEnum>[
|
||||
day,
|
||||
month,
|
||||
];
|
||||
|
||||
static TimeGroupEnum? fromJson(dynamic value) => TimeGroupEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<TimeGroupEnum>? listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <TimeGroupEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = TimeGroupEnum.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [TimeGroupEnum] to String,
|
||||
/// and [decode] dynamic data back to [TimeGroupEnum].
|
||||
class TimeGroupEnumTypeTransformer {
|
||||
factory TimeGroupEnumTypeTransformer() => _instance ??= const TimeGroupEnumTypeTransformer._();
|
||||
|
||||
const TimeGroupEnumTypeTransformer._();
|
||||
|
||||
String encode(TimeGroupEnum data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a TimeGroupEnum.
|
||||
///
|
||||
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||
///
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
TimeGroupEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'day': return TimeGroupEnum.day;
|
||||
case r'month': return TimeGroupEnum.month;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [TimeGroupEnumTypeTransformer] instance.
|
||||
static TimeGroupEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
32
mobile/openapi/test/asset_count_by_time_group_dto_test.dart
Normal file
32
mobile/openapi/test/asset_count_by_time_group_dto_test.dart
Normal file
@ -0,0 +1,32 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for AssetCountByTimeGroupDto
|
||||
void main() {
|
||||
// final instance = AssetCountByTimeGroupDto();
|
||||
|
||||
group('test AssetCountByTimeGroupDto', () {
|
||||
// String timeGroup
|
||||
test('to test the property `timeGroup`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// int count
|
||||
test('to test the property `count`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for AssetCountByTimeGroupResponseDto
|
||||
void main() {
|
||||
// final instance = AssetCountByTimeGroupResponseDto();
|
||||
|
||||
group('test AssetCountByTimeGroupResponseDto', () {
|
||||
// int totalAssets
|
||||
test('to test the property `totalAssets`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// List<AssetCountByTimeGroupDto> groups (default value: const [])
|
||||
test('to test the property `groups`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for GetAssetCountByTimeGroupDto
|
||||
void main() {
|
||||
// final instance = GetAssetCountByTimeGroupDto();
|
||||
|
||||
group('test GetAssetCountByTimeGroupDto', () {
|
||||
// String timeGroup (default value: 'month')
|
||||
test('to test the property `timeGroup`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
21
mobile/openapi/test/time_group_enum_test.dart
Normal file
21
mobile/openapi/test/time_group_enum_test.dart
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for TimeGroupEnum
|
||||
void main() {
|
||||
|
||||
group('test TimeGroupEnum', () {
|
||||
|
||||
});
|
||||
|
||||
}
|
Reference in New Issue
Block a user