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

feat(server) Tagging system (#1046)

This commit is contained in:
Alex
2022-12-05 11:56:44 -06:00
committed by GitHub
parent 6e2763b72c
commit 5de8ea162d
74 changed files with 8768 additions and 167 deletions

View File

@ -43,51 +43,48 @@ class AlbumResponseDto {
List<AssetResponseDto> assets;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is AlbumResponseDto &&
other.assetCount == assetCount &&
other.id == id &&
other.ownerId == ownerId &&
other.albumName == albumName &&
other.createdAt == createdAt &&
other.albumThumbnailAssetId == albumThumbnailAssetId &&
other.shared == shared &&
other.sharedUsers == sharedUsers &&
other.assets == assets;
bool operator ==(Object other) => identical(this, other) || other is AlbumResponseDto &&
other.assetCount == assetCount &&
other.id == id &&
other.ownerId == ownerId &&
other.albumName == albumName &&
other.createdAt == createdAt &&
other.albumThumbnailAssetId == albumThumbnailAssetId &&
other.shared == shared &&
other.sharedUsers == sharedUsers &&
other.assets == assets;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(assetCount.hashCode) +
(id.hashCode) +
(ownerId.hashCode) +
(albumName.hashCode) +
(createdAt.hashCode) +
(albumThumbnailAssetId == null ? 0 : albumThumbnailAssetId!.hashCode) +
(shared.hashCode) +
(sharedUsers.hashCode) +
(assets.hashCode);
// ignore: unnecessary_parenthesis
(assetCount.hashCode) +
(id.hashCode) +
(ownerId.hashCode) +
(albumName.hashCode) +
(createdAt.hashCode) +
(albumThumbnailAssetId == null ? 0 : albumThumbnailAssetId!.hashCode) +
(shared.hashCode) +
(sharedUsers.hashCode) +
(assets.hashCode);
@override
String toString() =>
'AlbumResponseDto[assetCount=$assetCount, id=$id, ownerId=$ownerId, albumName=$albumName, createdAt=$createdAt, albumThumbnailAssetId=$albumThumbnailAssetId, shared=$shared, sharedUsers=$sharedUsers, assets=$assets]';
String toString() => 'AlbumResponseDto[assetCount=$assetCount, id=$id, ownerId=$ownerId, albumName=$albumName, createdAt=$createdAt, albumThumbnailAssetId=$albumThumbnailAssetId, shared=$shared, sharedUsers=$sharedUsers, assets=$assets]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'assetCount'] = assetCount;
_json[r'id'] = id;
_json[r'ownerId'] = ownerId;
_json[r'albumName'] = albumName;
_json[r'createdAt'] = createdAt;
_json[r'assetCount'] = assetCount;
_json[r'id'] = id;
_json[r'ownerId'] = ownerId;
_json[r'albumName'] = albumName;
_json[r'createdAt'] = createdAt;
if (albumThumbnailAssetId != null) {
_json[r'albumThumbnailAssetId'] = albumThumbnailAssetId;
} else {
_json[r'albumThumbnailAssetId'] = null;
}
_json[r'shared'] = shared;
_json[r'sharedUsers'] = sharedUsers;
_json[r'assets'] = assets;
_json[r'shared'] = shared;
_json[r'sharedUsers'] = sharedUsers;
_json[r'assets'] = assets;
return _json;
}
@ -101,13 +98,13 @@ class AlbumResponseDto {
// 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 "AlbumResponseDto[$key]" is missing from JSON.');
// assert(json[key] != null, 'Required key "AlbumResponseDto[$key]" has a null value in JSON.');
// });
// return true;
// }());
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "AlbumResponseDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "AlbumResponseDto[$key]" has a null value in JSON.');
});
return true;
}());
return AlbumResponseDto(
assetCount: mapValueOfType<int>(json, r'assetCount')!,
@ -115,8 +112,7 @@ class AlbumResponseDto {
ownerId: mapValueOfType<String>(json, r'ownerId')!,
albumName: mapValueOfType<String>(json, r'albumName')!,
createdAt: mapValueOfType<String>(json, r'createdAt')!,
albumThumbnailAssetId:
mapValueOfType<String>(json, r'albumThumbnailAssetId'),
albumThumbnailAssetId: mapValueOfType<String>(json, r'albumThumbnailAssetId'),
shared: mapValueOfType<bool>(json, r'shared')!,
sharedUsers: UserResponseDto.listFromJson(json[r'sharedUsers'])!,
assets: AssetResponseDto.listFromJson(json[r'assets'])!,
@ -125,10 +121,7 @@ class AlbumResponseDto {
return null;
}
static List<AlbumResponseDto>? listFromJson(
dynamic json, {
bool growable = false,
}) {
static List<AlbumResponseDto>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <AlbumResponseDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
@ -156,18 +149,12 @@ class AlbumResponseDto {
}
// maps a json object with a list of AlbumResponseDto-objects as value to a dart map
static Map<String, List<AlbumResponseDto>> mapListFromJson(
dynamic json, {
bool growable = false,
}) {
static Map<String, List<AlbumResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<AlbumResponseDto>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AlbumResponseDto.listFromJson(
entry.value,
growable: growable,
);
final value = AlbumResponseDto.listFromJson(entry.value, growable: growable,);
if (value != null) {
map[entry.key] = value;
}
@ -189,3 +176,4 @@ class AlbumResponseDto {
'assets',
};
}

384
mobile/openapi/lib/model/asset_entity.dart generated Normal file
View File

@ -0,0 +1,384 @@
//
// 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 AssetEntity {
/// Returns a new [AssetEntity] instance.
AssetEntity({
required this.id,
required this.deviceAssetId,
required this.userId,
required this.deviceId,
required this.type,
required this.originalPath,
required this.resizePath,
required this.webpPath,
required this.encodedVideoPath,
required this.createdAt,
required this.modifiedAt,
required this.isFavorite,
required this.mimeType,
this.checksum,
required this.duration,
required this.isVisible,
required this.livePhotoVideoId,
this.exifInfo,
this.smartInfo,
this.tags = const [],
});
String id;
String deviceAssetId;
String userId;
String deviceId;
AssetEntityTypeEnum type;
String originalPath;
String? resizePath;
String? webpPath;
String encodedVideoPath;
String createdAt;
String modifiedAt;
bool isFavorite;
String? mimeType;
Object? checksum;
String? duration;
bool isVisible;
String? livePhotoVideoId;
///
/// 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.
///
ExifEntity? exifInfo;
///
/// 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.
///
SmartInfoEntity? smartInfo;
List<TagEntity> tags;
@override
bool operator ==(Object other) => identical(this, other) || other is AssetEntity &&
other.id == id &&
other.deviceAssetId == deviceAssetId &&
other.userId == userId &&
other.deviceId == deviceId &&
other.type == type &&
other.originalPath == originalPath &&
other.resizePath == resizePath &&
other.webpPath == webpPath &&
other.encodedVideoPath == encodedVideoPath &&
other.createdAt == createdAt &&
other.modifiedAt == modifiedAt &&
other.isFavorite == isFavorite &&
other.mimeType == mimeType &&
other.checksum == checksum &&
other.duration == duration &&
other.isVisible == isVisible &&
other.livePhotoVideoId == livePhotoVideoId &&
other.exifInfo == exifInfo &&
other.smartInfo == smartInfo &&
other.tags == tags;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(id.hashCode) +
(deviceAssetId.hashCode) +
(userId.hashCode) +
(deviceId.hashCode) +
(type.hashCode) +
(originalPath.hashCode) +
(resizePath == null ? 0 : resizePath!.hashCode) +
(webpPath == null ? 0 : webpPath!.hashCode) +
(encodedVideoPath.hashCode) +
(createdAt.hashCode) +
(modifiedAt.hashCode) +
(isFavorite.hashCode) +
(mimeType == null ? 0 : mimeType!.hashCode) +
(checksum == null ? 0 : checksum!.hashCode) +
(duration == null ? 0 : duration!.hashCode) +
(isVisible.hashCode) +
(livePhotoVideoId == null ? 0 : livePhotoVideoId!.hashCode) +
(exifInfo == null ? 0 : exifInfo!.hashCode) +
(smartInfo == null ? 0 : smartInfo!.hashCode) +
(tags.hashCode);
@override
String toString() => 'AssetEntity[id=$id, deviceAssetId=$deviceAssetId, userId=$userId, deviceId=$deviceId, type=$type, originalPath=$originalPath, resizePath=$resizePath, webpPath=$webpPath, encodedVideoPath=$encodedVideoPath, createdAt=$createdAt, modifiedAt=$modifiedAt, isFavorite=$isFavorite, mimeType=$mimeType, checksum=$checksum, duration=$duration, isVisible=$isVisible, livePhotoVideoId=$livePhotoVideoId, exifInfo=$exifInfo, smartInfo=$smartInfo, tags=$tags]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'deviceAssetId'] = deviceAssetId;
_json[r'userId'] = userId;
_json[r'deviceId'] = deviceId;
_json[r'type'] = type;
_json[r'originalPath'] = originalPath;
if (resizePath != null) {
_json[r'resizePath'] = resizePath;
} else {
_json[r'resizePath'] = null;
}
if (webpPath != null) {
_json[r'webpPath'] = webpPath;
} else {
_json[r'webpPath'] = null;
}
_json[r'encodedVideoPath'] = encodedVideoPath;
_json[r'createdAt'] = createdAt;
_json[r'modifiedAt'] = modifiedAt;
_json[r'isFavorite'] = isFavorite;
if (mimeType != null) {
_json[r'mimeType'] = mimeType;
} else {
_json[r'mimeType'] = null;
}
if (checksum != null) {
_json[r'checksum'] = checksum;
} else {
_json[r'checksum'] = null;
}
if (duration != null) {
_json[r'duration'] = duration;
} else {
_json[r'duration'] = null;
}
_json[r'isVisible'] = isVisible;
if (livePhotoVideoId != null) {
_json[r'livePhotoVideoId'] = livePhotoVideoId;
} else {
_json[r'livePhotoVideoId'] = null;
}
if (exifInfo != null) {
_json[r'exifInfo'] = exifInfo;
} else {
_json[r'exifInfo'] = null;
}
if (smartInfo != null) {
_json[r'smartInfo'] = smartInfo;
} else {
_json[r'smartInfo'] = null;
}
_json[r'tags'] = tags;
return _json;
}
/// Returns a new [AssetEntity] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AssetEntity? 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 "AssetEntity[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "AssetEntity[$key]" has a null value in JSON.');
});
return true;
}());
return AssetEntity(
id: mapValueOfType<String>(json, r'id')!,
deviceAssetId: mapValueOfType<String>(json, r'deviceAssetId')!,
userId: mapValueOfType<String>(json, r'userId')!,
deviceId: mapValueOfType<String>(json, r'deviceId')!,
type: AssetEntityTypeEnum.fromJson(json[r'type'])!,
originalPath: mapValueOfType<String>(json, r'originalPath')!,
resizePath: mapValueOfType<String>(json, r'resizePath'),
webpPath: mapValueOfType<String>(json, r'webpPath'),
encodedVideoPath: mapValueOfType<String>(json, r'encodedVideoPath')!,
createdAt: mapValueOfType<String>(json, r'createdAt')!,
modifiedAt: mapValueOfType<String>(json, r'modifiedAt')!,
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
mimeType: mapValueOfType<String>(json, r'mimeType'),
checksum: mapValueOfType<Object>(json, r'checksum'),
duration: mapValueOfType<String>(json, r'duration'),
isVisible: mapValueOfType<bool>(json, r'isVisible')!,
livePhotoVideoId: mapValueOfType<String>(json, r'livePhotoVideoId'),
exifInfo: ExifEntity.fromJson(json[r'exifInfo']),
smartInfo: SmartInfoEntity.fromJson(json[r'smartInfo']),
tags: TagEntity.listFromJson(json[r'tags'])!,
);
}
return null;
}
static List<AssetEntity>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <AssetEntity>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = AssetEntity.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, AssetEntity> mapFromJson(dynamic json) {
final map = <String, AssetEntity>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AssetEntity.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of AssetEntity-objects as value to a dart map
static Map<String, List<AssetEntity>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<AssetEntity>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AssetEntity.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>{
'id',
'deviceAssetId',
'userId',
'deviceId',
'type',
'originalPath',
'resizePath',
'webpPath',
'encodedVideoPath',
'createdAt',
'modifiedAt',
'isFavorite',
'mimeType',
'duration',
'isVisible',
'livePhotoVideoId',
'tags',
};
}
class AssetEntityTypeEnum {
/// Instantiate a new enum with the provided [value].
const AssetEntityTypeEnum._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const IMAGE = AssetEntityTypeEnum._(r'IMAGE');
static const VIDEO = AssetEntityTypeEnum._(r'VIDEO');
static const AUDIO = AssetEntityTypeEnum._(r'AUDIO');
static const OTHER = AssetEntityTypeEnum._(r'OTHER');
/// List of all possible values in this [enum][AssetEntityTypeEnum].
static const values = <AssetEntityTypeEnum>[
IMAGE,
VIDEO,
AUDIO,
OTHER,
];
static AssetEntityTypeEnum? fromJson(dynamic value) => AssetEntityTypeEnumTypeTransformer().decode(value);
static List<AssetEntityTypeEnum>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <AssetEntityTypeEnum>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = AssetEntityTypeEnum.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
}
/// Transformation class that can [encode] an instance of [AssetEntityTypeEnum] to String,
/// and [decode] dynamic data back to [AssetEntityTypeEnum].
class AssetEntityTypeEnumTypeTransformer {
factory AssetEntityTypeEnumTypeTransformer() => _instance ??= const AssetEntityTypeEnumTypeTransformer._();
const AssetEntityTypeEnumTypeTransformer._();
String encode(AssetEntityTypeEnum data) => data.value;
/// Decodes a [dynamic value][data] to a AssetEntityTypeEnum.
///
/// 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.
AssetEntityTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data.toString()) {
case r'IMAGE': return AssetEntityTypeEnum.IMAGE;
case r'VIDEO': return AssetEntityTypeEnum.VIDEO;
case r'AUDIO': return AssetEntityTypeEnum.AUDIO;
case r'OTHER': return AssetEntityTypeEnum.OTHER;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [AssetEntityTypeEnumTypeTransformer] instance.
static AssetEntityTypeEnumTypeTransformer? _instance;
}

