feat: asset metadata (#20446)

This commit is contained in:
Jason Rasmussen 2025-08-27 14:31:23 -04:00 committed by GitHub
parent 25a94bd117
commit 88072910da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 1999 additions and 21 deletions

View file

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

View file

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

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

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

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

View file

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

View file

@ -29,6 +29,8 @@ class SyncEntityType {
static const assetV1 = SyncEntityType._(r'AssetV1');
static const assetDeleteV1 = SyncEntityType._(r'AssetDeleteV1');
static const assetExifV1 = SyncEntityType._(r'AssetExifV1');
static const assetMetadataV1 = SyncEntityType._(r'AssetMetadataV1');
static const assetMetadataDeleteV1 = SyncEntityType._(r'AssetMetadataDeleteV1');
static const partnerV1 = SyncEntityType._(r'PartnerV1');
static const partnerDeleteV1 = SyncEntityType._(r'PartnerDeleteV1');
static const partnerAssetV1 = SyncEntityType._(r'PartnerAssetV1');
@ -76,6 +78,8 @@ class SyncEntityType {
assetV1,
assetDeleteV1,
assetExifV1,
assetMetadataV1,
assetMetadataDeleteV1,
partnerV1,
partnerDeleteV1,
partnerAssetV1,
@ -158,6 +162,8 @@ class SyncEntityTypeTypeTransformer {
case r'AssetV1': return SyncEntityType.assetV1;
case r'AssetDeleteV1': return SyncEntityType.assetDeleteV1;
case r'AssetExifV1': return SyncEntityType.assetExifV1;
case r'AssetMetadataV1': return SyncEntityType.assetMetadataV1;
case r'AssetMetadataDeleteV1': return SyncEntityType.assetMetadataDeleteV1;
case r'PartnerV1': return SyncEntityType.partnerV1;
case r'PartnerDeleteV1': return SyncEntityType.partnerDeleteV1;
case r'PartnerAssetV1': return SyncEntityType.partnerAssetV1;

View file

@ -30,6 +30,7 @@ class SyncRequestType {
static const albumAssetExifsV1 = SyncRequestType._(r'AlbumAssetExifsV1');
static const assetsV1 = SyncRequestType._(r'AssetsV1');
static const assetExifsV1 = SyncRequestType._(r'AssetExifsV1');
static const assetMetadataV1 = SyncRequestType._(r'AssetMetadataV1');
static const authUsersV1 = SyncRequestType._(r'AuthUsersV1');
static const memoriesV1 = SyncRequestType._(r'MemoriesV1');
static const memoryToAssetsV1 = SyncRequestType._(r'MemoryToAssetsV1');
@ -52,6 +53,7 @@ class SyncRequestType {
albumAssetExifsV1,
assetsV1,
assetExifsV1,
assetMetadataV1,
authUsersV1,
memoriesV1,
memoryToAssetsV1,
@ -109,6 +111,7 @@ class SyncRequestTypeTypeTransformer {
case r'AlbumAssetExifsV1': return SyncRequestType.albumAssetExifsV1;
case r'AssetsV1': return SyncRequestType.assetsV1;
case r'AssetExifsV1': return SyncRequestType.assetExifsV1;
case r'AssetMetadataV1': return SyncRequestType.assetMetadataV1;
case r'AuthUsersV1': return SyncRequestType.authUsersV1;
case r'MemoriesV1': return SyncRequestType.memoriesV1;
case r'MemoryToAssetsV1': return SyncRequestType.memoryToAssetsV1;