retain existing behavior

This commit is contained in:
shenlong-tanwen 2025-05-17 19:57:36 +05:30
parent ac70d03693
commit 8e71287bbc
42 changed files with 158 additions and 152 deletions

View File

@ -163,8 +163,7 @@ class Album {
dto.order == AssetOrder.asc ? SortOrder.asc : SortOrder.desc; dto.order == AssetOrder.asc ? SortOrder.asc : SortOrder.desc;
} }
if (dto.albumThumbnailAssetId != null && if (dto.albumThumbnailAssetId?.unwrapOrNull() != null) {
dto.albumThumbnailAssetId!.isSome) {
a.thumbnail.value = await db.assets a.thumbnail.value = await db.assets
.where() .where()
.remoteIdEqualTo(dto.albumThumbnailAssetId!.unwrap()) .remoteIdEqualTo(dto.albumThumbnailAssetId!.unwrap())

View File

@ -62,11 +62,11 @@ class SearchService {
SmartSearchDto( SmartSearchDto(
query: filter.context!, query: filter.context!,
language: filter.language, language: filter.language,
country: Option.from(filter.location.country), country: Some.tryFrom(filter.location.country),
state: Option.from(filter.location.state), state: Some.tryFrom(filter.location.state),
city: Option.from(filter.location.city), city: Some.tryFrom(filter.location.city),
make: filter.camera.make, make: filter.camera.make,
model: Option.from(filter.camera.model), model: Some.tryFrom(filter.camera.model),
takenAfter: filter.date.takenAfter, takenAfter: filter.date.takenAfter,
takenBefore: filter.date.takenBefore, takenBefore: filter.date.takenBefore,
visibility: filter.display.isArchive visibility: filter.display.isArchive
@ -87,15 +87,15 @@ class SearchService {
filter.filename != null && filter.filename!.isNotEmpty filter.filename != null && filter.filename!.isNotEmpty
? filter.filename ? filter.filename
: null, : null,
country: Option.from(filter.location.country), country: Some.tryFrom(filter.location.country),
description: description:
filter.description != null && filter.description!.isNotEmpty filter.description != null && filter.description!.isNotEmpty
? filter.description ? filter.description
: null, : null,
state: Option.from(filter.location.state), state: Some.tryFrom(filter.location.state),
city: Option.from(filter.location.city), city: Some.tryFrom(filter.location.city),
make: filter.camera.make, make: filter.camera.make,
model: Option.from(filter.camera.model), model: Some.tryFrom(filter.camera.model),
takenAfter: filter.date.takenAfter, takenAfter: filter.date.takenAfter,
takenBefore: filter.date.takenBefore, takenBefore: filter.date.takenBefore,
visibility: filter.display.isArchive visibility: filter.display.isArchive

View File

@ -57,7 +57,7 @@ class SharedLinkService {
showMetadata: showMeta, showMetadata: showMeta,
allowDownload: allowDownload, allowDownload: allowDownload,
allowUpload: allowUpload, allowUpload: allowUpload,
expiresAt: Option.from(expiresAt), expiresAt: Some.tryFrom(expiresAt),
description: description, description: description,
password: password, password: password,
); );
@ -67,7 +67,7 @@ class SharedLinkService {
showMetadata: showMeta, showMetadata: showMeta,
allowDownload: allowDownload, allowDownload: allowDownload,
allowUpload: allowUpload, allowUpload: allowUpload,
expiresAt: Option.from(expiresAt), expiresAt: Some.tryFrom(expiresAt),
description: description, description: description,
password: password, password: password,
assetIds: assetIds, assetIds: assetIds,
@ -104,7 +104,7 @@ class SharedLinkService {
showMetadata: showMeta, showMetadata: showMeta,
allowDownload: allowDownload, allowDownload: allowDownload,
allowUpload: allowUpload, allowUpload: allowUpload,
expiresAt: Option.from(expiresAt), expiresAt: Some.tryFrom(expiresAt),
description: description, description: description,
password: password, password: password,
changeExpiryTime: changeExpiry, changeExpiryTime: changeExpiry,

View File

@ -66,6 +66,13 @@ class Some<T> extends Option<T> {
final T value; final T value;
const Some(this.value); const Some(this.value);
static Some<U>? tryFrom<U>(U? value) {
if (value == null) {
return null;
}
return Some(value);
}
} }
class None extends Option<Never> { class None extends Option<Never> {

View File

@ -87,8 +87,8 @@ class ActivityResponseDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return ActivityResponseDto( return ActivityResponseDto(
assetId: Option.from(mapValueOfType<String>(json, r'assetId')), assetId: Some.tryFrom(mapValueOfType<String>(json, r'assetId')),
comment: Option.from(mapValueOfType<String>(json, r'comment')), comment: Some.tryFrom(mapValueOfType<String>(json, r'comment')),
createdAt: mapDateTime(json, r'createdAt', r'')!, createdAt: mapDateTime(json, r'createdAt', r'')!,
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
type: ReactionType.fromJson(json[r'type'])!, type: ReactionType.fromJson(json[r'type'])!,

View File

@ -194,7 +194,7 @@ class AlbumResponseDto {
return AlbumResponseDto( return AlbumResponseDto(
albumName: mapValueOfType<String>(json, r'albumName')!, albumName: mapValueOfType<String>(json, r'albumName')!,
albumThumbnailAssetId: Option.from(mapValueOfType<String>(json, r'albumThumbnailAssetId')), albumThumbnailAssetId: Some.tryFrom(mapValueOfType<String>(json, r'albumThumbnailAssetId')),
albumUsers: AlbumUserResponseDto.listFromJson(json[r'albumUsers']), albumUsers: AlbumUserResponseDto.listFromJson(json[r'albumUsers']),
assetCount: mapValueOfType<int>(json, r'assetCount')!, assetCount: mapValueOfType<int>(json, r'assetCount')!,
assets: AssetResponseDto.listFromJson(json[r'assets']), assets: AssetResponseDto.listFromJson(json[r'assets']),

View File

@ -156,7 +156,7 @@ class AssetBulkUpdateDto {
return AssetBulkUpdateDto( return AssetBulkUpdateDto(
dateTimeOriginal: mapValueOfType<String>(json, r'dateTimeOriginal'), dateTimeOriginal: mapValueOfType<String>(json, r'dateTimeOriginal'),
duplicateId: Option.from(mapValueOfType<String>(json, r'duplicateId')), duplicateId: Some.tryFrom(mapValueOfType<String>(json, r'duplicateId')),
ids: json[r'ids'] is Iterable ids: json[r'ids'] is Iterable
? (json[r'ids'] as Iterable).cast<String>().toList(growable: false) ? (json[r'ids'] as Iterable).cast<String>().toList(growable: false)
: const [], : const [],

View File

@ -116,7 +116,7 @@ class AssetFaceResponseDto {
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
imageHeight: mapValueOfType<int>(json, r'imageHeight')!, imageHeight: mapValueOfType<int>(json, r'imageHeight')!,
imageWidth: mapValueOfType<int>(json, r'imageWidth')!, imageWidth: mapValueOfType<int>(json, r'imageWidth')!,
person: Option.from(PersonResponseDto.fromJson(json[r'person'])), person: Some.tryFrom(PersonResponseDto.fromJson(json[r'person'])),
sourceType: SourceType.fromJson(json[r'sourceType']), sourceType: SourceType.fromJson(json[r'sourceType']),
); );
} }

View File

@ -301,7 +301,7 @@ class AssetResponseDto {
checksum: mapValueOfType<String>(json, r'checksum')!, checksum: mapValueOfType<String>(json, r'checksum')!,
deviceAssetId: mapValueOfType<String>(json, r'deviceAssetId')!, deviceAssetId: mapValueOfType<String>(json, r'deviceAssetId')!,
deviceId: mapValueOfType<String>(json, r'deviceId')!, deviceId: mapValueOfType<String>(json, r'deviceId')!,
duplicateId: Option.from(mapValueOfType<String>(json, r'duplicateId')), duplicateId: Some.tryFrom(mapValueOfType<String>(json, r'duplicateId')),
duration: mapValueOfType<String>(json, r'duration')!, duration: mapValueOfType<String>(json, r'duration')!,
exifInfo: ExifResponseDto.fromJson(json[r'exifInfo']), exifInfo: ExifResponseDto.fromJson(json[r'exifInfo']),
fileCreatedAt: mapDateTime(json, r'fileCreatedAt', r'')!, fileCreatedAt: mapDateTime(json, r'fileCreatedAt', r'')!,
@ -312,8 +312,8 @@ class AssetResponseDto {
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!, isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
isOffline: mapValueOfType<bool>(json, r'isOffline')!, isOffline: mapValueOfType<bool>(json, r'isOffline')!,
isTrashed: mapValueOfType<bool>(json, r'isTrashed')!, isTrashed: mapValueOfType<bool>(json, r'isTrashed')!,
libraryId: Option.from(mapValueOfType<String>(json, r'libraryId')), libraryId: Some.tryFrom(mapValueOfType<String>(json, r'libraryId')),
livePhotoVideoId: Option.from(mapValueOfType<String>(json, r'livePhotoVideoId')), livePhotoVideoId: Some.tryFrom(mapValueOfType<String>(json, r'livePhotoVideoId')),
localDateTime: mapDateTime(json, r'localDateTime', r'')!, localDateTime: mapDateTime(json, r'localDateTime', r'')!,
originalFileName: mapValueOfType<String>(json, r'originalFileName')!, originalFileName: mapValueOfType<String>(json, r'originalFileName')!,
originalMimeType: mapValueOfType<String>(json, r'originalMimeType'), originalMimeType: mapValueOfType<String>(json, r'originalMimeType'),
@ -322,9 +322,9 @@ class AssetResponseDto {
ownerId: mapValueOfType<String>(json, r'ownerId')!, ownerId: mapValueOfType<String>(json, r'ownerId')!,
people: PersonWithFacesResponseDto.listFromJson(json[r'people']), people: PersonWithFacesResponseDto.listFromJson(json[r'people']),
resized: mapValueOfType<bool>(json, r'resized'), resized: mapValueOfType<bool>(json, r'resized'),
stack: Option.from(AssetStackResponseDto.fromJson(json[r'stack'])), stack: Some.tryFrom(AssetStackResponseDto.fromJson(json[r'stack'])),
tags: TagResponseDto.listFromJson(json[r'tags']), tags: TagResponseDto.listFromJson(json[r'tags']),
thumbhash: Option.from(mapValueOfType<String>(json, r'thumbhash')), thumbhash: Some.tryFrom(mapValueOfType<String>(json, r'thumbhash')),
type: AssetTypeEnum.fromJson(json[r'type'])!, type: AssetTypeEnum.fromJson(json[r'type'])!,
unassignedFaces: AssetFaceWithoutPersonResponseDto.listFromJson(json[r'unassignedFaces']), unassignedFaces: AssetFaceWithoutPersonResponseDto.listFromJson(json[r'unassignedFaces']),
updatedAt: mapDateTime(json, r'updatedAt', r'')!, updatedAt: mapDateTime(json, r'updatedAt', r'')!,

View File

@ -303,44 +303,44 @@ class ExifResponseDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return ExifResponseDto( return ExifResponseDto(
city: Option.from(mapValueOfType<String>(json, r'city')), city: Some.tryFrom(mapValueOfType<String>(json, r'city')),
country: Option.from(mapValueOfType<String>(json, r'country')), country: Some.tryFrom(mapValueOfType<String>(json, r'country')),
dateTimeOriginal: Option.from(mapDateTime(json, r'dateTimeOriginal', r'')), dateTimeOriginal: Some.tryFrom(mapDateTime(json, r'dateTimeOriginal', r'')),
description: Option.from(mapValueOfType<String>(json, r'description')), description: Some.tryFrom(mapValueOfType<String>(json, r'description')),
exifImageHeight: Option.from(json[r'exifImageHeight'] == null exifImageHeight: Some.tryFrom(json[r'exifImageHeight'] == null
? null ? null
: num.parse('${json[r'exifImageHeight']}')), : num.parse('${json[r'exifImageHeight']}')),
exifImageWidth: Option.from(json[r'exifImageWidth'] == null exifImageWidth: Some.tryFrom(json[r'exifImageWidth'] == null
? null ? null
: num.parse('${json[r'exifImageWidth']}')), : num.parse('${json[r'exifImageWidth']}')),
exposureTime: Option.from(mapValueOfType<String>(json, r'exposureTime')), exposureTime: Some.tryFrom(mapValueOfType<String>(json, r'exposureTime')),
fNumber: Option.from(json[r'fNumber'] == null fNumber: Some.tryFrom(json[r'fNumber'] == null
? null ? null
: num.parse('${json[r'fNumber']}')), : num.parse('${json[r'fNumber']}')),
fileSizeInByte: Option.from(mapValueOfType<int>(json, r'fileSizeInByte')), fileSizeInByte: Some.tryFrom(mapValueOfType<int>(json, r'fileSizeInByte')),
focalLength: Option.from(json[r'focalLength'] == null focalLength: Some.tryFrom(json[r'focalLength'] == null
? null ? null
: num.parse('${json[r'focalLength']}')), : num.parse('${json[r'focalLength']}')),
iso: Option.from(json[r'iso'] == null iso: Some.tryFrom(json[r'iso'] == null
? null ? null
: num.parse('${json[r'iso']}')), : num.parse('${json[r'iso']}')),
latitude: Option.from(json[r'latitude'] == null latitude: Some.tryFrom(json[r'latitude'] == null
? null ? null
: num.parse('${json[r'latitude']}')), : num.parse('${json[r'latitude']}')),
lensModel: Option.from(mapValueOfType<String>(json, r'lensModel')), lensModel: Some.tryFrom(mapValueOfType<String>(json, r'lensModel')),
longitude: Option.from(json[r'longitude'] == null longitude: Some.tryFrom(json[r'longitude'] == null
? null ? null
: num.parse('${json[r'longitude']}')), : num.parse('${json[r'longitude']}')),
make: Option.from(mapValueOfType<String>(json, r'make')), make: Some.tryFrom(mapValueOfType<String>(json, r'make')),
model: Option.from(mapValueOfType<String>(json, r'model')), model: Some.tryFrom(mapValueOfType<String>(json, r'model')),
modifyDate: Option.from(mapDateTime(json, r'modifyDate', r'')), modifyDate: Some.tryFrom(mapDateTime(json, r'modifyDate', r'')),
orientation: Option.from(mapValueOfType<String>(json, r'orientation')), orientation: Some.tryFrom(mapValueOfType<String>(json, r'orientation')),
projectionType: Option.from(mapValueOfType<String>(json, r'projectionType')), projectionType: Some.tryFrom(mapValueOfType<String>(json, r'projectionType')),
rating: Option.from(json[r'rating'] == null rating: Some.tryFrom(json[r'rating'] == null
? null ? null
: num.parse('${json[r'rating']}')), : num.parse('${json[r'rating']}')),
state: Option.from(mapValueOfType<String>(json, r'state')), state: Some.tryFrom(mapValueOfType<String>(json, r'state')),
timeZone: Option.from(mapValueOfType<String>(json, r'timeZone')), timeZone: Some.tryFrom(mapValueOfType<String>(json, r'timeZone')),
); );
} }
return null; return null;

View File

@ -110,7 +110,7 @@ class LibraryResponseDto {
: const [], : const [],
name: mapValueOfType<String>(json, r'name')!, name: mapValueOfType<String>(json, r'name')!,
ownerId: mapValueOfType<String>(json, r'ownerId')!, ownerId: mapValueOfType<String>(json, r'ownerId')!,
refreshedAt: Option.from(mapDateTime(json, r'refreshedAt', r'')), refreshedAt: Some.tryFrom(mapDateTime(json, r'refreshedAt', r'')),
updatedAt: mapDateTime(json, r'updatedAt', r'')!, updatedAt: mapDateTime(json, r'updatedAt', r'')!,
); );
} }

View File

@ -93,12 +93,12 @@ class MapMarkerResponseDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return MapMarkerResponseDto( return MapMarkerResponseDto(
city: Option.from(mapValueOfType<String>(json, r'city')), city: Some.tryFrom(mapValueOfType<String>(json, r'city')),
country: Option.from(mapValueOfType<String>(json, r'country')), country: Some.tryFrom(mapValueOfType<String>(json, r'country')),
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
lat: (mapValueOfType<num>(json, r'lat')!).toDouble(), lat: (mapValueOfType<num>(json, r'lat')!).toDouble(),
lon: (mapValueOfType<num>(json, r'lon')!).toDouble(), lon: (mapValueOfType<num>(json, r'lon')!).toDouble(),
state: Option.from(mapValueOfType<String>(json, r'state')), state: Some.tryFrom(mapValueOfType<String>(json, r'state')),
); );
} }
return null; return null;

View File

@ -75,9 +75,9 @@ class MapReverseGeocodeResponseDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return MapReverseGeocodeResponseDto( return MapReverseGeocodeResponseDto(
city: Option.from(mapValueOfType<String>(json, r'city')), city: Some.tryFrom(mapValueOfType<String>(json, r'city')),
country: Option.from(mapValueOfType<String>(json, r'country')), country: Some.tryFrom(mapValueOfType<String>(json, r'country')),
state: Option.from(mapValueOfType<String>(json, r'state')), state: Some.tryFrom(mapValueOfType<String>(json, r'state')),
); );
} }
return null; return null;

View File

@ -663,8 +663,8 @@ class MetadataSearchDto {
return MetadataSearchDto( return MetadataSearchDto(
checksum: mapValueOfType<String>(json, r'checksum'), checksum: mapValueOfType<String>(json, r'checksum'),
city: Option.from(mapValueOfType<String>(json, r'city')), city: Some.tryFrom(mapValueOfType<String>(json, r'city')),
country: Option.from(mapValueOfType<String>(json, r'country')), country: Some.tryFrom(mapValueOfType<String>(json, r'country')),
createdAfter: mapDateTime(json, r'createdAfter', r''), createdAfter: mapDateTime(json, r'createdAfter', r''),
createdBefore: mapDateTime(json, r'createdBefore', r''), createdBefore: mapDateTime(json, r'createdBefore', r''),
description: mapValueOfType<String>(json, r'description'), description: mapValueOfType<String>(json, r'description'),
@ -677,10 +677,10 @@ class MetadataSearchDto {
isMotion: mapValueOfType<bool>(json, r'isMotion'), isMotion: mapValueOfType<bool>(json, r'isMotion'),
isNotInAlbum: mapValueOfType<bool>(json, r'isNotInAlbum'), isNotInAlbum: mapValueOfType<bool>(json, r'isNotInAlbum'),
isOffline: mapValueOfType<bool>(json, r'isOffline'), isOffline: mapValueOfType<bool>(json, r'isOffline'),
lensModel: Option.from(mapValueOfType<String>(json, r'lensModel')), lensModel: Some.tryFrom(mapValueOfType<String>(json, r'lensModel')),
libraryId: Option.from(mapValueOfType<String>(json, r'libraryId')), libraryId: Some.tryFrom(mapValueOfType<String>(json, r'libraryId')),
make: mapValueOfType<String>(json, r'make'), make: mapValueOfType<String>(json, r'make'),
model: Option.from(mapValueOfType<String>(json, r'model')), model: Some.tryFrom(mapValueOfType<String>(json, r'model')),
order: AssetOrder.fromJson(json[r'order']) ?? AssetOrder.desc, order: AssetOrder.fromJson(json[r'order']) ?? AssetOrder.desc,
originalFileName: mapValueOfType<String>(json, r'originalFileName'), originalFileName: mapValueOfType<String>(json, r'originalFileName'),
originalPath: mapValueOfType<String>(json, r'originalPath'), originalPath: mapValueOfType<String>(json, r'originalPath'),
@ -691,7 +691,7 @@ class MetadataSearchDto {
previewPath: mapValueOfType<String>(json, r'previewPath'), previewPath: mapValueOfType<String>(json, r'previewPath'),
rating: num.parse('${json[r'rating']}'), rating: num.parse('${json[r'rating']}'),
size: num.parse('${json[r'size']}'), size: num.parse('${json[r'size']}'),
state: Option.from(mapValueOfType<String>(json, r'state')), state: Some.tryFrom(mapValueOfType<String>(json, r'state')),
tagIds: json[r'tagIds'] is Iterable tagIds: json[r'tagIds'] is Iterable
? (json[r'tagIds'] as Iterable).cast<String>().toList(growable: false) ? (json[r'tagIds'] as Iterable).cast<String>().toList(growable: false)
: const [], : const [],

View File

@ -124,9 +124,9 @@ class NotificationCreateDto {
return NotificationCreateDto( return NotificationCreateDto(
data: mapValueOfType<Object>(json, r'data'), data: mapValueOfType<Object>(json, r'data'),
description: Option.from(mapValueOfType<String>(json, r'description')), description: Some.tryFrom(mapValueOfType<String>(json, r'description')),
level: NotificationLevel.fromJson(json[r'level']), level: NotificationLevel.fromJson(json[r'level']),
readAt: Option.from(mapDateTime(json, r'readAt', r'')), readAt: Some.tryFrom(mapDateTime(json, r'readAt', r'')),
title: mapValueOfType<String>(json, r'title')!, title: mapValueOfType<String>(json, r'title')!,
type: NotificationType.fromJson(json[r'type']), type: NotificationType.fromJson(json[r'type']),
userId: mapValueOfType<String>(json, r'userId')!, userId: mapValueOfType<String>(json, r'userId')!,

View File

@ -60,7 +60,7 @@ class NotificationUpdateAllDto {
ids: json[r'ids'] is Iterable ids: json[r'ids'] is Iterable
? (json[r'ids'] as Iterable).cast<String>().toList(growable: false) ? (json[r'ids'] as Iterable).cast<String>().toList(growable: false)
: const [], : const [],
readAt: Option.from(mapDateTime(json, r'readAt', r'')), readAt: Some.tryFrom(mapDateTime(json, r'readAt', r'')),
); );
} }
return null; return null;

View File

@ -51,7 +51,7 @@ class NotificationUpdateDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return NotificationUpdateDto( return NotificationUpdateDto(
readAt: Option.from(mapDateTime(json, r'readAt', r'')), readAt: Some.tryFrom(mapDateTime(json, r'readAt', r'')),
); );
} }
return null; return null;

View File

@ -138,8 +138,8 @@ class PeopleUpdateItem {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return PeopleUpdateItem( return PeopleUpdateItem(
birthDate: Option.from(mapDateTime(json, r'birthDate', r'')), birthDate: Some.tryFrom(mapDateTime(json, r'birthDate', r'')),
color: Option.from(mapValueOfType<String>(json, r'color')), color: Some.tryFrom(mapValueOfType<String>(json, r'color')),
featureFaceAssetId: mapValueOfType<String>(json, r'featureFaceAssetId'), featureFaceAssetId: mapValueOfType<String>(json, r'featureFaceAssetId'),
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
isFavorite: mapValueOfType<bool>(json, r'isFavorite'), isFavorite: mapValueOfType<bool>(json, r'isFavorite'),

View File

@ -114,8 +114,8 @@ class PersonCreateDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return PersonCreateDto( return PersonCreateDto(
birthDate: Option.from(mapDateTime(json, r'birthDate', r'')), birthDate: Some.tryFrom(mapDateTime(json, r'birthDate', r'')),
color: Option.from(mapValueOfType<String>(json, r'color')), color: Some.tryFrom(mapValueOfType<String>(json, r'color')),
isFavorite: mapValueOfType<bool>(json, r'isFavorite'), isFavorite: mapValueOfType<bool>(json, r'isFavorite'),
isHidden: mapValueOfType<bool>(json, r'isHidden'), isHidden: mapValueOfType<bool>(json, r'isHidden'),
name: mapValueOfType<String>(json, r'name'), name: mapValueOfType<String>(json, r'name'),

View File

@ -126,7 +126,7 @@ class PersonResponseDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return PersonResponseDto( return PersonResponseDto(
birthDate: Option.from(mapDateTime(json, r'birthDate', r'')), birthDate: Some.tryFrom(mapDateTime(json, r'birthDate', r'')),
color: mapValueOfType<String>(json, r'color'), color: mapValueOfType<String>(json, r'color'),
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
isFavorite: mapValueOfType<bool>(json, r'isFavorite'), isFavorite: mapValueOfType<bool>(json, r'isFavorite'),

View File

@ -131,8 +131,8 @@ class PersonUpdateDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return PersonUpdateDto( return PersonUpdateDto(
birthDate: Option.from(mapDateTime(json, r'birthDate', r'')), birthDate: Some.tryFrom(mapDateTime(json, r'birthDate', r'')),
color: Option.from(mapValueOfType<String>(json, r'color')), color: Some.tryFrom(mapValueOfType<String>(json, r'color')),
featureFaceAssetId: mapValueOfType<String>(json, r'featureFaceAssetId'), featureFaceAssetId: mapValueOfType<String>(json, r'featureFaceAssetId'),
isFavorite: mapValueOfType<bool>(json, r'isFavorite'), isFavorite: mapValueOfType<bool>(json, r'isFavorite'),
isHidden: mapValueOfType<bool>(json, r'isHidden'), isHidden: mapValueOfType<bool>(json, r'isHidden'),

View File

@ -132,7 +132,7 @@ class PersonWithFacesResponseDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return PersonWithFacesResponseDto( return PersonWithFacesResponseDto(
birthDate: Option.from(mapDateTime(json, r'birthDate', r'')), birthDate: Some.tryFrom(mapDateTime(json, r'birthDate', r'')),
color: mapValueOfType<String>(json, r'color'), color: mapValueOfType<String>(json, r'color'),
faces: AssetFaceWithoutPersonResponseDto.listFromJson(json[r'faces']), faces: AssetFaceWithoutPersonResponseDto.listFromJson(json[r'faces']),
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,

View File

@ -495,8 +495,8 @@ class RandomSearchDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return RandomSearchDto( return RandomSearchDto(
city: Option.from(mapValueOfType<String>(json, r'city')), city: Some.tryFrom(mapValueOfType<String>(json, r'city')),
country: Option.from(mapValueOfType<String>(json, r'country')), country: Some.tryFrom(mapValueOfType<String>(json, r'country')),
createdAfter: mapDateTime(json, r'createdAfter', r''), createdAfter: mapDateTime(json, r'createdAfter', r''),
createdBefore: mapDateTime(json, r'createdBefore', r''), createdBefore: mapDateTime(json, r'createdBefore', r''),
deviceId: mapValueOfType<String>(json, r'deviceId'), deviceId: mapValueOfType<String>(json, r'deviceId'),
@ -505,16 +505,16 @@ class RandomSearchDto {
isMotion: mapValueOfType<bool>(json, r'isMotion'), isMotion: mapValueOfType<bool>(json, r'isMotion'),
isNotInAlbum: mapValueOfType<bool>(json, r'isNotInAlbum'), isNotInAlbum: mapValueOfType<bool>(json, r'isNotInAlbum'),
isOffline: mapValueOfType<bool>(json, r'isOffline'), isOffline: mapValueOfType<bool>(json, r'isOffline'),
lensModel: Option.from(mapValueOfType<String>(json, r'lensModel')), lensModel: Some.tryFrom(mapValueOfType<String>(json, r'lensModel')),
libraryId: Option.from(mapValueOfType<String>(json, r'libraryId')), libraryId: Some.tryFrom(mapValueOfType<String>(json, r'libraryId')),
make: mapValueOfType<String>(json, r'make'), make: mapValueOfType<String>(json, r'make'),
model: Option.from(mapValueOfType<String>(json, r'model')), model: Some.tryFrom(mapValueOfType<String>(json, r'model')),
personIds: json[r'personIds'] is Iterable personIds: json[r'personIds'] is Iterable
? (json[r'personIds'] as Iterable).cast<String>().toList(growable: false) ? (json[r'personIds'] as Iterable).cast<String>().toList(growable: false)
: const [], : const [],
rating: num.parse('${json[r'rating']}'), rating: num.parse('${json[r'rating']}'),
size: num.parse('${json[r'size']}'), size: num.parse('${json[r'size']}'),
state: Option.from(mapValueOfType<String>(json, r'state')), state: Some.tryFrom(mapValueOfType<String>(json, r'state')),
tagIds: json[r'tagIds'] is Iterable tagIds: json[r'tagIds'] is Iterable
? (json[r'tagIds'] as Iterable).cast<String>().toList(growable: false) ? (json[r'tagIds'] as Iterable).cast<String>().toList(growable: false)
: const [], : const [],

View File

@ -63,8 +63,8 @@ class ReverseGeocodingStateResponseDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return ReverseGeocodingStateResponseDto( return ReverseGeocodingStateResponseDto(
lastImportFileName: Option.from(mapValueOfType<String>(json, r'lastImportFileName')), lastImportFileName: Some.tryFrom(mapValueOfType<String>(json, r'lastImportFileName')),
lastUpdate: Option.from(mapValueOfType<String>(json, r'lastUpdate')), lastUpdate: Some.tryFrom(mapValueOfType<String>(json, r'lastUpdate')),
); );
} }
return null; return null;

View File

@ -78,7 +78,7 @@ class SearchAssetResponseDto {
count: mapValueOfType<int>(json, r'count')!, count: mapValueOfType<int>(json, r'count')!,
facets: SearchFacetResponseDto.listFromJson(json[r'facets']), facets: SearchFacetResponseDto.listFromJson(json[r'facets']),
items: AssetResponseDto.listFromJson(json[r'items']), items: AssetResponseDto.listFromJson(json[r'items']),
nextPage: Option.from(mapValueOfType<String>(json, r'nextPage')), nextPage: Some.tryFrom(mapValueOfType<String>(json, r'nextPage')),
total: mapValueOfType<int>(json, r'total')!, total: mapValueOfType<int>(json, r'total')!,
); );
} }

View File

@ -146,7 +146,7 @@ class SharedLinkCreateDto {
? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false) ? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false)
: const [], : const [],
description: mapValueOfType<String>(json, r'description'), description: mapValueOfType<String>(json, r'description'),
expiresAt: Option.from(mapDateTime(json, r'expiresAt', r'')), expiresAt: Some.tryFrom(mapDateTime(json, r'expiresAt', r'')),
password: mapValueOfType<String>(json, r'password'), password: mapValueOfType<String>(json, r'password'),
showMetadata: mapValueOfType<bool>(json, r'showMetadata') ?? true, showMetadata: mapValueOfType<bool>(json, r'showMetadata') ?? true,
type: SharedLinkType.fromJson(json[r'type'])!, type: SharedLinkType.fromJson(json[r'type'])!,

View File

@ -152,7 +152,7 @@ class SharedLinkEditDto {
allowUpload: mapValueOfType<bool>(json, r'allowUpload'), allowUpload: mapValueOfType<bool>(json, r'allowUpload'),
changeExpiryTime: mapValueOfType<bool>(json, r'changeExpiryTime'), changeExpiryTime: mapValueOfType<bool>(json, r'changeExpiryTime'),
description: mapValueOfType<String>(json, r'description'), description: mapValueOfType<String>(json, r'description'),
expiresAt: Option.from(mapDateTime(json, r'expiresAt', r'')), expiresAt: Some.tryFrom(mapDateTime(json, r'expiresAt', r'')),
password: mapValueOfType<String>(json, r'password'), password: mapValueOfType<String>(json, r'password'),
showMetadata: mapValueOfType<bool>(json, r'showMetadata'), showMetadata: mapValueOfType<bool>(json, r'showMetadata'),
); );

View File

@ -162,13 +162,13 @@ class SharedLinkResponseDto {
allowUpload: mapValueOfType<bool>(json, r'allowUpload')!, allowUpload: mapValueOfType<bool>(json, r'allowUpload')!,
assets: AssetResponseDto.listFromJson(json[r'assets']), assets: AssetResponseDto.listFromJson(json[r'assets']),
createdAt: mapDateTime(json, r'createdAt', r'')!, createdAt: mapDateTime(json, r'createdAt', r'')!,
description: Option.from(mapValueOfType<String>(json, r'description')), description: Some.tryFrom(mapValueOfType<String>(json, r'description')),
expiresAt: Option.from(mapDateTime(json, r'expiresAt', r'')), expiresAt: Some.tryFrom(mapDateTime(json, r'expiresAt', r'')),
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
key: mapValueOfType<String>(json, r'key')!, key: mapValueOfType<String>(json, r'key')!,
password: Option.from(mapValueOfType<String>(json, r'password')), password: Some.tryFrom(mapValueOfType<String>(json, r'password')),
showMetadata: mapValueOfType<bool>(json, r'showMetadata')!, showMetadata: mapValueOfType<bool>(json, r'showMetadata')!,
token: Option.from(mapValueOfType<String>(json, r'token')), token: Some.tryFrom(mapValueOfType<String>(json, r'token')),
type: SharedLinkType.fromJson(json[r'type'])!, type: SharedLinkType.fromJson(json[r'type'])!,
userId: mapValueOfType<String>(json, r'userId')!, userId: mapValueOfType<String>(json, r'userId')!,
); );

View File

@ -502,8 +502,8 @@ class SmartSearchDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return SmartSearchDto( return SmartSearchDto(
city: Option.from(mapValueOfType<String>(json, r'city')), city: Some.tryFrom(mapValueOfType<String>(json, r'city')),
country: Option.from(mapValueOfType<String>(json, r'country')), country: Some.tryFrom(mapValueOfType<String>(json, r'country')),
createdAfter: mapDateTime(json, r'createdAfter', r''), createdAfter: mapDateTime(json, r'createdAfter', r''),
createdBefore: mapDateTime(json, r'createdBefore', r''), createdBefore: mapDateTime(json, r'createdBefore', r''),
deviceId: mapValueOfType<String>(json, r'deviceId'), deviceId: mapValueOfType<String>(json, r'deviceId'),
@ -513,10 +513,10 @@ class SmartSearchDto {
isNotInAlbum: mapValueOfType<bool>(json, r'isNotInAlbum'), isNotInAlbum: mapValueOfType<bool>(json, r'isNotInAlbum'),
isOffline: mapValueOfType<bool>(json, r'isOffline'), isOffline: mapValueOfType<bool>(json, r'isOffline'),
language: mapValueOfType<String>(json, r'language'), language: mapValueOfType<String>(json, r'language'),
lensModel: Option.from(mapValueOfType<String>(json, r'lensModel')), lensModel: Some.tryFrom(mapValueOfType<String>(json, r'lensModel')),
libraryId: Option.from(mapValueOfType<String>(json, r'libraryId')), libraryId: Some.tryFrom(mapValueOfType<String>(json, r'libraryId')),
make: mapValueOfType<String>(json, r'make'), make: mapValueOfType<String>(json, r'make'),
model: Option.from(mapValueOfType<String>(json, r'model')), model: Some.tryFrom(mapValueOfType<String>(json, r'model')),
page: num.parse('${json[r'page']}'), page: num.parse('${json[r'page']}'),
personIds: json[r'personIds'] is Iterable personIds: json[r'personIds'] is Iterable
? (json[r'personIds'] as Iterable).cast<String>().toList(growable: false) ? (json[r'personIds'] as Iterable).cast<String>().toList(growable: false)
@ -524,7 +524,7 @@ class SmartSearchDto {
query: mapValueOfType<String>(json, r'query')!, query: mapValueOfType<String>(json, r'query')!,
rating: num.parse('${json[r'rating']}'), rating: num.parse('${json[r'rating']}'),
size: num.parse('${json[r'size']}'), size: num.parse('${json[r'size']}'),
state: Option.from(mapValueOfType<String>(json, r'state')), state: Some.tryFrom(mapValueOfType<String>(json, r'state')),
tagIds: json[r'tagIds'] is Iterable tagIds: json[r'tagIds'] is Iterable
? (json[r'tagIds'] as Iterable).cast<String>().toList(growable: false) ? (json[r'tagIds'] as Iterable).cast<String>().toList(growable: false)
: const [], : const [],

View File

@ -334,30 +334,30 @@ class SyncAssetExifV1 {
return SyncAssetExifV1( return SyncAssetExifV1(
assetId: mapValueOfType<String>(json, r'assetId')!, assetId: mapValueOfType<String>(json, r'assetId')!,
city: Option.from(mapValueOfType<String>(json, r'city')), city: Some.tryFrom(mapValueOfType<String>(json, r'city')),
country: Option.from(mapValueOfType<String>(json, r'country')), country: Some.tryFrom(mapValueOfType<String>(json, r'country')),
dateTimeOriginal: Option.from(mapDateTime(json, r'dateTimeOriginal', r'')), dateTimeOriginal: Some.tryFrom(mapDateTime(json, r'dateTimeOriginal', r'')),
description: Option.from(mapValueOfType<String>(json, r'description')), description: Some.tryFrom(mapValueOfType<String>(json, r'description')),
exifImageHeight: Option.from(mapValueOfType<int>(json, r'exifImageHeight')), exifImageHeight: Some.tryFrom(mapValueOfType<int>(json, r'exifImageHeight')),
exifImageWidth: Option.from(mapValueOfType<int>(json, r'exifImageWidth')), exifImageWidth: Some.tryFrom(mapValueOfType<int>(json, r'exifImageWidth')),
exposureTime: Option.from(mapValueOfType<String>(json, r'exposureTime')), exposureTime: Some.tryFrom(mapValueOfType<String>(json, r'exposureTime')),
fNumber: Option.from(mapValueOfType<int>(json, r'fNumber')), fNumber: Some.tryFrom(mapValueOfType<int>(json, r'fNumber')),
fileSizeInByte: Option.from(mapValueOfType<int>(json, r'fileSizeInByte')), fileSizeInByte: Some.tryFrom(mapValueOfType<int>(json, r'fileSizeInByte')),
focalLength: Option.from(mapValueOfType<int>(json, r'focalLength')), focalLength: Some.tryFrom(mapValueOfType<int>(json, r'focalLength')),
fps: Option.from(mapValueOfType<int>(json, r'fps')), fps: Some.tryFrom(mapValueOfType<int>(json, r'fps')),
iso: Option.from(mapValueOfType<int>(json, r'iso')), iso: Some.tryFrom(mapValueOfType<int>(json, r'iso')),
latitude: Option.from(mapValueOfType<int>(json, r'latitude')), latitude: Some.tryFrom(mapValueOfType<int>(json, r'latitude')),
lensModel: Option.from(mapValueOfType<String>(json, r'lensModel')), lensModel: Some.tryFrom(mapValueOfType<String>(json, r'lensModel')),
longitude: Option.from(mapValueOfType<int>(json, r'longitude')), longitude: Some.tryFrom(mapValueOfType<int>(json, r'longitude')),
make: Option.from(mapValueOfType<String>(json, r'make')), make: Some.tryFrom(mapValueOfType<String>(json, r'make')),
model: Option.from(mapValueOfType<String>(json, r'model')), model: Some.tryFrom(mapValueOfType<String>(json, r'model')),
modifyDate: Option.from(mapDateTime(json, r'modifyDate', r'')), modifyDate: Some.tryFrom(mapDateTime(json, r'modifyDate', r'')),
orientation: Option.from(mapValueOfType<String>(json, r'orientation')), orientation: Some.tryFrom(mapValueOfType<String>(json, r'orientation')),
profileDescription: Option.from(mapValueOfType<String>(json, r'profileDescription')), profileDescription: Some.tryFrom(mapValueOfType<String>(json, r'profileDescription')),
projectionType: Option.from(mapValueOfType<String>(json, r'projectionType')), projectionType: Some.tryFrom(mapValueOfType<String>(json, r'projectionType')),
rating: Option.from(mapValueOfType<int>(json, r'rating')), rating: Some.tryFrom(mapValueOfType<int>(json, r'rating')),
state: Option.from(mapValueOfType<String>(json, r'state')), state: Some.tryFrom(mapValueOfType<String>(json, r'state')),
timeZone: Option.from(mapValueOfType<String>(json, r'timeZone')), timeZone: Some.tryFrom(mapValueOfType<String>(json, r'timeZone')),
); );
} }
return null; return null;

View File

@ -136,14 +136,14 @@ class SyncAssetV1 {
return SyncAssetV1( return SyncAssetV1(
checksum: mapValueOfType<String>(json, r'checksum')!, checksum: mapValueOfType<String>(json, r'checksum')!,
deletedAt: Option.from(mapDateTime(json, r'deletedAt', r'')), deletedAt: Some.tryFrom(mapDateTime(json, r'deletedAt', r'')),
fileCreatedAt: Option.from(mapDateTime(json, r'fileCreatedAt', r'')), fileCreatedAt: Some.tryFrom(mapDateTime(json, r'fileCreatedAt', r'')),
fileModifiedAt: Option.from(mapDateTime(json, r'fileModifiedAt', r'')), fileModifiedAt: Some.tryFrom(mapDateTime(json, r'fileModifiedAt', r'')),
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!, isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
localDateTime: Option.from(mapDateTime(json, r'localDateTime', r'')), localDateTime: Some.tryFrom(mapDateTime(json, r'localDateTime', r'')),
ownerId: mapValueOfType<String>(json, r'ownerId')!, ownerId: mapValueOfType<String>(json, r'ownerId')!,
thumbhash: Option.from(mapValueOfType<String>(json, r'thumbhash')), thumbhash: Some.tryFrom(mapValueOfType<String>(json, r'thumbhash')),
type: SyncAssetV1TypeEnum.fromJson(json[r'type'])!, type: SyncAssetV1TypeEnum.fromJson(json[r'type'])!,
visibility: SyncAssetV1VisibilityEnum.fromJson(json[r'visibility'])!, visibility: SyncAssetV1VisibilityEnum.fromJson(json[r'visibility'])!,
); );

View File

@ -69,7 +69,7 @@ class SyncUserV1 {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return SyncUserV1( return SyncUserV1(
deletedAt: Option.from(mapDateTime(json, r'deletedAt', r'')), deletedAt: Some.tryFrom(mapDateTime(json, r'deletedAt', r'')),
email: mapValueOfType<String>(json, r'email')!, email: mapValueOfType<String>(json, r'email')!,
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
name: mapValueOfType<String>(json, r'name')!, name: mapValueOfType<String>(json, r'name')!,

View File

@ -75,7 +75,7 @@ class TagCreateDto {
return TagCreateDto( return TagCreateDto(
color: mapValueOfType<String>(json, r'color'), color: mapValueOfType<String>(json, r'color'),
name: mapValueOfType<String>(json, r'name')!, name: mapValueOfType<String>(json, r'name')!,
parentId: Option.from(mapValueOfType<String>(json, r'parentId')), parentId: Some.tryFrom(mapValueOfType<String>(json, r'parentId')),
); );
} }
return null; return null;

View File

@ -51,7 +51,7 @@ class TagUpdateDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return TagUpdateDto( return TagUpdateDto(
color: Option.from(mapValueOfType<String>(json, r'color')), color: Some.tryFrom(mapValueOfType<String>(json, r'color')),
); );
} }
return null; return null;

View File

@ -169,7 +169,7 @@ class UpdateAssetDto {
description: mapValueOfType<String>(json, r'description'), description: mapValueOfType<String>(json, r'description'),
isFavorite: mapValueOfType<bool>(json, r'isFavorite'), isFavorite: mapValueOfType<bool>(json, r'isFavorite'),
latitude: num.parse('${json[r'latitude']}'), latitude: num.parse('${json[r'latitude']}'),
livePhotoVideoId: Option.from(mapValueOfType<String>(json, r'livePhotoVideoId')), livePhotoVideoId: Some.tryFrom(mapValueOfType<String>(json, r'livePhotoVideoId')),
longitude: num.parse('${json[r'longitude']}'), longitude: num.parse('${json[r'longitude']}'),
rating: num.parse('${json[r'rating']}'), rating: num.parse('${json[r'rating']}'),
visibility: AssetVisibility.fromJson(json[r'visibility']), visibility: AssetVisibility.fromJson(json[r'visibility']),

View File

@ -94,7 +94,7 @@ class UsageByUserDto {
return UsageByUserDto( return UsageByUserDto(
photos: mapValueOfType<int>(json, r'photos')!, photos: mapValueOfType<int>(json, r'photos')!,
quotaSizeInBytes: Option.from(mapValueOfType<int>(json, r'quotaSizeInBytes')), quotaSizeInBytes: Some.tryFrom(mapValueOfType<int>(json, r'quotaSizeInBytes')),
usage: mapValueOfType<int>(json, r'usage')!, usage: mapValueOfType<int>(json, r'usage')!,
usagePhotos: mapValueOfType<int>(json, r'usagePhotos')!, usagePhotos: mapValueOfType<int>(json, r'usagePhotos')!,
usageVideos: mapValueOfType<int>(json, r'usageVideos')!, usageVideos: mapValueOfType<int>(json, r'usageVideos')!,

View File

@ -126,14 +126,14 @@ class UserAdminCreateDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return UserAdminCreateDto( return UserAdminCreateDto(
avatarColor: Option.from(UserAvatarColor.fromJson(json[r'avatarColor'])), avatarColor: Some.tryFrom(UserAvatarColor.fromJson(json[r'avatarColor'])),
email: mapValueOfType<String>(json, r'email')!, email: mapValueOfType<String>(json, r'email')!,
name: mapValueOfType<String>(json, r'name')!, name: mapValueOfType<String>(json, r'name')!,
notify: mapValueOfType<bool>(json, r'notify'), notify: mapValueOfType<bool>(json, r'notify'),
password: mapValueOfType<String>(json, r'password')!, password: mapValueOfType<String>(json, r'password')!,
quotaSizeInBytes: Option.from(mapValueOfType<int>(json, r'quotaSizeInBytes')), quotaSizeInBytes: Some.tryFrom(mapValueOfType<int>(json, r'quotaSizeInBytes')),
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword'), shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword'),
storageLabel: Option.from(mapValueOfType<String>(json, r'storageLabel')), storageLabel: Some.tryFrom(mapValueOfType<String>(json, r'storageLabel')),
); );
} }
return null; return null;

View File

@ -173,20 +173,20 @@ class UserAdminResponseDto {
return UserAdminResponseDto( return UserAdminResponseDto(
avatarColor: UserAvatarColor.fromJson(json[r'avatarColor'])!, avatarColor: UserAvatarColor.fromJson(json[r'avatarColor'])!,
createdAt: mapDateTime(json, r'createdAt', r'')!, createdAt: mapDateTime(json, r'createdAt', r'')!,
deletedAt: Option.from(mapDateTime(json, r'deletedAt', r'')), deletedAt: Some.tryFrom(mapDateTime(json, r'deletedAt', r'')),
email: mapValueOfType<String>(json, r'email')!, email: mapValueOfType<String>(json, r'email')!,
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
isAdmin: mapValueOfType<bool>(json, r'isAdmin')!, isAdmin: mapValueOfType<bool>(json, r'isAdmin')!,
license: Option.from(UserLicense.fromJson(json[r'license'])), license: Some.tryFrom(UserLicense.fromJson(json[r'license'])),
name: mapValueOfType<String>(json, r'name')!, name: mapValueOfType<String>(json, r'name')!,
oauthId: mapValueOfType<String>(json, r'oauthId')!, oauthId: mapValueOfType<String>(json, r'oauthId')!,
profileChangedAt: mapDateTime(json, r'profileChangedAt', r'')!, profileChangedAt: mapDateTime(json, r'profileChangedAt', r'')!,
profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!, profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!,
quotaSizeInBytes: Option.from(mapValueOfType<int>(json, r'quotaSizeInBytes')), quotaSizeInBytes: Some.tryFrom(mapValueOfType<int>(json, r'quotaSizeInBytes')),
quotaUsageInBytes: Option.from(mapValueOfType<int>(json, r'quotaUsageInBytes')), quotaUsageInBytes: Some.tryFrom(mapValueOfType<int>(json, r'quotaUsageInBytes')),
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!, shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
status: UserStatus.fromJson(json[r'status'])!, status: UserStatus.fromJson(json[r'status'])!,
storageLabel: Option.from(mapValueOfType<String>(json, r'storageLabel')), storageLabel: Some.tryFrom(mapValueOfType<String>(json, r'storageLabel')),
updatedAt: mapDateTime(json, r'updatedAt', r'')!, updatedAt: mapDateTime(json, r'updatedAt', r'')!,
); );
} }

View File

@ -152,14 +152,14 @@ class UserAdminUpdateDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return UserAdminUpdateDto( return UserAdminUpdateDto(
avatarColor: Option.from(UserAvatarColor.fromJson(json[r'avatarColor'])), avatarColor: Some.tryFrom(UserAvatarColor.fromJson(json[r'avatarColor'])),
email: mapValueOfType<String>(json, r'email'), email: mapValueOfType<String>(json, r'email'),
name: mapValueOfType<String>(json, r'name'), name: mapValueOfType<String>(json, r'name'),
password: mapValueOfType<String>(json, r'password'), password: mapValueOfType<String>(json, r'password'),
pinCode: Option.from(mapValueOfType<String>(json, r'pinCode')), pinCode: Some.tryFrom(mapValueOfType<String>(json, r'pinCode')),
quotaSizeInBytes: Option.from(mapValueOfType<int>(json, r'quotaSizeInBytes')), quotaSizeInBytes: Some.tryFrom(mapValueOfType<int>(json, r'quotaSizeInBytes')),
shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword'), shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword'),
storageLabel: Option.from(mapValueOfType<String>(json, r'storageLabel')), storageLabel: Some.tryFrom(mapValueOfType<String>(json, r'storageLabel')),
); );
} }
return null; return null;

View File

@ -99,7 +99,7 @@ class UserUpdateMeDto {
final json = value.cast<String, dynamic>(); final json = value.cast<String, dynamic>();
return UserUpdateMeDto( return UserUpdateMeDto(
avatarColor: Option.from(UserAvatarColor.fromJson(json[r'avatarColor'])), avatarColor: Some.tryFrom(UserAvatarColor.fromJson(json[r'avatarColor'])),
email: mapValueOfType<String>(json, r'email'), email: mapValueOfType<String>(json, r'email'),
name: mapValueOfType<String>(json, r'name'), name: mapValueOfType<String>(json, r'name'),
password: mapValueOfType<String>(json, r'password'), password: mapValueOfType<String>(json, r'password'),

View File

@ -120,10 +120,10 @@ class {{{classname}}} {
return {{{classname}}}( return {{{classname}}}(
{{#vars}} {{#vars}}
{{#isDateTime}} {{#isDateTime}}
{{{name}}}: {{#isNullable}}Option.from({{/isNullable}}mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}}, {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}},
{{/isDateTime}} {{/isDateTime}}
{{#isDate}} {{#isDate}}
{{{name}}}: {{#isNullable}}Option.from({{/isNullable}}mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}}, {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}},
{{/isDate}} {{/isDate}}
{{^isDateTime}} {{^isDateTime}}
{{^isDate}} {{^isDate}}
@ -181,7 +181,7 @@ class {{{classname}}} {
{{{name}}}: null, // No support for decoding binary content from JSON {{{name}}}: null, // No support for decoding binary content from JSON
{{/isBinary}} {{/isBinary}}
{{^isBinary}} {{^isBinary}}
{{{name}}}: {{#isNullable}}Option.from({{/isNullable}}{{{complexType}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}}, {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}{{{complexType}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}},
{{/isBinary}} {{/isBinary}}
{{/isMap}} {{/isMap}}
{{/isArray}} {{/isArray}}
@ -203,20 +203,20 @@ class {{{classname}}} {
{{/isMap}} {{/isMap}}
{{^isMap}} {{^isMap}}
{{#isNumber}} {{#isNumber}}
{{{name}}}: {{#isNullable}}Option.from(json[r'{{{baseName}}}'] == null {{{name}}}: {{#isNullable}}Some.tryFrom(json[r'{{{baseName}}}'] == null
? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} ? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}
: {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'){{#isNullable}}){{/isNullable}}, : {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'){{#isNullable}}){{/isNullable}},
{{/isNumber}} {{/isNumber}}
{{#isDouble}} {{#isDouble}}
{{{name}}}: {{#isNullable}}Option.from({{/isNullable}}(mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}).toDouble(){{#isNullable}}){{/isNullable}}, {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}(mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}).toDouble(){{#isNullable}}){{/isNullable}},
{{/isDouble}} {{/isDouble}}
{{^isDouble}} {{^isDouble}}
{{^isNumber}} {{^isNumber}}
{{^isEnum}} {{^isEnum}}
{{{name}}}: {{#isNullable}}Option.from({{/isNullable}}mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}}, {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}},
{{/isEnum}} {{/isEnum}}
{{#isEnum}} {{#isEnum}}
{{{name}}}: {{#isNullable}}Option.from({{/isNullable}}{{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}}, {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}{{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}},
{{/isEnum}} {{/isEnum}}
{{/isNumber}} {{/isNumber}}
{{/isDouble}} {{/isDouble}}

View File

@ -93,11 +93,11 @@ index 3a6c457..b1c8c5b 100644
{{#vars}} {{#vars}}
{{#isDateTime}} {{#isDateTime}}
- {{{name}}}: mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, - {{{name}}}: mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
+ {{{name}}}: {{#isNullable}}Option.from({{/isNullable}}mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}}, + {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}},
{{/isDateTime}} {{/isDateTime}}
{{#isDate}} {{#isDate}}
- {{{name}}}: mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, - {{{name}}}: mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
+ {{{name}}}: {{#isNullable}}Option.from({{/isNullable}}mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}}, + {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}},
{{/isDate}} {{/isDate}}
{{^isDateTime}} {{^isDateTime}}
{{^isDate}} {{^isDate}}
@ -106,7 +106,7 @@ index 3a6c457..b1c8c5b 100644
{{/isBinary}} {{/isBinary}}
{{^isBinary}} {{^isBinary}}
- {{{name}}}: {{{complexType}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, - {{{name}}}: {{{complexType}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
+ {{{name}}}: {{#isNullable}}Option.from({{/isNullable}}{{{complexType}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}}, + {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}{{{complexType}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}},
{{/isBinary}} {{/isBinary}}
{{/isMap}} {{/isMap}}
{{/isArray}} {{/isArray}}
@ -115,23 +115,23 @@ index 3a6c457..b1c8c5b 100644
{{^isMap}} {{^isMap}}
{{#isNumber}} {{#isNumber}}
- {{{name}}}: {{#isNullable}}json[r'{{{baseName}}}'] == null - {{{name}}}: {{#isNullable}}json[r'{{{baseName}}}'] == null
+ {{{name}}}: {{#isNullable}}Option.from(json[r'{{{baseName}}}'] == null + {{{name}}}: {{#isNullable}}Some.tryFrom(json[r'{{{baseName}}}'] == null
? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} ? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}
- : {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'), - : {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'),
+ : {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'){{#isNullable}}){{/isNullable}}, + : {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'){{#isNullable}}){{/isNullable}},
{{/isNumber}} {{/isNumber}}
+ {{#isDouble}} + {{#isDouble}}
+ {{{name}}}: {{#isNullable}}Option.from({{/isNullable}}(mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}).toDouble(){{#isNullable}}){{/isNullable}}, + {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}(mapValueOfType<num>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}).toDouble(){{#isNullable}}){{/isNullable}},
+ {{/isDouble}} + {{/isDouble}}
+ {{^isDouble}} + {{^isDouble}}
{{^isNumber}} {{^isNumber}}
{{^isEnum}} {{^isEnum}}
- {{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, - {{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
+ {{{name}}}: {{#isNullable}}Option.from({{/isNullable}}mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}}, + {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}},
{{/isEnum}} {{/isEnum}}
{{#isEnum}} {{#isEnum}}
- {{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, - {{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
+ {{{name}}}: {{#isNullable}}Option.from({{/isNullable}}{{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}}, + {{{name}}}: {{#isNullable}}Some.tryFrom({{/isNullable}}{{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}{{#isNullable}}){{/isNullable}},
{{/isEnum}} {{/isEnum}}
{{/isNumber}} {{/isNumber}}
+ {{/isDouble}} + {{/isDouble}}