1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-16 07:24:40 +02:00

refactor(server): user endpoints (#9730)

* refactor(server): user endpoints

* fix repos

* fix unit tests

---------

Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
Jason Rasmussen
2024-05-26 18:15:52 -04:00
committed by GitHub
parent e7c8501930
commit 75830a4878
80 changed files with 2453 additions and 1914 deletions

View File

@ -31,7 +31,7 @@ class ActivityResponseDto {
ActivityResponseDtoTypeEnum type;
UserDto user;
UserResponseDto user;
@override
bool operator ==(Object other) => identical(this, other) || other is ActivityResponseDto &&
@ -87,7 +87,7 @@ class ActivityResponseDto {
createdAt: mapDateTime(json, r'createdAt', r'')!,
id: mapValueOfType<String>(json, r'id')!,
type: ActivityResponseDtoTypeEnum.fromJson(json[r'type'])!,
user: UserDto.fromJson(json[r'user'])!,
user: UserResponseDto.fromJson(json[r'user'])!,
);
}
return null;

View File

@ -14,30 +14,15 @@ class PartnerResponseDto {
/// Returns a new [PartnerResponseDto] instance.
PartnerResponseDto({
required this.avatarColor,
required this.createdAt,
required this.deletedAt,
required this.email,
required this.id,
this.inTimeline,
required this.isAdmin,
this.memoriesEnabled,
required this.name,
required this.oauthId,
required this.profileImagePath,
required this.quotaSizeInBytes,
required this.quotaUsageInBytes,
required this.shouldChangePassword,
required this.status,
required this.storageLabel,
required this.updatedAt,
});
UserAvatarColor avatarColor;
DateTime createdAt;
DateTime? deletedAt;
String email;
String id;
@ -50,121 +35,44 @@ class PartnerResponseDto {
///
bool? inTimeline;
bool isAdmin;
///
/// 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.
///
bool? memoriesEnabled;
String name;
String oauthId;
String profileImagePath;
int? quotaSizeInBytes;
int? quotaUsageInBytes;
bool shouldChangePassword;
UserStatus status;
String? storageLabel;
DateTime updatedAt;
@override
bool operator ==(Object other) => identical(this, other) || other is PartnerResponseDto &&
other.avatarColor == avatarColor &&
other.createdAt == createdAt &&
other.deletedAt == deletedAt &&
other.email == email &&
other.id == id &&
other.inTimeline == inTimeline &&
other.isAdmin == isAdmin &&
other.memoriesEnabled == memoriesEnabled &&
other.name == name &&
other.oauthId == oauthId &&
other.profileImagePath == profileImagePath &&
other.quotaSizeInBytes == quotaSizeInBytes &&
other.quotaUsageInBytes == quotaUsageInBytes &&
other.shouldChangePassword == shouldChangePassword &&
other.status == status &&
other.storageLabel == storageLabel &&
other.updatedAt == updatedAt;
other.profileImagePath == profileImagePath;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(avatarColor.hashCode) +
(createdAt.hashCode) +
(deletedAt == null ? 0 : deletedAt!.hashCode) +
(email.hashCode) +
(id.hashCode) +
(inTimeline == null ? 0 : inTimeline!.hashCode) +
(isAdmin.hashCode) +
(memoriesEnabled == null ? 0 : memoriesEnabled!.hashCode) +
(name.hashCode) +
(oauthId.hashCode) +
(profileImagePath.hashCode) +
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
(quotaUsageInBytes == null ? 0 : quotaUsageInBytes!.hashCode) +
(shouldChangePassword.hashCode) +
(status.hashCode) +
(storageLabel == null ? 0 : storageLabel!.hashCode) +
(updatedAt.hashCode);
(profileImagePath.hashCode);
@override
String toString() => 'PartnerResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, inTimeline=$inTimeline, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, status=$status, storageLabel=$storageLabel, updatedAt=$updatedAt]';
String toString() => 'PartnerResponseDto[avatarColor=$avatarColor, email=$email, id=$id, inTimeline=$inTimeline, name=$name, profileImagePath=$profileImagePath]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'avatarColor'] = this.avatarColor;
json[r'createdAt'] = this.createdAt.toUtc().toIso8601String();
if (this.deletedAt != null) {
json[r'deletedAt'] = this.deletedAt!.toUtc().toIso8601String();
} else {
// json[r'deletedAt'] = null;
}
json[r'email'] = this.email;
json[r'id'] = this.id;
if (this.inTimeline != null) {
json[r'inTimeline'] = this.inTimeline;
} else {
// json[r'inTimeline'] = null;
}
json[r'isAdmin'] = this.isAdmin;
if (this.memoriesEnabled != null) {
json[r'memoriesEnabled'] = this.memoriesEnabled;
} else {
// json[r'memoriesEnabled'] = null;
}
json[r'name'] = this.name;
json[r'oauthId'] = this.oauthId;
json[r'profileImagePath'] = this.profileImagePath;
if (this.quotaSizeInBytes != null) {
json[r'quotaSizeInBytes'] = this.quotaSizeInBytes;
} else {
// json[r'quotaSizeInBytes'] = null;
}
if (this.quotaUsageInBytes != null) {
json[r'quotaUsageInBytes'] = this.quotaUsageInBytes;
} else {
// json[r'quotaUsageInBytes'] = null;
}
json[r'shouldChangePassword'] = this.shouldChangePassword;
json[r'status'] = this.status;
if (this.storageLabel != null) {
json[r'storageLabel'] = this.storageLabel;
} else {
// json[r'storageLabel'] = null;
}
json[r'updatedAt'] = this.updatedAt.toUtc().toIso8601String();
return json;
}
@ -177,22 +85,11 @@ class PartnerResponseDto {
return PartnerResponseDto(
avatarColor: UserAvatarColor.fromJson(json[r'avatarColor'])!,
createdAt: mapDateTime(json, r'createdAt', r'')!,
deletedAt: mapDateTime(json, r'deletedAt', r''),
email: mapValueOfType<String>(json, r'email')!,
id: mapValueOfType<String>(json, r'id')!,
inTimeline: mapValueOfType<bool>(json, r'inTimeline'),
isAdmin: mapValueOfType<bool>(json, r'isAdmin')!,
memoriesEnabled: mapValueOfType<bool>(json, r'memoriesEnabled'),
name: mapValueOfType<String>(json, r'name')!,
oauthId: mapValueOfType<String>(json, r'oauthId')!,
profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!,
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
quotaUsageInBytes: mapValueOfType<int>(json, r'quotaUsageInBytes'),
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
status: UserStatus.fromJson(json[r'status'])!,
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
updatedAt: mapDateTime(json, r'updatedAt', r'')!,
);
}
return null;
@ -241,20 +138,10 @@ class PartnerResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'avatarColor',
'createdAt',
'deletedAt',
'email',
'id',
'isAdmin',
'name',
'oauthId',
'profileImagePath',
'quotaSizeInBytes',
'quotaUsageInBytes',
'shouldChangePassword',
'status',
'storageLabel',
'updatedAt',
};
}

