fix(mobile): omit null values from json requests (#1212)

* chore: initial template

* feat: exlude null values

* chore: regenerate openapi

* chore: merge

* feat: store changes in a patch file

* feat: extract to sh script

* chore: regenerate openapi

* chore: remove duplicate file

* feat: generate mobile by itself

* Fixed number property not decorated correctly

* Revert hotfix, fix test

* Merge main

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Jason Rasmussen 2023-01-09 23:08:45 -05:00 committed by GitHub
parent bd838a71d1
commit 079ee658a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
79 changed files with 890 additions and 557 deletions

View File

@ -8,7 +8,7 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **num** | |
**id** | **int** | |
**name** | **String** | |
**createdAt** | **String** | |
**updatedAt** | **String** | |

View File

@ -31,9 +31,9 @@ class AddAssetsDto {
String toString() => 'AddAssetsDto[assetIds=$assetIds]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'assetIds'] = assetIds;
return _json;
final json = <String, dynamic>{};
json[r'assetIds'] = this.assetIds;
return json;
}
/// Returns a new [AddAssetsDto] instance and imports its values from

View File

@ -47,15 +47,15 @@ class AddAssetsResponseDto {
String toString() => 'AddAssetsResponseDto[successfullyAdded=$successfullyAdded, alreadyInAlbum=$alreadyInAlbum, album=$album]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'successfullyAdded'] = successfullyAdded;
_json[r'alreadyInAlbum'] = alreadyInAlbum;
if (album != null) {
_json[r'album'] = album;
final json = <String, dynamic>{};
json[r'successfullyAdded'] = this.successfullyAdded;
json[r'alreadyInAlbum'] = this.alreadyInAlbum;
if (this.album != null) {
json[r'album'] = this.album;
} else {
_json[r'album'] = null;
// json[r'album'] = null;
}
return _json;
return json;
}
/// Returns a new [AddAssetsResponseDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class AddUsersDto {
String toString() => 'AddUsersDto[sharedUserIds=$sharedUserIds]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'sharedUserIds'] = sharedUserIds;
return _json;
final json = <String, dynamic>{};
json[r'sharedUserIds'] = this.sharedUserIds;
return json;
}
/// Returns a new [AddUsersDto] instance and imports its values from

View File

@ -51,13 +51,13 @@ class AdminSignupResponseDto {
String toString() => 'AdminSignupResponseDto[id=$id, email=$email, firstName=$firstName, lastName=$lastName, createdAt=$createdAt]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'email'] = email;
_json[r'firstName'] = firstName;
_json[r'lastName'] = lastName;
_json[r'createdAt'] = createdAt;
return _json;
final json = <String, dynamic>{};
json[r'id'] = this.id;
json[r'email'] = this.email;
json[r'firstName'] = this.firstName;
json[r'lastName'] = this.lastName;
json[r'createdAt'] = this.createdAt;
return json;
}
/// Returns a new [AdminSignupResponseDto] instance and imports its values from

View File

@ -41,11 +41,11 @@ class AlbumCountResponseDto {
String toString() => 'AlbumCountResponseDto[owned=$owned, shared=$shared, sharing=$sharing]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'owned'] = owned;
_json[r'shared'] = shared;
_json[r'sharing'] = sharing;
return _json;
final json = <String, dynamic>{};
json[r'owned'] = this.owned;
json[r'shared'] = this.shared;
json[r'sharing'] = this.sharing;
return json;
}
/// Returns a new [AlbumCountResponseDto] instance and imports its values from

View File

@ -71,21 +71,21 @@ class AlbumResponseDto {
String toString() => 'AlbumResponseDto[assetCount=$assetCount, id=$id, ownerId=$ownerId, albumName=$albumName, createdAt=$createdAt, albumThumbnailAssetId=$albumThumbnailAssetId, shared=$shared, sharedUsers=$sharedUsers, assets=$assets]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'assetCount'] = assetCount;
_json[r'id'] = id;
_json[r'ownerId'] = ownerId;
_json[r'albumName'] = albumName;
_json[r'createdAt'] = createdAt;
if (albumThumbnailAssetId != null) {
_json[r'albumThumbnailAssetId'] = albumThumbnailAssetId;
final json = <String, dynamic>{};
json[r'assetCount'] = this.assetCount;
json[r'id'] = this.id;
json[r'ownerId'] = this.ownerId;
json[r'albumName'] = this.albumName;
json[r'createdAt'] = this.createdAt;
if (this.albumThumbnailAssetId != null) {
json[r'albumThumbnailAssetId'] = this.albumThumbnailAssetId;
} else {
_json[r'albumThumbnailAssetId'] = null;
// json[r'albumThumbnailAssetId'] = null;
}
_json[r'shared'] = shared;
_json[r'sharedUsers'] = sharedUsers;
_json[r'assets'] = assets;
return _json;
json[r'shared'] = this.shared;
json[r'sharedUsers'] = this.sharedUsers;
json[r'assets'] = this.assets;
return json;
}
/// Returns a new [AlbumResponseDto] instance and imports its values from

View File

@ -76,18 +76,18 @@ class AllJobStatusResponseDto {
String toString() => 'AllJobStatusResponseDto[thumbnailGenerationQueueCount=$thumbnailGenerationQueueCount, metadataExtractionQueueCount=$metadataExtractionQueueCount, videoConversionQueueCount=$videoConversionQueueCount, machineLearningQueueCount=$machineLearningQueueCount, storageMigrationQueueCount=$storageMigrationQueueCount, isThumbnailGenerationActive=$isThumbnailGenerationActive, isMetadataExtractionActive=$isMetadataExtractionActive, isVideoConversionActive=$isVideoConversionActive, isMachineLearningActive=$isMachineLearningActive, isStorageMigrationActive=$isStorageMigrationActive]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'thumbnailGenerationQueueCount'] = thumbnailGenerationQueueCount;
_json[r'metadataExtractionQueueCount'] = metadataExtractionQueueCount;
_json[r'videoConversionQueueCount'] = videoConversionQueueCount;
_json[r'machineLearningQueueCount'] = machineLearningQueueCount;
_json[r'storageMigrationQueueCount'] = storageMigrationQueueCount;
_json[r'isThumbnailGenerationActive'] = isThumbnailGenerationActive;
_json[r'isMetadataExtractionActive'] = isMetadataExtractionActive;
_json[r'isVideoConversionActive'] = isVideoConversionActive;
_json[r'isMachineLearningActive'] = isMachineLearningActive;
_json[r'isStorageMigrationActive'] = isStorageMigrationActive;
return _json;
final json = <String, dynamic>{};
json[r'thumbnailGenerationQueueCount'] = this.thumbnailGenerationQueueCount;
json[r'metadataExtractionQueueCount'] = this.metadataExtractionQueueCount;
json[r'videoConversionQueueCount'] = this.videoConversionQueueCount;
json[r'machineLearningQueueCount'] = this.machineLearningQueueCount;
json[r'storageMigrationQueueCount'] = this.storageMigrationQueueCount;
json[r'isThumbnailGenerationActive'] = this.isThumbnailGenerationActive;
json[r'isMetadataExtractionActive'] = this.isMetadataExtractionActive;
json[r'isVideoConversionActive'] = this.isVideoConversionActive;
json[r'isMachineLearningActive'] = this.isMachineLearningActive;
json[r'isStorageMigrationActive'] = this.isStorageMigrationActive;
return json;
}
/// Returns a new [AllJobStatusResponseDto] instance and imports its values from

View File

@ -37,13 +37,13 @@ class APIKeyCreateDto {
String toString() => 'APIKeyCreateDto[name=$name]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
if (name != null) {
_json[r'name'] = name;
final json = <String, dynamic>{};
if (this.name != null) {
json[r'name'] = this.name;
} else {
_json[r'name'] = null;
// json[r'name'] = null;
}
return _json;
return json;
}
/// Returns a new [APIKeyCreateDto] instance and imports its values from

View File

@ -36,10 +36,10 @@ class APIKeyCreateResponseDto {
String toString() => 'APIKeyCreateResponseDto[secret=$secret, apiKey=$apiKey]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'secret'] = secret;
_json[r'apiKey'] = apiKey;
return _json;
final json = <String, dynamic>{};
json[r'secret'] = this.secret;
json[r'apiKey'] = this.apiKey;
return json;
}
/// Returns a new [APIKeyCreateResponseDto] instance and imports its values from

View File

@ -19,7 +19,7 @@ class APIKeyResponseDto {
required this.updatedAt,
});
num id;
int id;
String name;
@ -46,12 +46,12 @@ class APIKeyResponseDto {
String toString() => 'APIKeyResponseDto[id=$id, name=$name, createdAt=$createdAt, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'name'] = name;
_json[r'createdAt'] = createdAt;
_json[r'updatedAt'] = updatedAt;
return _json;
final json = <String, dynamic>{};
json[r'id'] = this.id;
json[r'name'] = this.name;
json[r'createdAt'] = this.createdAt;
json[r'updatedAt'] = this.updatedAt;
return json;
}
/// Returns a new [APIKeyResponseDto] instance and imports its values from
@ -73,9 +73,7 @@ class APIKeyResponseDto {
}());
return APIKeyResponseDto(
id: json[r'id'] == null
? null
: num.parse(json[r'id'].toString()),
id: mapValueOfType<int>(json, r'id')!,
name: mapValueOfType<String>(json, r'name')!,
createdAt: mapValueOfType<String>(json, r'createdAt')!,
updatedAt: mapValueOfType<String>(json, r'updatedAt')!,

View File

@ -31,9 +31,9 @@ class APIKeyUpdateDto {
String toString() => 'APIKeyUpdateDto[name=$name]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'name'] = name;
return _json;
final json = <String, dynamic>{};
json[r'name'] = this.name;
return json;
}
/// Returns a new [APIKeyUpdateDto] instance and imports its values from

View File

@ -36,10 +36,10 @@ class AssetCountByTimeBucket {
String toString() => 'AssetCountByTimeBucket[timeBucket=$timeBucket, count=$count]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'timeBucket'] = timeBucket;
_json[r'count'] = count;
return _json;
final json = <String, dynamic>{};
json[r'timeBucket'] = this.timeBucket;
json[r'count'] = this.count;
return json;
}
/// Returns a new [AssetCountByTimeBucket] instance and imports its values from

View File

@ -36,10 +36,10 @@ class AssetCountByTimeBucketResponseDto {
String toString() => 'AssetCountByTimeBucketResponseDto[totalCount=$totalCount, buckets=$buckets]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'totalCount'] = totalCount;
_json[r'buckets'] = buckets;
return _json;
final json = <String, dynamic>{};
json[r'totalCount'] = this.totalCount;
json[r'buckets'] = this.buckets;
return json;
}
/// Returns a new [AssetCountByTimeBucketResponseDto] instance and imports its values from

View File

@ -51,13 +51,13 @@ class AssetCountByUserIdResponseDto {
String toString() => 'AssetCountByUserIdResponseDto[audio=$audio, photos=$photos, videos=$videos, other=$other, total=$total]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'audio'] = audio;
_json[r'photos'] = photos;
_json[r'videos'] = videos;
_json[r'other'] = other;
_json[r'total'] = total;
return _json;
final json = <String, dynamic>{};
json[r'audio'] = this.audio;
json[r'photos'] = this.photos;
json[r'videos'] = this.videos;
json[r'other'] = this.other;
json[r'total'] = this.total;
return json;
}
/// Returns a new [AssetCountByUserIdResponseDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class AssetFileUploadResponseDto {
String toString() => 'AssetFileUploadResponseDto[id=$id]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
return _json;
final json = <String, dynamic>{};
json[r'id'] = this.id;
return json;
}
/// Returns a new [AssetFileUploadResponseDto] instance and imports its values from

View File

@ -128,54 +128,54 @@ class AssetResponseDto {
String toString() => 'AssetResponseDto[type=$type, id=$id, deviceAssetId=$deviceAssetId, ownerId=$ownerId, deviceId=$deviceId, originalPath=$originalPath, resizePath=$resizePath, createdAt=$createdAt, modifiedAt=$modifiedAt, isFavorite=$isFavorite, mimeType=$mimeType, duration=$duration, webpPath=$webpPath, encodedVideoPath=$encodedVideoPath, exifInfo=$exifInfo, smartInfo=$smartInfo, livePhotoVideoId=$livePhotoVideoId, tags=$tags]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'type'] = type;
_json[r'id'] = id;
_json[r'deviceAssetId'] = deviceAssetId;
_json[r'ownerId'] = ownerId;
_json[r'deviceId'] = deviceId;
_json[r'originalPath'] = originalPath;
if (resizePath != null) {
_json[r'resizePath'] = resizePath;
final json = <String, dynamic>{};
json[r'type'] = this.type;
json[r'id'] = this.id;
json[r'deviceAssetId'] = this.deviceAssetId;
json[r'ownerId'] = this.ownerId;
json[r'deviceId'] = this.deviceId;
json[r'originalPath'] = this.originalPath;
if (this.resizePath != null) {
json[r'resizePath'] = this.resizePath;
} else {
_json[r'resizePath'] = null;
// json[r'resizePath'] = null;
}
_json[r'createdAt'] = createdAt;
_json[r'modifiedAt'] = modifiedAt;
_json[r'isFavorite'] = isFavorite;
if (mimeType != null) {
_json[r'mimeType'] = mimeType;
json[r'createdAt'] = this.createdAt;
json[r'modifiedAt'] = this.modifiedAt;
json[r'isFavorite'] = this.isFavorite;
if (this.mimeType != null) {
json[r'mimeType'] = this.mimeType;
} else {
_json[r'mimeType'] = null;
// json[r'mimeType'] = null;
}
_json[r'duration'] = duration;
if (webpPath != null) {
_json[r'webpPath'] = webpPath;
json[r'duration'] = this.duration;
if (this.webpPath != null) {
json[r'webpPath'] = this.webpPath;
} else {
_json[r'webpPath'] = null;
// json[r'webpPath'] = null;
}
if (encodedVideoPath != null) {
_json[r'encodedVideoPath'] = encodedVideoPath;
if (this.encodedVideoPath != null) {
json[r'encodedVideoPath'] = this.encodedVideoPath;
} else {
_json[r'encodedVideoPath'] = null;
// json[r'encodedVideoPath'] = null;
}
if (exifInfo != null) {
_json[r'exifInfo'] = exifInfo;
if (this.exifInfo != null) {
json[r'exifInfo'] = this.exifInfo;
} else {
_json[r'exifInfo'] = null;
// json[r'exifInfo'] = null;
}
if (smartInfo != null) {
_json[r'smartInfo'] = smartInfo;
if (this.smartInfo != null) {
json[r'smartInfo'] = this.smartInfo;
} else {
_json[r'smartInfo'] = null;
// json[r'smartInfo'] = null;
}
if (livePhotoVideoId != null) {
_json[r'livePhotoVideoId'] = livePhotoVideoId;
if (this.livePhotoVideoId != null) {
json[r'livePhotoVideoId'] = this.livePhotoVideoId;
} else {
_json[r'livePhotoVideoId'] = null;
// json[r'livePhotoVideoId'] = null;
}
_json[r'tags'] = tags;
return _json;
json[r'tags'] = this.tags;
return json;
}
/// Returns a new [AssetResponseDto] instance and imports its values from

View File

@ -36,10 +36,10 @@ class ChangePasswordDto {
String toString() => 'ChangePasswordDto[password=$password, newPassword=$newPassword]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'password'] = password;
_json[r'newPassword'] = newPassword;
return _json;
final json = <String, dynamic>{};
json[r'password'] = this.password;
json[r'newPassword'] = this.newPassword;
return json;
}
/// Returns a new [ChangePasswordDto] instance and imports its values from

View File

@ -36,10 +36,10 @@ class CheckDuplicateAssetDto {
String toString() => 'CheckDuplicateAssetDto[deviceAssetId=$deviceAssetId, deviceId=$deviceId]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'deviceAssetId'] = deviceAssetId;
_json[r'deviceId'] = deviceId;
return _json;
final json = <String, dynamic>{};
json[r'deviceAssetId'] = this.deviceAssetId;
json[r'deviceId'] = this.deviceId;
return json;
}
/// Returns a new [CheckDuplicateAssetDto] instance and imports its values from

View File

@ -42,14 +42,14 @@ class CheckDuplicateAssetResponseDto {
String toString() => 'CheckDuplicateAssetResponseDto[isExist=$isExist, id=$id]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'isExist'] = isExist;
if (id != null) {
_json[r'id'] = id;
final json = <String, dynamic>{};
json[r'isExist'] = this.isExist;
if (this.id != null) {
json[r'id'] = this.id;
} else {
_json[r'id'] = null;
// json[r'id'] = null;
}
return _json;
return json;
}
/// Returns a new [CheckDuplicateAssetResponseDto] instance and imports its values from

View File

@ -36,10 +36,10 @@ class CheckExistingAssetsDto {
String toString() => 'CheckExistingAssetsDto[deviceAssetIds=$deviceAssetIds, deviceId=$deviceId]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'deviceAssetIds'] = deviceAssetIds;
_json[r'deviceId'] = deviceId;
return _json;
final json = <String, dynamic>{};
json[r'deviceAssetIds'] = this.deviceAssetIds;
json[r'deviceId'] = this.deviceId;
return json;
}
/// Returns a new [CheckExistingAssetsDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class CheckExistingAssetsResponseDto {
String toString() => 'CheckExistingAssetsResponseDto[existingIds=$existingIds]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'existingIds'] = existingIds;
return _json;
final json = <String, dynamic>{};
json[r'existingIds'] = this.existingIds;
return json;
}
/// Returns a new [CheckExistingAssetsResponseDto] instance and imports its values from

View File

@ -41,11 +41,11 @@ class CreateAlbumDto {
String toString() => 'CreateAlbumDto[albumName=$albumName, sharedWithUserIds=$sharedWithUserIds, assetIds=$assetIds]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'albumName'] = albumName;
_json[r'sharedWithUserIds'] = sharedWithUserIds;
_json[r'assetIds'] = assetIds;
return _json;
final json = <String, dynamic>{};
json[r'albumName'] = this.albumName;
json[r'sharedWithUserIds'] = this.sharedWithUserIds;
json[r'assetIds'] = this.assetIds;
return json;
}
/// Returns a new [CreateAlbumDto] instance and imports its values from

View File

@ -64,24 +64,24 @@ class CreateAlbumShareLinkDto {
String toString() => 'CreateAlbumShareLinkDto[albumId=$albumId, expiredAt=$expiredAt, allowUpload=$allowUpload, description=$description]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'albumId'] = albumId;
if (expiredAt != null) {
_json[r'expiredAt'] = expiredAt;
final json = <String, dynamic>{};
json[r'albumId'] = this.albumId;
if (this.expiredAt != null) {
json[r'expiredAt'] = this.expiredAt;
} else {
_json[r'expiredAt'] = null;
// json[r'expiredAt'] = null;
}
if (allowUpload != null) {
_json[r'allowUpload'] = allowUpload;
if (this.allowUpload != null) {
json[r'allowUpload'] = this.allowUpload;
} else {
_json[r'allowUpload'] = null;
// json[r'allowUpload'] = null;
}
if (description != null) {
_json[r'description'] = description;
if (this.description != null) {
json[r'description'] = this.description;
} else {
_json[r'description'] = null;
// json[r'description'] = null;
}
return _json;
return json;
}
/// Returns a new [CreateAlbumShareLinkDto] instance and imports its values from

View File

@ -36,10 +36,10 @@ class CreateProfileImageResponseDto {
String toString() => 'CreateProfileImageResponseDto[userId=$userId, profileImagePath=$profileImagePath]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'userId'] = userId;
_json[r'profileImagePath'] = profileImagePath;
return _json;
final json = <String, dynamic>{};
json[r'userId'] = this.userId;
json[r'profileImagePath'] = this.profileImagePath;
return json;
}
/// Returns a new [CreateProfileImageResponseDto] instance and imports its values from

View File

@ -36,10 +36,10 @@ class CreateTagDto {
String toString() => 'CreateTagDto[type=$type, name=$name]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'type'] = type;
_json[r'name'] = name;
return _json;
final json = <String, dynamic>{};
json[r'type'] = this.type;
json[r'name'] = this.name;
return json;
}
/// Returns a new [CreateTagDto] instance and imports its values from

View File

@ -46,12 +46,12 @@ class CreateUserDto {
String toString() => 'CreateUserDto[email=$email, password=$password, firstName=$firstName, lastName=$lastName]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'email'] = email;
_json[r'password'] = password;
_json[r'firstName'] = firstName;
_json[r'lastName'] = lastName;
return _json;
final json = <String, dynamic>{};
json[r'email'] = this.email;
json[r'password'] = this.password;
json[r'firstName'] = this.firstName;
json[r'lastName'] = this.lastName;
return json;
}
/// Returns a new [CreateUserDto] instance and imports its values from

View File

@ -51,13 +51,13 @@ class CuratedLocationsResponseDto {
String toString() => 'CuratedLocationsResponseDto[id=$id, city=$city, resizePath=$resizePath, deviceAssetId=$deviceAssetId, deviceId=$deviceId]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'city'] = city;
_json[r'resizePath'] = resizePath;
_json[r'deviceAssetId'] = deviceAssetId;
_json[r'deviceId'] = deviceId;
return _json;
final json = <String, dynamic>{};
json[r'id'] = this.id;
json[r'city'] = this.city;
json[r'resizePath'] = this.resizePath;
json[r'deviceAssetId'] = this.deviceAssetId;
json[r'deviceId'] = this.deviceId;
return json;
}
/// Returns a new [CuratedLocationsResponseDto] instance and imports its values from

View File

@ -51,13 +51,13 @@ class CuratedObjectsResponseDto {
String toString() => 'CuratedObjectsResponseDto[id=$id, object=$object, resizePath=$resizePath, deviceAssetId=$deviceAssetId, deviceId=$deviceId]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'object'] = object;
_json[r'resizePath'] = resizePath;
_json[r'deviceAssetId'] = deviceAssetId;
_json[r'deviceId'] = deviceId;
return _json;
final json = <String, dynamic>{};
json[r'id'] = this.id;
json[r'object'] = this.object;
json[r'resizePath'] = this.resizePath;
json[r'deviceAssetId'] = this.deviceAssetId;
json[r'deviceId'] = this.deviceId;
return json;
}
/// Returns a new [CuratedObjectsResponseDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class DeleteAssetDto {
String toString() => 'DeleteAssetDto[ids=$ids]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'ids'] = ids;
return _json;
final json = <String, dynamic>{};
json[r'ids'] = this.ids;
return json;
}
/// Returns a new [DeleteAssetDto] instance and imports its values from

View File

@ -36,10 +36,10 @@ class DeleteAssetResponseDto {
String toString() => 'DeleteAssetResponseDto[status=$status, id=$id]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'status'] = status;
_json[r'id'] = id;
return _json;
final json = <String, dynamic>{};
json[r'status'] = this.status;
json[r'id'] = this.id;
return json;
}
/// Returns a new [DeleteAssetResponseDto] instance and imports its values from

View File

@ -56,14 +56,14 @@ class DeviceInfoResponseDto {
String toString() => 'DeviceInfoResponseDto[id=$id, deviceType=$deviceType, userId=$userId, deviceId=$deviceId, createdAt=$createdAt, isAutoBackup=$isAutoBackup]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'deviceType'] = deviceType;
_json[r'userId'] = userId;
_json[r'deviceId'] = deviceId;
_json[r'createdAt'] = createdAt;
_json[r'isAutoBackup'] = isAutoBackup;
return _json;
final json = <String, dynamic>{};
json[r'id'] = this.id;
json[r'deviceType'] = this.deviceType;
json[r'userId'] = this.userId;
json[r'deviceId'] = this.deviceId;
json[r'createdAt'] = this.createdAt;
json[r'isAutoBackup'] = this.isAutoBackup;
return json;
}
/// Returns a new [DeviceInfoResponseDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class DownloadFilesDto {
String toString() => 'DownloadFilesDto[assetIds=$assetIds]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'assetIds'] = assetIds;
return _json;
final json = <String, dynamic>{};
json[r'assetIds'] = this.assetIds;
return json;
}
/// Returns a new [DownloadFilesDto] instance and imports its values from

View File

@ -70,28 +70,28 @@ class EditSharedLinkDto {
String toString() => 'EditSharedLinkDto[description=$description, expiredAt=$expiredAt, allowUpload=$allowUpload, isEditExpireTime=$isEditExpireTime]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
if (description != null) {
_json[r'description'] = description;
final json = <String, dynamic>{};
if (this.description != null) {
json[r'description'] = this.description;
} else {
_json[r'description'] = null;
// json[r'description'] = null;
}
if (expiredAt != null) {
_json[r'expiredAt'] = expiredAt;
if (this.expiredAt != null) {
json[r'expiredAt'] = this.expiredAt;
} else {
_json[r'expiredAt'] = null;
// json[r'expiredAt'] = null;
}
if (allowUpload != null) {
_json[r'allowUpload'] = allowUpload;
if (this.allowUpload != null) {
json[r'allowUpload'] = this.allowUpload;
} else {
_json[r'allowUpload'] = null;
// json[r'allowUpload'] = null;
}
if (isEditExpireTime != null) {
_json[r'isEditExpireTime'] = isEditExpireTime;
if (this.isEditExpireTime != null) {
json[r'isEditExpireTime'] = this.isEditExpireTime;
} else {
_json[r'isEditExpireTime'] = null;
// json[r'isEditExpireTime'] = null;
}
return _json;
return json;
}
/// Returns a new [EditSharedLinkDto] instance and imports its values from

View File

@ -126,108 +126,108 @@ class ExifResponseDto {
String toString() => 'ExifResponseDto[id=$id, fileSizeInByte=$fileSizeInByte, make=$make, model=$model, imageName=$imageName, exifImageWidth=$exifImageWidth, exifImageHeight=$exifImageHeight, orientation=$orientation, dateTimeOriginal=$dateTimeOriginal, modifyDate=$modifyDate, lensModel=$lensModel, fNumber=$fNumber, focalLength=$focalLength, iso=$iso, exposureTime=$exposureTime, latitude=$latitude, longitude=$longitude, city=$city, state=$state, country=$country]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
if (id != null) {
_json[r'id'] = id;
final json = <String, dynamic>{};
if (this.id != null) {
json[r'id'] = this.id;
} else {
_json[r'id'] = null;
// json[r'id'] = null;
}
if (fileSizeInByte != null) {
_json[r'fileSizeInByte'] = fileSizeInByte;
if (this.fileSizeInByte != null) {
json[r'fileSizeInByte'] = this.fileSizeInByte;
} else {
_json[r'fileSizeInByte'] = null;
// json[r'fileSizeInByte'] = null;
}
if (make != null) {
_json[r'make'] = make;
if (this.make != null) {
json[r'make'] = this.make;
} else {
_json[r'make'] = null;
// json[r'make'] = null;
}
if (model != null) {
_json[r'model'] = model;
if (this.model != null) {
json[r'model'] = this.model;
} else {
_json[r'model'] = null;
// json[r'model'] = null;
}
if (imageName != null) {
_json[r'imageName'] = imageName;
if (this.imageName != null) {
json[r'imageName'] = this.imageName;
} else {
_json[r'imageName'] = null;
// json[r'imageName'] = null;
}
if (exifImageWidth != null) {
_json[r'exifImageWidth'] = exifImageWidth;
if (this.exifImageWidth != null) {
json[r'exifImageWidth'] = this.exifImageWidth;
} else {
_json[r'exifImageWidth'] = null;
// json[r'exifImageWidth'] = null;
}
if (exifImageHeight != null) {
_json[r'exifImageHeight'] = exifImageHeight;
if (this.exifImageHeight != null) {
json[r'exifImageHeight'] = this.exifImageHeight;
} else {
_json[r'exifImageHeight'] = null;
// json[r'exifImageHeight'] = null;
}
if (orientation != null) {
_json[r'orientation'] = orientation;
if (this.orientation != null) {
json[r'orientation'] = this.orientation;
} else {
_json[r'orientation'] = null;
// json[r'orientation'] = null;
}
if (dateTimeOriginal != null) {
_json[r'dateTimeOriginal'] = dateTimeOriginal!.toUtc().toIso8601String();
if (this.dateTimeOriginal != null) {
json[r'dateTimeOriginal'] = this.dateTimeOriginal!.toUtc().toIso8601String();
} else {
_json[r'dateTimeOriginal'] = null;
// json[r'dateTimeOriginal'] = null;
}
if (modifyDate != null) {
_json[r'modifyDate'] = modifyDate!.toUtc().toIso8601String();
if (this.modifyDate != null) {
json[r'modifyDate'] = this.modifyDate!.toUtc().toIso8601String();
} else {
_json[r'modifyDate'] = null;
// json[r'modifyDate'] = null;
}
if (lensModel != null) {
_json[r'lensModel'] = lensModel;
if (this.lensModel != null) {
json[r'lensModel'] = this.lensModel;
} else {
_json[r'lensModel'] = null;
// json[r'lensModel'] = null;
}
if (fNumber != null) {
_json[r'fNumber'] = fNumber;
if (this.fNumber != null) {
json[r'fNumber'] = this.fNumber;
} else {
_json[r'fNumber'] = null;
// json[r'fNumber'] = null;
}
if (focalLength != null) {
_json[r'focalLength'] = focalLength;
if (this.focalLength != null) {
json[r'focalLength'] = this.focalLength;
} else {
_json[r'focalLength'] = null;
// json[r'focalLength'] = null;
}
if (iso != null) {
_json[r'iso'] = iso;
if (this.iso != null) {
json[r'iso'] = this.iso;
} else {
_json[r'iso'] = null;
// json[r'iso'] = null;
}
if (exposureTime != null) {
_json[r'exposureTime'] = exposureTime;
if (this.exposureTime != null) {
json[r'exposureTime'] = this.exposureTime;
} else {
_json[r'exposureTime'] = null;
// json[r'exposureTime'] = null;
}
if (latitude != null) {
_json[r'latitude'] = latitude;
if (this.latitude != null) {
json[r'latitude'] = this.latitude;
} else {
_json[r'latitude'] = null;
// json[r'latitude'] = null;
}
if (longitude != null) {
_json[r'longitude'] = longitude;
if (this.longitude != null) {
json[r'longitude'] = this.longitude;
} else {
_json[r'longitude'] = null;
// json[r'longitude'] = null;
}
if (city != null) {
_json[r'city'] = city;
if (this.city != null) {
json[r'city'] = this.city;
} else {
_json[r'city'] = null;
// json[r'city'] = null;
}
if (state != null) {
_json[r'state'] = state;
if (this.state != null) {
json[r'state'] = this.state;
} else {
_json[r'state'] = null;
// json[r'state'] = null;
}
if (country != null) {
_json[r'country'] = country;
if (this.country != null) {
json[r'country'] = this.country;
} else {
_json[r'country'] = null;
// json[r'country'] = null;
}
return _json;
return json;
}
/// Returns a new [ExifResponseDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class GetAssetByTimeBucketDto {
String toString() => 'GetAssetByTimeBucketDto[timeBucket=$timeBucket]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'timeBucket'] = timeBucket;
return _json;
final json = <String, dynamic>{};
json[r'timeBucket'] = this.timeBucket;
return json;
}
/// Returns a new [GetAssetByTimeBucketDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class GetAssetCountByTimeBucketDto {
String toString() => 'GetAssetCountByTimeBucketDto[timeGroup=$timeGroup]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'timeGroup'] = timeGroup;
return _json;
final json = <String, dynamic>{};
json[r'timeGroup'] = this.timeGroup;
return json;
}
/// Returns a new [GetAssetCountByTimeBucketDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class JobCommandDto {
String toString() => 'JobCommandDto[command=$command]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'command'] = command;
return _json;
final json = <String, dynamic>{};
json[r'command'] = this.command;
return json;
}
/// Returns a new [JobCommandDto] instance and imports its values from

View File

@ -51,13 +51,13 @@ class JobCounts {
String toString() => 'JobCounts[active=$active, completed=$completed, failed=$failed, delayed=$delayed, waiting=$waiting]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'active'] = active;
_json[r'completed'] = completed;
_json[r'failed'] = failed;
_json[r'delayed'] = delayed;
_json[r'waiting'] = waiting;
return _json;
final json = <String, dynamic>{};
json[r'active'] = this.active;
json[r'completed'] = this.completed;
json[r'failed'] = this.failed;
json[r'delayed'] = this.delayed;
json[r'waiting'] = this.waiting;
return json;
}
/// Returns a new [JobCounts] instance and imports its values from

View File

@ -36,10 +36,10 @@ class JobStatusResponseDto {
String toString() => 'JobStatusResponseDto[isActive=$isActive, queueCount=$queueCount]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'isActive'] = isActive;
_json[r'queueCount'] = queueCount;
return _json;
final json = <String, dynamic>{};
json[r'isActive'] = this.isActive;
json[r'queueCount'] = this.queueCount;
return json;
}
/// Returns a new [JobStatusResponseDto] instance and imports its values from

View File

@ -36,10 +36,10 @@ class LoginCredentialDto {
String toString() => 'LoginCredentialDto[email=$email, password=$password]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'email'] = email;
_json[r'password'] = password;
return _json;
final json = <String, dynamic>{};
json[r'email'] = this.email;
json[r'password'] = this.password;
return json;
}
/// Returns a new [LoginCredentialDto] instance and imports its values from

View File

@ -66,16 +66,16 @@ class LoginResponseDto {
String toString() => 'LoginResponseDto[accessToken=$accessToken, userId=$userId, userEmail=$userEmail, firstName=$firstName, lastName=$lastName, profileImagePath=$profileImagePath, isAdmin=$isAdmin, shouldChangePassword=$shouldChangePassword]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'accessToken'] = accessToken;
_json[r'userId'] = userId;
_json[r'userEmail'] = userEmail;
_json[r'firstName'] = firstName;
_json[r'lastName'] = lastName;
_json[r'profileImagePath'] = profileImagePath;
_json[r'isAdmin'] = isAdmin;
_json[r'shouldChangePassword'] = shouldChangePassword;
return _json;
final json = <String, dynamic>{};
json[r'accessToken'] = this.accessToken;
json[r'userId'] = this.userId;
json[r'userEmail'] = this.userEmail;
json[r'firstName'] = this.firstName;
json[r'lastName'] = this.lastName;
json[r'profileImagePath'] = this.profileImagePath;
json[r'isAdmin'] = this.isAdmin;
json[r'shouldChangePassword'] = this.shouldChangePassword;
return json;
}
/// Returns a new [LoginResponseDto] instance and imports its values from

View File

@ -36,10 +36,10 @@ class LogoutResponseDto {
String toString() => 'LogoutResponseDto[successful=$successful, redirectUri=$redirectUri]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'successful'] = successful;
_json[r'redirectUri'] = redirectUri;
return _json;
final json = <String, dynamic>{};
json[r'successful'] = this.successful;
json[r'redirectUri'] = this.redirectUri;
return json;
}
/// Returns a new [LogoutResponseDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class OAuthCallbackDto {
String toString() => 'OAuthCallbackDto[url=$url]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'url'] = url;
return _json;
final json = <String, dynamic>{};
json[r'url'] = this.url;
return json;
}
/// Returns a new [OAuthCallbackDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class OAuthConfigDto {
String toString() => 'OAuthConfigDto[redirectUri=$redirectUri]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'redirectUri'] = redirectUri;
return _json;
final json = <String, dynamic>{};
json[r'redirectUri'] = this.redirectUri;
return json;
}
/// Returns a new [OAuthConfigDto] instance and imports its values from

View File

@ -69,25 +69,25 @@ class OAuthConfigResponseDto {
String toString() => 'OAuthConfigResponseDto[enabled=$enabled, passwordLoginEnabled=$passwordLoginEnabled, url=$url, buttonText=$buttonText, autoLaunch=$autoLaunch]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'enabled'] = enabled;
_json[r'passwordLoginEnabled'] = passwordLoginEnabled;
if (url != null) {
_json[r'url'] = url;
final json = <String, dynamic>{};
json[r'enabled'] = this.enabled;
json[r'passwordLoginEnabled'] = this.passwordLoginEnabled;
if (this.url != null) {
json[r'url'] = this.url;
} else {
_json[r'url'] = null;
// json[r'url'] = null;
}
if (buttonText != null) {
_json[r'buttonText'] = buttonText;
if (this.buttonText != null) {
json[r'buttonText'] = this.buttonText;
} else {
_json[r'buttonText'] = null;
// json[r'buttonText'] = null;
}
if (autoLaunch != null) {
_json[r'autoLaunch'] = autoLaunch;
if (this.autoLaunch != null) {
json[r'autoLaunch'] = this.autoLaunch;
} else {
_json[r'autoLaunch'] = null;
// json[r'autoLaunch'] = null;
}
return _json;
return json;
}
/// Returns a new [OAuthConfigResponseDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class RemoveAssetsDto {
String toString() => 'RemoveAssetsDto[assetIds=$assetIds]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'assetIds'] = assetIds;
return _json;
final json = <String, dynamic>{};
json[r'assetIds'] = this.assetIds;
return json;
}
/// Returns a new [RemoveAssetsDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class SearchAssetDto {
String toString() => 'SearchAssetDto[searchTerm=$searchTerm]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'searchTerm'] = searchTerm;
return _json;
final json = <String, dynamic>{};
json[r'searchTerm'] = this.searchTerm;
return json;
}
/// Returns a new [SearchAssetDto] instance and imports its values from

View File

@ -61,15 +61,15 @@ class ServerInfoResponseDto {
String toString() => 'ServerInfoResponseDto[diskSizeRaw=$diskSizeRaw, diskUseRaw=$diskUseRaw, diskAvailableRaw=$diskAvailableRaw, diskUsagePercentage=$diskUsagePercentage, diskSize=$diskSize, diskUse=$diskUse, diskAvailable=$diskAvailable]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'diskSizeRaw'] = diskSizeRaw;
_json[r'diskUseRaw'] = diskUseRaw;
_json[r'diskAvailableRaw'] = diskAvailableRaw;
_json[r'diskUsagePercentage'] = diskUsagePercentage;
_json[r'diskSize'] = diskSize;
_json[r'diskUse'] = diskUse;
_json[r'diskAvailable'] = diskAvailable;
return _json;
final json = <String, dynamic>{};
json[r'diskSizeRaw'] = this.diskSizeRaw;
json[r'diskUseRaw'] = this.diskUseRaw;
json[r'diskAvailableRaw'] = this.diskAvailableRaw;
json[r'diskUsagePercentage'] = this.diskUsagePercentage;
json[r'diskSize'] = this.diskSize;
json[r'diskUse'] = this.diskUse;
json[r'diskAvailable'] = this.diskAvailable;
return json;
}
/// Returns a new [ServerInfoResponseDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class ServerPingResponse {
String toString() => 'ServerPingResponse[res=$res]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'res'] = res;
return _json;
final json = <String, dynamic>{};
json[r'res'] = this.res;
return json;
}
/// Returns a new [ServerPingResponse] instance and imports its values from

View File

@ -56,14 +56,14 @@ class ServerStatsResponseDto {
String toString() => 'ServerStatsResponseDto[photos=$photos, videos=$videos, objects=$objects, usageRaw=$usageRaw, usage=$usage, usageByUser=$usageByUser]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'photos'] = photos;
_json[r'videos'] = videos;
_json[r'objects'] = objects;
_json[r'usageRaw'] = usageRaw;
_json[r'usage'] = usage;
_json[r'usageByUser'] = usageByUser;
return _json;
final json = <String, dynamic>{};
json[r'photos'] = this.photos;
json[r'videos'] = this.videos;
json[r'objects'] = this.objects;
json[r'usageRaw'] = this.usageRaw;
json[r'usage'] = this.usage;
json[r'usageByUser'] = this.usageByUser;
return json;
}
/// Returns a new [ServerStatsResponseDto] instance and imports its values from

View File

@ -46,12 +46,12 @@ class ServerVersionReponseDto {
String toString() => 'ServerVersionReponseDto[major=$major, minor=$minor, patch_=$patch_, build=$build]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'major'] = major;
_json[r'minor'] = minor;
_json[r'patch'] = patch_;
_json[r'build'] = build;
return _json;
final json = <String, dynamic>{};
json[r'major'] = this.major;
json[r'minor'] = this.minor;
json[r'patch'] = this.patch_;
json[r'build'] = this.build;
return json;
}
/// Returns a new [ServerVersionReponseDto] instance and imports its values from

View File

@ -88,30 +88,30 @@ class SharedLinkResponseDto {
String toString() => 'SharedLinkResponseDto[type=$type, id=$id, description=$description, userId=$userId, key=$key, createdAt=$createdAt, expiresAt=$expiresAt, assets=$assets, album=$album, allowUpload=$allowUpload]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'type'] = type;
_json[r'id'] = id;
if (description != null) {
_json[r'description'] = description;
final json = <String, dynamic>{};
json[r'type'] = this.type;
json[r'id'] = this.id;
if (this.description != null) {
json[r'description'] = this.description;
} else {
_json[r'description'] = null;
// json[r'description'] = null;
}
_json[r'userId'] = userId;
_json[r'key'] = key;
_json[r'createdAt'] = createdAt;
if (expiresAt != null) {
_json[r'expiresAt'] = expiresAt;
json[r'userId'] = this.userId;
json[r'key'] = this.key;
json[r'createdAt'] = this.createdAt;
if (this.expiresAt != null) {
json[r'expiresAt'] = this.expiresAt;
} else {
_json[r'expiresAt'] = null;
// json[r'expiresAt'] = null;
}
_json[r'assets'] = assets;
if (album != null) {
_json[r'album'] = album;
json[r'assets'] = this.assets;
if (this.album != null) {
json[r'album'] = this.album;
} else {
_json[r'album'] = null;
// json[r'album'] = null;
}
_json[r'allowUpload'] = allowUpload;
return _json;
json[r'allowUpload'] = this.allowUpload;
return json;
}
/// Returns a new [SharedLinkResponseDto] instance and imports its values from

View File

@ -46,12 +46,12 @@ class SignUpDto {
String toString() => 'SignUpDto[email=$email, password=$password, firstName=$firstName, lastName=$lastName]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'email'] = email;
_json[r'password'] = password;
_json[r'firstName'] = firstName;
_json[r'lastName'] = lastName;
return _json;
final json = <String, dynamic>{};
json[r'email'] = this.email;
json[r'password'] = this.password;
json[r'firstName'] = this.firstName;
json[r'lastName'] = this.lastName;
return json;
}
/// Returns a new [SignUpDto] instance and imports its values from

View File

@ -47,23 +47,23 @@ class SmartInfoResponseDto {
String toString() => 'SmartInfoResponseDto[id=$id, tags=$tags, objects=$objects]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
if (id != null) {
_json[r'id'] = id;
final json = <String, dynamic>{};
if (this.id != null) {
json[r'id'] = this.id;
} else {
_json[r'id'] = null;
// json[r'id'] = null;
}
if (tags != null) {
_json[r'tags'] = tags;
if (this.tags != null) {
json[r'tags'] = this.tags;
} else {
_json[r'tags'] = null;
// json[r'tags'] = null;
}
if (objects != null) {
_json[r'objects'] = objects;
if (this.objects != null) {
json[r'objects'] = this.objects;
} else {
_json[r'objects'] = null;
// json[r'objects'] = null;
}
return _json;
return json;
}
/// Returns a new [SmartInfoResponseDto] instance and imports its values from

View File

@ -46,12 +46,12 @@ class SystemConfigDto {
String toString() => 'SystemConfigDto[ffmpeg=$ffmpeg, oauth=$oauth, passwordLogin=$passwordLogin, storageTemplate=$storageTemplate]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'ffmpeg'] = ffmpeg;
_json[r'oauth'] = oauth;
_json[r'passwordLogin'] = passwordLogin;
_json[r'storageTemplate'] = storageTemplate;
return _json;
final json = <String, dynamic>{};
json[r'ffmpeg'] = this.ffmpeg;
json[r'oauth'] = this.oauth;
json[r'passwordLogin'] = this.passwordLogin;
json[r'storageTemplate'] = this.storageTemplate;
return json;
}
/// Returns a new [SystemConfigDto] instance and imports its values from

View File

@ -51,13 +51,13 @@ class SystemConfigFFmpegDto {
String toString() => 'SystemConfigFFmpegDto[crf=$crf, preset=$preset, targetVideoCodec=$targetVideoCodec, targetAudioCodec=$targetAudioCodec, targetScaling=$targetScaling]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'crf'] = crf;
_json[r'preset'] = preset;
_json[r'targetVideoCodec'] = targetVideoCodec;
_json[r'targetAudioCodec'] = targetAudioCodec;
_json[r'targetScaling'] = targetScaling;
return _json;
final json = <String, dynamic>{};
json[r'crf'] = this.crf;
json[r'preset'] = this.preset;
json[r'targetVideoCodec'] = this.targetVideoCodec;
json[r'targetAudioCodec'] = this.targetAudioCodec;
json[r'targetScaling'] = this.targetScaling;
return json;
}
/// Returns a new [SystemConfigFFmpegDto] instance and imports its values from

View File

@ -76,18 +76,18 @@ class SystemConfigOAuthDto {
String toString() => 'SystemConfigOAuthDto[enabled=$enabled, issuerUrl=$issuerUrl, clientId=$clientId, clientSecret=$clientSecret, scope=$scope, buttonText=$buttonText, autoRegister=$autoRegister, autoLaunch=$autoLaunch, mobileOverrideEnabled=$mobileOverrideEnabled, mobileRedirectUri=$mobileRedirectUri]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'enabled'] = enabled;
_json[r'issuerUrl'] = issuerUrl;
_json[r'clientId'] = clientId;
_json[r'clientSecret'] = clientSecret;
_json[r'scope'] = scope;
_json[r'buttonText'] = buttonText;
_json[r'autoRegister'] = autoRegister;
_json[r'autoLaunch'] = autoLaunch;
_json[r'mobileOverrideEnabled'] = mobileOverrideEnabled;
_json[r'mobileRedirectUri'] = mobileRedirectUri;
return _json;
final json = <String, dynamic>{};
json[r'enabled'] = this.enabled;
json[r'issuerUrl'] = this.issuerUrl;
json[r'clientId'] = this.clientId;
json[r'clientSecret'] = this.clientSecret;
json[r'scope'] = this.scope;
json[r'buttonText'] = this.buttonText;
json[r'autoRegister'] = this.autoRegister;
json[r'autoLaunch'] = this.autoLaunch;
json[r'mobileOverrideEnabled'] = this.mobileOverrideEnabled;
json[r'mobileRedirectUri'] = this.mobileRedirectUri;
return json;
}
/// Returns a new [SystemConfigOAuthDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class SystemConfigPasswordLoginDto {
String toString() => 'SystemConfigPasswordLoginDto[enabled=$enabled]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'enabled'] = enabled;
return _json;
final json = <String, dynamic>{};
json[r'enabled'] = this.enabled;
return json;
}
/// Returns a new [SystemConfigPasswordLoginDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class SystemConfigStorageTemplateDto {
String toString() => 'SystemConfigStorageTemplateDto[template=$template]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'template'] = template;
return _json;
final json = <String, dynamic>{};
json[r'template'] = this.template;
return json;
}
/// Returns a new [SystemConfigStorageTemplateDto] instance and imports its values from

View File

@ -61,15 +61,15 @@ class SystemConfigTemplateStorageOptionDto {
String toString() => 'SystemConfigTemplateStorageOptionDto[yearOptions=$yearOptions, monthOptions=$monthOptions, dayOptions=$dayOptions, hourOptions=$hourOptions, minuteOptions=$minuteOptions, secondOptions=$secondOptions, presetOptions=$presetOptions]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'yearOptions'] = yearOptions;
_json[r'monthOptions'] = monthOptions;
_json[r'dayOptions'] = dayOptions;
_json[r'hourOptions'] = hourOptions;
_json[r'minuteOptions'] = minuteOptions;
_json[r'secondOptions'] = secondOptions;
_json[r'presetOptions'] = presetOptions;
return _json;
final json = <String, dynamic>{};
json[r'yearOptions'] = this.yearOptions;
json[r'monthOptions'] = this.monthOptions;
json[r'dayOptions'] = this.dayOptions;
json[r'hourOptions'] = this.hourOptions;
json[r'minuteOptions'] = this.minuteOptions;
json[r'secondOptions'] = this.secondOptions;
json[r'presetOptions'] = this.presetOptions;
return json;
}
/// Returns a new [SystemConfigTemplateStorageOptionDto] instance and imports its values from

View File

@ -51,17 +51,17 @@ class TagResponseDto {
String toString() => 'TagResponseDto[id=$id, type=$type, name=$name, userId=$userId, renameTagId=$renameTagId]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'type'] = type;
_json[r'name'] = name;
_json[r'userId'] = userId;
if (renameTagId != null) {
_json[r'renameTagId'] = renameTagId;
final json = <String, dynamic>{};
json[r'id'] = this.id;
json[r'type'] = this.type;
json[r'name'] = this.name;
json[r'userId'] = this.userId;
if (this.renameTagId != null) {
json[r'renameTagId'] = this.renameTagId;
} else {
_json[r'renameTagId'] = null;
// json[r'renameTagId'] = null;
}
return _json;
return json;
}
/// Returns a new [TagResponseDto] instance and imports its values from

View File

@ -48,18 +48,18 @@ class UpdateAlbumDto {
String toString() => 'UpdateAlbumDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
if (albumName != null) {
_json[r'albumName'] = albumName;
final json = <String, dynamic>{};
if (this.albumName != null) {
json[r'albumName'] = this.albumName;
} else {
_json[r'albumName'] = null;
// json[r'albumName'] = null;
}
if (albumThumbnailAssetId != null) {
_json[r'albumThumbnailAssetId'] = albumThumbnailAssetId;
if (this.albumThumbnailAssetId != null) {
json[r'albumThumbnailAssetId'] = this.albumThumbnailAssetId;
} else {
_json[r'albumThumbnailAssetId'] = null;
// json[r'albumThumbnailAssetId'] = null;
}
return _json;
return json;
}
/// Returns a new [UpdateAlbumDto] instance and imports its values from

View File

@ -42,14 +42,14 @@ class UpdateAssetDto {
String toString() => 'UpdateAssetDto[tagIds=$tagIds, isFavorite=$isFavorite]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'tagIds'] = tagIds;
if (isFavorite != null) {
_json[r'isFavorite'] = isFavorite;
final json = <String, dynamic>{};
json[r'tagIds'] = this.tagIds;
if (this.isFavorite != null) {
json[r'isFavorite'] = this.isFavorite;
} else {
_json[r'isFavorite'] = null;
// json[r'isFavorite'] = null;
}
return _json;
return json;
}
/// Returns a new [UpdateAssetDto] instance and imports its values from

View File

@ -48,18 +48,18 @@ class UpdateTagDto {
String toString() => 'UpdateTagDto[name=$name, renameTagId=$renameTagId]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
if (name != null) {
_json[r'name'] = name;
final json = <String, dynamic>{};
if (this.name != null) {
json[r'name'] = this.name;
} else {
_json[r'name'] = null;
// json[r'name'] = null;
}
if (renameTagId != null) {
_json[r'renameTagId'] = renameTagId;
if (this.renameTagId != null) {
json[r'renameTagId'] = this.renameTagId;
} else {
_json[r'renameTagId'] = null;
// json[r'renameTagId'] = null;
}
return _json;
return json;
}
/// Returns a new [UpdateTagDto] instance and imports its values from

View File

@ -108,44 +108,44 @@ class UpdateUserDto {
String toString() => 'UpdateUserDto[id=$id, email=$email, password=$password, firstName=$firstName, lastName=$lastName, isAdmin=$isAdmin, shouldChangePassword=$shouldChangePassword, profileImagePath=$profileImagePath]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
if (email != null) {
_json[r'email'] = email;
final json = <String, dynamic>{};
json[r'id'] = this.id;
if (this.email != null) {
json[r'email'] = this.email;
} else {
_json[r'email'] = null;
// json[r'email'] = null;
}
if (password != null) {
_json[r'password'] = password;
if (this.password != null) {
json[r'password'] = this.password;
} else {
_json[r'password'] = null;
// json[r'password'] = null;
}
if (firstName != null) {
_json[r'firstName'] = firstName;
if (this.firstName != null) {
json[r'firstName'] = this.firstName;
} else {
_json[r'firstName'] = null;
// json[r'firstName'] = null;
}
if (lastName != null) {
_json[r'lastName'] = lastName;
if (this.lastName != null) {
json[r'lastName'] = this.lastName;
} else {
_json[r'lastName'] = null;
// json[r'lastName'] = null;
}
if (isAdmin != null) {
_json[r'isAdmin'] = isAdmin;
if (this.isAdmin != null) {
json[r'isAdmin'] = this.isAdmin;
} else {
_json[r'isAdmin'] = null;
// json[r'isAdmin'] = null;
}
if (shouldChangePassword != null) {
_json[r'shouldChangePassword'] = shouldChangePassword;
if (this.shouldChangePassword != null) {
json[r'shouldChangePassword'] = this.shouldChangePassword;
} else {
_json[r'shouldChangePassword'] = null;
// json[r'shouldChangePassword'] = null;
}
if (profileImagePath != null) {
_json[r'profileImagePath'] = profileImagePath;
if (this.profileImagePath != null) {
json[r'profileImagePath'] = this.profileImagePath;
} else {
_json[r'profileImagePath'] = null;
// json[r'profileImagePath'] = null;
}
return _json;
return json;
}
/// Returns a new [UpdateUserDto] instance and imports its values from

View File

@ -47,15 +47,15 @@ class UpsertDeviceInfoDto {
String toString() => 'UpsertDeviceInfoDto[deviceType=$deviceType, deviceId=$deviceId, isAutoBackup=$isAutoBackup]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'deviceType'] = deviceType;
_json[r'deviceId'] = deviceId;
if (isAutoBackup != null) {
_json[r'isAutoBackup'] = isAutoBackup;
final json = <String, dynamic>{};
json[r'deviceType'] = this.deviceType;
json[r'deviceId'] = this.deviceId;
if (this.isAutoBackup != null) {
json[r'isAutoBackup'] = this.isAutoBackup;
} else {
_json[r'isAutoBackup'] = null;
// json[r'isAutoBackup'] = null;
}
return _json;
return json;
}
/// Returns a new [UpsertDeviceInfoDto] instance and imports its values from

View File

@ -51,13 +51,13 @@ class UsageByUserDto {
String toString() => 'UsageByUserDto[userId=$userId, videos=$videos, photos=$photos, usageRaw=$usageRaw, usage=$usage]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'userId'] = userId;
_json[r'videos'] = videos;
_json[r'photos'] = photos;
_json[r'usageRaw'] = usageRaw;
_json[r'usage'] = usage;
return _json;
final json = <String, dynamic>{};
json[r'userId'] = this.userId;
json[r'videos'] = this.videos;
json[r'photos'] = this.photos;
json[r'usageRaw'] = this.usageRaw;
json[r'usage'] = this.usage;
return json;
}
/// Returns a new [UsageByUserDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class UserCountResponseDto {
String toString() => 'UserCountResponseDto[userCount=$userCount]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'userCount'] = userCount;
return _json;
final json = <String, dynamic>{};
json[r'userCount'] = this.userCount;
return json;
}
/// Returns a new [UserCountResponseDto] instance and imports its values from

View File

@ -82,22 +82,22 @@ class UserResponseDto {
String toString() => 'UserResponseDto[id=$id, email=$email, firstName=$firstName, lastName=$lastName, createdAt=$createdAt, profileImagePath=$profileImagePath, shouldChangePassword=$shouldChangePassword, isAdmin=$isAdmin, deletedAt=$deletedAt, oauthId=$oauthId]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'id'] = id;
_json[r'email'] = email;
_json[r'firstName'] = firstName;
_json[r'lastName'] = lastName;
_json[r'createdAt'] = createdAt;
_json[r'profileImagePath'] = profileImagePath;
_json[r'shouldChangePassword'] = shouldChangePassword;
_json[r'isAdmin'] = isAdmin;
if (deletedAt != null) {
_json[r'deletedAt'] = deletedAt!.toUtc().toIso8601String();
final json = <String, dynamic>{};
json[r'id'] = this.id;
json[r'email'] = this.email;
json[r'firstName'] = this.firstName;
json[r'lastName'] = this.lastName;
json[r'createdAt'] = this.createdAt;
json[r'profileImagePath'] = this.profileImagePath;
json[r'shouldChangePassword'] = this.shouldChangePassword;
json[r'isAdmin'] = this.isAdmin;
if (this.deletedAt != null) {
json[r'deletedAt'] = this.deletedAt!.toUtc().toIso8601String();
} else {
_json[r'deletedAt'] = null;
// json[r'deletedAt'] = null;
}
_json[r'oauthId'] = oauthId;
return _json;
json[r'oauthId'] = this.oauthId;
return json;
}
/// Returns a new [UserResponseDto] instance and imports its values from

View File

@ -31,9 +31,9 @@ class ValidateAccessTokenResponseDto {
String toString() => 'ValidateAccessTokenResponseDto[authStatus=$authStatus]';
Map<String, dynamic> toJson() {
final _json = <String, dynamic>{};
_json[r'authStatus'] = authStatus;
return _json;
final json = <String, dynamic>{};
json[r'authStatus'] = this.authStatus;
return json;
}
/// Returns a new [ValidateAccessTokenResponseDto] instance and imports its values from

View File

@ -16,7 +16,7 @@ void main() {
// final instance = APIKeyResponseDto();
group('test APIKeyResponseDto', () {
// num id
// int id
test('to test the property `id`', () async {
// TODO
});

View File

@ -1,6 +1,8 @@
import { APIKeyEntity } from '@app/database';
import { ApiProperty } from '@nestjs/swagger';
export class APIKeyResponseDto {
@ApiProperty({ type: 'integer' })
id!: number;
name!: string;
createdAt!: string;

View File

@ -35,25 +35,12 @@ export class UserCore {
}
}
const user = await this.userRepository.get(id);
if (!user) {
throw new NotFoundException('User not found');
}
try {
if (dto.password) {
dto.password = await hash(dto.password, SALT_ROUNDS);
}
user.password = dto.password ?? user.password;
user.email = dto.email ?? user.email;
user.firstName = dto.firstName ?? user.firstName;
user.lastName = dto.lastName ?? user.lastName;
user.isAdmin = dto.isAdmin ?? user.isAdmin;
user.shouldChangePassword = dto.shouldChangePassword ?? user.shouldChangePassword;
user.profileImagePath = dto.profileImagePath ?? user.profileImagePath;
return this.userRepository.update(id, user);
return this.userRepository.update(id, dto);
} catch (e) {
Logger.error(e, 'Failed to update user info');
throw new InternalServerErrorException('Failed to update user info');

24
server/bin/generate-open-api.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
function mobile {
rm -rf ../mobile/openapi
cd ./openapi-generator/templates/serialization/native
wget -O native_class.mustache https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/main/resources/dart2/serialization/native/native_class.mustache
patch -u native_class.mustache <native_class.mustache.patch
cd ../../../..
npx openapi-generator-cli generate -g dart -i ./immich-openapi-specs.json -o ../mobile/openapi -t ./openapi-generator/templates
}
function web {
rm -rf ../web/src/api/open-api
npx openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ../web/src/api/open-api
}
if [[ $1 == 'mobile' ]]; then
mobile
elif [[ $1 == 'web' ]]; then
web
else
mobile
web
fi

View File

@ -2834,7 +2834,7 @@
"type": "object",
"properties": {
"id": {
"type": "number"
"type": "integer"
},
"name": {
"type": "string"

View File

@ -0,0 +1,303 @@
class {{{classname}}} {
{{>dart_constructor}}
{{#vars}}
{{#description}}
/// {{{.}}}
{{/description}}
{{^isEnum}}
{{#minimum}}
{{#description}}
///
{{/description}}
/// Minimum value: {{{.}}}
{{/minimum}}
{{#maximum}}
{{#description}}
{{^minimum}}
///
{{/minimum}}
{{/description}}
/// Maximum value: {{{.}}}
{{/maximum}}
{{^isNullable}}
{{^required}}
{{^defaultValue}}
///
/// 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.
///
{{/defaultValue}}
{{/required}}
{{/isNullable}}
{{/isEnum}}
{{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isNullable}} {{{name}}};
{{/vars}}
@override
bool operator ==(Object other) => identical(this, other) || other is {{{classname}}} &&
{{#vars}}
other.{{{name}}} == {{{name}}}{{^-last}} &&{{/-last}}{{#-last}};{{/-last}}
{{/vars}}
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
{{#vars}}
({{#isNullable}}{{{name}}} == null ? 0 : {{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}{{{name}}} == null ? 0 : {{/defaultValue}}{{/required}}{{/isNullable}}{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.hashCode){{^-last}} +{{/-last}}{{#-last}};{{/-last}}
{{/vars}}
@override
String toString() => '{{{classname}}}[{{#vars}}{{{name}}}=${{{name}}}{{^-last}}, {{/-last}}{{/vars}}]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
{{#vars}}
{{#isNullable}}
if (this.{{{name}}} != null) {
{{/isNullable}}
{{^isNullable}}
{{^required}}
{{^defaultValue}}
if (this.{{{name}}} != null) {
{{/defaultValue}}
{{/required}}
{{/isNullable}}
{{#isDateTime}}
{{#pattern}}
json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}'
? this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch
: this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String();
{{/pattern}}
{{^pattern}}
json[r'{{{baseName}}}'] = this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc().toIso8601String();
{{/pattern}}
{{/isDateTime}}
{{#isDate}}
{{#pattern}}
json[r'{{{baseName}}}'] = _dateEpochMarker == '{{{pattern}}}'
? this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.millisecondsSinceEpoch
: _dateFormatter.format(this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc());
{{/pattern}}
{{^pattern}}
json[r'{{{baseName}}}'] = _dateFormatter.format(this.{{{name}}}{{#isNullable}}!{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}!{{/defaultValue}}{{/required}}{{/isNullable}}.toUtc());
{{/pattern}}
{{/isDate}}
{{^isDateTime}}
{{^isDate}}
json[r'{{{baseName}}}'] = this.{{{name}}};
{{/isDate}}
{{/isDateTime}}
{{#isNullable}}
} else {
// json[r'{{{baseName}}}'] = null;
}
{{/isNullable}}
{{^isNullable}}
{{^required}}
{{^defaultValue}}
} else {
// json[r'{{{baseName}}}'] = null;
}
{{/defaultValue}}
{{/required}}
{{/isNullable}}
{{/vars}}
return json;
}
/// Returns a new [{{{classname}}}] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static {{{classname}}}? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "{{{classname}}}[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "{{{classname}}}[$key]" has a null value in JSON.');
});
return true;
}());
return {{{classname}}}(
{{#vars}}
{{#isDateTime}}
{{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/isDateTime}}
{{#isDate}}
{{{name}}}: mapDateTime(json, r'{{{baseName}}}', '{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/isDate}}
{{^isDateTime}}
{{^isDate}}
{{#complexType}}
{{#isArray}}
{{#items.isArray}}
{{{name}}}: json[r'{{{baseName}}}'] is List
? (json[r'{{{baseName}}}'] as List).map((e) =>
{{#items.complexType}}
{{items.complexType}}.listFromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}
{{/items.complexType}}
{{^items.complexType}}
e == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}>[]{{/items.isNullable}} : (e as List).cast<{{items.items.dataType}}>()
{{/items.complexType}}
).toList()
: {{#isNullable}}null{{/isNullable}}{{^isNullable}}const []{{/isNullable}},
{{/items.isArray}}
{{^items.isArray}}
{{{name}}}: {{{complexType}}}.listFromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/items.isArray}}
{{/isArray}}
{{^isArray}}
{{#isMap}}
{{#items.isArray}}
{{{name}}}: json[r'{{{baseName}}}'] == null
? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}
{{#items.complexType}}
: {{items.complexType}}.mapListFromJson(json[r'{{{baseName}}}']),
{{/items.complexType}}
{{^items.complexType}}
: mapCastOfType<String, List>(json, r'{{{baseName}}}'),
{{/items.complexType}}
{{/items.isArray}}
{{^items.isArray}}
{{#items.isMap}}
{{#items.complexType}}
{{{name}}}: {{items.complexType}}.mapFromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/items.complexType}}
{{^items.complexType}}
{{{name}}}: mapCastOfType<String, dynamic>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/items.complexType}}
{{/items.isMap}}
{{^items.isMap}}
{{#items.complexType}}
{{{name}}}: {{{items.complexType}}}.mapFromJson(json[r'{{{baseName}}}'{{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}}]) ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/items.complexType}}
{{^items.complexType}}
{{{name}}}: mapCastOfType<String, {{items.dataType}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/items.complexType}}
{{/items.isMap}}
{{/items.isArray}}
{{/isMap}}
{{^isMap}}
{{#isBinary}}
{{{name}}}: null, // No support for decoding binary content from JSON
{{/isBinary}}
{{^isBinary}}
{{{name}}}: {{{complexType}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/isBinary}}
{{/isMap}}
{{/isArray}}
{{/complexType}}
{{^complexType}}
{{#isArray}}
{{#isEnum}}
{{{name}}}: {{{items.datatypeWithEnum}}}.listFromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/isEnum}}
{{^isEnum}}
{{{name}}}: json[r'{{{baseName}}}'] is {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}
? (json[r'{{{baseName}}}'] as {{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}).cast<{{{items.datatype}}}>()
: {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}},
{{/isEnum}}
{{/isArray}}
{{^isArray}}
{{#isMap}}
{{{name}}}: mapCastOfType<String, {{{items.datatype}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/isMap}}
{{^isMap}}
{{#isNumber}}
{{{name}}}: json[r'{{{baseName}}}'] == null
? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}
: {{{datatypeWithEnum}}}.parse(json[r'{{{baseName}}}'].toString()),
{{/isNumber}}
{{^isNumber}}
{{^isEnum}}
{{{name}}}: mapValueOfType<{{{datatypeWithEnum}}}>(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/isEnum}}
{{#isEnum}}
{{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}},
{{/isEnum}}
{{/isNumber}}
{{/isMap}}
{{/isArray}}
{{/complexType}}
{{/isDate}}
{{/isDateTime}}
{{/vars}}
);
}
return null;
}
static List<{{{classname}}}>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <{{{classname}}}>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = {{{classname}}}.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, {{{classname}}}> mapFromJson(dynamic json) {
final map = <String, {{{classname}}}>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = {{{classname}}}.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of {{{classname}}}-objects as value to a dart map
static Map<String, List<{{{classname}}}>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<{{{classname}}}>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = {{{classname}}}.listFromJson(entry.value, growable: growable,);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
{{#vars}}
{{#required}}
'{{{baseName}}}',
{{/required}}
{{/vars}}
};
}
{{#vars}}
{{^isModel}}
{{#isEnum}}
{{^isContainer}}
{{>serialization/native/native_enum_inline}}
{{/isContainer}}
{{#isContainer}}
{{#mostInnerItems}}
{{>serialization/native/native_enum_inline}}
{{/mostInnerItems}}
{{/isContainer}}
{{/isEnum}}
{{/isModel}}
{{/vars}}

View File

@ -0,0 +1,19 @@
--- native_class.mustache 2023-01-04 09:58:25.683944036 -0500
+++ native_class1.mustache 2023-01-04 09:59:43.856353945 -0500
@@ -91,14 +91,14 @@
{{/isDateTime}}
{{#isNullable}}
} else {
- json[r'{{{baseName}}}'] = null;
+ // json[r'{{{baseName}}}'] = null;
}
{{/isNullable}}
{{^isNullable}}
{{^required}}
{{^defaultValue}}
} else {
- json[r'{{{baseName}}}'] = null;
+ // json[r'{{{baseName}}}'] = null;
}
{{/defaultValue}}
{{/required}}

View File

@ -27,9 +27,9 @@
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./apps/immich/test/jest-e2e.json",
"typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js",
"api:typescript": "rm -rf ../web/src/api/open-api && npx openapi-generator-cli generate -g typescript-axios -i ./immich-openapi-specs.json -o ../web/src/api/open-api",
"api:dart": "rm -rf ../mobile/openapi && npx openapi-generator-cli generate -g dart -i ./immich-openapi-specs.json -o ../mobile/openapi",
"api:generate": "npm run api:typescript && npm run api:dart"
"api:typescript": "bash ./bin/generate-open-api.sh web",
"api:dart": "bash ./bin/generate-open-api.sh mobile",
"api:generate": "bash ./bin/generate-open-api.sh"
},
"dependencies": {
"@nestjs/bull": "^0.5.5",