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

feat: user preferences for archive download size (#10296)

* feat: user preferences for archive download size

* chore: open api

* chore: clean up

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Daniel Dietzler
2024-06-14 17:27:12 +02:00
committed by GitHub
parent 596412cb8f
commit dddc06c3b2
19 changed files with 442 additions and 24 deletions

View File

@@ -118,7 +118,9 @@ part 'model/create_profile_image_response_dto.dart';
part 'model/create_tag_dto.dart';
part 'model/download_archive_info.dart';
part 'model/download_info_dto.dart';
part 'model/download_response.dart';
part 'model/download_response_dto.dart';
part 'model/download_update.dart';
part 'model/duplicate_detection_config.dart';
part 'model/duplicate_response_dto.dart';
part 'model/email_notifications_response.dart';

View File

@@ -298,8 +298,12 @@ class ApiClient {
return DownloadArchiveInfo.fromJson(value);
case 'DownloadInfoDto':
return DownloadInfoDto.fromJson(value);
case 'DownloadResponse':
return DownloadResponse.fromJson(value);
case 'DownloadResponseDto':
return DownloadResponseDto.fromJson(value);
case 'DownloadUpdate':
return DownloadUpdate.fromJson(value);
case 'DuplicateDetectionConfig':
return DuplicateDetectionConfig.fromJson(value);
case 'DuplicateResponseDto':

View File

@@ -0,0 +1,98 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// 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 DownloadResponse {
/// Returns a new [DownloadResponse] instance.
DownloadResponse({
required this.archiveSize,
});
int archiveSize;
@override
bool operator ==(Object other) => identical(this, other) || other is DownloadResponse &&
other.archiveSize == archiveSize;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(archiveSize.hashCode);
@override
String toString() => 'DownloadResponse[archiveSize=$archiveSize]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'archiveSize'] = this.archiveSize;
return json;
}
/// Returns a new [DownloadResponse] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DownloadResponse? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return DownloadResponse(
archiveSize: mapValueOfType<int>(json, r'archiveSize')!,
);
}
return null;
}
static List<DownloadResponse> listFromJson(dynamic json, {bool growable = false,}) {
final result = <DownloadResponse>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = DownloadResponse.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, DownloadResponse> mapFromJson(dynamic json) {
final map = <String, DownloadResponse>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = DownloadResponse.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of DownloadResponse-objects as value to a dart map
static Map<String, List<DownloadResponse>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<DownloadResponse>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = DownloadResponse.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'archiveSize',
};
}

View File

@@ -0,0 +1,108 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// 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 DownloadUpdate {
/// Returns a new [DownloadUpdate] instance.
DownloadUpdate({
this.archiveSize,
});
/// Minimum value: 1
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
int? archiveSize;
@override
bool operator ==(Object other) => identical(this, other) || other is DownloadUpdate &&
other.archiveSize == archiveSize;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(archiveSize == null ? 0 : archiveSize!.hashCode);
@override
String toString() => 'DownloadUpdate[archiveSize=$archiveSize]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.archiveSize != null) {
json[r'archiveSize'] = this.archiveSize;
} else {
// json[r'archiveSize'] = null;
}
return json;
}
/// Returns a new [DownloadUpdate] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DownloadUpdate? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return DownloadUpdate(
archiveSize: mapValueOfType<int>(json, r'archiveSize'),
);
}
return null;
}
static List<DownloadUpdate> listFromJson(dynamic json, {bool growable = false,}) {
final result = <DownloadUpdate>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = DownloadUpdate.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, DownloadUpdate> mapFromJson(dynamic json) {
final map = <String, DownloadUpdate>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = DownloadUpdate.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of DownloadUpdate-objects as value to a dart map
static Map<String, List<DownloadUpdate>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<DownloadUpdate>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = DownloadUpdate.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
};
}

View File

