You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-07-16 07:24:40 +02:00
feat: sync assets, partner assets, exif, and partner exif (#16658)
* feat: sync assets, partner assets, exif, and partner exif Co-authored-by: Zack Pollard <zack@futo.org> Co-authored-by: Alex Tran <alex.tran1502@gmail.com> * refactor: remove duplicate where clause and orderBy statements in sync queries * fix: asset deletes not filtering by ownerId --------- Co-authored-by: Zack Pollard <zack@futo.org> Co-authored-by: Alex Tran <alex.tran1502@gmail.com> Co-authored-by: Zack Pollard <zackpollard@ymail.com>
This commit is contained in:
99
mobile/openapi/lib/model/sync_asset_delete_v1.dart
generated
Normal file
99
mobile/openapi/lib/model/sync_asset_delete_v1.dart
generated
Normal file
@ -0,0 +1,99 @@
|
||||
//
|
||||
// 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 SyncAssetDeleteV1 {
|
||||
/// Returns a new [SyncAssetDeleteV1] instance.
|
||||
SyncAssetDeleteV1({
|
||||
required this.assetId,
|
||||
});
|
||||
|
||||
String assetId;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SyncAssetDeleteV1 &&
|
||||
other.assetId == assetId;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(assetId.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SyncAssetDeleteV1[assetId=$assetId]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'assetId'] = this.assetId;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [SyncAssetDeleteV1] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static SyncAssetDeleteV1? fromJson(dynamic value) {
|
||||
upgradeDto(value, "SyncAssetDeleteV1");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return SyncAssetDeleteV1(
|
||||
assetId: mapValueOfType<String>(json, r'assetId')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<SyncAssetDeleteV1> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <SyncAssetDeleteV1>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = SyncAssetDeleteV1.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, SyncAssetDeleteV1> mapFromJson(dynamic json) {
|
||||
final map = <String, SyncAssetDeleteV1>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = SyncAssetDeleteV1.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of SyncAssetDeleteV1-objects as value to a dart map
|
||||
static Map<String, List<SyncAssetDeleteV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<SyncAssetDeleteV1>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = SyncAssetDeleteV1.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'assetId',
|
||||
};
|
||||
}
|
||||
|
387
mobile/openapi/lib/model/sync_asset_exif_v1.dart
generated
Normal file
387
mobile/openapi/lib/model/sync_asset_exif_v1.dart
generated
Normal file
@ -0,0 +1,387 @@
|
||||
//
|
||||
// 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 SyncAssetExifV1 {
|
||||
/// Returns a new [SyncAssetExifV1] instance.
|
||||
SyncAssetExifV1({
|
||||
required this.assetId,
|
||||
required this.city,
|
||||
required this.country,
|
||||
required this.dateTimeOriginal,
|
||||
required this.description,
|
||||
required this.exifImageHeight,
|
||||
required this.exifImageWidth,
|
||||
required this.exposureTime,
|
||||
required this.fNumber,
|
||||
required this.fileSizeInByte,
|
||||
required this.focalLength,
|
||||
required this.fps,
|
||||
required this.iso,
|
||||
required this.latitude,
|
||||
required this.lensModel,
|
||||
required this.longitude,
|
||||
required this.make,
|
||||
required this.model,
|
||||
required this.modifyDate,
|
||||
required this.orientation,
|
||||
required this.profileDescription,
|
||||
required this.projectionType,
|
||||
required this.rating,
|
||||
required this.state,
|
||||
required this.timeZone,
|
||||
});
|
||||
|
||||
String assetId;
|
||||
|
||||
String? city;
|
||||
|
||||
String? country;
|
||||
|
||||
DateTime? dateTimeOriginal;
|
||||
|
||||
String? description;
|
||||
|
||||
int? exifImageHeight;
|
||||
|
||||
int? exifImageWidth;
|
||||
|
||||
String? exposureTime;
|
||||
|
||||
int? fNumber;
|
||||
|
||||
int? fileSizeInByte;
|
||||
|
||||
int? focalLength;
|
||||
|
||||
int? fps;
|
||||
|
||||
int? iso;
|
||||
|
||||
int? latitude;
|
||||
|
||||
String? lensModel;
|
||||
|
||||
int? longitude;
|
||||
|
||||
String? make;
|
||||
|
||||
String? model;
|
||||
|
||||
DateTime? modifyDate;
|
||||
|
||||
String? orientation;
|
||||
|
||||
String? profileDescription;
|
||||
|
||||
String? projectionType;
|
||||
|
||||
int? rating;
|
||||
|
||||
String? state;
|
||||
|
||||
String? timeZone;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SyncAssetExifV1 &&
|
||||
other.assetId == assetId &&
|
||||
other.city == city &&
|
||||
other.country == country &&
|
||||
other.dateTimeOriginal == dateTimeOriginal &&
|
||||
other.description == description &&
|
||||
other.exifImageHeight == exifImageHeight &&
|
||||
other.exifImageWidth == exifImageWidth &&
|
||||
other.exposureTime == exposureTime &&
|
||||
other.fNumber == fNumber &&
|
||||
other.fileSizeInByte == fileSizeInByte &&
|
||||
other.focalLength == focalLength &&
|
||||
other.fps == fps &&
|
||||
other.iso == iso &&
|
||||
other.latitude == latitude &&
|
||||
other.lensModel == lensModel &&
|
||||
other.longitude == longitude &&
|
||||
other.make == make &&
|
||||
other.model == model &&
|
||||
other.modifyDate == modifyDate &&
|
||||
other.orientation == orientation &&
|
||||
other.profileDescription == profileDescription &&
|
||||
other.projectionType == projectionType &&
|
||||
other.rating == rating &&
|
||||
other.state == state &&
|
||||
other.timeZone == timeZone;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(assetId.hashCode) +
|
||||
(city == null ? 0 : city!.hashCode) +
|
||||
(country == null ? 0 : country!.hashCode) +
|
||||
(dateTimeOriginal == null ? 0 : dateTimeOriginal!.hashCode) +
|
||||
(description == null ? 0 : description!.hashCode) +
|
||||
(exifImageHeight == null ? 0 : exifImageHeight!.hashCode) +
|
||||
(exifImageWidth == null ? 0 : exifImageWidth!.hashCode) +
|
||||
(exposureTime == null ? 0 : exposureTime!.hashCode) +
|
||||
(fNumber == null ? 0 : fNumber!.hashCode) +
|
||||
(fileSizeInByte == null ? 0 : fileSizeInByte!.hashCode) +
|
||||
(focalLength == null ? 0 : focalLength!.hashCode) +
|
||||
(fps == null ? 0 : fps!.hashCode) +
|
||||
(iso == null ? 0 : iso!.hashCode) +
|
||||
(latitude == null ? 0 : latitude!.hashCode) +
|
||||
(lensModel == null ? 0 : lensModel!.hashCode) +
|
||||
(longitude == null ? 0 : longitude!.hashCode) +
|
||||
(make == null ? 0 : make!.hashCode) +
|
||||
(model == null ? 0 : model!.hashCode) +
|
||||
(modifyDate == null ? 0 : modifyDate!.hashCode) +
|
||||
(orientation == null ? 0 : orientation!.hashCode) +
|
||||
(profileDescription == null ? 0 : profileDescription!.hashCode) +
|
||||
(projectionType == null ? 0 : projectionType!.hashCode) +
|
||||
(rating == null ? 0 : rating!.hashCode) +
|
||||
(state == null ? 0 : state!.hashCode) +
|
||||
(timeZone == null ? 0 : timeZone!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SyncAssetExifV1[assetId=$assetId, city=$city, country=$country, dateTimeOriginal=$dateTimeOriginal, description=$description, exifImageHeight=$exifImageHeight, exifImageWidth=$exifImageWidth, exposureTime=$exposureTime, fNumber=$fNumber, fileSizeInByte=$fileSizeInByte, focalLength=$focalLength, fps=$fps, iso=$iso, latitude=$latitude, lensModel=$lensModel, longitude=$longitude, make=$make, model=$model, modifyDate=$modifyDate, orientation=$orientation, profileDescription=$profileDescription, projectionType=$projectionType, rating=$rating, state=$state, timeZone=$timeZone]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'assetId'] = this.assetId;
|
||||
if (this.city != null) {
|
||||
json[r'city'] = this.city;
|
||||
} else {
|
||||
// json[r'city'] = null;
|
||||
}
|
||||
if (this.country != null) {
|
||||
json[r'country'] = this.country;
|
||||
} else {
|
||||
// json[r'country'] = null;
|
||||
}
|
||||
if (this.dateTimeOriginal != null) {
|
||||
json[r'dateTimeOriginal'] = this.dateTimeOriginal!.toUtc().toIso8601String();
|
||||
} else {
|
||||
// json[r'dateTimeOriginal'] = null;
|
||||
}
|
||||
if (this.description != null) {
|
||||
json[r'description'] = this.description;
|
||||
} else {
|
||||
// json[r'description'] = null;
|
||||
}
|
||||
if (this.exifImageHeight != null) {
|
||||
json[r'exifImageHeight'] = this.exifImageHeight;
|
||||
} else {
|
||||
// json[r'exifImageHeight'] = null;
|
||||
}
|
||||
if (this.exifImageWidth != null) {
|
||||
json[r'exifImageWidth'] = this.exifImageWidth;
|
||||
} else {
|
||||
// json[r'exifImageWidth'] = null;
|
||||
}
|
||||
if (this.exposureTime != null) {
|
||||
json[r'exposureTime'] = this.exposureTime;
|
||||
} else {
|
||||
// json[r'exposureTime'] = null;
|
||||
}
|
||||
if (this.fNumber != null) {
|
||||
json[r'fNumber'] = this.fNumber;
|
||||
} else {
|
||||
// json[r'fNumber'] = null;
|
||||
}
|
||||
if (this.fileSizeInByte != null) {
|
||||
json[r'fileSizeInByte'] = this.fileSizeInByte;
|
||||
} else {
|
||||
// json[r'fileSizeInByte'] = null;
|
||||
}
|
||||
if (this.focalLength != null) {
|
||||
json[r'focalLength'] = this.focalLength;
|
||||
} else {
|
||||
// json[r'focalLength'] = null;
|
||||
}
|
||||
if (this.fps != null) {
|
||||
json[r'fps'] = this.fps;
|
||||
} else {
|
||||
// json[r'fps'] = null;
|
||||
}
|
||||
if (this.iso != null) {
|
||||
json[r'iso'] = this.iso;
|
||||
} else {
|
||||
// json[r'iso'] = null;
|
||||
}
|
||||
if (this.latitude != null) {
|
||||
json[r'latitude'] = this.latitude;
|
||||
} else {
|
||||
// json[r'latitude'] = null;
|
||||
}
|
||||
if (this.lensModel != null) {
|
||||
json[r'lensModel'] = this.lensModel;
|
||||
} else {
|
||||
// json[r'lensModel'] = null;
|
||||
}
|
||||
if (this.longitude != null) {
|
||||
json[r'longitude'] = this.longitude;
|
||||
} else {
|
||||
// json[r'longitude'] = null;
|
||||
}
|
||||
if (this.make != null) {
|
||||
json[r'make'] = this.make;
|
||||
} else {
|
||||
// json[r'make'] = null;
|
||||
}
|
||||
if (this.model != null) {
|
||||
json[r'model'] = this.model;
|
||||
} else {
|
||||
// json[r'model'] = null;
|
||||
}
|
||||
if (this.modifyDate != null) {
|
||||
json[r'modifyDate'] = this.modifyDate!.toUtc().toIso8601String();
|
||||
} else {
|
||||
// json[r'modifyDate'] = null;
|
||||
}
|
||||
if (this.orientation != null) {
|
||||
json[r'orientation'] = this.orientation;
|
||||
} else {
|
||||
// json[r'orientation'] = null;
|
||||
}
|
||||
if (this.profileDescription != null) {
|
||||
json[r'profileDescription'] = this.profileDescription;
|
||||
} else {
|
||||
// json[r'profileDescription'] = null;
|
||||
}
|
||||
if (this.projectionType != null) {
|
||||
json[r'projectionType'] = this.projectionType;
|
||||
} else {
|
||||
// json[r'projectionType'] = null;
|
||||
}
|
||||
if (this.rating != null) {
|
||||
json[r'rating'] = this.rating;
|
||||
} else {
|
||||
// json[r'rating'] = null;
|
||||
}
|
||||
if (this.state != null) {
|
||||
json[r'state'] = this.state;
|
||||
} else {
|
||||
// json[r'state'] = null;
|
||||
}
|
||||
if (this.timeZone != null) {
|
||||
json[r'timeZone'] = this.timeZone;
|
||||
} else {
|
||||
// json[r'timeZone'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [SyncAssetExifV1] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static SyncAssetExifV1? fromJson(dynamic value) {
|
||||
upgradeDto(value, "SyncAssetExifV1");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return SyncAssetExifV1(
|
||||
assetId: mapValueOfType<String>(json, r'assetId')!,
|
||||
city: mapValueOfType<String>(json, r'city'),
|
||||
country: mapValueOfType<String>(json, r'country'),
|
||||
dateTimeOriginal: mapDateTime(json, r'dateTimeOriginal', r''),
|
||||
description: mapValueOfType<String>(json, r'description'),
|
||||
exifImageHeight: mapValueOfType<int>(json, r'exifImageHeight'),
|
||||
exifImageWidth: mapValueOfType<int>(json, r'exifImageWidth'),
|
||||
exposureTime: mapValueOfType<String>(json, r'exposureTime'),
|
||||
fNumber: mapValueOfType<int>(json, r'fNumber'),
|
||||
fileSizeInByte: mapValueOfType<int>(json, r'fileSizeInByte'),
|
||||
focalLength: mapValueOfType<int>(json, r'focalLength'),
|
||||
fps: mapValueOfType<int>(json, r'fps'),
|
||||
iso: mapValueOfType<int>(json, r'iso'),
|
||||
latitude: mapValueOfType<int>(json, r'latitude'),
|
||||
lensModel: mapValueOfType<String>(json, r'lensModel'),
|
||||
longitude: mapValueOfType<int>(json, r'longitude'),
|
||||
make: mapValueOfType<String>(json, r'make'),
|
||||
model: mapValueOfType<String>(json, r'model'),
|
||||
modifyDate: mapDateTime(json, r'modifyDate', r''),
|
||||
orientation: mapValueOfType<String>(json, r'orientation'),
|
||||
profileDescription: mapValueOfType<String>(json, r'profileDescription'),
|
||||
projectionType: mapValueOfType<String>(json, r'projectionType'),
|
||||
rating: mapValueOfType<int>(json, r'rating'),
|
||||
state: mapValueOfType<String>(json, r'state'),
|
||||
timeZone: mapValueOfType<String>(json, r'timeZone'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<SyncAssetExifV1> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <SyncAssetExifV1>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = SyncAssetExifV1.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, SyncAssetExifV1> mapFromJson(dynamic json) {
|
||||
final map = <String, SyncAssetExifV1>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = SyncAssetExifV1.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of SyncAssetExifV1-objects as value to a dart map
|
||||
static Map<String, List<SyncAssetExifV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<SyncAssetExifV1>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = SyncAssetExifV1.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'assetId',
|
||||
'city',
|
||||
'country',
|
||||
'dateTimeOriginal',
|
||||
'description',
|
||||
'exifImageHeight',
|
||||
'exifImageWidth',
|
||||
'exposureTime',
|
||||
'fNumber',
|
||||
'fileSizeInByte',
|
||||
'focalLength',
|
||||
'fps',
|
||||
'iso',
|
||||
'latitude',
|
||||
'lensModel',
|
||||
'longitude',
|
||||
'make',
|
||||
'model',
|
||||
'modifyDate',
|
||||
'orientation',
|
||||
'profileDescription',
|
||||
'projectionType',
|
||||
'rating',
|
||||
'state',
|
||||
'timeZone',
|
||||
};
|
||||
}
|
||||
|
279
mobile/openapi/lib/model/sync_asset_v1.dart
generated
Normal file
279
mobile/openapi/lib/model/sync_asset_v1.dart
generated
Normal file
@ -0,0 +1,279 @@
|
||||
//
|
||||
// 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 SyncAssetV1 {
|
||||
/// Returns a new [SyncAssetV1] instance.
|
||||
SyncAssetV1({
|
||||
required this.checksum,
|
||||
required this.deletedAt,
|
||||
required this.fileCreatedAt,
|
||||
required this.fileModifiedAt,
|
||||
required this.id,
|
||||
required this.isFavorite,
|
||||
required this.isVisible,
|
||||
required this.localDateTime,
|
||||
required this.ownerId,
|
||||
required this.thumbhash,
|
||||
required this.type,
|
||||
});
|
||||
|
||||
String checksum;
|
||||
|
||||
DateTime? deletedAt;
|
||||
|
||||
DateTime? fileCreatedAt;
|
||||
|
||||
DateTime? fileModifiedAt;
|
||||
|
||||
String id;
|
||||
|
||||
bool isFavorite;
|
||||
|
||||
bool isVisible;
|
||||
|
||||
DateTime? localDateTime;
|
||||
|
||||
String ownerId;
|
||||
|
||||
String? thumbhash;
|
||||
|
||||
SyncAssetV1TypeEnum type;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SyncAssetV1 &&
|
||||
other.checksum == checksum &&
|
||||
other.deletedAt == deletedAt &&
|
||||
other.fileCreatedAt == fileCreatedAt &&
|
||||
other.fileModifiedAt == fileModifiedAt &&
|
||||
other.id == id &&
|
||||
other.isFavorite == isFavorite &&
|
||||
other.isVisible == isVisible &&
|
||||
other.localDateTime == localDateTime &&
|
||||
other.ownerId == ownerId &&
|
||||
other.thumbhash == thumbhash &&
|
||||
other.type == type;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(checksum.hashCode) +
|
||||
(deletedAt == null ? 0 : deletedAt!.hashCode) +
|
||||
(fileCreatedAt == null ? 0 : fileCreatedAt!.hashCode) +
|
||||
(fileModifiedAt == null ? 0 : fileModifiedAt!.hashCode) +
|
||||
(id.hashCode) +
|
||||
(isFavorite.hashCode) +
|
||||
(isVisible.hashCode) +
|
||||
(localDateTime == null ? 0 : localDateTime!.hashCode) +
|
||||
(ownerId.hashCode) +
|
||||
(thumbhash == null ? 0 : thumbhash!.hashCode) +
|
||||
(type.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SyncAssetV1[checksum=$checksum, deletedAt=$deletedAt, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, id=$id, isFavorite=$isFavorite, isVisible=$isVisible, localDateTime=$localDateTime, ownerId=$ownerId, thumbhash=$thumbhash, type=$type]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'checksum'] = this.checksum;
|
||||
if (this.deletedAt != null) {
|
||||
json[r'deletedAt'] = this.deletedAt!.toUtc().toIso8601String();
|
||||
} else {
|
||||
// json[r'deletedAt'] = null;
|
||||
}
|
||||
if (this.fileCreatedAt != null) {
|
||||
json[r'fileCreatedAt'] = this.fileCreatedAt!.toUtc().toIso8601String();
|
||||
} else {
|
||||
// json[r'fileCreatedAt'] = null;
|
||||
}
|
||||
if (this.fileModifiedAt != null) {
|
||||
json[r'fileModifiedAt'] = this.fileModifiedAt!.toUtc().toIso8601String();
|
||||
} else {
|
||||
// json[r'fileModifiedAt'] = null;
|
||||
}
|
||||
json[r'id'] = this.id;
|
||||
json[r'isFavorite'] = this.isFavorite;
|
||||
json[r'isVisible'] = this.isVisible;
|
||||
if (this.localDateTime != null) {
|
||||
json[r'localDateTime'] = this.localDateTime!.toUtc().toIso8601String();
|
||||
} else {
|
||||
// json[r'localDateTime'] = null;
|
||||
}
|
||||
json[r'ownerId'] = this.ownerId;
|
||||
if (this.thumbhash != null) {
|
||||
json[r'thumbhash'] = this.thumbhash;
|
||||
} else {
|
||||
// json[r'thumbhash'] = null;
|
||||
}
|
||||
json[r'type'] = this.type;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [SyncAssetV1] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static SyncAssetV1? fromJson(dynamic value) {
|
||||
upgradeDto(value, "SyncAssetV1");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return SyncAssetV1(
|
||||
checksum: mapValueOfType<String>(json, r'checksum')!,
|
||||
deletedAt: mapDateTime(json, r'deletedAt', r''),
|
||||
fileCreatedAt: mapDateTime(json, r'fileCreatedAt', r''),
|
||||
fileModifiedAt: mapDateTime(json, r'fileModifiedAt', r''),
|
||||
id: mapValueOfType<String>(json, r'id')!,
|
||||
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
|
||||
isVisible: mapValueOfType<bool>(json, r'isVisible')!,
|
||||
localDateTime: mapDateTime(json, r'localDateTime', r''),
|
||||
ownerId: mapValueOfType<String>(json, r'ownerId')!,
|
||||
thumbhash: mapValueOfType<String>(json, r'thumbhash'),
|
||||
type: SyncAssetV1TypeEnum.fromJson(json[r'type'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<SyncAssetV1> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <SyncAssetV1>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = SyncAssetV1.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, SyncAssetV1> mapFromJson(dynamic json) {
|
||||
final map = <String, SyncAssetV1>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = SyncAssetV1.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of SyncAssetV1-objects as value to a dart map
|
||||
static Map<String, List<SyncAssetV1>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<SyncAssetV1>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = SyncAssetV1.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'checksum',
|
||||
'deletedAt',
|
||||
'fileCreatedAt',
|
||||
'fileModifiedAt',
|
||||
'id',
|
||||
'isFavorite',
|
||||
'isVisible',
|
||||
'localDateTime',
|
||||
'ownerId',
|
||||
'thumbhash',
|
||||
'type',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class SyncAssetV1TypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const SyncAssetV1TypeEnum._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
static const IMAGE = SyncAssetV1TypeEnum._(r'IMAGE');
|
||||
static const VIDEO = SyncAssetV1TypeEnum._(r'VIDEO');
|
||||
static const AUDIO = SyncAssetV1TypeEnum._(r'AUDIO');
|
||||
static const OTHER = SyncAssetV1TypeEnum._(r'OTHER');
|
||||
|
||||
/// List of all possible values in this [enum][SyncAssetV1TypeEnum].
|
||||
static const values = <SyncAssetV1TypeEnum>[
|
||||
IMAGE,
|
||||
VIDEO,
|
||||
AUDIO,
|
||||
OTHER,
|
||||
];
|
||||
|
||||
static SyncAssetV1TypeEnum? fromJson(dynamic value) => SyncAssetV1TypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<SyncAssetV1TypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <SyncAssetV1TypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = SyncAssetV1TypeEnum.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [SyncAssetV1TypeEnum] to String,
|
||||
/// and [decode] dynamic data back to [SyncAssetV1TypeEnum].
|
||||
class SyncAssetV1TypeEnumTypeTransformer {
|
||||
factory SyncAssetV1TypeEnumTypeTransformer() => _instance ??= const SyncAssetV1TypeEnumTypeTransformer._();
|
||||
|
||||
const SyncAssetV1TypeEnumTypeTransformer._();
|
||||
|
||||
String encode(SyncAssetV1TypeEnum data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a SyncAssetV1TypeEnum.
|
||||
///
|
||||
/// 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.
|
||||
SyncAssetV1TypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case r'IMAGE': return SyncAssetV1TypeEnum.IMAGE;
|
||||
case r'VIDEO': return SyncAssetV1TypeEnum.VIDEO;
|
||||
case r'AUDIO': return SyncAssetV1TypeEnum.AUDIO;
|
||||
case r'OTHER': return SyncAssetV1TypeEnum.OTHER;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [SyncAssetV1TypeEnumTypeTransformer] instance.
|
||||
static SyncAssetV1TypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
18
mobile/openapi/lib/model/sync_entity_type.dart
generated
18
mobile/openapi/lib/model/sync_entity_type.dart
generated
@ -27,6 +27,12 @@ class SyncEntityType {
|
||||
static const userDeleteV1 = SyncEntityType._(r'UserDeleteV1');
|
||||
static const partnerV1 = SyncEntityType._(r'PartnerV1');
|
||||
static const partnerDeleteV1 = SyncEntityType._(r'PartnerDeleteV1');
|
||||
static const assetV1 = SyncEntityType._(r'AssetV1');
|
||||
static const assetDeleteV1 = SyncEntityType._(r'AssetDeleteV1');
|
||||
static const assetExifV1 = SyncEntityType._(r'AssetExifV1');
|
||||
static const partnerAssetV1 = SyncEntityType._(r'PartnerAssetV1');
|
||||
static const partnerAssetDeleteV1 = SyncEntityType._(r'PartnerAssetDeleteV1');
|
||||
static const partnerAssetExifV1 = SyncEntityType._(r'PartnerAssetExifV1');
|
||||
|
||||
/// List of all possible values in this [enum][SyncEntityType].
|
||||
static const values = <SyncEntityType>[
|
||||
@ -34,6 +40,12 @@ class SyncEntityType {
|
||||
userDeleteV1,
|
||||
partnerV1,
|
||||
partnerDeleteV1,
|
||||
assetV1,
|
||||
assetDeleteV1,
|
||||
assetExifV1,
|
||||
partnerAssetV1,
|
||||
partnerAssetDeleteV1,
|
||||
partnerAssetExifV1,
|
||||
];
|
||||
|
||||
static SyncEntityType? fromJson(dynamic value) => SyncEntityTypeTypeTransformer().decode(value);
|
||||
@ -76,6 +88,12 @@ class SyncEntityTypeTypeTransformer {
|
||||
case r'UserDeleteV1': return SyncEntityType.userDeleteV1;
|
||||
case r'PartnerV1': return SyncEntityType.partnerV1;
|
||||
case r'PartnerDeleteV1': return SyncEntityType.partnerDeleteV1;
|
||||
case r'AssetV1': return SyncEntityType.assetV1;
|
||||
case r'AssetDeleteV1': return SyncEntityType.assetDeleteV1;
|
||||
case r'AssetExifV1': return SyncEntityType.assetExifV1;
|
||||
case r'PartnerAssetV1': return SyncEntityType.partnerAssetV1;
|
||||
case r'PartnerAssetDeleteV1': return SyncEntityType.partnerAssetDeleteV1;
|
||||
case r'PartnerAssetExifV1': return SyncEntityType.partnerAssetExifV1;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
|
12
mobile/openapi/lib/model/sync_request_type.dart
generated
12
mobile/openapi/lib/model/sync_request_type.dart
generated
@ -25,11 +25,19 @@ class SyncRequestType {
|
||||
|
||||
static const usersV1 = SyncRequestType._(r'UsersV1');
|
||||
static const partnersV1 = SyncRequestType._(r'PartnersV1');
|
||||
static const assetsV1 = SyncRequestType._(r'AssetsV1');
|
||||
static const assetExifsV1 = SyncRequestType._(r'AssetExifsV1');
|
||||
static const partnerAssetsV1 = SyncRequestType._(r'PartnerAssetsV1');
|
||||
static const partnerAssetExifsV1 = SyncRequestType._(r'PartnerAssetExifsV1');
|
||||
|
||||
/// List of all possible values in this [enum][SyncRequestType].
|
||||
static const values = <SyncRequestType>[
|
||||
usersV1,
|
||||
partnersV1,
|
||||
assetsV1,
|
||||
assetExifsV1,
|
||||
partnerAssetsV1,
|
||||
partnerAssetExifsV1,
|
||||
];
|
||||
|
||||
static SyncRequestType? fromJson(dynamic value) => SyncRequestTypeTypeTransformer().decode(value);
|
||||
@ -70,6 +78,10 @@ class SyncRequestTypeTypeTransformer {
|
||||
switch (data) {
|
||||
case r'UsersV1': return SyncRequestType.usersV1;
|
||||
case r'PartnersV1': return SyncRequestType.partnersV1;
|
||||
case r'AssetsV1': return SyncRequestType.assetsV1;
|
||||
case r'AssetExifsV1': return SyncRequestType.assetExifsV1;
|
||||
case r'PartnerAssetsV1': return SyncRequestType.partnerAssetsV1;
|
||||
case r'PartnerAssetExifsV1': return SyncRequestType.partnerAssetExifsV1;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
|
Reference in New Issue
Block a user