View File

@ -30,6 +30,7 @@ class AssetResponseDto {
this.exifInfo,
this.smartInfo,
this.livePhotoVideoId,
this.tags = const [],
});
AssetTypeEnum type;
@ -78,6 +79,8 @@ class AssetResponseDto {
String? livePhotoVideoId;
List<TagResponseDto> tags;
@override
bool operator ==(Object other) => identical(this, other) || other is AssetResponseDto &&
other.type == type &&
@ -96,7 +99,8 @@ class AssetResponseDto {
other.encodedVideoPath == encodedVideoPath &&
other.exifInfo == exifInfo &&
other.smartInfo == smartInfo &&
other.livePhotoVideoId == livePhotoVideoId;
other.livePhotoVideoId == livePhotoVideoId &&
other.tags == tags;
@override
int get hashCode =>
@ -117,10 +121,11 @@ class AssetResponseDto {
(encodedVideoPath == null ? 0 : encodedVideoPath!.hashCode) +
(exifInfo == null ? 0 : exifInfo!.hashCode) +
(smartInfo == null ? 0 : smartInfo!.hashCode) +
(livePhotoVideoId == null ? 0 : livePhotoVideoId!.hashCode);
(livePhotoVideoId == null ? 0 : livePhotoVideoId!.hashCode) +
(tags.hashCode);
@override
String toString() => 'AssetResponseDto[type=$type, id=$id, deviceAssetId=$deviceAssetId, ownerId=$ownerId, deviceId=$deviceId, originalPath=$originalPath, resizePath=$resizePath, createdAt=$createdAt, modifiedAt=$modifiedAt, isFavorite=$isFavorite, mimeType=$mimeType, duration=$duration, webpPath=$webpPath, encodedVideoPath=$encodedVideoPath, exifInfo=$exifInfo, smartInfo=$smartInfo, livePhotoVideoId=$livePhotoVideoId]';
String toString() => 'AssetResponseDto[type=$type, id=$id, deviceAssetId=$deviceAssetId, ownerId=$ownerId, deviceId=$deviceId, originalPath=$originalPath, resizePath=$resizePath, createdAt=$createdAt, modifiedAt=$modifiedAt, isFavorite=$isFavorite, mimeType=$mimeType, duration=$duration, webpPath=$webpPath, encodedVideoPath=$encodedVideoPath, exifInfo=$exifInfo, smartInfo=$smartInfo, livePhotoVideoId=$livePhotoVideoId, tags=$tags]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
@ -169,6 +174,7 @@ class AssetResponseDto {
} else {
_json[r'livePhotoVideoId'] = null;
}
_json[r'tags'] = tags;
return _json;
}
@ -208,6 +214,7 @@ class AssetResponseDto {
exifInfo: ExifResponseDto.fromJson(json[r'exifInfo']),
smartInfo: SmartInfoResponseDto.fromJson(json[r'smartInfo']),
livePhotoVideoId: mapValueOfType<String>(json, r'livePhotoVideoId'),
tags: TagResponseDto.listFromJson(json[r'tags'])!,
);
}
return null;
@ -270,6 +277,7 @@ class AssetResponseDto {
'mimeType',
'duration',
'webpPath',
'tags',
};
}

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