@@ -14,12 +14,15 @@ class UserPreferencesResponseDto {
/// Returns a new [UserPreferencesResponseDto] instance.
UserPreferencesResponseDto({
required this.avatar,
required this.download,
required this.emailNotifications,
required this.memories,
});
AvatarResponse avatar;
DownloadResponse download;
EmailNotificationsResponse emailNotifications;
MemoryResponse memories;
@@ -27,6 +30,7 @@ class UserPreferencesResponseDto {
@override
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesResponseDto &&
other.avatar == avatar &&
other.download == download &&
other.emailNotifications == emailNotifications &&
other.memories == memories;
@@ -34,15 +38,17 @@ class UserPreferencesResponseDto {
int get hashCode =>
// ignore: unnecessary_parenthesis
(avatar.hashCode) +
(download.hashCode) +
(emailNotifications.hashCode) +
(memories.hashCode);
@override
String toString() => 'UserPreferencesResponseDto[avatar=$avatar, emailNotifications=$emailNotifications, memories=$memories]';
String toString() => 'UserPreferencesResponseDto[avatar=$avatar, download=$download, emailNotifications=$emailNotifications, memories=$memories]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'avatar'] = this.avatar;
json[r'download'] = this.download;
json[r'emailNotifications'] = this.emailNotifications;
json[r'memories'] = this.memories;
return json;
@@ -57,6 +63,7 @@ class UserPreferencesResponseDto {
return UserPreferencesResponseDto(
avatar: AvatarResponse.fromJson(json[r'avatar'])!,
download: DownloadResponse.fromJson(json[r'download'])!,
emailNotifications: EmailNotificationsResponse.fromJson(json[r'emailNotifications'])!,
memories: MemoryResponse.fromJson(json[r'memories'])!,
);
@@ -107,6 +114,7 @@ class UserPreferencesResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'avatar',
'download',
'emailNotifications',
'memories',
};

View File

@@ -14,6 +14,7 @@ class UserPreferencesUpdateDto {
/// Returns a new [UserPreferencesUpdateDto] instance.
UserPreferencesUpdateDto({
this.avatar,
this.download,
this.emailNotifications,
this.memories,
});
@@ -26,6 +27,14 @@ class UserPreferencesUpdateDto {
///
AvatarUpdate? avatar;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
DownloadUpdate? download;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
@@ -45,6 +54,7 @@ class UserPreferencesUpdateDto {
@override
bool operator ==(Object other) => identical(this, other) || other is UserPreferencesUpdateDto &&
other.avatar == avatar &&
other.download == download &&
other.emailNotifications == emailNotifications &&
other.memories == memories;
@@ -52,11 +62,12 @@ class UserPreferencesUpdateDto {
int get hashCode =>
// ignore: unnecessary_parenthesis
(avatar == null ? 0 : avatar!.hashCode) +
(download == null ? 0 : download!.hashCode) +
(emailNotifications == null ? 0 : emailNotifications!.hashCode) +
(memories == null ? 0 : memories!.hashCode);
@override
String toString() => 'UserPreferencesUpdateDto[avatar=$avatar, emailNotifications=$emailNotifications, memories=$memories]';
String toString() => 'UserPreferencesUpdateDto[avatar=$avatar, download=$download, emailNotifications=$emailNotifications, memories=$memories]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@@ -65,6 +76,11 @@ class UserPreferencesUpdateDto {
} else {
// json[r'avatar'] = null;
}
if (this.download != null) {
json[r'download'] = this.download;
} else {
// json[r'download'] = null;
}
if (this.emailNotifications != null) {
json[r'emailNotifications'] = this.emailNotifications;
} else {
@@ -87,6 +103,7 @@ class UserPreferencesUpdateDto {
return UserPreferencesUpdateDto(
avatar: AvatarUpdate.fromJson(json[r'avatar']),
download: DownloadUpdate.fromJson(json[r'download']),
emailNotifications: EmailNotificationsUpdate.fromJson(json[r'emailNotifications']),
memories: MemoryUpdate.fromJson(json[r'memories']),
);