2022-07-13 14:23:48 +02:00
|
|
|
//
|
|
|
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
|
|
|
//
|
|
|
|
// @dart=2.12
|
|
|
|
|
|
|
|
// 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 AssetResponseDto {
|
|
|
|
/// Returns a new [AssetResponseDto] instance.
|
|
|
|
AssetResponseDto({
|
2023-08-01 18:49:18 +02:00
|
|
|
required this.checksum,
|
2022-07-13 14:23:48 +02:00
|
|
|
required this.deviceAssetId,
|
|
|
|
required this.deviceId,
|
2023-08-01 18:49:18 +02:00
|
|
|
required this.duration,
|
|
|
|
this.exifInfo,
|
2023-02-19 18:44:53 +02:00
|
|
|
required this.fileCreatedAt,
|
|
|
|
required this.fileModifiedAt,
|
2023-10-14 03:46:30 +02:00
|
|
|
required this.hasMetadata,
|
2023-08-01 18:49:18 +02:00
|
|
|
required this.id,
|
2023-04-12 17:37:52 +02:00
|
|
|
required this.isArchived,
|
2023-09-20 13:16:33 +02:00
|
|
|
required this.isExternal,
|
2023-08-01 18:49:18 +02:00
|
|
|
required this.isFavorite,
|
2023-09-20 13:16:33 +02:00
|
|
|
required this.isOffline,
|
|
|
|
required this.isReadOnly,
|
2023-10-06 09:01:14 +02:00
|
|
|
required this.isTrashed,
|
2023-09-20 13:16:33 +02:00
|
|
|
required this.libraryId,
|
2022-11-26 18:16:02 +02:00
|
|
|
this.livePhotoVideoId,
|
2023-10-05 00:11:11 +02:00
|
|
|
required this.localDateTime,
|
2023-08-01 18:49:18 +02:00
|
|
|
required this.originalFileName,
|
|
|
|
required this.originalPath,
|
2023-09-06 05:14:44 +02:00
|
|
|
this.owner,
|
2023-08-01 18:49:18 +02:00
|
|
|
required this.ownerId,
|
2023-05-17 19:07:17 +02:00
|
|
|
this.people = const [],
|
2023-08-01 18:49:18 +02:00
|
|
|
required this.resized,
|
|
|
|
this.smartInfo,
|
2023-10-22 04:38:07 +02:00
|
|
|
this.stack = const [],
|
|
|
|
required this.stackCount,
|
|
|
|
this.stackParentId,
|
2023-08-01 18:49:18 +02:00
|
|
|
this.tags = const [],
|
|
|
|
required this.thumbhash,
|
|
|
|
required this.type,
|
|
|
|
required this.updatedAt,
|
2022-07-13 14:23:48 +02:00
|
|
|
});
|
|
|
|
|
2023-08-01 18:49:18 +02:00
|
|
|
/// base64 encoded sha1 hash
|
|
|
|
String checksum;
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
String deviceAssetId;
|
|
|
|
|
|
|
|
String deviceId;
|
|
|
|
|
2023-08-01 18:49:18 +02:00
|
|
|
String duration;
|
2022-07-13 14:23:48 +02:00
|
|
|
|
2023-08-01 18:49:18 +02:00
|
|
|
///
|
|
|
|
/// 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
|
|
|
|
/// source code must fall back to having a nullable type.
|
|
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
|
|
///
|
|
|
|
ExifResponseDto? exifInfo;
|
2023-06-18 05:22:31 +02:00
|
|
|
|
2023-05-29 16:05:14 +02:00
|
|
|
DateTime fileCreatedAt;
|
2022-07-13 14:23:48 +02:00
|
|
|
|
2023-05-29 16:05:14 +02:00
|
|
|
DateTime fileModifiedAt;
|
2022-07-13 14:23:48 +02:00
|
|
|
|
2023-10-14 03:46:30 +02:00
|
|
|
bool hasMetadata;
|
|
|
|
|
2023-08-01 18:49:18 +02:00
|
|
|
String id;
|
|
|
|
|
|
|
|
bool isArchived;
|
2023-02-06 18:24:58 +02:00
|
|
|
|
2023-09-20 13:16:33 +02:00
|
|
|
bool isExternal;
|
|
|
|
|
2022-07-13 14:23:48 +02:00
|
|
|
bool isFavorite;
|
|
|
|
|
2023-09-20 13:16:33 +02:00
|
|
|
bool isOffline;
|
|
|
|
|
|
|
|
bool isReadOnly;
|
|
|
|
|
2023-10-06 09:01:14 +02:00
|
|
|
bool isTrashed;
|
|
|
|
|
2023-09-20 13:16:33 +02:00
|
|
|
String libraryId;
|
|
|
|
|
2023-08-01 18:49:18 +02:00
|
|
|
String? livePhotoVideoId;
|
2023-04-12 17:37:52 +02:00
|
|
|
|
2023-10-05 00:11:11 +02:00
|
|
|
DateTime localDateTime;
|
|
|
|
|
2023-08-01 18:49:18 +02:00
|
|
|
String originalFileName;
|
2022-07-13 14:23:48 +02:00
|
|
|
|
2023-08-01 18:49:18 +02:00
|
|
|
String originalPath;
|
|
|
|
|
2023-09-06 05:14:44 +02:00
|
|
|
///
|
|
|
|
/// 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
|
|
|
|
/// source code must fall back to having a nullable type.
|
|
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
|
|
///
|
|
|
|
UserResponseDto? owner;
|
|
|
|
|
2023-08-01 18:49:18 +02:00
|
|
|
String ownerId;
|
|
|
|
|
|
|
|
List<PersonResponseDto> people;
|
|
|
|
|
|
|
|
bool resized;
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
/// 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
|
|
|
|
/// source code must fall back to having a nullable type.
|
|
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
|
|
///
|
|
|
|
SmartInfoResponseDto? smartInfo;
|
|
|
|
|
2023-10-22 04:38:07 +02:00
|
|
|
List<AssetResponseDto> stack;
|
|
|
|
|
2023-10-26 16:19:06 +02:00
|
|
|
int? stackCount;
|
2023-10-22 04:38:07 +02:00
|
|
|
|
|
|
|
String? stackParentId;
|
|
|
|
|
2022-12-05 19:56:44 +02:00
|
|
|
List<TagResponseDto> tags;
|
|
|
|
|
2023-08-01 18:49:18 +02:00
|
|
|
String? thumbhash;
|
2023-05-17 19:07:17 +02:00
|
|
|
|
2023-08-01 18:49:18 +02:00
|
|
|
AssetTypeEnum type;
|
|
|
|
|
|
|
|
DateTime updatedAt;
|
2023-05-28 03:56:17 +02:00
|
|
|
|
2022-07-13 14:23:48 +02:00
|
|
|
@override
|
2023-03-25 06:17:40 +02:00
|
|
|
bool operator ==(Object other) => identical(this, other) || other is AssetResponseDto &&
|
2023-08-06 22:55:14 +02:00
|
|
|
other.checksum == checksum &&
|
|
|
|
other.deviceAssetId == deviceAssetId &&
|
|
|
|
other.deviceId == deviceId &&
|
|
|
|
other.duration == duration &&
|
|
|
|
other.exifInfo == exifInfo &&
|
|
|
|
other.fileCreatedAt == fileCreatedAt &&
|
|
|
|
other.fileModifiedAt == fileModifiedAt &&
|
2023-10-14 03:46:30 +02:00
|
|
|
other.hasMetadata == hasMetadata &&
|
2023-08-06 22:55:14 +02:00
|
|
|
other.id == id &&
|
|
|
|
other.isArchived == isArchived &&
|
2023-09-20 13:16:33 +02:00
|
|
|
other.isExternal == isExternal &&
|
2023-08-06 22:55:14 +02:00
|
|
|
other.isFavorite == isFavorite &&
|
2023-09-20 13:16:33 +02:00
|
|
|
other.isOffline == isOffline &&
|
|
|
|
other.isReadOnly == isReadOnly &&
|
2023-10-06 09:01:14 +02:00
|
|
|
other.isTrashed == isTrashed &&
|
2023-09-20 13:16:33 +02:00
|
|
|
other.libraryId == libraryId &&
|
2023-08-06 22:55:14 +02:00
|
|
|
other.livePhotoVideoId == livePhotoVideoId &&
|
2023-10-05 00:11:11 +02:00
|
|
|
other.localDateTime == localDateTime &&
|
2023-08-06 22:55:14 +02:00
|
|
|
other.originalFileName == originalFileName &&
|
|
|
|
other.originalPath == originalPath &&
|
2023-09-06 05:14:44 +02:00
|
|
|
other.owner == owner &&
|
2023-08-06 22:55:14 +02:00
|
|
|
other.ownerId == ownerId &&
|
|
|
|
other.people == people &&
|
|
|
|
other.resized == resized &&
|
|
|
|
other.smartInfo == smartInfo &&
|
2023-10-22 04:38:07 +02:00
|
|
|
other.stack == stack &&
|
|
|
|
other.stackCount == stackCount &&
|
|
|
|
other.stackParentId == stackParentId &&
|
2023-08-06 22:55:14 +02:00
|
|
|
other.tags == tags &&
|
|
|
|
other.thumbhash == thumbhash &&
|
|
|
|
other.type == type &&
|
|
|
|
other.updatedAt == updatedAt;
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode =>
|
2023-03-25 06:17:40 +02:00
|
|
|
// ignore: unnecessary_parenthesis
|
2023-08-01 18:49:18 +02:00
|
|
|
(checksum.hashCode) +
|
2023-03-25 06:17:40 +02:00
|
|
|
(deviceAssetId.hashCode) +
|
|
|
|
(deviceId.hashCode) +
|
2023-08-01 18:49:18 +02:00
|
|
|
(duration.hashCode) +
|
|
|
|
(exifInfo == null ? 0 : exifInfo!.hashCode) +
|
2023-03-25 06:17:40 +02:00
|
|
|
(fileCreatedAt.hashCode) +
|
|
|
|
(fileModifiedAt.hashCode) +
|
2023-10-14 03:46:30 +02:00
|
|
|
(hasMetadata.hashCode) +
|
2023-08-01 18:49:18 +02:00
|
|
|
(id.hashCode) +
|
2023-04-12 17:37:52 +02:00
|
|
|
(isArchived.hashCode) +
|
2023-09-20 13:16:33 +02:00
|
|
|
(isExternal.hashCode) +
|
2023-08-01 18:49:18 +02:00
|
|
|
(isFavorite.hashCode) +
|
2023-09-20 13:16:33 +02:00
|
|
|
(isOffline.hashCode) +
|
|
|
|
(isReadOnly.hashCode) +
|
2023-10-06 09:01:14 +02:00
|
|
|
(isTrashed.hashCode) +
|
2023-09-20 13:16:33 +02:00
|
|
|
(libraryId.hashCode) +
|
2023-03-25 06:17:40 +02:00
|
|
|
(livePhotoVideoId == null ? 0 : livePhotoVideoId!.hashCode) +
|
2023-10-05 00:11:11 +02:00
|
|
|
(localDateTime.hashCode) +
|
2023-08-01 18:49:18 +02:00
|
|
|
(originalFileName.hashCode) +
|
|
|
|
(originalPath.hashCode) +
|
2023-09-06 05:14:44 +02:00
|
|
|
(owner == null ? 0 : owner!.hashCode) +
|
2023-08-01 18:49:18 +02:00
|
|
|
(ownerId.hashCode) +
|
2023-05-28 03:56:17 +02:00
|
|
|
(people.hashCode) +
|
2023-08-01 18:49:18 +02:00
|
|
|
(resized.hashCode) +
|
|
|
|
(smartInfo == null ? 0 : smartInfo!.hashCode) +
|
2023-10-22 04:38:07 +02:00
|
|
|
(stack.hashCode) +
|
2023-10-26 16:19:06 +02:00
|
|
|
(stackCount == null ? 0 : stackCount!.hashCode) +
|
2023-10-22 04:38:07 +02:00
|
|
|
(stackParentId == null ? 0 : stackParentId!.hashCode) +
|
2023-08-01 18:49:18 +02:00
|
|
|
(tags.hashCode) +
|
|
|
|
(thumbhash == null ? 0 : thumbhash!.hashCode) +
|
|
|
|
(type.hashCode) +
|
|
|
|
(updatedAt.hashCode);
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
@override
|
2023-10-22 04:38:07 +02:00
|
|
|
String toString() => 'AssetResponseDto[checksum=$checksum, deviceAssetId=$deviceAssetId, deviceId=$deviceId, duration=$duration, exifInfo=$exifInfo, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, hasMetadata=$hasMetadata, id=$id, isArchived=$isArchived, isExternal=$isExternal, isFavorite=$isFavorite, isOffline=$isOffline, isReadOnly=$isReadOnly, isTrashed=$isTrashed, libraryId=$libraryId, livePhotoVideoId=$livePhotoVideoId, localDateTime=$localDateTime, originalFileName=$originalFileName, originalPath=$originalPath, owner=$owner, ownerId=$ownerId, people=$people, resized=$resized, smartInfo=$smartInfo, stack=$stack, stackCount=$stackCount, stackParentId=$stackParentId, tags=$tags, thumbhash=$thumbhash, type=$type, updatedAt=$updatedAt]';
|
2022-07-13 14:23:48 +02:00
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
2023-01-10 06:08:45 +02:00
|
|
|
final json = <String, dynamic>{};
|
2023-08-01 18:49:18 +02:00
|
|
|
json[r'checksum'] = this.checksum;
|
2023-03-25 06:17:40 +02:00
|
|
|
json[r'deviceAssetId'] = this.deviceAssetId;
|
|
|
|
json[r'deviceId'] = this.deviceId;
|
2023-08-01 18:49:18 +02:00
|
|
|
json[r'duration'] = this.duration;
|
|
|
|
if (this.exifInfo != null) {
|
|
|
|
json[r'exifInfo'] = this.exifInfo;
|
2023-06-18 05:22:31 +02:00
|
|
|
} else {
|
2023-08-01 18:49:18 +02:00
|
|
|
// json[r'exifInfo'] = null;
|
2023-06-18 05:22:31 +02:00
|
|
|
}
|
2023-05-29 16:05:14 +02:00
|
|
|
json[r'fileCreatedAt'] = this.fileCreatedAt.toUtc().toIso8601String();
|
|
|
|
json[r'fileModifiedAt'] = this.fileModifiedAt.toUtc().toIso8601String();
|
2023-10-14 03:46:30 +02:00
|
|
|
json[r'hasMetadata'] = this.hasMetadata;
|
2023-08-01 18:49:18 +02:00
|
|
|
json[r'id'] = this.id;
|
2023-04-12 17:37:52 +02:00
|
|
|
json[r'isArchived'] = this.isArchived;
|
2023-09-20 13:16:33 +02:00
|
|
|
json[r'isExternal'] = this.isExternal;
|
2023-08-01 18:49:18 +02:00
|
|
|
json[r'isFavorite'] = this.isFavorite;
|
2023-09-20 13:16:33 +02:00
|
|
|
json[r'isOffline'] = this.isOffline;
|
|
|
|
json[r'isReadOnly'] = this.isReadOnly;
|
2023-10-06 09:01:14 +02:00
|
|
|
json[r'isTrashed'] = this.isTrashed;
|
2023-09-20 13:16:33 +02:00
|
|
|
json[r'libraryId'] = this.libraryId;
|
2023-08-01 18:49:18 +02:00
|
|
|
if (this.livePhotoVideoId != null) {
|
|
|
|
json[r'livePhotoVideoId'] = this.livePhotoVideoId;
|
2022-07-13 14:23:48 +02:00
|
|
|
} else {
|
2023-08-01 18:49:18 +02:00
|
|
|
// json[r'livePhotoVideoId'] = null;
|
2022-07-13 14:23:48 +02:00
|
|
|
}
|
2023-10-05 00:11:11 +02:00
|
|
|
json[r'localDateTime'] = this.localDateTime.toUtc().toIso8601String();
|
2023-08-01 18:49:18 +02:00
|
|
|
json[r'originalFileName'] = this.originalFileName;
|
|
|
|
json[r'originalPath'] = this.originalPath;
|
2023-09-06 05:14:44 +02:00
|
|
|
if (this.owner != null) {
|
|
|
|
json[r'owner'] = this.owner;
|
|
|
|
} else {
|
|
|
|
// json[r'owner'] = null;
|
|
|
|
}
|
2023-08-01 18:49:18 +02:00
|
|
|
json[r'ownerId'] = this.ownerId;
|
|
|
|
json[r'people'] = this.people;
|
|
|
|
json[r'resized'] = this.resized;
|
2023-01-10 06:08:45 +02:00
|
|
|
if (this.smartInfo != null) {
|
|
|
|
json[r'smartInfo'] = this.smartInfo;
|
2022-07-13 14:23:48 +02:00
|
|
|
} else {
|
2023-06-22 20:00:07 +02:00
|
|
|
// json[r'smartInfo'] = null;
|
2023-10-22 04:38:07 +02:00
|
|
|
}
|
|
|
|
json[r'stack'] = this.stack;
|
2023-10-26 16:19:06 +02:00
|
|
|
if (this.stackCount != null) {
|
2023-10-22 04:38:07 +02:00
|
|
|
json[r'stackCount'] = this.stackCount;
|
2023-10-26 16:19:06 +02:00
|
|
|
} else {
|
|
|
|
// json[r'stackCount'] = null;
|
|
|
|
}
|
2023-10-22 04:38:07 +02:00
|
|
|
if (this.stackParentId != null) {
|
|
|
|
json[r'stackParentId'] = this.stackParentId;
|
|
|
|
} else {
|
|
|
|
// json[r'stackParentId'] = null;
|
2022-07-13 14:23:48 +02:00
|
|
|
}
|
2023-08-01 18:49:18 +02:00
|
|
|
json[r'tags'] = this.tags;
|
|
|
|
if (this.thumbhash != null) {
|
|
|
|
json[r'thumbhash'] = this.thumbhash;
|
2022-11-19 07:12:54 +02:00
|
|
|
} else {
|
2023-08-01 18:49:18 +02:00
|
|
|
// json[r'thumbhash'] = null;
|
2022-11-19 07:12:54 +02:00
|
|
|
}
|
2023-08-01 18:49:18 +02:00
|
|
|
json[r'type'] = this.type;
|
|
|
|
json[r'updatedAt'] = this.updatedAt.toUtc().toIso8601String();
|
2023-01-10 06:08:45 +02:00
|
|
|
return json;
|
2022-07-13 14:23:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Returns a new [AssetResponseDto] instance and imports its values from
|
|
|
|
/// [value] if it's a [Map], null otherwise.
|
|
|
|
// ignore: prefer_constructors_over_static_methods
|
|
|
|
static AssetResponseDto? fromJson(dynamic value) {
|
|
|
|
if (value is Map) {
|
|
|
|
final json = value.cast<String, dynamic>();
|
|
|
|
|
|
|
|
return AssetResponseDto(
|
2023-08-01 18:49:18 +02:00
|
|
|
checksum: mapValueOfType<String>(json, r'checksum')!,
|
2022-07-13 14:23:48 +02:00
|
|
|
deviceAssetId: mapValueOfType<String>(json, r'deviceAssetId')!,
|
|
|
|
deviceId: mapValueOfType<String>(json, r'deviceId')!,
|
2023-08-01 18:49:18 +02:00
|
|
|
duration: mapValueOfType<String>(json, r'duration')!,
|
|
|
|
exifInfo: ExifResponseDto.fromJson(json[r'exifInfo']),
|
2023-08-06 22:55:14 +02:00
|
|
|
fileCreatedAt: mapDateTime(json, r'fileCreatedAt', '')!,
|
|
|
|
fileModifiedAt: mapDateTime(json, r'fileModifiedAt', '')!,
|
2023-10-14 03:46:30 +02:00
|
|
|
hasMetadata: mapValueOfType<bool>(json, r'hasMetadata')!,
|
2023-08-01 18:49:18 +02:00
|
|
|
id: mapValueOfType<String>(json, r'id')!,
|
2023-04-12 17:37:52 +02:00
|
|
|
isArchived: mapValueOfType<bool>(json, r'isArchived')!,
|
2023-09-20 13:16:33 +02:00
|
|
|
isExternal: mapValueOfType<bool>(json, r'isExternal')!,
|
2023-08-01 18:49:18 +02:00
|
|
|
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
|
2023-09-20 13:16:33 +02:00
|
|
|
isOffline: mapValueOfType<bool>(json, r'isOffline')!,
|
|
|
|
isReadOnly: mapValueOfType<bool>(json, r'isReadOnly')!,
|
2023-10-06 09:01:14 +02:00
|
|
|
isTrashed: mapValueOfType<bool>(json, r'isTrashed')!,
|
2023-09-20 13:16:33 +02:00
|
|
|
libraryId: mapValueOfType<String>(json, r'libraryId')!,
|
2022-11-19 07:12:54 +02:00
|
|
|
livePhotoVideoId: mapValueOfType<String>(json, r'livePhotoVideoId'),
|
2023-10-05 00:11:11 +02:00
|
|
|
localDateTime: mapDateTime(json, r'localDateTime', '')!,
|
2023-08-01 18:49:18 +02:00
|
|
|
originalFileName: mapValueOfType<String>(json, r'originalFileName')!,
|
|
|
|
originalPath: mapValueOfType<String>(json, r'originalPath')!,
|
2023-09-06 05:14:44 +02:00
|
|
|
owner: UserResponseDto.fromJson(json[r'owner']),
|
2023-08-01 18:49:18 +02:00
|
|
|
ownerId: mapValueOfType<String>(json, r'ownerId')!,
|
2023-05-17 19:07:17 +02:00
|
|
|
people: PersonResponseDto.listFromJson(json[r'people']),
|
2023-08-01 18:49:18 +02:00
|
|
|
resized: mapValueOfType<bool>(json, r'resized')!,
|
|
|
|
smartInfo: SmartInfoResponseDto.fromJson(json[r'smartInfo']),
|
2023-10-22 04:38:07 +02:00
|
|
|
stack: AssetResponseDto.listFromJson(json[r'stack']),
|
2023-10-26 16:19:06 +02:00
|
|
|
stackCount: mapValueOfType<int>(json, r'stackCount'),
|
2023-10-22 04:38:07 +02:00
|
|
|
stackParentId: mapValueOfType<String>(json, r'stackParentId'),
|
2023-08-01 18:49:18 +02:00
|
|
|
tags: TagResponseDto.listFromJson(json[r'tags']),
|
|
|
|
thumbhash: mapValueOfType<String>(json, r'thumbhash'),
|
|
|
|
type: AssetTypeEnum.fromJson(json[r'type'])!,
|
2023-08-06 22:55:14 +02:00
|
|
|
updatedAt: mapDateTime(json, r'updatedAt', '')!,
|
2022-07-13 14:23:48 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-05-03 21:27:57 +02:00
|
|
|
static List<AssetResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
2022-07-13 14:23:48 +02:00
|
|
|
final result = <AssetResponseDto>[];
|
|
|
|
if (json is List && json.isNotEmpty) {
|
|
|
|
for (final row in json) {
|
|
|
|
final value = AssetResponseDto.fromJson(row);
|
|
|
|
if (value != null) {
|
|
|
|
result.add(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result.toList(growable: growable);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Map<String, AssetResponseDto> mapFromJson(dynamic json) {
|
|
|
|
final map = <String, AssetResponseDto>{};
|
|
|
|
if (json is Map && json.isNotEmpty) {
|
|
|
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
|
|
|
for (final entry in json.entries) {
|
|
|
|
final value = AssetResponseDto.fromJson(entry.value);
|
|
|
|
if (value != null) {
|
|
|
|
map[entry.key] = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
// maps a json object with a list of AssetResponseDto-objects as value to a dart map
|
2023-03-25 06:17:40 +02:00
|
|
|
static Map<String, List<AssetResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
2022-07-13 14:23:48 +02:00
|
|
|
final map = <String, List<AssetResponseDto>>{};
|
|
|
|
if (json is Map && json.isNotEmpty) {
|
2023-05-03 21:27:57 +02:00
|
|
|
// ignore: parameter_assignments
|
|
|
|
json = json.cast<String, dynamic>();
|
2022-07-13 14:23:48 +02:00
|
|
|
for (final entry in json.entries) {
|
2023-05-03 21:27:57 +02:00
|
|
|
map[entry.key] = AssetResponseDto.listFromJson(entry.value, growable: growable,);
|
2022-07-13 14:23:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// The list of required keys that must be present in a JSON.
|
|
|
|
static const requiredKeys = <String>{
|
2023-08-01 18:49:18 +02:00
|
|
|
'checksum',
|
2022-07-13 14:23:48 +02:00
|
|
|
'deviceAssetId',
|
|
|
|
'deviceId',
|
2023-08-01 18:49:18 +02:00
|
|
|
'duration',
|
|
|
|
'fileCreatedAt',
|
|
|
|
'fileModifiedAt',
|
2023-10-14 03:46:30 +02:00
|
|
|
'hasMetadata',
|
2023-08-01 18:49:18 +02:00
|
|
|
'id',
|
|
|
|
'isArchived',
|
2023-09-20 13:16:33 +02:00
|
|
|
'isExternal',
|
2023-08-01 18:49:18 +02:00
|
|
|
'isFavorite',
|
2023-09-20 13:16:33 +02:00
|
|
|
'isOffline',
|
|
|
|
'isReadOnly',
|
2023-10-06 09:01:14 +02:00
|
|
|
'isTrashed',
|
2023-09-20 13:16:33 +02:00
|
|
|
'libraryId',
|
2023-10-05 00:11:11 +02:00
|
|
|
'localDateTime',
|
2023-04-11 12:23:39 +02:00
|
|
|
'originalFileName',
|
2023-08-01 18:49:18 +02:00
|
|
|
'originalPath',
|
|
|
|
'ownerId',
|
2023-05-28 03:56:17 +02:00
|
|
|
'resized',
|
2023-10-22 04:38:07 +02:00
|
|
|
'stackCount',
|
2023-06-18 05:22:31 +02:00
|
|
|
'thumbhash',
|
2023-08-01 18:49:18 +02:00
|
|
|
'type',
|
2023-02-06 18:24:58 +02:00
|
|
|
'updatedAt',
|
2022-07-13 14:23:48 +02:00
|
|
|
};
|
|
|
|
}
|
2023-03-25 06:17:40 +02:00
|
|
|
|