414
mobile/openapi/lib/model/exif_entity.dart generated Normal file
View File

@ -0,0 +1,414 @@
//
// 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 ExifEntity {
/// Returns a new [ExifEntity] instance.
ExifEntity({
required this.id,
required this.assetId,
required this.description,
required this.exifImageWidth,
required this.exifImageHeight,
required this.fileSizeInByte,
required this.orientation,
required this.dateTimeOriginal,
required this.modifyDate,
required this.latitude,
required this.longitude,
required this.city,
required this.state,
required this.country,
required this.make,
required this.model,
required this.imageName,
required this.lensModel,
required this.fNumber,
required this.focalLength,
required this.iso,
required this.exposureTime,
this.fps,
this.asset,
required this.exifTextSearchableColumn,
});
String id;
String assetId;
/// General info
String description;
num? exifImageWidth;
num? exifImageHeight;
num? fileSizeInByte;
String? orientation;
DateTime? dateTimeOriginal;
DateTime? modifyDate;
num? latitude;
num? longitude;
String? city;
String? state;
String? country;
/// Image info
String? make;
String? model;
String? imageName;
String? lensModel;
num? fNumber;
num? focalLength;
num? iso;
num? exposureTime;
/// Video info
num? fps;
///
/// 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.
///
AssetEntity? asset;
String exifTextSearchableColumn;
@override
bool operator ==(Object other) => identical(this, other) || other is ExifEntity &&
other.id == id &&
other.assetId == assetId &&
other.description == description &&
other.exifImageWidth == exifImageWidth &&
other.exifImageHeight == exifImageHeight &&
other.fileSizeInByte == fileSizeInByte &&
other.orientation == orientation &&
other.dateTimeOriginal == dateTimeOriginal &&
other.modifyDate == modifyDate &&
other.latitude == latitude &&
other.longitude == longitude &&
other.city == city &&
other.state == state &&
other.country == country &&
other.make == make &&
other.model == model &&
other.imageName == imageName &&
other.lensModel == lensModel &&
other.fNumber == fNumber &&
other.focalLength == focalLength &&
other.iso == iso &&
other.exposureTime == exposureTime &&
other.fps == fps &&
other.asset == asset &&
other.exifTextSearchableColumn == exifTextSearchableColumn;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(id.hashCode) +
(assetId.hashCode) +
(description.hashCode) +
(exifImageWidth == null ? 0 : exifImageWidth!.hashCode) +
(exifImageHeight == null ? 0 : exifImageHeight!.hashCode) +
(fileSizeInByte == null ? 0 : fileSizeInByte!.hashCode) +
(orientation == null ? 0 : orientation!.hashCode) +
(dateTimeOriginal == null ? 0 : dateTimeOriginal!.hashCode) +
(modifyDate == null ? 0 : modifyDate!.hashCode) +
(latitude == null ? 0 : latitude!.hashCode) +
(longitude == null ? 0 : longitude!.hashCode) +
(city == null ? 0 : city!.hashCode) +
(state == null ? 0 : state!.hashCode) +
(country == null ? 0 : country!.hashCode) +
(make == null ? 0 : make!.hashCode) +
(model == null ? 0 : model!.hashCode) +
(imageName == null ? 0 : imageName!.hashCode) +
(lensModel == null ? 0 : lensModel!.hashCode) +
(fNumber == null ? 0 : fNumber!.hashCode) +
(focalLength == null ? 0 : focalLength!.hashCode) +
(iso == null ? 0 : iso!.hashCode) +
(exposureTime == null ? 0 : exposureTime!.hashCode) +
(fps == null ? 0 : fps!.hashCode) +
(asset == null ? 0 : asset!.hashCode) +
(exifTextSearchableColumn.hashCode);
@override
String toString() => 'ExifEntity[id=$id, assetId=$assetId, description=$description, exifImageWidth=$exifImageWidth, exifImageHeight=$exifImageHeight, fileSizeInByte=$fileSizeInByte, orientation=$orientation, dateTimeOriginal=$dateTimeOriginal, modifyDate=$modifyDate, latitude=$latitude, longitude=$longitude, city=$city, state=$state, country=$country, make=$make, model=$model, imageName=$imageName, lensModel=$lensModel, fNumber=$fNumber, focalLength=$focalLength, iso=$iso, exposureTime=$exposureTime, fps=$fps, asset=$asset, exifTextSearchableColumn=$exifTextSearchableColumn]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'assetId'] = assetId;
_json[r'description'] = description;
if (exifImageWidth != null) {
_json[r'exifImageWidth'] = exifImageWidth;
} else {
_json[r'exifImageWidth'] = null;
}
if (exifImageHeight != null) {
_json[r'exifImageHeight'] = exifImageHeight;
} else {
_json[r'exifImageHeight'] = null;
}
if (fileSizeInByte != null) {
_json[r'fileSizeInByte'] = fileSizeInByte;
} else {
_json[r'fileSizeInByte'] = null;
}
if (orientation != null) {
_json[r'orientation'] = orientation;
} else {
_json[r'orientation'] = null;
}
if (dateTimeOriginal != null) {
_json[r'dateTimeOriginal'] = dateTimeOriginal!.toUtc().toIso8601String();
} else {
_json[r'dateTimeOriginal'] = null;
}
if (modifyDate != null) {
_json[r'modifyDate'] = modifyDate!.toUtc().toIso8601String();
} else {
_json[r'modifyDate'] = null;
}
if (latitude != null) {
_json[r'latitude'] = latitude;
} else {
_json[r'latitude'] = null;
}
if (longitude != null) {
_json[r'longitude'] = longitude;
} else {
_json[r'longitude'] = null;
}
if (city != null) {
_json[r'city'] = city;
} else {
_json[r'city'] = null;
}
if (state != null) {
_json[r'state'] = state;
} else {
_json[r'state'] = null;
}
if (country != null) {
_json[r'country'] = country;
} else {
_json[r'country'] = null;
}
if (make != null) {
_json[r'make'] = make;
} else {
_json[r'make'] = null;
}
if (model != null) {
_json[r'model'] = model;
} else {
_json[r'model'] = null;
}
if (imageName != null) {
_json[r'imageName'] = imageName;
} else {
_json[r'imageName'] = null;
}
if (lensModel != null) {
_json[r'lensModel'] = lensModel;
} else {
_json[r'lensModel'] = null;
}
if (fNumber != null) {
_json[r'fNumber'] = fNumber;
} else {
_json[r'fNumber'] = null;
}
if (focalLength != null) {
_json[r'focalLength'] = focalLength;
} else {
_json[r'focalLength'] = null;
}
if (iso != null) {
_json[r'iso'] = iso;
} else {
_json[r'iso'] = null;
}
if (exposureTime != null) {
_json[r'exposureTime'] = exposureTime;
} else {
_json[r'exposureTime'] = null;
}
if (fps != null) {
_json[r'fps'] = fps;
} else {
_json[r'fps'] = null;
}
if (asset != null) {
_json[r'asset'] = asset;
} else {
_json[r'asset'] = null;
}
_json[r'exifTextSearchableColumn'] = exifTextSearchableColumn;
return _json;
}
/// Returns a new [ExifEntity] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static ExifEntity? 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 "ExifEntity[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "ExifEntity[$key]" has a null value in JSON.');
});
return true;
}());
return ExifEntity(
id: mapValueOfType<String>(json, r'id')!,
assetId: mapValueOfType<String>(json, r'assetId')!,
description: mapValueOfType<String>(json, r'description')!,
exifImageWidth: json[r'exifImageWidth'] == null
? null
: num.parse(json[r'exifImageWidth'].toString()),
exifImageHeight: json[r'exifImageHeight'] == null
? null
: num.parse(json[r'exifImageHeight'].toString()),
fileSizeInByte: json[r'fileSizeInByte'] == null
? null
: num.parse(json[r'fileSizeInByte'].toString()),
orientation: mapValueOfType<String>(json, r'orientation'),
dateTimeOriginal: mapDateTime(json, r'dateTimeOriginal', ''),
modifyDate: mapDateTime(json, r'modifyDate', ''),
latitude: json[r'latitude'] == null
? null
: num.parse(json[r'latitude'].toString()),
longitude: json[r'longitude'] == null
? null
: num.parse(json[r'longitude'].toString()),
city: mapValueOfType<String>(json, r'city'),
state: mapValueOfType<String>(json, r'state'),
country: mapValueOfType<String>(json, r'country'),
make: mapValueOfType<String>(json, r'make'),
model: mapValueOfType<String>(json, r'model'),
imageName: mapValueOfType<String>(json, r'imageName'),
lensModel: mapValueOfType<String>(json, r'lensModel'),
fNumber: json[r'fNumber'] == null
? null
: num.parse(json[r'fNumber'].toString()),
focalLength: json[r'focalLength'] == null
? null
: num.parse(json[r'focalLength'].toString()),
iso: json[r'iso'] == null
? null
: num.parse(json[r'iso'].toString()),
exposureTime: json[r'exposureTime'] == null
? null
: num.parse(json[r'exposureTime'].toString()),
fps: json[r'fps'] == null
? null
: num.parse(json[r'fps'].toString()),
asset: AssetEntity.fromJson(json[r'asset']),
exifTextSearchableColumn: mapValueOfType<String>(json, r'exifTextSearchableColumn')!,
);
}
return null;
}
static List<ExifEntity>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <ExifEntity>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = ExifEntity.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, ExifEntity> mapFromJson(dynamic json) {
final map = <String, ExifEntity>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = ExifEntity.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of ExifEntity-objects as value to a dart map
static Map<String, List<ExifEntity>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<ExifEntity>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = ExifEntity.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>{
'id',
'assetId',
'description',
'exifImageWidth',
'exifImageHeight',
'fileSizeInByte',
'orientation',
'dateTimeOriginal',
'modifyDate',
'latitude',
'longitude',
'city',
'state',
'country',
'make',
'model',
'imageName',
'lensModel',
'fNumber',
'focalLength',
'iso',
'exposureTime',
'exifTextSearchableColumn',
};
}