View File

@ -10,9 +10,9 @@
part of openapi.api;
class CreateUserDto {
/// Returns a new [CreateUserDto] instance.
CreateUserDto({
class UserAdminCreateDto {
/// Returns a new [UserAdminCreateDto] instance.
UserAdminCreateDto({
required this.email,
this.memoriesEnabled,
required this.name,
@ -59,7 +59,7 @@ class CreateUserDto {
String? storageLabel;
@override
bool operator ==(Object other) => identical(this, other) || other is CreateUserDto &&
bool operator ==(Object other) => identical(this, other) || other is UserAdminCreateDto &&
other.email == email &&
other.memoriesEnabled == memoriesEnabled &&
other.name == name &&
@ -82,7 +82,7 @@ class CreateUserDto {
(storageLabel == null ? 0 : storageLabel!.hashCode);
@override
String toString() => 'CreateUserDto[email=$email, memoriesEnabled=$memoriesEnabled, name=$name, notify=$notify, password=$password, quotaSizeInBytes=$quotaSizeInBytes, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel]';
String toString() => 'UserAdminCreateDto[email=$email, memoriesEnabled=$memoriesEnabled, name=$name, notify=$notify, password=$password, quotaSizeInBytes=$quotaSizeInBytes, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -117,14 +117,14 @@ class CreateUserDto {
return json;
}
/// Returns a new [CreateUserDto] instance and imports its values from
/// Returns a new [UserAdminCreateDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static CreateUserDto? fromJson(dynamic value) {
static UserAdminCreateDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return CreateUserDto(
return UserAdminCreateDto(
email: mapValueOfType<String>(json, r'email')!,
memoriesEnabled: mapValueOfType<bool>(json, r'memoriesEnabled'),
name: mapValueOfType<String>(json, r'name')!,
@ -138,11 +138,11 @@ class CreateUserDto {
return null;
}
static List<CreateUserDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <CreateUserDto>[];
static List<UserAdminCreateDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <UserAdminCreateDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = CreateUserDto.fromJson(row);
final value = UserAdminCreateDto.fromJson(row);
if (value != null) {
result.add(value);
}
@ -151,12 +151,12 @@ class CreateUserDto {
return result.toList(growable: growable);
}
static Map<String, CreateUserDto> mapFromJson(dynamic json) {
final map = <String, CreateUserDto>{};
static Map<String, UserAdminCreateDto> mapFromJson(dynamic json) {
final map = <String, UserAdminCreateDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = CreateUserDto.fromJson(entry.value);
final value = UserAdminCreateDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
@ -165,14 +165,14 @@ class CreateUserDto {
return map;
}
// maps a json object with a list of CreateUserDto-objects as value to a dart map
static Map<String, List<CreateUserDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<CreateUserDto>>{};
// maps a json object with a list of UserAdminCreateDto-objects as value to a dart map
static Map<String, List<UserAdminCreateDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<UserAdminCreateDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = CreateUserDto.listFromJson(entry.value, growable: growable,);
map[entry.key] = UserAdminCreateDto.listFromJson(entry.value, growable: growable,);
}
}
return map;

View File

@ -10,9 +10,9 @@
part of openapi.api;
class DeleteUserDto {
/// Returns a new [DeleteUserDto] instance.
DeleteUserDto({
class UserAdminDeleteDto {
/// Returns a new [UserAdminDeleteDto] instance.
UserAdminDeleteDto({
this.force,
});
@ -25,7 +25,7 @@ class DeleteUserDto {
bool? force;
@override
bool operator ==(Object other) => identical(this, other) || other is DeleteUserDto &&
bool operator ==(Object other) => identical(this, other) || other is UserAdminDeleteDto &&
other.force == force;
@override
@ -34,7 +34,7 @@ class DeleteUserDto {
(force == null ? 0 : force!.hashCode);
@override
String toString() => 'DeleteUserDto[force=$force]';
String toString() => 'UserAdminDeleteDto[force=$force]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -46,25 +46,25 @@ class DeleteUserDto {
return json;
}
/// Returns a new [DeleteUserDto] instance and imports its values from
/// Returns a new [UserAdminDeleteDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DeleteUserDto? fromJson(dynamic value) {
static UserAdminDeleteDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return DeleteUserDto(
return UserAdminDeleteDto(
force: mapValueOfType<bool>(json, r'force'),
);
}
return null;
}
static List<DeleteUserDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <DeleteUserDto>[];
static List<UserAdminDeleteDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <UserAdminDeleteDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = DeleteUserDto.fromJson(row);
final value = UserAdminDeleteDto.fromJson(row);
if (value != null) {
result.add(value);
}
@ -73,12 +73,12 @@ class DeleteUserDto {
return result.toList(growable: growable);
}
static Map<String, DeleteUserDto> mapFromJson(dynamic json) {
final map = <String, DeleteUserDto>{};
static Map<String, UserAdminDeleteDto> mapFromJson(dynamic json) {
final map = <String, UserAdminDeleteDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = DeleteUserDto.fromJson(entry.value);
final value = UserAdminDeleteDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
@ -87,14 +87,14 @@ class DeleteUserDto {
return map;
}
// maps a json object with a list of DeleteUserDto-objects as value to a dart map
static Map<String, List<DeleteUserDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<DeleteUserDto>>{};
// maps a json object with a list of UserAdminDeleteDto-objects as value to a dart map
static Map<String, List<UserAdminDeleteDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<UserAdminDeleteDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = DeleteUserDto.listFromJson(entry.value, growable: growable,);
map[entry.key] = UserAdminDeleteDto.listFromJson(entry.value, growable: growable,);
}
}
return map;

View File

@ -0,0 +1,243 @@
//
// 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 UserAdminResponseDto {
/// Returns a new [UserAdminResponseDto] instance.
UserAdminResponseDto({
required this.avatarColor,
required this.createdAt,
required this.deletedAt,
required this.email,
required this.id,
required this.isAdmin,
this.memoriesEnabled,
required this.name,
required this.oauthId,
required this.profileImagePath,
required this.quotaSizeInBytes,
required this.quotaUsageInBytes,
required this.shouldChangePassword,
required this.status,
required this.storageLabel,
required this.updatedAt,
});
UserAvatarColor avatarColor;
DateTime createdAt;
DateTime? deletedAt;
String email;
String id;
bool isAdmin;
///
/// 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.
///
bool? memoriesEnabled;
String name;
String oauthId;
String profileImagePath;
int? quotaSizeInBytes;
int? quotaUsageInBytes;
bool shouldChangePassword;
UserStatus status;
String? storageLabel;
DateTime updatedAt;
@override
bool operator ==(Object other) => identical(this, other) || other is UserAdminResponseDto &&
other.avatarColor == avatarColor &&
other.createdAt == createdAt &&
other.deletedAt == deletedAt &&
other.email == email &&
other.id == id &&
other.isAdmin == isAdmin &&
other.memoriesEnabled == memoriesEnabled &&
other.name == name &&
other.oauthId == oauthId &&
other.profileImagePath == profileImagePath &&
other.quotaSizeInBytes == quotaSizeInBytes &&
other.quotaUsageInBytes == quotaUsageInBytes &&
other.shouldChangePassword == shouldChangePassword &&
other.status == status &&
other.storageLabel == storageLabel &&
other.updatedAt == updatedAt;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(avatarColor.hashCode) +
(createdAt.hashCode) +
(deletedAt == null ? 0 : deletedAt!.hashCode) +
(email.hashCode) +
(id.hashCode) +
(isAdmin.hashCode) +
(memoriesEnabled == null ? 0 : memoriesEnabled!.hashCode) +
(name.hashCode) +
(oauthId.hashCode) +
(profileImagePath.hashCode) +
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
(quotaUsageInBytes == null ? 0 : quotaUsageInBytes!.hashCode) +
(shouldChangePassword.hashCode) +
(status.hashCode) +
(storageLabel == null ? 0 : storageLabel!.hashCode) +
(updatedAt.hashCode);
@override
String toString() => 'UserAdminResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, status=$status, storageLabel=$storageLabel, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'avatarColor'] = this.avatarColor;
json[r'createdAt'] = this.createdAt.toUtc().toIso8601String();
if (this.deletedAt != null) {
json[r'deletedAt'] = this.deletedAt!.toUtc().toIso8601String();
} else {
// json[r'deletedAt'] = null;
}
json[r'email'] = this.email;
json[r'id'] = this.id;
json[r'isAdmin'] = this.isAdmin;
if (this.memoriesEnabled != null) {
json[r'memoriesEnabled'] = this.memoriesEnabled;
} else {
// json[r'memoriesEnabled'] = null;
}
json[r'name'] = this.name;
json[r'oauthId'] = this.oauthId;
json[r'profileImagePath'] = this.profileImagePath;
if (this.quotaSizeInBytes != null) {
json[r'quotaSizeInBytes'] = this.quotaSizeInBytes;
} else {
// json[r'quotaSizeInBytes'] = null;
}
if (this.quotaUsageInBytes != null) {
json[r'quotaUsageInBytes'] = this.quotaUsageInBytes;
} else {
// json[r'quotaUsageInBytes'] = null;
}
json[r'shouldChangePassword'] = this.shouldChangePassword;
json[r'status'] = this.status;
if (this.storageLabel != null) {
json[r'storageLabel'] = this.storageLabel;
} else {
// json[r'storageLabel'] = null;
}
json[r'updatedAt'] = this.updatedAt.toUtc().toIso8601String();
return json;
}
/// Returns a new [UserAdminResponseDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static UserAdminResponseDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return UserAdminResponseDto(
avatarColor: UserAvatarColor.fromJson(json[r'avatarColor'])!,
createdAt: mapDateTime(json, r'createdAt', r'')!,
deletedAt: mapDateTime(json, r'deletedAt', r''),
email: mapValueOfType<String>(json, r'email')!,
id: mapValueOfType<String>(json, r'id')!,
isAdmin: mapValueOfType<bool>(json, r'isAdmin')!,
memoriesEnabled: mapValueOfType<bool>(json, r'memoriesEnabled'),
name: mapValueOfType<String>(json, r'name')!,
oauthId: mapValueOfType<String>(json, r'oauthId')!,
profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!,
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
quotaUsageInBytes: mapValueOfType<int>(json, r'quotaUsageInBytes'),
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
status: UserStatus.fromJson(json[r'status'])!,
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
updatedAt: mapDateTime(json, r'updatedAt', r'')!,
);
}
return null;
}
static List<UserAdminResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <UserAdminResponseDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = UserAdminResponseDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, UserAdminResponseDto> mapFromJson(dynamic json) {
final map = <String, UserAdminResponseDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = UserAdminResponseDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of UserAdminResponseDto-objects as value to a dart map
static Map<String, List<UserAdminResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<UserAdminResponseDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = UserAdminResponseDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'avatarColor',
'createdAt',
'deletedAt',
'email',
'id',
'isAdmin',
'name',
'oauthId',
'profileImagePath',
'quotaSizeInBytes',
'quotaUsageInBytes',
'shouldChangePassword',
'status',
'storageLabel',
'updatedAt',
};
}

View File

@ -10,13 +10,11 @@
part of openapi.api;
class UpdateUserDto {
/// Returns a new [UpdateUserDto] instance.
UpdateUserDto({
class UserAdminUpdateDto {
/// Returns a new [UserAdminUpdateDto] instance.
UserAdminUpdateDto({
this.avatarColor,
this.email,
required this.id,
this.isAdmin,
this.memoriesEnabled,
this.name,
this.password,
@ -41,16 +39,6 @@ class UpdateUserDto {
///
String? email;
String id;
///
/// 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.
///
bool? isAdmin;
///
/// 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
@ -86,20 +74,12 @@ class UpdateUserDto {
///
bool? shouldChangePassword;
///
/// 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.
///
String? storageLabel;
@override
bool operator ==(Object other) => identical(this, other) || other is UpdateUserDto &&
bool operator ==(Object other) => identical(this, other) || other is UserAdminUpdateDto &&
other.avatarColor == avatarColor &&
other.email == email &&
other.id == id &&
other.isAdmin == isAdmin &&
other.memoriesEnabled == memoriesEnabled &&
other.name == name &&
other.password == password &&
@ -112,8 +92,6 @@ class UpdateUserDto {
// ignore: unnecessary_parenthesis
(avatarColor == null ? 0 : avatarColor!.hashCode) +
(email == null ? 0 : email!.hashCode) +
(id.hashCode) +
(isAdmin == null ? 0 : isAdmin!.hashCode) +
(memoriesEnabled == null ? 0 : memoriesEnabled!.hashCode) +
(name == null ? 0 : name!.hashCode) +
(password == null ? 0 : password!.hashCode) +
@ -122,7 +100,7 @@ class UpdateUserDto {
(storageLabel == null ? 0 : storageLabel!.hashCode);
@override
String toString() => 'UpdateUserDto[avatarColor=$avatarColor, email=$email, id=$id, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, password=$password, quotaSizeInBytes=$quotaSizeInBytes, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel]';
String toString() => 'UserAdminUpdateDto[avatarColor=$avatarColor, email=$email, memoriesEnabled=$memoriesEnabled, name=$name, password=$password, quotaSizeInBytes=$quotaSizeInBytes, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -135,12 +113,6 @@ class UpdateUserDto {
json[r'email'] = this.email;
} else {
// json[r'email'] = null;
}
json[r'id'] = this.id;
if (this.isAdmin != null) {
json[r'isAdmin'] = this.isAdmin;
} else {
// json[r'isAdmin'] = null;
}
if (this.memoriesEnabled != null) {
json[r'memoriesEnabled'] = this.memoriesEnabled;
@ -175,18 +147,16 @@ class UpdateUserDto {
return json;
}
/// Returns a new [UpdateUserDto] instance and imports its values from
/// Returns a new [UserAdminUpdateDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static UpdateUserDto? fromJson(dynamic value) {
static UserAdminUpdateDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return UpdateUserDto(
return UserAdminUpdateDto(
avatarColor: UserAvatarColor.fromJson(json[r'avatarColor']),
email: mapValueOfType<String>(json, r'email'),
id: mapValueOfType<String>(json, r'id')!,
isAdmin: mapValueOfType<bool>(json, r'isAdmin'),
memoriesEnabled: mapValueOfType<bool>(json, r'memoriesEnabled'),
name: mapValueOfType<String>(json, r'name'),
password: mapValueOfType<String>(json, r'password'),
@ -198,11 +168,11 @@ class UpdateUserDto {
return null;
}
static List<UpdateUserDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <UpdateUserDto>[];
static List<UserAdminUpdateDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <UserAdminUpdateDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = UpdateUserDto.fromJson(row);
final value = UserAdminUpdateDto.fromJson(row);
if (value != null) {
result.add(value);
}
@ -211,12 +181,12 @@ class UpdateUserDto {
return result.toList(growable: growable);
}
static Map<String, UpdateUserDto> mapFromJson(dynamic json) {
final map = <String, UpdateUserDto>{};
static Map<String, UserAdminUpdateDto> mapFromJson(dynamic json) {
final map = <String, UserAdminUpdateDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = UpdateUserDto.fromJson(entry.value);
final value = UserAdminUpdateDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
@ -225,14 +195,14 @@ class UpdateUserDto {
return map;
}
// maps a json object with a list of UpdateUserDto-objects as value to a dart map
static Map<String, List<UpdateUserDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<UpdateUserDto>>{};
// maps a json object with a list of UserAdminUpdateDto-objects as value to a dart map
static Map<String, List<UserAdminUpdateDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<UserAdminUpdateDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = UpdateUserDto.listFromJson(entry.value, growable: growable,);
map[entry.key] = UserAdminUpdateDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
@ -240,7 +210,6 @@ class UpdateUserDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'id',
};
}

View File

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

View File

@ -14,141 +14,49 @@ class UserResponseDto {
/// Returns a new [UserResponseDto] instance.
UserResponseDto({
required this.avatarColor,
required this.createdAt,
required this.deletedAt,
required this.email,
required this.id,
required this.isAdmin,
this.memoriesEnabled,
required this.name,
required this.oauthId,
required this.profileImagePath,
required this.quotaSizeInBytes,
required this.quotaUsageInBytes,
required this.shouldChangePassword,
required this.status,
required this.storageLabel,
required this.updatedAt,
});
UserAvatarColor avatarColor;
DateTime createdAt;
DateTime? deletedAt;
String email;
String id;
bool isAdmin;
///
/// 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.
///
bool? memoriesEnabled;
String name;
String oauthId;
String profileImagePath;
int? quotaSizeInBytes;
int? quotaUsageInBytes;
bool shouldChangePassword;
UserStatus status;
String? storageLabel;
DateTime updatedAt;
@override
bool operator ==(Object other) => identical(this, other) || other is UserResponseDto &&
other.avatarColor == avatarColor &&
other.createdAt == createdAt &&
other.deletedAt == deletedAt &&
other.email == email &&
other.id == id &&
other.isAdmin == isAdmin &&
other.memoriesEnabled == memoriesEnabled &&
other.name == name &&
other.oauthId == oauthId &&
other.profileImagePath == profileImagePath &&
other.quotaSizeInBytes == quotaSizeInBytes &&
other.quotaUsageInBytes == quotaUsageInBytes &&
other.shouldChangePassword == shouldChangePassword &&
other.status == status &&
other.storageLabel == storageLabel &&
other.updatedAt == updatedAt;
other.profileImagePath == profileImagePath;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(avatarColor.hashCode) +
(createdAt.hashCode) +
(deletedAt == null ? 0 : deletedAt!.hashCode) +
(email.hashCode) +
(id.hashCode) +
(isAdmin.hashCode) +
(memoriesEnabled == null ? 0 : memoriesEnabled!.hashCode) +
(name.hashCode) +
(oauthId.hashCode) +
(profileImagePath.hashCode) +
(quotaSizeInBytes == null ? 0 : quotaSizeInBytes!.hashCode) +
(quotaUsageInBytes == null ? 0 : quotaUsageInBytes!.hashCode) +
(shouldChangePassword.hashCode) +
(status.hashCode) +
(storageLabel == null ? 0 : storageLabel!.hashCode) +
(updatedAt.hashCode);
(profileImagePath.hashCode);
@override
String toString() => 'UserResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, status=$status, storageLabel=$storageLabel, updatedAt=$updatedAt]';
String toString() => 'UserResponseDto[avatarColor=$avatarColor, email=$email, id=$id, name=$name, profileImagePath=$profileImagePath]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'avatarColor'] = this.avatarColor;
json[r'createdAt'] = this.createdAt.toUtc().toIso8601String();
if (this.deletedAt != null) {
json[r'deletedAt'] = this.deletedAt!.toUtc().toIso8601String();
} else {
// json[r'deletedAt'] = null;
}
json[r'email'] = this.email;
json[r'id'] = this.id;
json[r'isAdmin'] = this.isAdmin;
if (this.memoriesEnabled != null) {
json[r'memoriesEnabled'] = this.memoriesEnabled;
} else {
// json[r'memoriesEnabled'] = null;
}
json[r'name'] = this.name;
json[r'oauthId'] = this.oauthId;
json[r'profileImagePath'] = this.profileImagePath;
if (this.quotaSizeInBytes != null) {
json[r'quotaSizeInBytes'] = this.quotaSizeInBytes;
} else {
// json[r'quotaSizeInBytes'] = null;
}
if (this.quotaUsageInBytes != null) {
json[r'quotaUsageInBytes'] = this.quotaUsageInBytes;
} else {
// json[r'quotaUsageInBytes'] = null;
}
json[r'shouldChangePassword'] = this.shouldChangePassword;
json[r'status'] = this.status;
if (this.storageLabel != null) {
json[r'storageLabel'] = this.storageLabel;
} else {
// json[r'storageLabel'] = null;
}
json[r'updatedAt'] = this.updatedAt.toUtc().toIso8601String();
return json;
}
@ -161,21 +69,10 @@ class UserResponseDto {
return UserResponseDto(
avatarColor: UserAvatarColor.fromJson(json[r'avatarColor'])!,
createdAt: mapDateTime(json, r'createdAt', r'')!,
deletedAt: mapDateTime(json, r'deletedAt', r''),
email: mapValueOfType<String>(json, r'email')!,
id: mapValueOfType<String>(json, r'id')!,
isAdmin: mapValueOfType<bool>(json, r'isAdmin')!,
memoriesEnabled: mapValueOfType<bool>(json, r'memoriesEnabled'),
name: mapValueOfType<String>(json, r'name')!,
oauthId: mapValueOfType<String>(json, r'oauthId')!,
profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!,
quotaSizeInBytes: mapValueOfType<int>(json, r'quotaSizeInBytes'),
quotaUsageInBytes: mapValueOfType<int>(json, r'quotaUsageInBytes'),
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
status: UserStatus.fromJson(json[r'status'])!,
storageLabel: mapValueOfType<String>(json, r'storageLabel'),
updatedAt: mapDateTime(json, r'updatedAt', r'')!,
);
}
return null;
@ -224,20 +121,10 @@ class UserResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'avatarColor',
'createdAt',
'deletedAt',
'email',
'id',
'isAdmin',
'name',
'oauthId',
'profileImagePath',
'quotaSizeInBytes',
'quotaUsageInBytes',
'shouldChangePassword',
'status',
'storageLabel',
'updatedAt',
};
}

View File

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