This commit is contained in:
idubnori 2025-10-17 18:27:40 +02:00 committed by GitHub
commit 4bf5c8fab5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 361 additions and 10 deletions

View file

@ -15,6 +15,7 @@ class ActivityCreateDto {
ActivityCreateDto({
required this.albumId,
this.assetId,
this.assetIds = const [],
this.comment,
required this.type,
});
@ -29,6 +30,8 @@ class ActivityCreateDto {
///
String? assetId;
List<String> assetIds;
///
/// 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
@ -43,6 +46,7 @@ class ActivityCreateDto {
bool operator ==(Object other) => identical(this, other) || other is ActivityCreateDto &&
other.albumId == albumId &&
other.assetId == assetId &&
_deepEquality.equals(other.assetIds, assetIds) &&
other.comment == comment &&
other.type == type;
@ -51,11 +55,12 @@ class ActivityCreateDto {
// ignore: unnecessary_parenthesis
(albumId.hashCode) +
(assetId == null ? 0 : assetId!.hashCode) +
(assetIds.hashCode) +
(comment == null ? 0 : comment!.hashCode) +
(type.hashCode);
@override
String toString() => 'ActivityCreateDto[albumId=$albumId, assetId=$assetId, comment=$comment, type=$type]';
String toString() => 'ActivityCreateDto[albumId=$albumId, assetId=$assetId, assetIds=$assetIds, comment=$comment, type=$type]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -65,6 +70,7 @@ class ActivityCreateDto {
} else {
// json[r'assetId'] = null;
}
json[r'assetIds'] = this.assetIds;
if (this.comment != null) {
json[r'comment'] = this.comment;
} else {
@ -85,6 +91,9 @@ class ActivityCreateDto {
return ActivityCreateDto(
albumId: mapValueOfType<String>(json, r'albumId')!,
assetId: mapValueOfType<String>(json, r'assetId'),
assetIds: json[r'assetIds'] is Iterable
? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
comment: mapValueOfType<String>(json, r'comment'),
type: ReactionType.fromJson(json[r'type'])!,
);

View file

@ -14,6 +14,7 @@ class ActivityResponseDto {
/// Returns a new [ActivityResponseDto] instance.
ActivityResponseDto({
required this.assetId,
this.assetIds = const [],
this.comment,
required this.createdAt,
required this.id,
@ -23,6 +24,8 @@ class ActivityResponseDto {
String? assetId;
List<String>? assetIds;
String? comment;
DateTime createdAt;
@ -36,6 +39,7 @@ class ActivityResponseDto {
@override
bool operator ==(Object other) => identical(this, other) || other is ActivityResponseDto &&
other.assetId == assetId &&
_deepEquality.equals(other.assetIds, assetIds) &&
other.comment == comment &&
other.createdAt == createdAt &&
other.id == id &&
@ -46,6 +50,7 @@ class ActivityResponseDto {
int get hashCode =>
// ignore: unnecessary_parenthesis
(assetId == null ? 0 : assetId!.hashCode) +
(assetIds == null ? 0 : assetIds!.hashCode) +
(comment == null ? 0 : comment!.hashCode) +
(createdAt.hashCode) +
(id.hashCode) +
@ -53,7 +58,7 @@ class ActivityResponseDto {
(user.hashCode);
@override
String toString() => 'ActivityResponseDto[assetId=$assetId, comment=$comment, createdAt=$createdAt, id=$id, type=$type, user=$user]';
String toString() => 'ActivityResponseDto[assetId=$assetId, assetIds=$assetIds, comment=$comment, createdAt=$createdAt, id=$id, type=$type, user=$user]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -62,6 +67,11 @@ class ActivityResponseDto {
} else {
// json[r'assetId'] = null;
}
if (this.assetIds != null) {
json[r'assetIds'] = this.assetIds;
} else {
// json[r'assetIds'] = null;
}
if (this.comment != null) {
json[r'comment'] = this.comment;
} else {
@ -84,6 +94,9 @@ class ActivityResponseDto {
return ActivityResponseDto(
assetId: mapValueOfType<String>(json, r'assetId'),
assetIds: json[r'assetIds'] is Iterable
? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
comment: mapValueOfType<String>(json, r'comment'),
createdAt: mapDateTime(json, r'createdAt', r'')!,
id: mapValueOfType<String>(json, r'id')!,
@ -137,6 +150,7 @@ class ActivityResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'assetId',
'assetIds',
'createdAt',
'id',
'type',

View file

@ -25,11 +25,13 @@ class ReactionType {
static const comment = ReactionType._(r'comment');
static const like = ReactionType._(r'like');
static const asset = ReactionType._(r'asset');
/// List of all possible values in this [enum][ReactionType].
static const values = <ReactionType>[
comment,
like,
asset,
];
static ReactionType? fromJson(dynamic value) => ReactionTypeTypeTransformer().decode(value);
@ -70,6 +72,7 @@ class ReactionTypeTypeTransformer {
switch (data) {
case r'comment': return ReactionType.comment;
case r'like': return ReactionType.like;
case r'asset': return ReactionType.asset;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');