1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-08 23:07:06 +02:00

Feature - Implemented virtual scroll on web (#573)

This PR implemented a virtual scroll on the web, as seen in this article.

[Building the Google Photos Web UI](https://medium.com/google-design/google-photos-45b714dfbed1)
This commit is contained in:
Alex
2022-09-04 08:34:39 -05:00
committed by GitHub
parent bd92dde117
commit 552340add7
58 changed files with 2197 additions and 698 deletions

View File

@ -8,8 +8,8 @@ doc/AdminSignupResponseDto.md
doc/AlbumApi.md
doc/AlbumResponseDto.md
doc/AssetApi.md
doc/AssetCountByTimeGroupDto.md
doc/AssetCountByTimeGroupResponseDto.md
doc/AssetCountByTimeBucket.md
doc/AssetCountByTimeBucketResponseDto.md
doc/AssetFileUploadResponseDto.md
doc/AssetResponseDto.md
doc/AssetTypeEnum.md
@ -29,7 +29,8 @@ doc/DeviceInfoApi.md
doc/DeviceInfoResponseDto.md
doc/DeviceTypeEnum.md
doc/ExifResponseDto.md
doc/GetAssetCountByTimeGroupDto.md
doc/GetAssetByTimeBucketDto.md
doc/GetAssetCountByTimeBucketDto.md
doc/LoginCredentialDto.md
doc/LoginResponseDto.md
doc/LogoutResponseDto.md
@ -70,8 +71,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_count_by_time_bucket.dart
lib/model/asset_count_by_time_bucket_response_dto.dart
lib/model/asset_file_upload_response_dto.dart
lib/model/asset_response_dto.dart
lib/model/asset_type_enum.dart
@ -89,7 +90,8 @@ 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/get_asset_by_time_bucket_dto.dart
lib/model/get_asset_count_by_time_bucket_dto.dart
lib/model/login_credential_dto.dart
lib/model/login_response_dto.dart
lib/model/logout_response_dto.dart

View File

@ -79,7 +79,8 @@ 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* | [**getAssetCountByTimeGroup**](doc//AssetApi.md#getassetcountbytimegroup) | **GET** /asset/count-by-date |
*AssetApi* | [**getAssetByTimeBucket**](doc//AssetApi.md#getassetbytimebucket) | **POST** /asset/time-bucket |
*AssetApi* | [**getAssetCountByTimeBucket**](doc//AssetApi.md#getassetcountbytimebucket) | **POST** /asset/count-by-time-bucket |
*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/curated-locations |
@ -113,8 +114,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)
- [AssetCountByTimeBucket](doc//AssetCountByTimeBucket.md)
- [AssetCountByTimeBucketResponseDto](doc//AssetCountByTimeBucketResponseDto.md)
- [AssetFileUploadResponseDto](doc//AssetFileUploadResponseDto.md)
- [AssetResponseDto](doc//AssetResponseDto.md)
- [AssetTypeEnum](doc//AssetTypeEnum.md)
@ -132,7 +133,8 @@ Class | Method | HTTP request | Description
- [DeviceInfoResponseDto](doc//DeviceInfoResponseDto.md)
- [DeviceTypeEnum](doc//DeviceTypeEnum.md)
- [ExifResponseDto](doc//ExifResponseDto.md)
- [GetAssetCountByTimeGroupDto](doc//GetAssetCountByTimeGroupDto.md)
- [GetAssetByTimeBucketDto](doc//GetAssetByTimeBucketDto.md)
- [GetAssetCountByTimeBucketDto](doc//GetAssetCountByTimeBucketDto.md)
- [LoginCredentialDto](doc//LoginCredentialDto.md)
- [LoginResponseDto](doc//LoginResponseDto.md)
- [LogoutResponseDto](doc//LogoutResponseDto.md)

View File

@ -14,7 +14,8 @@ 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} |
[**getAssetCountByTimeGroup**](AssetApi.md#getassetcountbytimegroup) | **GET** /asset/count-by-date |
[**getAssetByTimeBucket**](AssetApi.md#getassetbytimebucket) | **POST** /asset/time-bucket |
[**getAssetCountByTimeBucket**](AssetApi.md#getassetcountbytimebucket) | **POST** /asset/count-by-time-bucket |
[**getAssetSearchTerms**](AssetApi.md#getassetsearchterms) | **GET** /asset/search-terms |
[**getAssetThumbnail**](AssetApi.md#getassetthumbnail) | **GET** /asset/thumbnail/{assetId} |
[**getCuratedLocations**](AssetApi.md#getcuratedlocations) | **GET** /asset/curated-locations |
@ -268,8 +269,8 @@ 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)
# **getAssetByTimeBucket**
> List<AssetResponseDto> getAssetByTimeBucket(getAssetByTimeBucketDto)
@ -284,13 +285,13 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = AssetApi();
final getAssetCountByTimeGroupDto = GetAssetCountByTimeGroupDto(); // GetAssetCountByTimeGroupDto |
final getAssetByTimeBucketDto = GetAssetByTimeBucketDto(); // GetAssetByTimeBucketDto |
try {
final result = api_instance.getAssetCountByTimeGroup(getAssetCountByTimeGroupDto);
final result = api_instance.getAssetByTimeBucket(getAssetByTimeBucketDto);
print(result);
} catch (e) {
print('Exception when calling AssetApi->getAssetCountByTimeGroup: $e\n');
print('Exception when calling AssetApi->getAssetByTimeBucket: $e\n');
}
```
@ -298,11 +299,58 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**getAssetCountByTimeGroupDto** | [**GetAssetCountByTimeGroupDto**](GetAssetCountByTimeGroupDto.md)| |
**getAssetByTimeBucketDto** | [**GetAssetByTimeBucketDto**](GetAssetByTimeBucketDto.md)| |
### Return type
[**AssetCountByTimeGroupResponseDto**](AssetCountByTimeGroupResponseDto.md)
[**List<AssetResponseDto>**](AssetResponseDto.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)
# **getAssetCountByTimeBucket**
> AssetCountByTimeBucketResponseDto getAssetCountByTimeBucket(getAssetCountByTimeBucketDto)
### 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 getAssetCountByTimeBucketDto = GetAssetCountByTimeBucketDto(); // GetAssetCountByTimeBucketDto |
try {
final result = api_instance.getAssetCountByTimeBucket(getAssetCountByTimeBucketDto);
print(result);
} catch (e) {
print('Exception when calling AssetApi->getAssetCountByTimeBucket: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**getAssetCountByTimeBucketDto** | [**GetAssetCountByTimeBucketDto**](GetAssetCountByTimeBucketDto.md)| |
### Return type
[**AssetCountByTimeBucketResponseDto**](AssetCountByTimeBucketResponseDto.md)
### Authorization

View File

@ -0,0 +1,16 @@
# openapi.model.AssetCountByTimeBucket
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**timeBucket** | **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)

View File

@ -0,0 +1,16 @@
# openapi.model.AssetCountByTimeBucketResponseDto
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**totalCount** | **int** | |
**buckets** | [**List<AssetCountByTimeBucket>**](AssetCountByTimeBucket.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)

View File

@ -8,8 +8,8 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**totalAssets** | **int** | |
**groups** | [**List<AssetCountByTimeGroupDto>**](AssetCountByTimeGroupDto.md) | | [default to const []]
**count** | **int** | |
**buckets** | [**List<AssetCountByTimeBucketResponseDto>**](AssetCountByTimeBucketResponseDto.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)

View File

@ -0,0 +1,15 @@
# openapi.model.GetAssetByTimeBucketDto
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**timeBucket** | **List<String>** | | [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)

View File

@ -0,0 +1,15 @@
# openapi.model.GetAssetCountByTimeBucketDto
## 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)

View File

@ -0,0 +1,14 @@
# openapi.model.TimeBucketEnum
## 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)

View File

@ -38,8 +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_count_by_time_bucket.dart';
part 'model/asset_count_by_time_bucket_response_dto.dart';
part 'model/asset_file_upload_response_dto.dart';
part 'model/asset_response_dto.dart';
part 'model/asset_type_enum.dart';
@ -57,7 +57,8 @@ 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/get_asset_by_time_bucket_dto.dart';
part 'model/get_asset_count_by_time_bucket_dto.dart';
part 'model/login_credential_dto.dart';
part 'model/login_response_dto.dart';
part 'model/logout_response_dto.dart';

View File

@ -298,16 +298,16 @@ class AssetApi {
return null;
}
/// Performs an HTTP 'GET /asset/count-by-date' operation and returns the [Response].
/// Performs an HTTP 'POST /asset/time-bucket' operation and returns the [Response].
/// Parameters:
///
/// * [GetAssetCountByTimeGroupDto] getAssetCountByTimeGroupDto (required):
Future<Response> getAssetCountByTimeGroupWithHttpInfo(GetAssetCountByTimeGroupDto getAssetCountByTimeGroupDto,) async {
/// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
Future<Response> getAssetByTimeBucketWithHttpInfo(GetAssetByTimeBucketDto getAssetByTimeBucketDto,) async {
// ignore: prefer_const_declarations
final path = r'/asset/count-by-date';
final path = r'/asset/time-bucket';
// ignore: prefer_final_locals
Object? postBody = getAssetCountByTimeGroupDto;
Object? postBody = getAssetByTimeBucketDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
@ -318,7 +318,7 @@ class AssetApi {
return apiClient.invokeAPI(
path,
'GET',
'POST',
queryParams,
postBody,
headerParams,
@ -329,9 +329,9 @@ class AssetApi {
/// Parameters:
///
/// * [GetAssetCountByTimeGroupDto] getAssetCountByTimeGroupDto (required):
Future<AssetCountByTimeGroupResponseDto?> getAssetCountByTimeGroup(GetAssetCountByTimeGroupDto getAssetCountByTimeGroupDto,) async {
final response = await getAssetCountByTimeGroupWithHttpInfo(getAssetCountByTimeGroupDto,);
/// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
Future<List<AssetResponseDto>?> getAssetByTimeBucket(GetAssetByTimeBucketDto getAssetByTimeBucketDto,) async {
final response = await getAssetByTimeBucketWithHttpInfo(getAssetByTimeBucketDto,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
@ -339,7 +339,57 @@ class AssetApi {
// 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;
final responseBody = await _decodeBodyBytes(response);
return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
.cast<AssetResponseDto>()
.toList();
}
return null;
}
/// Performs an HTTP 'POST /asset/count-by-time-bucket' operation and returns the [Response].
/// Parameters:
///
/// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
Future<Response> getAssetCountByTimeBucketWithHttpInfo(GetAssetCountByTimeBucketDto getAssetCountByTimeBucketDto,) async {
// ignore: prefer_const_declarations
final path = r'/asset/count-by-time-bucket';
// ignore: prefer_final_locals
Object? postBody = getAssetCountByTimeBucketDto;
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:
///
/// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
Future<AssetCountByTimeBucketResponseDto?> getAssetCountByTimeBucket(GetAssetCountByTimeBucketDto getAssetCountByTimeBucketDto,) async {
final response = await getAssetCountByTimeBucketWithHttpInfo(getAssetCountByTimeBucketDto,);
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), 'AssetCountByTimeBucketResponseDto',) as AssetCountByTimeBucketResponseDto;
}
return null;

View File

@ -200,10 +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 'AssetCountByTimeBucket':
return AssetCountByTimeBucket.fromJson(value);
case 'AssetCountByTimeBucketResponseDto':
return AssetCountByTimeBucketResponseDto.fromJson(value);
case 'AssetFileUploadResponseDto':
return AssetFileUploadResponseDto.fromJson(value);
case 'AssetResponseDto':
@ -238,8 +238,10 @@ class ApiClient {
return DeviceTypeEnumTypeTransformer().decode(value);
case 'ExifResponseDto':
return ExifResponseDto.fromJson(value);
case 'GetAssetCountByTimeGroupDto':
return GetAssetCountByTimeGroupDto.fromJson(value);
case 'GetAssetByTimeBucketDto':
return GetAssetByTimeBucketDto.fromJson(value);
case 'GetAssetCountByTimeBucketDto':
return GetAssetCountByTimeBucketDto.fromJson(value);
case 'LoginCredentialDto':
return LoginCredentialDto.fromJson(value);
case 'LoginResponseDto':

View 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 AssetCountByTimeBucket {
/// Returns a new [AssetCountByTimeBucket] instance.
AssetCountByTimeBucket({
required this.timeBucket,
required this.count,
});
String timeBucket;
int count;
@override
bool operator ==(Object other) => identical(this, other) || other is AssetCountByTimeBucket &&
other.timeBucket == timeBucket &&
other.count == count;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(timeBucket.hashCode) +
(count.hashCode);
@override
String toString() => 'AssetCountByTimeBucket[timeBucket=$timeBucket, count=$count]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'timeBucket'] = timeBucket;
_json[r'count'] = count;
return _json;
}
/// Returns a new [AssetCountByTimeBucket] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetCountByTimeBucket? 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 "AssetCountByTimeBucket[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "AssetCountByTimeBucket[$key]" has a null value in JSON.');
});
return true;
}());
return AssetCountByTimeBucket(
timeBucket: mapValueOfType<String>(json, r'timeBucket')!,
count: mapValueOfType<int>(json, r'count')!,
);
}
return null;
}
static List<AssetCountByTimeBucket>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <AssetCountByTimeBucket>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = AssetCountByTimeBucket.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, AssetCountByTimeBucket> mapFromJson(dynamic json) {
final map = <String, AssetCountByTimeBucket>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AssetCountByTimeBucket.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of AssetCountByTimeBucket-objects as value to a dart map
static Map<String, List<AssetCountByTimeBucket>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<AssetCountByTimeBucket>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AssetCountByTimeBucket.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>{
'timeBucket',
'count',
};
}

View 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 AssetCountByTimeBucketResponseDto {
/// Returns a new [AssetCountByTimeBucketResponseDto] instance.
AssetCountByTimeBucketResponseDto({
required this.totalCount,
this.buckets = const [],
});
int totalCount;
List<AssetCountByTimeBucket> buckets;
@override
bool operator ==(Object other) => identical(this, other) || other is AssetCountByTimeBucketResponseDto &&
other.totalCount == totalCount &&
other.buckets == buckets;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(totalCount.hashCode) +
(buckets.hashCode);
@override
String toString() => 'AssetCountByTimeBucketResponseDto[totalCount=$totalCount, buckets=$buckets]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'totalCount'] = totalCount;
_json[r'buckets'] = buckets;
return _json;
}
/// Returns a new [AssetCountByTimeBucketResponseDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetCountByTimeBucketResponseDto? 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 "AssetCountByTimeBucketResponseDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "AssetCountByTimeBucketResponseDto[$key]" has a null value in JSON.');
});
return true;
}());
return AssetCountByTimeBucketResponseDto(
totalCount: mapValueOfType<int>(json, r'totalCount')!,
buckets: AssetCountByTimeBucket.listFromJson(json[r'buckets'])!,
);
}
return null;
}
static List<AssetCountByTimeBucketResponseDto>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <AssetCountByTimeBucketResponseDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = AssetCountByTimeBucketResponseDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, AssetCountByTimeBucketResponseDto> mapFromJson(dynamic json) {
final map = <String, AssetCountByTimeBucketResponseDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AssetCountByTimeBucketResponseDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of AssetCountByTimeBucketResponseDto-objects as value to a dart map
static Map<String, List<AssetCountByTimeBucketResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<AssetCountByTimeBucketResponseDto>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AssetCountByTimeBucketResponseDto.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>{
'totalCount',
'buckets',
};
}

View File

@ -13,32 +13,32 @@ part of openapi.api;
class AssetCountByTimeGroupResponseDto {
/// Returns a new [AssetCountByTimeGroupResponseDto] instance.
AssetCountByTimeGroupResponseDto({
required this.totalAssets,
this.groups = const [],
required this.count,
this.buckets = const [],
});
int totalAssets;
int count;
List<AssetCountByTimeGroupDto> groups;
List<AssetCountByTimeBucketResponseDto> buckets;
@override
bool operator ==(Object other) => identical(this, other) || other is AssetCountByTimeGroupResponseDto &&
other.totalAssets == totalAssets &&
other.groups == groups;
other.count == count &&
other.buckets == buckets;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(totalAssets.hashCode) +
(groups.hashCode);
(count.hashCode) +
(buckets.hashCode);
@override
String toString() => 'AssetCountByTimeGroupResponseDto[totalAssets=$totalAssets, groups=$groups]';
String toString() => 'AssetCountByTimeGroupResponseDto[count=$count, buckets=$buckets]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'totalAssets'] = totalAssets;
_json[r'groups'] = groups;
_json[r'count'] = count;
_json[r'buckets'] = buckets;
return _json;
}
@ -61,8 +61,8 @@ class AssetCountByTimeGroupResponseDto {
}());
return AssetCountByTimeGroupResponseDto(
totalAssets: mapValueOfType<int>(json, r'totalAssets')!,
groups: AssetCountByTimeGroupDto.listFromJson(json[r'groups'])!,
count: mapValueOfType<int>(json, r'count')!,
buckets: AssetCountByTimeBucketResponseDto.listFromJson(json[r'buckets'])!,
);
}
return null;
@ -112,8 +112,8 @@ class AssetCountByTimeGroupResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'totalAssets',
'groups',
'count',
'buckets',
};
}

View File

@ -0,0 +1,113 @@
//
// 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 GetAssetByTimeBucketDto {
/// Returns a new [GetAssetByTimeBucketDto] instance.
GetAssetByTimeBucketDto({
this.timeBucket = const [],
});
List<String> timeBucket;
@override
bool operator ==(Object other) => identical(this, other) || other is GetAssetByTimeBucketDto &&
other.timeBucket == timeBucket;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(timeBucket.hashCode);
@override
String toString() => 'GetAssetByTimeBucketDto[timeBucket=$timeBucket]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'timeBucket'] = timeBucket;
return _json;
}
/// Returns a new [GetAssetByTimeBucketDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static GetAssetByTimeBucketDto? 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 "GetAssetByTimeBucketDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "GetAssetByTimeBucketDto[$key]" has a null value in JSON.');
});
return true;
}());
return GetAssetByTimeBucketDto(
timeBucket: json[r'timeBucket'] is List
? (json[r'timeBucket'] as List).cast<String>()
: const [],
);
}
return null;
}
static List<GetAssetByTimeBucketDto>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <GetAssetByTimeBucketDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = GetAssetByTimeBucketDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, GetAssetByTimeBucketDto> mapFromJson(dynamic json) {
final map = <String, GetAssetByTimeBucketDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = GetAssetByTimeBucketDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of GetAssetByTimeBucketDto-objects as value to a dart map
static Map<String, List<GetAssetByTimeBucketDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<GetAssetByTimeBucketDto>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = GetAssetByTimeBucketDto.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>{
'timeBucket',
};
}

View 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 GetAssetCountByTimeBucketDto {
/// Returns a new [GetAssetCountByTimeBucketDto] instance.
GetAssetCountByTimeBucketDto({
required this.timeGroup,
});
TimeGroupEnum timeGroup;
@override
bool operator ==(Object other) => identical(this, other) || other is GetAssetCountByTimeBucketDto &&
other.timeGroup == timeGroup;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(timeGroup.hashCode);
@override
String toString() => 'GetAssetCountByTimeBucketDto[timeGroup=$timeGroup]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'timeGroup'] = timeGroup;
return _json;
}
/// Returns a new [GetAssetCountByTimeBucketDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static GetAssetCountByTimeBucketDto? 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 "GetAssetCountByTimeBucketDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "GetAssetCountByTimeBucketDto[$key]" has a null value in JSON.');
});
return true;
}());
return GetAssetCountByTimeBucketDto(
timeGroup: TimeGroupEnum.fromJson(json[r'timeGroup'])!,
);
}
return null;
}
static List<GetAssetCountByTimeBucketDto>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <GetAssetCountByTimeBucketDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = GetAssetCountByTimeBucketDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, GetAssetCountByTimeBucketDto> mapFromJson(dynamic json) {
final map = <String, GetAssetCountByTimeBucketDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = GetAssetCountByTimeBucketDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of GetAssetCountByTimeBucketDto-objects as value to a dart map
static Map<String, List<GetAssetCountByTimeBucketDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<GetAssetCountByTimeBucketDto>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = GetAssetCountByTimeBucketDto.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',
};
}

View 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 TimeBucketEnum {
/// Instantiate a new enum with the provided [value].
const TimeBucketEnum._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const day = TimeBucketEnum._(r'day');
static const month = TimeBucketEnum._(r'month');
/// List of all possible values in this [enum][TimeBucketEnum].
static const values = <TimeBucketEnum>[
day,
month,
];
static TimeBucketEnum? fromJson(dynamic value) => TimeBucketEnumTypeTransformer().decode(value);
static List<TimeBucketEnum>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <TimeBucketEnum>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = TimeBucketEnum.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
}
/// Transformation class that can [encode] an instance of [TimeBucketEnum] to String,
/// and [decode] dynamic data back to [TimeBucketEnum].
class TimeBucketEnumTypeTransformer {
factory TimeBucketEnumTypeTransformer() => _instance ??= const TimeBucketEnumTypeTransformer._();
const TimeBucketEnumTypeTransformer._();
String encode(TimeBucketEnum data) => data.value;
/// Decodes a [dynamic value][data] to a TimeBucketEnum.
///
/// 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.
TimeBucketEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data.toString()) {
case r'day': return TimeBucketEnum.day;
case r'month': return TimeBucketEnum.month;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [TimeBucketEnumTypeTransformer] instance.
static TimeBucketEnumTypeTransformer? _instance;
}

View 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 AssetCountByTimeBucketResponseDto
void main() {
// final instance = AssetCountByTimeBucketResponseDto();
group('test AssetCountByTimeBucketResponseDto', () {
// String timeGroup
test('to test the property `timeGroup`', () async {
// TODO
});
// int count
test('to test the property `count`', () async {
// TODO
});
});
}

View 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 AssetCountByTimeBucket
void main() {
// final instance = AssetCountByTimeBucket();
group('test AssetCountByTimeBucket', () {
// String timeBucket
test('to test the property `timeBucket`', () async {
// TODO
});
// int count
test('to test the property `count`', () async {
// TODO
});
});
}

View File

@ -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 GetAssetByTimeBucketDto
void main() {
// final instance = GetAssetByTimeBucketDto();
group('test GetAssetByTimeBucketDto', () {
// List<String> timeBucket (default value: const [])
test('to test the property `timeBucket`', () async {
// TODO
});
});
}

View File

@ -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 GetAssetCountByTimeBucketDto
void main() {
// final instance = GetAssetCountByTimeBucketDto();
group('test GetAssetCountByTimeBucketDto', () {
// TimeGroupEnum timeGroup
test('to test the property `timeGroup`', () async {
// TODO
});
});
}

View 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 TimeBucketEnum
void main() {
group('test TimeBucketEnum', () {
});
}