View File

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

236
mobile/openapi/lib/model/tag_entity.dart generated Normal file
View File

@ -0,0 +1,236 @@
//
// 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 TagEntity {
/// Returns a new [TagEntity] instance.
TagEntity({
required this.id,
required this.type,
required this.name,
required this.userId,
required this.renameTagId,
this.assets = const [],
required this.user,
});
String id;
TagEntityTypeEnum type;
String name;
String userId;
String renameTagId;
List<AssetEntity> assets;
UserEntity user;
@override
bool operator ==(Object other) => identical(this, other) || other is TagEntity &&
other.id == id &&
other.type == type &&
other.name == name &&
other.userId == userId &&
other.renameTagId == renameTagId &&
other.assets == assets &&
other.user == user;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(id.hashCode) +
(type.hashCode) +
(name.hashCode) +
(userId.hashCode) +
(renameTagId.hashCode) +
(assets.hashCode) +
(user.hashCode);
@override
String toString() => 'TagEntity[id=$id, type=$type, name=$name, userId=$userId, renameTagId=$renameTagId, assets=$assets, user=$user]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'type'] = type;
_json[r'name'] = name;
_json[r'userId'] = userId;
_json[r'renameTagId'] = renameTagId;
_json[r'assets'] = assets;
_json[r'user'] = user;
return _json;
}
/// Returns a new [TagEntity] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static TagEntity? 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 "TagEntity[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "TagEntity[$key]" has a null value in JSON.');
});
return true;
}());
return TagEntity(
id: mapValueOfType<String>(json, r'id')!,
type: TagEntityTypeEnum.fromJson(json[r'type'])!,
name: mapValueOfType<String>(json, r'name')!,
userId: mapValueOfType<String>(json, r'userId')!,
renameTagId: mapValueOfType<String>(json, r'renameTagId')!,
assets: AssetEntity.listFromJson(json[r'assets'])!,
user: UserEntity.fromJson(json[r'user'])!,
);
}
return null;
}
static List<TagEntity>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <TagEntity>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = TagEntity.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, TagEntity> mapFromJson(dynamic json) {
final map = <String, TagEntity>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = TagEntity.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of TagEntity-objects as value to a dart map
static Map<String, List<TagEntity>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<TagEntity>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = TagEntity.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>{
'id',
'type',
'name',
'userId',
'renameTagId',
'assets',
'user',
};
}
class TagEntityTypeEnum {
/// Instantiate a new enum with the provided [value].
const TagEntityTypeEnum._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const OBJECT = TagEntityTypeEnum._(r'OBJECT');
static const FACE = TagEntityTypeEnum._(r'FACE');
static const CUSTOM = TagEntityTypeEnum._(r'CUSTOM');
/// List of all possible values in this [enum][TagEntityTypeEnum].
static const values = <TagEntityTypeEnum>[
OBJECT,
FACE,
CUSTOM,
];
static TagEntityTypeEnum? fromJson(dynamic value) => TagEntityTypeEnumTypeTransformer().decode(value);
static List<TagEntityTypeEnum>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <TagEntityTypeEnum>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = TagEntityTypeEnum.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
}
/// Transformation class that can [encode] an instance of [TagEntityTypeEnum] to String,
/// and [decode] dynamic data back to [TagEntityTypeEnum].
class TagEntityTypeEnumTypeTransformer {
factory TagEntityTypeEnumTypeTransformer() => _instance ??= const TagEntityTypeEnumTypeTransformer._();
const TagEntityTypeEnumTypeTransformer._();
String encode(TagEntityTypeEnum data) => data.value;
/// Decodes a [dynamic value][data] to a TagEntityTypeEnum.
///
/// 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.
TagEntityTypeEnum? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data.toString()) {
case r'OBJECT': return TagEntityTypeEnum.OBJECT;
case r'FACE': return TagEntityTypeEnum.FACE;
case r'CUSTOM': return TagEntityTypeEnum.CUSTOM;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [TagEntityTypeEnumTypeTransformer] instance.
static TagEntityTypeEnumTypeTransformer? _instance;
}

