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

feat: sync stacks (#19629)

This commit is contained in:
Jason Rasmussen
2025-06-30 15:26:41 -04:00
committed by GitHub
parent 095ace8687
commit 181a7e115f
35 changed files with 646 additions and 62 deletions

View File

@ -265,6 +265,8 @@ 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';
part 'model/sync_stack_delete_v1.dart';
part 'model/sync_stack_v1.dart';
part 'model/sync_stream_dto.dart';
part 'model/sync_user_delete_v1.dart';
part 'model/sync_user_v1.dart';

View File

@ -586,6 +586,10 @@ class ApiClient {
return SyncPartnerV1.fromJson(value);
case 'SyncRequestType':
return SyncRequestTypeTypeTransformer().decode(value);
case 'SyncStackDeleteV1':
return SyncStackDeleteV1.fromJson(value);
case 'SyncStackV1':
return SyncStackV1.fromJson(value);
case 'SyncStreamDto':
return SyncStreamDto.fromJson(value);
case 'SyncUserDeleteV1':

View File

@ -51,6 +51,8 @@ class SyncEntityType {
static const memoryDeleteV1 = SyncEntityType._(r'MemoryDeleteV1');
static const memoryToAssetV1 = SyncEntityType._(r'MemoryToAssetV1');
static const memoryToAssetDeleteV1 = SyncEntityType._(r'MemoryToAssetDeleteV1');
static const stackV1 = SyncEntityType._(r'StackV1');
static const stackDeleteV1 = SyncEntityType._(r'StackDeleteV1');
static const syncAckV1 = SyncEntityType._(r'SyncAckV1');
/// List of all possible values in this [enum][SyncEntityType].
@ -83,6 +85,8 @@ class SyncEntityType {
memoryDeleteV1,
memoryToAssetV1,
memoryToAssetDeleteV1,
stackV1,
stackDeleteV1,
syncAckV1,
];
@ -150,6 +154,8 @@ class SyncEntityTypeTypeTransformer {
case r'MemoryDeleteV1': return SyncEntityType.memoryDeleteV1;
case r'MemoryToAssetV1': return SyncEntityType.memoryToAssetV1;
case r'MemoryToAssetDeleteV1': return SyncEntityType.memoryToAssetDeleteV1;
case r'StackV1': return SyncEntityType.stackV1;
case r'StackDeleteV1': return SyncEntityType.stackDeleteV1;
case r'SyncAckV1': return SyncEntityType.syncAckV1;
default:
if (!allowNull) {

View File

@ -36,6 +36,7 @@ class SyncRequestType {
static const albumAssetExifsV1 = SyncRequestType._(r'AlbumAssetExifsV1');
static const memoriesV1 = SyncRequestType._(r'MemoriesV1');
static const memoryToAssetsV1 = SyncRequestType._(r'MemoryToAssetsV1');
static const stacksV1 = SyncRequestType._(r'StacksV1');
/// List of all possible values in this [enum][SyncRequestType].
static const values = <SyncRequestType>[
@ -52,6 +53,7 @@ class SyncRequestType {
albumAssetExifsV1,
memoriesV1,
memoryToAssetsV1,
stacksV1,
];
static SyncRequestType? fromJson(dynamic value) => SyncRequestTypeTypeTransformer().decode(value);
@ -103,6 +105,7 @@ class SyncRequestTypeTypeTransformer {
case r'AlbumAssetExifsV1': return SyncRequestType.albumAssetExifsV1;
case r'MemoriesV1': return SyncRequestType.memoriesV1;
case r'MemoryToAssetsV1': return SyncRequestType.memoryToAssetsV1;
case r'StacksV1': return SyncRequestType.stacksV1;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');

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

View File

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