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

feat: sync memories (#19579)

This commit is contained in:
Jason Rasmussen
2025-06-27 12:20:13 -04:00
committed by GitHub
parent 97aabe466e
commit 6feca56da8
31 changed files with 1482 additions and 203 deletions

View File

@ -258,6 +258,10 @@ part 'model/sync_asset_delete_v1.dart';
part 'model/sync_asset_exif_v1.dart';
part 'model/sync_asset_v1.dart';
part 'model/sync_entity_type.dart';
part 'model/sync_memory_asset_delete_v1.dart';
part 'model/sync_memory_asset_v1.dart';
part 'model/sync_memory_delete_v1.dart';
part 'model/sync_memory_v1.dart';
part 'model/sync_partner_delete_v1.dart';
part 'model/sync_partner_v1.dart';
part 'model/sync_request_type.dart';

View File

@ -572,6 +572,14 @@ class ApiClient {
return SyncAssetV1.fromJson(value);
case 'SyncEntityType':
return SyncEntityTypeTypeTransformer().decode(value);
case 'SyncMemoryAssetDeleteV1':
return SyncMemoryAssetDeleteV1.fromJson(value);
case 'SyncMemoryAssetV1':
return SyncMemoryAssetV1.fromJson(value);
case 'SyncMemoryDeleteV1':
return SyncMemoryDeleteV1.fromJson(value);
case 'SyncMemoryV1':
return SyncMemoryV1.fromJson(value);
case 'SyncPartnerDeleteV1':
return SyncPartnerDeleteV1.fromJson(value);
case 'SyncPartnerV1':

View File

@ -25,11 +25,11 @@ class SyncEntityType {
static const userV1 = SyncEntityType._(r'UserV1');
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 partnerV1 = SyncEntityType._(r'PartnerV1');
static const partnerDeleteV1 = SyncEntityType._(r'PartnerDeleteV1');
static const partnerAssetV1 = SyncEntityType._(r'PartnerAssetV1');
static const partnerAssetBackfillV1 = SyncEntityType._(r'PartnerAssetBackfillV1');
static const partnerAssetDeleteV1 = SyncEntityType._(r'PartnerAssetDeleteV1');
@ -47,17 +47,21 @@ class SyncEntityType {
static const albumToAssetV1 = SyncEntityType._(r'AlbumToAssetV1');
static const albumToAssetDeleteV1 = SyncEntityType._(r'AlbumToAssetDeleteV1');
static const albumToAssetBackfillV1 = SyncEntityType._(r'AlbumToAssetBackfillV1');
static const memoryV1 = SyncEntityType._(r'MemoryV1');
static const memoryDeleteV1 = SyncEntityType._(r'MemoryDeleteV1');
static const memoryToAssetV1 = SyncEntityType._(r'MemoryToAssetV1');
static const memoryToAssetDeleteV1 = SyncEntityType._(r'MemoryToAssetDeleteV1');
static const syncAckV1 = SyncEntityType._(r'SyncAckV1');
/// List of all possible values in this [enum][SyncEntityType].
static const values = <SyncEntityType>[
userV1,
userDeleteV1,
partnerV1,
partnerDeleteV1,
assetV1,
assetDeleteV1,
assetExifV1,
partnerV1,
partnerDeleteV1,
partnerAssetV1,
partnerAssetBackfillV1,
partnerAssetDeleteV1,
@ -75,6 +79,10 @@ class SyncEntityType {
albumToAssetV1,
albumToAssetDeleteV1,
albumToAssetBackfillV1,
memoryV1,
memoryDeleteV1,
memoryToAssetV1,
memoryToAssetDeleteV1,
syncAckV1,
];
@ -116,11 +124,11 @@ class SyncEntityTypeTypeTransformer {
switch (data) {
case r'UserV1': return SyncEntityType.userV1;
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'PartnerV1': return SyncEntityType.partnerV1;
case r'PartnerDeleteV1': return SyncEntityType.partnerDeleteV1;
case r'PartnerAssetV1': return SyncEntityType.partnerAssetV1;
case r'PartnerAssetBackfillV1': return SyncEntityType.partnerAssetBackfillV1;
case r'PartnerAssetDeleteV1': return SyncEntityType.partnerAssetDeleteV1;
@ -138,6 +146,10 @@ class SyncEntityTypeTypeTransformer {
case r'AlbumToAssetV1': return SyncEntityType.albumToAssetV1;
case r'AlbumToAssetDeleteV1': return SyncEntityType.albumToAssetDeleteV1;
case r'AlbumToAssetBackfillV1': return SyncEntityType.albumToAssetBackfillV1;
case r'MemoryV1': return SyncEntityType.memoryV1;
case r'MemoryDeleteV1': return SyncEntityType.memoryDeleteV1;
case r'MemoryToAssetV1': return SyncEntityType.memoryToAssetV1;
case r'MemoryToAssetDeleteV1': return SyncEntityType.memoryToAssetDeleteV1;
case r'SyncAckV1': return SyncEntityType.syncAckV1;
default:
if (!allowNull) {

View File

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

View File

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

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

View File

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

View File

@ -34,6 +34,8 @@ class SyncRequestType {
static const albumToAssetsV1 = SyncRequestType._(r'AlbumToAssetsV1');
static const albumAssetsV1 = SyncRequestType._(r'AlbumAssetsV1');
static const albumAssetExifsV1 = SyncRequestType._(r'AlbumAssetExifsV1');
static const memoriesV1 = SyncRequestType._(r'MemoriesV1');
static const memoryToAssetsV1 = SyncRequestType._(r'MemoryToAssetsV1');
/// List of all possible values in this [enum][SyncRequestType].
static const values = <SyncRequestType>[
@ -48,6 +50,8 @@ class SyncRequestType {
albumToAssetsV1,
albumAssetsV1,
albumAssetExifsV1,
memoriesV1,
memoryToAssetsV1,
];
static SyncRequestType? fromJson(dynamic value) => SyncRequestTypeTypeTransformer().decode(value);
@ -97,6 +101,8 @@ class SyncRequestTypeTypeTransformer {
case r'AlbumToAssetsV1': return SyncRequestType.albumToAssetsV1;
case r'AlbumAssetsV1': return SyncRequestType.albumAssetsV1;
case r'AlbumAssetExifsV1': return SyncRequestType.albumAssetExifsV1;
case r'MemoriesV1': return SyncRequestType.memoriesV1;
case r'MemoryToAssetsV1': return SyncRequestType.memoryToAssetsV1;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');