View File

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

View File

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

View File

@ -13,26 +13,42 @@ part of openapi.api;
class UpdateAssetDto {
/// Returns a new [UpdateAssetDto] instance.
UpdateAssetDto({
required this.isFavorite,
this.tagIds = const [],
this.isFavorite,
});
bool isFavorite;
List<String> tagIds;
///
/// 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? isFavorite;
@override
bool operator ==(Object other) => identical(this, other) || other is UpdateAssetDto &&
other.tagIds == tagIds &&
other.isFavorite == isFavorite;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(isFavorite.hashCode);
(tagIds.hashCode) +
(isFavorite == null ? 0 : isFavorite!.hashCode);
@override
String toString() => 'UpdateAssetDto[isFavorite=$isFavorite]';
String toString() => 'UpdateAssetDto[tagIds=$tagIds, isFavorite=$isFavorite]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'tagIds'] = tagIds;
if (isFavorite != null) {
_json[r'isFavorite'] = isFavorite;
} else {
_json[r'isFavorite'] = null;
}
return _json;
}
@ -55,7 +71,10 @@ class UpdateAssetDto {
}());
return UpdateAssetDto(
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
tagIds: json[r'tagIds'] is List
? (json[r'tagIds'] as List).cast<String>()
: const [],
isFavorite: mapValueOfType<bool>(json, r'isFavorite'),
);
}
return null;
@ -105,7 +124,6 @@ class UpdateAssetDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'isFavorite',
};
}

View File

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

234
mobile/openapi/lib/model/user_entity.dart generated Normal file
View File

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