diff --git a/mobile/openapi/.openapi-generator/VERSION b/mobile/openapi/.openapi-generator/VERSION index 09a6d30847..696eaac5ce 100644 --- a/mobile/openapi/.openapi-generator/VERSION +++ b/mobile/openapi/.openapi-generator/VERSION @@ -1 +1 @@ -7.8.0 +7.22.0 diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index e92b885904..af40910b4d 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -4,7 +4,7 @@ Immich API This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 3.0.0 -- Generator version: 7.8.0 +- Generator version: 7.22.0 - Build package: org.openapitools.codegen.languages.DartClientCodegen ## Requirements diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index 3af18e5fe8..1dbe28cc0f 100644 --- a/mobile/openapi/lib/api.dart +++ b/mobile/openapi/lib/api.dart @@ -29,6 +29,7 @@ part 'auth/api_key_auth.dart'; part 'auth/oauth.dart'; part 'auth/http_basic_auth.dart'; part 'auth/http_bearer_auth.dart'; +part 'optional.dart'; part 'api/api_keys_api.dart'; part 'api/activities_api.dart'; diff --git a/mobile/openapi/lib/api_helper.dart b/mobile/openapi/lib/api_helper.dart index 6cf11022c3..6c824d4a86 100644 --- a/mobile/openapi/lib/api_helper.dart +++ b/mobile/openapi/lib/api_helper.dart @@ -226,6 +226,9 @@ Future _decodeBodyBytes(Response response) async { /// Returns a valid [T] value found at the specified Map [key], null otherwise. T? mapValueOfType(dynamic map, String key) { final dynamic value = map is Map ? map[key] : null; + if (T == double && value is int) { + return value.toDouble() as T; + } return value is T ? value : null; } diff --git a/mobile/openapi/lib/model/activity_create_dto.dart b/mobile/openapi/lib/model/activity_create_dto.dart index bc220e64ce..b19c128185 100644 --- a/mobile/openapi/lib/model/activity_create_dto.dart +++ b/mobile/openapi/lib/model/activity_create_dto.dart @@ -14,8 +14,8 @@ class ActivityCreateDto { /// Returns a new [ActivityCreateDto] instance. ActivityCreateDto({ required this.albumId, - this.assetId, - this.comment, + this.assetId = const Optional.absent(), + this.comment = const Optional.absent(), required this.type, }); @@ -29,7 +29,7 @@ class ActivityCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? assetId; + Optional assetId; /// Comment text (required if type is comment) /// @@ -38,7 +38,7 @@ class ActivityCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? comment; + Optional comment; ReactionType type; @@ -63,15 +63,13 @@ class ActivityCreateDto { Map toJson() { final json = {}; json[r'albumId'] = this.albumId; - if (this.assetId != null) { - json[r'assetId'] = this.assetId; - } else { - // json[r'assetId'] = null; + if (this.assetId.isPresent) { + final value = this.assetId.value; + json[r'assetId'] = value; } - if (this.comment != null) { - json[r'comment'] = this.comment; - } else { - // json[r'comment'] = null; + if (this.comment.isPresent) { + final value = this.comment.value; + json[r'comment'] = value; } json[r'type'] = this.type; return json; @@ -85,10 +83,21 @@ class ActivityCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumId'), 'Required key "ActivityCreateDto[albumId]" is missing from JSON.'); + assert(json[r'albumId'] != null, 'Required key "ActivityCreateDto[albumId]" has a null value in JSON.'); + assert(json.containsKey(r'type'), 'Required key "ActivityCreateDto[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "ActivityCreateDto[type]" has a null value in JSON.'); + return true; + }()); + return ActivityCreateDto( albumId: mapValueOfType(json, r'albumId')!, - assetId: mapValueOfType(json, r'assetId'), - comment: mapValueOfType(json, r'comment'), + assetId: json.containsKey(r'assetId') ? Optional.present(mapValueOfType(json, r'assetId')) : const Optional.absent(), + comment: json.containsKey(r'comment') ? Optional.present(mapValueOfType(json, r'comment')) : const Optional.absent(), type: ReactionType.fromJson(json[r'type'])!, ); } diff --git a/mobile/openapi/lib/model/activity_response_dto.dart b/mobile/openapi/lib/model/activity_response_dto.dart index 1b0e279ab7..9a1533eb0f 100644 --- a/mobile/openapi/lib/model/activity_response_dto.dart +++ b/mobile/openapi/lib/model/activity_response_dto.dart @@ -14,7 +14,7 @@ class ActivityResponseDto { /// Returns a new [ActivityResponseDto] instance. ActivityResponseDto({ required this.assetId, - this.comment, + this.comment = const Optional.absent(), required this.createdAt, required this.id, required this.type, @@ -25,7 +25,7 @@ class ActivityResponseDto { String? assetId; /// Comment text (for comment activities) - String? comment; + Optional comment; /// Creation date DateTime createdAt; @@ -64,12 +64,11 @@ class ActivityResponseDto { if (this.assetId != null) { json[r'assetId'] = this.assetId; } else { - // json[r'assetId'] = null; + json[r'assetId'] = null; } - if (this.comment != null) { - json[r'comment'] = this.comment; - } else { - // json[r'comment'] = null; + if (this.comment.isPresent) { + final value = this.comment.value; + json[r'comment'] = value; } json[r'createdAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.createdAt.millisecondsSinceEpoch @@ -88,9 +87,25 @@ class ActivityResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "ActivityResponseDto[assetId]" is missing from JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "ActivityResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "ActivityResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "ActivityResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "ActivityResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'type'), 'Required key "ActivityResponseDto[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "ActivityResponseDto[type]" has a null value in JSON.'); + assert(json.containsKey(r'user'), 'Required key "ActivityResponseDto[user]" is missing from JSON.'); + assert(json[r'user'] != null, 'Required key "ActivityResponseDto[user]" has a null value in JSON.'); + return true; + }()); + return ActivityResponseDto( assetId: mapValueOfType(json, r'assetId'), - comment: mapValueOfType(json, r'comment'), + comment: json.containsKey(r'comment') ? Optional.present(mapValueOfType(json, r'comment')) : const Optional.absent(), createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, id: mapValueOfType(json, r'id')!, type: ReactionType.fromJson(json[r'type'])!, diff --git a/mobile/openapi/lib/model/activity_statistics_response_dto.dart b/mobile/openapi/lib/model/activity_statistics_response_dto.dart index d9ac019ee2..2aa49276b9 100644 --- a/mobile/openapi/lib/model/activity_statistics_response_dto.dart +++ b/mobile/openapi/lib/model/activity_statistics_response_dto.dart @@ -58,6 +58,17 @@ class ActivityStatisticsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'comments'), 'Required key "ActivityStatisticsResponseDto[comments]" is missing from JSON.'); + assert(json[r'comments'] != null, 'Required key "ActivityStatisticsResponseDto[comments]" has a null value in JSON.'); + assert(json.containsKey(r'likes'), 'Required key "ActivityStatisticsResponseDto[likes]" is missing from JSON.'); + assert(json[r'likes'] != null, 'Required key "ActivityStatisticsResponseDto[likes]" has a null value in JSON.'); + return true; + }()); + return ActivityStatisticsResponseDto( comments: mapValueOfType(json, r'comments')!, likes: mapValueOfType(json, r'likes')!, diff --git a/mobile/openapi/lib/model/add_users_dto.dart b/mobile/openapi/lib/model/add_users_dto.dart index 1dad234811..7e0e90a94c 100644 --- a/mobile/openapi/lib/model/add_users_dto.dart +++ b/mobile/openapi/lib/model/add_users_dto.dart @@ -45,6 +45,15 @@ class AddUsersDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumUsers'), 'Required key "AddUsersDto[albumUsers]" is missing from JSON.'); + assert(json[r'albumUsers'] != null, 'Required key "AddUsersDto[albumUsers]" has a null value in JSON.'); + return true; + }()); + return AddUsersDto( albumUsers: AlbumUserAddDto.listFromJson(json[r'albumUsers']), ); diff --git a/mobile/openapi/lib/model/admin_onboarding_update_dto.dart b/mobile/openapi/lib/model/admin_onboarding_update_dto.dart index 6daba2a796..265a33d8ae 100644 --- a/mobile/openapi/lib/model/admin_onboarding_update_dto.dart +++ b/mobile/openapi/lib/model/admin_onboarding_update_dto.dart @@ -45,6 +45,15 @@ class AdminOnboardingUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'isOnboarded'), 'Required key "AdminOnboardingUpdateDto[isOnboarded]" is missing from JSON.'); + assert(json[r'isOnboarded'] != null, 'Required key "AdminOnboardingUpdateDto[isOnboarded]" has a null value in JSON.'); + return true; + }()); + return AdminOnboardingUpdateDto( isOnboarded: mapValueOfType(json, r'isOnboarded')!, ); diff --git a/mobile/openapi/lib/model/album_response_dto.dart b/mobile/openapi/lib/model/album_response_dto.dart index fd90f23e3a..2b9e710d53 100644 --- a/mobile/openapi/lib/model/album_response_dto.dart +++ b/mobile/openapi/lib/model/album_response_dto.dart @@ -17,17 +17,17 @@ class AlbumResponseDto { required this.albumThumbnailAssetId, this.albumUsers = const [], required this.assetCount, - this.contributorCounts = const [], + this.contributorCounts = const Optional.present(const []), required this.createdAt, required this.description, - this.endDate, + this.endDate = const Optional.absent(), required this.hasSharedLink, required this.id, required this.isActivityEnabled, - this.lastModifiedAssetTimestamp, - this.order, + this.lastModifiedAssetTimestamp = const Optional.absent(), + this.order = const Optional.absent(), required this.shared, - this.startDate, + this.startDate = const Optional.absent(), required this.updatedAt, }); @@ -46,7 +46,7 @@ class AlbumResponseDto { /// Maximum value: 9007199254740991 int assetCount; - List contributorCounts; + Optional?> contributorCounts; /// Creation date DateTime createdAt; @@ -61,7 +61,7 @@ class AlbumResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? endDate; + Optional endDate; /// Has shared link bool hasSharedLink; @@ -79,7 +79,7 @@ class AlbumResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? lastModifiedAssetTimestamp; + Optional lastModifiedAssetTimestamp; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -87,7 +87,7 @@ class AlbumResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetOrder? order; + Optional order; /// Is shared album bool shared; @@ -99,7 +99,7 @@ class AlbumResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? startDate; + Optional startDate; /// Last update date DateTime updatedAt; @@ -152,36 +152,35 @@ class AlbumResponseDto { if (this.albumThumbnailAssetId != null) { json[r'albumThumbnailAssetId'] = this.albumThumbnailAssetId; } else { - // json[r'albumThumbnailAssetId'] = null; + json[r'albumThumbnailAssetId'] = null; } json[r'albumUsers'] = this.albumUsers; json[r'assetCount'] = this.assetCount; - json[r'contributorCounts'] = this.contributorCounts; + if (this.contributorCounts.isPresent) { + final value = this.contributorCounts.value; + json[r'contributorCounts'] = value; + } json[r'createdAt'] = this.createdAt.toUtc().toIso8601String(); json[r'description'] = this.description; - if (this.endDate != null) { - json[r'endDate'] = this.endDate!.toUtc().toIso8601String(); - } else { - // json[r'endDate'] = null; + if (this.endDate.isPresent) { + final value = this.endDate.value; + json[r'endDate'] = value == null ? null : value.toUtc().toIso8601String(); } json[r'hasSharedLink'] = this.hasSharedLink; json[r'id'] = this.id; json[r'isActivityEnabled'] = this.isActivityEnabled; - if (this.lastModifiedAssetTimestamp != null) { - json[r'lastModifiedAssetTimestamp'] = this.lastModifiedAssetTimestamp!.toUtc().toIso8601String(); - } else { - // json[r'lastModifiedAssetTimestamp'] = null; + if (this.lastModifiedAssetTimestamp.isPresent) { + final value = this.lastModifiedAssetTimestamp.value; + json[r'lastModifiedAssetTimestamp'] = value == null ? null : value.toUtc().toIso8601String(); } - if (this.order != null) { - json[r'order'] = this.order; - } else { - // json[r'order'] = null; + if (this.order.isPresent) { + final value = this.order.value; + json[r'order'] = value; } json[r'shared'] = this.shared; - if (this.startDate != null) { - json[r'startDate'] = this.startDate!.toUtc().toIso8601String(); - } else { - // json[r'startDate'] = null; + if (this.startDate.isPresent) { + final value = this.startDate.value; + json[r'startDate'] = value == null ? null : value.toUtc().toIso8601String(); } json[r'updatedAt'] = this.updatedAt.toUtc().toIso8601String(); return json; @@ -195,22 +194,50 @@ class AlbumResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumName'), 'Required key "AlbumResponseDto[albumName]" is missing from JSON.'); + assert(json[r'albumName'] != null, 'Required key "AlbumResponseDto[albumName]" has a null value in JSON.'); + assert(json.containsKey(r'albumThumbnailAssetId'), 'Required key "AlbumResponseDto[albumThumbnailAssetId]" is missing from JSON.'); + assert(json.containsKey(r'albumUsers'), 'Required key "AlbumResponseDto[albumUsers]" is missing from JSON.'); + assert(json[r'albumUsers'] != null, 'Required key "AlbumResponseDto[albumUsers]" has a null value in JSON.'); + assert(json.containsKey(r'assetCount'), 'Required key "AlbumResponseDto[assetCount]" is missing from JSON.'); + assert(json[r'assetCount'] != null, 'Required key "AlbumResponseDto[assetCount]" has a null value in JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "AlbumResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "AlbumResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'description'), 'Required key "AlbumResponseDto[description]" is missing from JSON.'); + assert(json[r'description'] != null, 'Required key "AlbumResponseDto[description]" has a null value in JSON.'); + assert(json.containsKey(r'hasSharedLink'), 'Required key "AlbumResponseDto[hasSharedLink]" is missing from JSON.'); + assert(json[r'hasSharedLink'] != null, 'Required key "AlbumResponseDto[hasSharedLink]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "AlbumResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "AlbumResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'isActivityEnabled'), 'Required key "AlbumResponseDto[isActivityEnabled]" is missing from JSON.'); + assert(json[r'isActivityEnabled'] != null, 'Required key "AlbumResponseDto[isActivityEnabled]" has a null value in JSON.'); + assert(json.containsKey(r'shared'), 'Required key "AlbumResponseDto[shared]" is missing from JSON.'); + assert(json[r'shared'] != null, 'Required key "AlbumResponseDto[shared]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "AlbumResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "AlbumResponseDto[updatedAt]" has a null value in JSON.'); + return true; + }()); + return AlbumResponseDto( albumName: mapValueOfType(json, r'albumName')!, albumThumbnailAssetId: mapValueOfType(json, r'albumThumbnailAssetId'), albumUsers: AlbumUserResponseDto.listFromJson(json[r'albumUsers']), assetCount: mapValueOfType(json, r'assetCount')!, - contributorCounts: ContributorCountResponseDto.listFromJson(json[r'contributorCounts']), + contributorCounts: json.containsKey(r'contributorCounts') ? Optional.present(ContributorCountResponseDto.listFromJson(json[r'contributorCounts'])) : const Optional.absent(), createdAt: mapDateTime(json, r'createdAt', r'')!, description: mapValueOfType(json, r'description')!, - endDate: mapDateTime(json, r'endDate', r''), + endDate: json.containsKey(r'endDate') ? Optional.present(mapDateTime(json, r'endDate', r'')) : const Optional.absent(), hasSharedLink: mapValueOfType(json, r'hasSharedLink')!, id: mapValueOfType(json, r'id')!, isActivityEnabled: mapValueOfType(json, r'isActivityEnabled')!, - lastModifiedAssetTimestamp: mapDateTime(json, r'lastModifiedAssetTimestamp', r''), - order: AssetOrder.fromJson(json[r'order']), + lastModifiedAssetTimestamp: json.containsKey(r'lastModifiedAssetTimestamp') ? Optional.present(mapDateTime(json, r'lastModifiedAssetTimestamp', r'')) : const Optional.absent(), + order: json.containsKey(r'order') ? Optional.present(AssetOrder.fromJson(json[r'order'])) : const Optional.absent(), shared: mapValueOfType(json, r'shared')!, - startDate: mapDateTime(json, r'startDate', r''), + startDate: json.containsKey(r'startDate') ? Optional.present(mapDateTime(json, r'startDate', r'')) : const Optional.absent(), updatedAt: mapDateTime(json, r'updatedAt', r'')!, ); } diff --git a/mobile/openapi/lib/model/album_statistics_response_dto.dart b/mobile/openapi/lib/model/album_statistics_response_dto.dart index 0f440d572d..548b98b0f9 100644 --- a/mobile/openapi/lib/model/album_statistics_response_dto.dart +++ b/mobile/openapi/lib/model/album_statistics_response_dto.dart @@ -68,6 +68,19 @@ class AlbumStatisticsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'notShared'), 'Required key "AlbumStatisticsResponseDto[notShared]" is missing from JSON.'); + assert(json[r'notShared'] != null, 'Required key "AlbumStatisticsResponseDto[notShared]" has a null value in JSON.'); + assert(json.containsKey(r'owned'), 'Required key "AlbumStatisticsResponseDto[owned]" is missing from JSON.'); + assert(json[r'owned'] != null, 'Required key "AlbumStatisticsResponseDto[owned]" has a null value in JSON.'); + assert(json.containsKey(r'shared'), 'Required key "AlbumStatisticsResponseDto[shared]" is missing from JSON.'); + assert(json[r'shared'] != null, 'Required key "AlbumStatisticsResponseDto[shared]" has a null value in JSON.'); + return true; + }()); + return AlbumStatisticsResponseDto( notShared: mapValueOfType(json, r'notShared')!, owned: mapValueOfType(json, r'owned')!, diff --git a/mobile/openapi/lib/model/album_user_add_dto.dart b/mobile/openapi/lib/model/album_user_add_dto.dart index ee457905bd..8d958cfc85 100644 --- a/mobile/openapi/lib/model/album_user_add_dto.dart +++ b/mobile/openapi/lib/model/album_user_add_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class AlbumUserAddDto { /// Returns a new [AlbumUserAddDto] instance. AlbumUserAddDto({ - this.role, + this.role = const Optional.absent(), required this.userId, }); @@ -23,7 +23,7 @@ class AlbumUserAddDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AlbumUserRole? role; + Optional role; /// User ID String userId; @@ -44,10 +44,9 @@ class AlbumUserAddDto { Map toJson() { final json = {}; - if (this.role != null) { - json[r'role'] = this.role; - } else { - // json[r'role'] = null; + if (this.role.isPresent) { + final value = this.role.value; + json[r'role'] = value; } json[r'userId'] = this.userId; return json; @@ -61,8 +60,17 @@ class AlbumUserAddDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'userId'), 'Required key "AlbumUserAddDto[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "AlbumUserAddDto[userId]" has a null value in JSON.'); + return true; + }()); + return AlbumUserAddDto( - role: AlbumUserRole.fromJson(json[r'role']), + role: json.containsKey(r'role') ? Optional.present(AlbumUserRole.fromJson(json[r'role'])) : const Optional.absent(), userId: mapValueOfType(json, r'userId')!, ); } diff --git a/mobile/openapi/lib/model/album_user_create_dto.dart b/mobile/openapi/lib/model/album_user_create_dto.dart index 26aa35ae78..780cd0dfd4 100644 --- a/mobile/openapi/lib/model/album_user_create_dto.dart +++ b/mobile/openapi/lib/model/album_user_create_dto.dart @@ -51,6 +51,17 @@ class AlbumUserCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'role'), 'Required key "AlbumUserCreateDto[role]" is missing from JSON.'); + assert(json[r'role'] != null, 'Required key "AlbumUserCreateDto[role]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "AlbumUserCreateDto[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "AlbumUserCreateDto[userId]" has a null value in JSON.'); + return true; + }()); + return AlbumUserCreateDto( role: AlbumUserRole.fromJson(json[r'role'])!, userId: mapValueOfType(json, r'userId')!, diff --git a/mobile/openapi/lib/model/album_user_response_dto.dart b/mobile/openapi/lib/model/album_user_response_dto.dart index bbae03fba7..2d42fe5105 100644 --- a/mobile/openapi/lib/model/album_user_response_dto.dart +++ b/mobile/openapi/lib/model/album_user_response_dto.dart @@ -50,6 +50,17 @@ class AlbumUserResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'role'), 'Required key "AlbumUserResponseDto[role]" is missing from JSON.'); + assert(json[r'role'] != null, 'Required key "AlbumUserResponseDto[role]" has a null value in JSON.'); + assert(json.containsKey(r'user'), 'Required key "AlbumUserResponseDto[user]" is missing from JSON.'); + assert(json[r'user'] != null, 'Required key "AlbumUserResponseDto[user]" has a null value in JSON.'); + return true; + }()); + return AlbumUserResponseDto( role: AlbumUserRole.fromJson(json[r'role'])!, user: UserResponseDto.fromJson(json[r'user'])!, diff --git a/mobile/openapi/lib/model/albums_add_assets_dto.dart b/mobile/openapi/lib/model/albums_add_assets_dto.dart index d6aa3db1c1..47ba9447ed 100644 --- a/mobile/openapi/lib/model/albums_add_assets_dto.dart +++ b/mobile/openapi/lib/model/albums_add_assets_dto.dart @@ -52,6 +52,17 @@ class AlbumsAddAssetsDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumIds'), 'Required key "AlbumsAddAssetsDto[albumIds]" is missing from JSON.'); + assert(json[r'albumIds'] != null, 'Required key "AlbumsAddAssetsDto[albumIds]" has a null value in JSON.'); + assert(json.containsKey(r'assetIds'), 'Required key "AlbumsAddAssetsDto[assetIds]" is missing from JSON.'); + assert(json[r'assetIds'] != null, 'Required key "AlbumsAddAssetsDto[assetIds]" has a null value in JSON.'); + return true; + }()); + return AlbumsAddAssetsDto( albumIds: json[r'albumIds'] is Iterable ? (json[r'albumIds'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/albums_add_assets_response_dto.dart b/mobile/openapi/lib/model/albums_add_assets_response_dto.dart index 99e679222e..44878ada7e 100644 --- a/mobile/openapi/lib/model/albums_add_assets_response_dto.dart +++ b/mobile/openapi/lib/model/albums_add_assets_response_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class AlbumsAddAssetsResponseDto { /// Returns a new [AlbumsAddAssetsResponseDto] instance. AlbumsAddAssetsResponseDto({ - this.error, + this.error = const Optional.absent(), required this.success, }); @@ -23,7 +23,7 @@ class AlbumsAddAssetsResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - BulkIdErrorReason? error; + Optional error; /// Operation success bool success; @@ -44,10 +44,9 @@ class AlbumsAddAssetsResponseDto { Map toJson() { final json = {}; - if (this.error != null) { - json[r'error'] = this.error; - } else { - // json[r'error'] = null; + if (this.error.isPresent) { + final value = this.error.value; + json[r'error'] = value; } json[r'success'] = this.success; return json; @@ -61,8 +60,17 @@ class AlbumsAddAssetsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'success'), 'Required key "AlbumsAddAssetsResponseDto[success]" is missing from JSON.'); + assert(json[r'success'] != null, 'Required key "AlbumsAddAssetsResponseDto[success]" has a null value in JSON.'); + return true; + }()); + return AlbumsAddAssetsResponseDto( - error: BulkIdErrorReason.fromJson(json[r'error']), + error: json.containsKey(r'error') ? Optional.present(BulkIdErrorReason.fromJson(json[r'error'])) : const Optional.absent(), success: mapValueOfType(json, r'success')!, ); } diff --git a/mobile/openapi/lib/model/albums_response.dart b/mobile/openapi/lib/model/albums_response.dart index def205de90..7b0a10de96 100644 --- a/mobile/openapi/lib/model/albums_response.dart +++ b/mobile/openapi/lib/model/albums_response.dart @@ -44,6 +44,15 @@ class AlbumsResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'defaultAssetOrder'), 'Required key "AlbumsResponse[defaultAssetOrder]" is missing from JSON.'); + assert(json[r'defaultAssetOrder'] != null, 'Required key "AlbumsResponse[defaultAssetOrder]" has a null value in JSON.'); + return true; + }()); + return AlbumsResponse( defaultAssetOrder: AssetOrder.fromJson(json[r'defaultAssetOrder'])!, ); diff --git a/mobile/openapi/lib/model/albums_update.dart b/mobile/openapi/lib/model/albums_update.dart index d61b5c1398..bca18ab3d0 100644 --- a/mobile/openapi/lib/model/albums_update.dart +++ b/mobile/openapi/lib/model/albums_update.dart @@ -13,7 +13,7 @@ part of openapi.api; class AlbumsUpdate { /// Returns a new [AlbumsUpdate] instance. AlbumsUpdate({ - this.defaultAssetOrder, + this.defaultAssetOrder = const Optional.absent(), }); /// @@ -22,7 +22,7 @@ class AlbumsUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetOrder? defaultAssetOrder; + Optional defaultAssetOrder; @override bool operator ==(Object other) => identical(this, other) || other is AlbumsUpdate && @@ -38,10 +38,9 @@ class AlbumsUpdate { Map toJson() { final json = {}; - if (this.defaultAssetOrder != null) { - json[r'defaultAssetOrder'] = this.defaultAssetOrder; - } else { - // json[r'defaultAssetOrder'] = null; + if (this.defaultAssetOrder.isPresent) { + final value = this.defaultAssetOrder.value; + json[r'defaultAssetOrder'] = value; } return json; } @@ -54,8 +53,15 @@ class AlbumsUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return AlbumsUpdate( - defaultAssetOrder: AssetOrder.fromJson(json[r'defaultAssetOrder']), + defaultAssetOrder: json.containsKey(r'defaultAssetOrder') ? Optional.present(AssetOrder.fromJson(json[r'defaultAssetOrder'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/api_key_create_dto.dart b/mobile/openapi/lib/model/api_key_create_dto.dart index 6d3ffc1eb1..46a8fd93a8 100644 --- a/mobile/openapi/lib/model/api_key_create_dto.dart +++ b/mobile/openapi/lib/model/api_key_create_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class ApiKeyCreateDto { /// Returns a new [ApiKeyCreateDto] instance. ApiKeyCreateDto({ - this.name, + this.name = const Optional.absent(), this.permissions = const [], }); @@ -24,7 +24,7 @@ class ApiKeyCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? name; + Optional name; /// List of permissions List permissions; @@ -45,10 +45,9 @@ class ApiKeyCreateDto { Map toJson() { final json = {}; - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; } json[r'permissions'] = this.permissions; return json; @@ -62,8 +61,17 @@ class ApiKeyCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'permissions'), 'Required key "ApiKeyCreateDto[permissions]" is missing from JSON.'); + assert(json[r'permissions'] != null, 'Required key "ApiKeyCreateDto[permissions]" has a null value in JSON.'); + return true; + }()); + return ApiKeyCreateDto( - name: mapValueOfType(json, r'name'), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), permissions: Permission.listFromJson(json[r'permissions']), ); } diff --git a/mobile/openapi/lib/model/api_key_create_response_dto.dart b/mobile/openapi/lib/model/api_key_create_response_dto.dart index 77b19ebfd2..ae91573413 100644 --- a/mobile/openapi/lib/model/api_key_create_response_dto.dart +++ b/mobile/openapi/lib/model/api_key_create_response_dto.dart @@ -51,6 +51,17 @@ class ApiKeyCreateResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'apiKey'), 'Required key "ApiKeyCreateResponseDto[apiKey]" is missing from JSON.'); + assert(json[r'apiKey'] != null, 'Required key "ApiKeyCreateResponseDto[apiKey]" has a null value in JSON.'); + assert(json.containsKey(r'secret'), 'Required key "ApiKeyCreateResponseDto[secret]" is missing from JSON.'); + assert(json[r'secret'] != null, 'Required key "ApiKeyCreateResponseDto[secret]" has a null value in JSON.'); + return true; + }()); + return ApiKeyCreateResponseDto( apiKey: ApiKeyResponseDto.fromJson(json[r'apiKey'])!, secret: mapValueOfType(json, r'secret')!, diff --git a/mobile/openapi/lib/model/api_key_response_dto.dart b/mobile/openapi/lib/model/api_key_response_dto.dart index 79099188a3..172c965a05 100644 --- a/mobile/openapi/lib/model/api_key_response_dto.dart +++ b/mobile/openapi/lib/model/api_key_response_dto.dart @@ -77,6 +77,23 @@ class ApiKeyResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'createdAt'), 'Required key "ApiKeyResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "ApiKeyResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "ApiKeyResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "ApiKeyResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "ApiKeyResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "ApiKeyResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'permissions'), 'Required key "ApiKeyResponseDto[permissions]" is missing from JSON.'); + assert(json[r'permissions'] != null, 'Required key "ApiKeyResponseDto[permissions]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "ApiKeyResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "ApiKeyResponseDto[updatedAt]" has a null value in JSON.'); + return true; + }()); + return ApiKeyResponseDto( createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, id: mapValueOfType(json, r'id')!, diff --git a/mobile/openapi/lib/model/api_key_update_dto.dart b/mobile/openapi/lib/model/api_key_update_dto.dart index c8df4be654..da9dbaee05 100644 --- a/mobile/openapi/lib/model/api_key_update_dto.dart +++ b/mobile/openapi/lib/model/api_key_update_dto.dart @@ -13,8 +13,8 @@ part of openapi.api; class ApiKeyUpdateDto { /// Returns a new [ApiKeyUpdateDto] instance. ApiKeyUpdateDto({ - this.name, - this.permissions = const [], + this.name = const Optional.absent(), + this.permissions = const Optional.present(const []), }); /// API key name @@ -24,10 +24,10 @@ class ApiKeyUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? name; + Optional name; /// List of permissions - List permissions; + Optional?> permissions; @override bool operator ==(Object other) => identical(this, other) || other is ApiKeyUpdateDto && @@ -45,12 +45,14 @@ class ApiKeyUpdateDto { Map toJson() { final json = {}; - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; + } + if (this.permissions.isPresent) { + final value = this.permissions.value; + json[r'permissions'] = value; } - json[r'permissions'] = this.permissions; return json; } @@ -62,9 +64,16 @@ class ApiKeyUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return ApiKeyUpdateDto( - name: mapValueOfType(json, r'name'), - permissions: Permission.listFromJson(json[r'permissions']), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), + permissions: json.containsKey(r'permissions') ? Optional.present(Permission.listFromJson(json[r'permissions'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/asset_bulk_delete_dto.dart b/mobile/openapi/lib/model/asset_bulk_delete_dto.dart index 055ef16015..44800cae6b 100644 --- a/mobile/openapi/lib/model/asset_bulk_delete_dto.dart +++ b/mobile/openapi/lib/model/asset_bulk_delete_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class AssetBulkDeleteDto { /// Returns a new [AssetBulkDeleteDto] instance. AssetBulkDeleteDto({ - this.force, + this.force = const Optional.absent(), this.ids = const [], }); @@ -24,7 +24,7 @@ class AssetBulkDeleteDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? force; + Optional force; /// IDs to process List ids; @@ -45,10 +45,9 @@ class AssetBulkDeleteDto { Map toJson() { final json = {}; - if (this.force != null) { - json[r'force'] = this.force; - } else { - // json[r'force'] = null; + if (this.force.isPresent) { + final value = this.force.value; + json[r'force'] = value; } json[r'ids'] = this.ids; return json; @@ -62,8 +61,17 @@ class AssetBulkDeleteDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'ids'), 'Required key "AssetBulkDeleteDto[ids]" is missing from JSON.'); + assert(json[r'ids'] != null, 'Required key "AssetBulkDeleteDto[ids]" has a null value in JSON.'); + return true; + }()); + return AssetBulkDeleteDto( - force: mapValueOfType(json, r'force'), + force: json.containsKey(r'force') ? Optional.present(mapValueOfType(json, r'force')) : const Optional.absent(), ids: json[r'ids'] is Iterable ? (json[r'ids'] as Iterable).cast().toList(growable: false) : const [], diff --git a/mobile/openapi/lib/model/asset_bulk_update_dto.dart b/mobile/openapi/lib/model/asset_bulk_update_dto.dart index f85026f054..e932d4d331 100644 --- a/mobile/openapi/lib/model/asset_bulk_update_dto.dart +++ b/mobile/openapi/lib/model/asset_bulk_update_dto.dart @@ -13,17 +13,17 @@ part of openapi.api; class AssetBulkUpdateDto { /// Returns a new [AssetBulkUpdateDto] instance. AssetBulkUpdateDto({ - this.dateTimeOriginal, - this.dateTimeRelative, - this.description, - this.duplicateId, + this.dateTimeOriginal = const Optional.absent(), + this.dateTimeRelative = const Optional.absent(), + this.description = const Optional.absent(), + this.duplicateId = const Optional.absent(), this.ids = const [], - this.isFavorite, - this.latitude, - this.longitude, - this.rating, - this.timeZone, - this.visibility, + this.isFavorite = const Optional.absent(), + this.latitude = const Optional.absent(), + this.longitude = const Optional.absent(), + this.rating = const Optional.absent(), + this.timeZone = const Optional.absent(), + this.visibility = const Optional.absent(), }); /// Original date and time @@ -33,7 +33,7 @@ class AssetBulkUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? dateTimeOriginal; + Optional dateTimeOriginal; /// Relative time offset in seconds /// @@ -45,7 +45,7 @@ class AssetBulkUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? dateTimeRelative; + Optional dateTimeRelative; /// Asset description /// @@ -54,10 +54,10 @@ class AssetBulkUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? description; + Optional description; /// Duplicate ID - String? duplicateId; + Optional duplicateId; /// Asset IDs to update List ids; @@ -69,7 +69,7 @@ class AssetBulkUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isFavorite; + Optional isFavorite; /// Latitude coordinate /// @@ -81,7 +81,7 @@ class AssetBulkUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - num? latitude; + Optional latitude; /// Longitude coordinate /// @@ -93,13 +93,13 @@ class AssetBulkUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - num? longitude; + Optional longitude; /// Rating in range [1-5], or null for unrated /// /// Minimum value: -1 /// Maximum value: 5 - int? rating; + Optional rating; /// Time zone (IANA timezone) /// @@ -108,7 +108,7 @@ class AssetBulkUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? timeZone; + Optional timeZone; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -116,7 +116,7 @@ class AssetBulkUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetVisibility? visibility; + Optional visibility; @override bool operator ==(Object other) => identical(this, other) || other is AssetBulkUpdateDto && @@ -152,56 +152,46 @@ class AssetBulkUpdateDto { Map toJson() { final json = {}; - if (this.dateTimeOriginal != null) { - json[r'dateTimeOriginal'] = this.dateTimeOriginal; - } else { - // json[r'dateTimeOriginal'] = null; + if (this.dateTimeOriginal.isPresent) { + final value = this.dateTimeOriginal.value; + json[r'dateTimeOriginal'] = value; } - if (this.dateTimeRelative != null) { - json[r'dateTimeRelative'] = this.dateTimeRelative; - } else { - // json[r'dateTimeRelative'] = null; + if (this.dateTimeRelative.isPresent) { + final value = this.dateTimeRelative.value; + json[r'dateTimeRelative'] = value; } - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - if (this.duplicateId != null) { - json[r'duplicateId'] = this.duplicateId; - } else { - // json[r'duplicateId'] = null; + if (this.duplicateId.isPresent) { + final value = this.duplicateId.value; + json[r'duplicateId'] = value; } json[r'ids'] = this.ids; - if (this.isFavorite != null) { - json[r'isFavorite'] = this.isFavorite; - } else { - // json[r'isFavorite'] = null; + if (this.isFavorite.isPresent) { + final value = this.isFavorite.value; + json[r'isFavorite'] = value; } - if (this.latitude != null) { - json[r'latitude'] = this.latitude; - } else { - // json[r'latitude'] = null; + if (this.latitude.isPresent) { + final value = this.latitude.value; + json[r'latitude'] = value; } - if (this.longitude != null) { - json[r'longitude'] = this.longitude; - } else { - // json[r'longitude'] = null; + if (this.longitude.isPresent) { + final value = this.longitude.value; + json[r'longitude'] = value; } - if (this.rating != null) { - json[r'rating'] = this.rating; - } else { - // json[r'rating'] = null; + if (this.rating.isPresent) { + final value = this.rating.value; + json[r'rating'] = value; } - if (this.timeZone != null) { - json[r'timeZone'] = this.timeZone; - } else { - // json[r'timeZone'] = null; + if (this.timeZone.isPresent) { + final value = this.timeZone.value; + json[r'timeZone'] = value; } - if (this.visibility != null) { - json[r'visibility'] = this.visibility; - } else { - // json[r'visibility'] = null; + if (this.visibility.isPresent) { + final value = this.visibility.value; + json[r'visibility'] = value; } return json; } @@ -214,20 +204,29 @@ class AssetBulkUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'ids'), 'Required key "AssetBulkUpdateDto[ids]" is missing from JSON.'); + assert(json[r'ids'] != null, 'Required key "AssetBulkUpdateDto[ids]" has a null value in JSON.'); + return true; + }()); + return AssetBulkUpdateDto( - dateTimeOriginal: mapValueOfType(json, r'dateTimeOriginal'), - dateTimeRelative: mapValueOfType(json, r'dateTimeRelative'), - description: mapValueOfType(json, r'description'), - duplicateId: mapValueOfType(json, r'duplicateId'), + dateTimeOriginal: json.containsKey(r'dateTimeOriginal') ? Optional.present(mapValueOfType(json, r'dateTimeOriginal')) : const Optional.absent(), + dateTimeRelative: json.containsKey(r'dateTimeRelative') ? Optional.present(json[r'dateTimeRelative'] == null ? null : int.parse('${json[r'dateTimeRelative']}')) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + duplicateId: json.containsKey(r'duplicateId') ? Optional.present(mapValueOfType(json, r'duplicateId')) : const Optional.absent(), ids: json[r'ids'] is Iterable ? (json[r'ids'] as Iterable).cast().toList(growable: false) : const [], - isFavorite: mapValueOfType(json, r'isFavorite'), - latitude: num.parse('${json[r'latitude']}'), - longitude: num.parse('${json[r'longitude']}'), - rating: mapValueOfType(json, r'rating'), - timeZone: mapValueOfType(json, r'timeZone'), - visibility: AssetVisibility.fromJson(json[r'visibility']), + isFavorite: json.containsKey(r'isFavorite') ? Optional.present(mapValueOfType(json, r'isFavorite')) : const Optional.absent(), + latitude: json.containsKey(r'latitude') ? Optional.present(json[r'latitude'] == null ? null : num.parse('${json[r'latitude']}')) : const Optional.absent(), + longitude: json.containsKey(r'longitude') ? Optional.present(json[r'longitude'] == null ? null : num.parse('${json[r'longitude']}')) : const Optional.absent(), + rating: json.containsKey(r'rating') ? Optional.present(json[r'rating'] == null ? null : int.parse('${json[r'rating']}')) : const Optional.absent(), + timeZone: json.containsKey(r'timeZone') ? Optional.present(mapValueOfType(json, r'timeZone')) : const Optional.absent(), + visibility: json.containsKey(r'visibility') ? Optional.present(AssetVisibility.fromJson(json[r'visibility'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/asset_bulk_upload_check_dto.dart b/mobile/openapi/lib/model/asset_bulk_upload_check_dto.dart index 66f46795e8..fbf18c825e 100644 --- a/mobile/openapi/lib/model/asset_bulk_upload_check_dto.dart +++ b/mobile/openapi/lib/model/asset_bulk_upload_check_dto.dart @@ -45,6 +45,15 @@ class AssetBulkUploadCheckDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assets'), 'Required key "AssetBulkUploadCheckDto[assets]" is missing from JSON.'); + assert(json[r'assets'] != null, 'Required key "AssetBulkUploadCheckDto[assets]" has a null value in JSON.'); + return true; + }()); + return AssetBulkUploadCheckDto( assets: AssetBulkUploadCheckItem.listFromJson(json[r'assets']), ); diff --git a/mobile/openapi/lib/model/asset_bulk_upload_check_item.dart b/mobile/openapi/lib/model/asset_bulk_upload_check_item.dart index 65f81926e3..7e94850ce7 100644 --- a/mobile/openapi/lib/model/asset_bulk_upload_check_item.dart +++ b/mobile/openapi/lib/model/asset_bulk_upload_check_item.dart @@ -52,6 +52,17 @@ class AssetBulkUploadCheckItem { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'checksum'), 'Required key "AssetBulkUploadCheckItem[checksum]" is missing from JSON.'); + assert(json[r'checksum'] != null, 'Required key "AssetBulkUploadCheckItem[checksum]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "AssetBulkUploadCheckItem[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "AssetBulkUploadCheckItem[id]" has a null value in JSON.'); + return true; + }()); + return AssetBulkUploadCheckItem( checksum: mapValueOfType(json, r'checksum')!, id: mapValueOfType(json, r'id')!, diff --git a/mobile/openapi/lib/model/asset_bulk_upload_check_response_dto.dart b/mobile/openapi/lib/model/asset_bulk_upload_check_response_dto.dart index b37bb0de8a..d744d6927b 100644 --- a/mobile/openapi/lib/model/asset_bulk_upload_check_response_dto.dart +++ b/mobile/openapi/lib/model/asset_bulk_upload_check_response_dto.dart @@ -45,6 +45,15 @@ class AssetBulkUploadCheckResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'results'), 'Required key "AssetBulkUploadCheckResponseDto[results]" is missing from JSON.'); + assert(json[r'results'] != null, 'Required key "AssetBulkUploadCheckResponseDto[results]" has a null value in JSON.'); + return true; + }()); + return AssetBulkUploadCheckResponseDto( results: AssetBulkUploadCheckResult.listFromJson(json[r'results']), ); diff --git a/mobile/openapi/lib/model/asset_bulk_upload_check_result.dart b/mobile/openapi/lib/model/asset_bulk_upload_check_result.dart index bf3ee8e244..e8ee351769 100644 --- a/mobile/openapi/lib/model/asset_bulk_upload_check_result.dart +++ b/mobile/openapi/lib/model/asset_bulk_upload_check_result.dart @@ -14,10 +14,10 @@ class AssetBulkUploadCheckResult { /// Returns a new [AssetBulkUploadCheckResult] instance. AssetBulkUploadCheckResult({ required this.action, - this.assetId, + this.assetId = const Optional.absent(), required this.id, - this.isTrashed, - this.reason, + this.isTrashed = const Optional.absent(), + this.reason = const Optional.absent(), }); AssetUploadAction action; @@ -29,7 +29,7 @@ class AssetBulkUploadCheckResult { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? assetId; + Optional assetId; /// Asset ID String id; @@ -41,7 +41,7 @@ class AssetBulkUploadCheckResult { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isTrashed; + Optional isTrashed; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -49,7 +49,7 @@ class AssetBulkUploadCheckResult { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetRejectReason? reason; + Optional reason; @override bool operator ==(Object other) => identical(this, other) || other is AssetBulkUploadCheckResult && @@ -74,21 +74,18 @@ class AssetBulkUploadCheckResult { Map toJson() { final json = {}; json[r'action'] = this.action; - if (this.assetId != null) { - json[r'assetId'] = this.assetId; - } else { - // json[r'assetId'] = null; + if (this.assetId.isPresent) { + final value = this.assetId.value; + json[r'assetId'] = value; } json[r'id'] = this.id; - if (this.isTrashed != null) { - json[r'isTrashed'] = this.isTrashed; - } else { - // json[r'isTrashed'] = null; + if (this.isTrashed.isPresent) { + final value = this.isTrashed.value; + json[r'isTrashed'] = value; } - if (this.reason != null) { - json[r'reason'] = this.reason; - } else { - // json[r'reason'] = null; + if (this.reason.isPresent) { + final value = this.reason.value; + json[r'reason'] = value; } return json; } @@ -101,12 +98,23 @@ class AssetBulkUploadCheckResult { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'action'), 'Required key "AssetBulkUploadCheckResult[action]" is missing from JSON.'); + assert(json[r'action'] != null, 'Required key "AssetBulkUploadCheckResult[action]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "AssetBulkUploadCheckResult[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "AssetBulkUploadCheckResult[id]" has a null value in JSON.'); + return true; + }()); + return AssetBulkUploadCheckResult( action: AssetUploadAction.fromJson(json[r'action'])!, - assetId: mapValueOfType(json, r'assetId'), + assetId: json.containsKey(r'assetId') ? Optional.present(mapValueOfType(json, r'assetId')) : const Optional.absent(), id: mapValueOfType(json, r'id')!, - isTrashed: mapValueOfType(json, r'isTrashed'), - reason: AssetRejectReason.fromJson(json[r'reason']), + isTrashed: json.containsKey(r'isTrashed') ? Optional.present(mapValueOfType(json, r'isTrashed')) : const Optional.absent(), + reason: json.containsKey(r'reason') ? Optional.present(AssetRejectReason.fromJson(json[r'reason'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/asset_copy_dto.dart b/mobile/openapi/lib/model/asset_copy_dto.dart index 2e68c5c113..7d4b8d0a68 100644 --- a/mobile/openapi/lib/model/asset_copy_dto.dart +++ b/mobile/openapi/lib/model/asset_copy_dto.dart @@ -13,32 +13,32 @@ part of openapi.api; class AssetCopyDto { /// Returns a new [AssetCopyDto] instance. AssetCopyDto({ - this.albums = true, - this.favorite = true, - this.sharedLinks = true, - this.sidecar = true, + this.albums = const Optional.present(true), + this.favorite = const Optional.present(true), + this.sharedLinks = const Optional.present(true), + this.sidecar = const Optional.present(true), required this.sourceId, - this.stack = true, + this.stack = const Optional.present(true), required this.targetId, }); /// Copy album associations - bool albums; + Optional albums; /// Copy favorite status - bool favorite; + Optional favorite; /// Copy shared links - bool sharedLinks; + Optional sharedLinks; /// Copy sidecar file - bool sidecar; + Optional sidecar; /// Source asset ID String sourceId; /// Copy stack association - bool stack; + Optional stack; /// Target asset ID String targetId; @@ -69,12 +69,27 @@ class AssetCopyDto { Map toJson() { final json = {}; - json[r'albums'] = this.albums; - json[r'favorite'] = this.favorite; - json[r'sharedLinks'] = this.sharedLinks; - json[r'sidecar'] = this.sidecar; + if (this.albums.isPresent) { + final value = this.albums.value; + json[r'albums'] = value; + } + if (this.favorite.isPresent) { + final value = this.favorite.value; + json[r'favorite'] = value; + } + if (this.sharedLinks.isPresent) { + final value = this.sharedLinks.value; + json[r'sharedLinks'] = value; + } + if (this.sidecar.isPresent) { + final value = this.sidecar.value; + json[r'sidecar'] = value; + } json[r'sourceId'] = this.sourceId; - json[r'stack'] = this.stack; + if (this.stack.isPresent) { + final value = this.stack.value; + json[r'stack'] = value; + } json[r'targetId'] = this.targetId; return json; } @@ -87,13 +102,24 @@ class AssetCopyDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'sourceId'), 'Required key "AssetCopyDto[sourceId]" is missing from JSON.'); + assert(json[r'sourceId'] != null, 'Required key "AssetCopyDto[sourceId]" has a null value in JSON.'); + assert(json.containsKey(r'targetId'), 'Required key "AssetCopyDto[targetId]" is missing from JSON.'); + assert(json[r'targetId'] != null, 'Required key "AssetCopyDto[targetId]" has a null value in JSON.'); + return true; + }()); + return AssetCopyDto( - albums: mapValueOfType(json, r'albums') ?? true, - favorite: mapValueOfType(json, r'favorite') ?? true, - sharedLinks: mapValueOfType(json, r'sharedLinks') ?? true, - sidecar: mapValueOfType(json, r'sidecar') ?? true, + albums: json.containsKey(r'albums') ? Optional.present(mapValueOfType(json, r'albums')) : const Optional.absent(), + favorite: json.containsKey(r'favorite') ? Optional.present(mapValueOfType(json, r'favorite')) : const Optional.absent(), + sharedLinks: json.containsKey(r'sharedLinks') ? Optional.present(mapValueOfType(json, r'sharedLinks')) : const Optional.absent(), + sidecar: json.containsKey(r'sidecar') ? Optional.present(mapValueOfType(json, r'sidecar')) : const Optional.absent(), sourceId: mapValueOfType(json, r'sourceId')!, - stack: mapValueOfType(json, r'stack') ?? true, + stack: json.containsKey(r'stack') ? Optional.present(mapValueOfType(json, r'stack')) : const Optional.absent(), targetId: mapValueOfType(json, r'targetId')!, ); } diff --git a/mobile/openapi/lib/model/asset_edit_action_item_dto.dart b/mobile/openapi/lib/model/asset_edit_action_item_dto.dart index 1b19612bf3..441a1ce389 100644 --- a/mobile/openapi/lib/model/asset_edit_action_item_dto.dart +++ b/mobile/openapi/lib/model/asset_edit_action_item_dto.dart @@ -50,6 +50,17 @@ class AssetEditActionItemDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'action'), 'Required key "AssetEditActionItemDto[action]" is missing from JSON.'); + assert(json[r'action'] != null, 'Required key "AssetEditActionItemDto[action]" has a null value in JSON.'); + assert(json.containsKey(r'parameters'), 'Required key "AssetEditActionItemDto[parameters]" is missing from JSON.'); + assert(json[r'parameters'] != null, 'Required key "AssetEditActionItemDto[parameters]" has a null value in JSON.'); + return true; + }()); + return AssetEditActionItemDto( action: AssetEditAction.fromJson(json[r'action'])!, parameters: json[r'parameters'], diff --git a/mobile/openapi/lib/model/asset_edit_action_item_dto_parameters.dart b/mobile/openapi/lib/model/asset_edit_action_item_dto_parameters.dart index 6f2811e89d..5bc0b34fcd 100644 --- a/mobile/openapi/lib/model/asset_edit_action_item_dto_parameters.dart +++ b/mobile/openapi/lib/model/asset_edit_action_item_dto_parameters.dart @@ -91,6 +91,25 @@ class AssetEditActionItemDtoParameters { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'height'), 'Required key "AssetEditActionItemDtoParameters[height]" is missing from JSON.'); + assert(json[r'height'] != null, 'Required key "AssetEditActionItemDtoParameters[height]" has a null value in JSON.'); + assert(json.containsKey(r'width'), 'Required key "AssetEditActionItemDtoParameters[width]" is missing from JSON.'); + assert(json[r'width'] != null, 'Required key "AssetEditActionItemDtoParameters[width]" has a null value in JSON.'); + assert(json.containsKey(r'x'), 'Required key "AssetEditActionItemDtoParameters[x]" is missing from JSON.'); + assert(json[r'x'] != null, 'Required key "AssetEditActionItemDtoParameters[x]" has a null value in JSON.'); + assert(json.containsKey(r'y'), 'Required key "AssetEditActionItemDtoParameters[y]" is missing from JSON.'); + assert(json[r'y'] != null, 'Required key "AssetEditActionItemDtoParameters[y]" has a null value in JSON.'); + assert(json.containsKey(r'angle'), 'Required key "AssetEditActionItemDtoParameters[angle]" is missing from JSON.'); + assert(json[r'angle'] != null, 'Required key "AssetEditActionItemDtoParameters[angle]" has a null value in JSON.'); + assert(json.containsKey(r'axis'), 'Required key "AssetEditActionItemDtoParameters[axis]" is missing from JSON.'); + assert(json[r'axis'] != null, 'Required key "AssetEditActionItemDtoParameters[axis]" has a null value in JSON.'); + return true; + }()); + return AssetEditActionItemDtoParameters( height: mapValueOfType(json, r'height')!, width: mapValueOfType(json, r'width')!, diff --git a/mobile/openapi/lib/model/asset_edit_action_item_response_dto.dart b/mobile/openapi/lib/model/asset_edit_action_item_response_dto.dart index 3315fe8579..3d9cd9bcfb 100644 --- a/mobile/openapi/lib/model/asset_edit_action_item_response_dto.dart +++ b/mobile/openapi/lib/model/asset_edit_action_item_response_dto.dart @@ -57,6 +57,19 @@ class AssetEditActionItemResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'action'), 'Required key "AssetEditActionItemResponseDto[action]" is missing from JSON.'); + assert(json[r'action'] != null, 'Required key "AssetEditActionItemResponseDto[action]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "AssetEditActionItemResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "AssetEditActionItemResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'parameters'), 'Required key "AssetEditActionItemResponseDto[parameters]" is missing from JSON.'); + assert(json[r'parameters'] != null, 'Required key "AssetEditActionItemResponseDto[parameters]" has a null value in JSON.'); + return true; + }()); + return AssetEditActionItemResponseDto( action: AssetEditAction.fromJson(json[r'action'])!, id: mapValueOfType(json, r'id')!, diff --git a/mobile/openapi/lib/model/asset_edits_create_dto.dart b/mobile/openapi/lib/model/asset_edits_create_dto.dart index 9f6fc66904..c01bfb593d 100644 --- a/mobile/openapi/lib/model/asset_edits_create_dto.dart +++ b/mobile/openapi/lib/model/asset_edits_create_dto.dart @@ -45,6 +45,15 @@ class AssetEditsCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'edits'), 'Required key "AssetEditsCreateDto[edits]" is missing from JSON.'); + assert(json[r'edits'] != null, 'Required key "AssetEditsCreateDto[edits]" has a null value in JSON.'); + return true; + }()); + return AssetEditsCreateDto( edits: AssetEditActionItemDto.listFromJson(json[r'edits']), ); diff --git a/mobile/openapi/lib/model/asset_edits_response_dto.dart b/mobile/openapi/lib/model/asset_edits_response_dto.dart index 322b4c0a4c..aac0d5974b 100644 --- a/mobile/openapi/lib/model/asset_edits_response_dto.dart +++ b/mobile/openapi/lib/model/asset_edits_response_dto.dart @@ -52,6 +52,17 @@ class AssetEditsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "AssetEditsResponseDto[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "AssetEditsResponseDto[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'edits'), 'Required key "AssetEditsResponseDto[edits]" is missing from JSON.'); + assert(json[r'edits'] != null, 'Required key "AssetEditsResponseDto[edits]" has a null value in JSON.'); + return true; + }()); + return AssetEditsResponseDto( assetId: mapValueOfType(json, r'assetId')!, edits: AssetEditActionItemResponseDto.listFromJson(json[r'edits']), diff --git a/mobile/openapi/lib/model/asset_face_create_dto.dart b/mobile/openapi/lib/model/asset_face_create_dto.dart index 29c28175cd..e6d990196b 100644 --- a/mobile/openapi/lib/model/asset_face_create_dto.dart +++ b/mobile/openapi/lib/model/asset_face_create_dto.dart @@ -112,6 +112,29 @@ class AssetFaceCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "AssetFaceCreateDto[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "AssetFaceCreateDto[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'height'), 'Required key "AssetFaceCreateDto[height]" is missing from JSON.'); + assert(json[r'height'] != null, 'Required key "AssetFaceCreateDto[height]" has a null value in JSON.'); + assert(json.containsKey(r'imageHeight'), 'Required key "AssetFaceCreateDto[imageHeight]" is missing from JSON.'); + assert(json[r'imageHeight'] != null, 'Required key "AssetFaceCreateDto[imageHeight]" has a null value in JSON.'); + assert(json.containsKey(r'imageWidth'), 'Required key "AssetFaceCreateDto[imageWidth]" is missing from JSON.'); + assert(json[r'imageWidth'] != null, 'Required key "AssetFaceCreateDto[imageWidth]" has a null value in JSON.'); + assert(json.containsKey(r'personId'), 'Required key "AssetFaceCreateDto[personId]" is missing from JSON.'); + assert(json[r'personId'] != null, 'Required key "AssetFaceCreateDto[personId]" has a null value in JSON.'); + assert(json.containsKey(r'width'), 'Required key "AssetFaceCreateDto[width]" is missing from JSON.'); + assert(json[r'width'] != null, 'Required key "AssetFaceCreateDto[width]" has a null value in JSON.'); + assert(json.containsKey(r'x'), 'Required key "AssetFaceCreateDto[x]" is missing from JSON.'); + assert(json[r'x'] != null, 'Required key "AssetFaceCreateDto[x]" has a null value in JSON.'); + assert(json.containsKey(r'y'), 'Required key "AssetFaceCreateDto[y]" is missing from JSON.'); + assert(json[r'y'] != null, 'Required key "AssetFaceCreateDto[y]" has a null value in JSON.'); + return true; + }()); + return AssetFaceCreateDto( assetId: mapValueOfType(json, r'assetId')!, height: mapValueOfType(json, r'height')!, diff --git a/mobile/openapi/lib/model/asset_face_delete_dto.dart b/mobile/openapi/lib/model/asset_face_delete_dto.dart index a1f3731bea..0047f9ccdd 100644 --- a/mobile/openapi/lib/model/asset_face_delete_dto.dart +++ b/mobile/openapi/lib/model/asset_face_delete_dto.dart @@ -45,6 +45,15 @@ class AssetFaceDeleteDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'force'), 'Required key "AssetFaceDeleteDto[force]" is missing from JSON.'); + assert(json[r'force'] != null, 'Required key "AssetFaceDeleteDto[force]" has a null value in JSON.'); + return true; + }()); + return AssetFaceDeleteDto( force: mapValueOfType(json, r'force')!, ); diff --git a/mobile/openapi/lib/model/asset_face_response_dto.dart b/mobile/openapi/lib/model/asset_face_response_dto.dart index 21b86dfe4e..ee74cd35ec 100644 --- a/mobile/openapi/lib/model/asset_face_response_dto.dart +++ b/mobile/openapi/lib/model/asset_face_response_dto.dart @@ -21,7 +21,7 @@ class AssetFaceResponseDto { required this.imageHeight, required this.imageWidth, required this.person, - this.sourceType, + this.sourceType = const Optional.absent(), }); /// Bounding box X1 coordinate @@ -71,7 +71,7 @@ class AssetFaceResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - SourceType? sourceType; + Optional sourceType; @override bool operator ==(Object other) => identical(this, other) || other is AssetFaceResponseDto && @@ -113,12 +113,11 @@ class AssetFaceResponseDto { if (this.person != null) { json[r'person'] = this.person; } else { - // json[r'person'] = null; + json[r'person'] = null; } - if (this.sourceType != null) { - json[r'sourceType'] = this.sourceType; - } else { - // json[r'sourceType'] = null; + if (this.sourceType.isPresent) { + final value = this.sourceType.value; + json[r'sourceType'] = value; } return json; } @@ -131,6 +130,28 @@ class AssetFaceResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'boundingBoxX1'), 'Required key "AssetFaceResponseDto[boundingBoxX1]" is missing from JSON.'); + assert(json[r'boundingBoxX1'] != null, 'Required key "AssetFaceResponseDto[boundingBoxX1]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxX2'), 'Required key "AssetFaceResponseDto[boundingBoxX2]" is missing from JSON.'); + assert(json[r'boundingBoxX2'] != null, 'Required key "AssetFaceResponseDto[boundingBoxX2]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxY1'), 'Required key "AssetFaceResponseDto[boundingBoxY1]" is missing from JSON.'); + assert(json[r'boundingBoxY1'] != null, 'Required key "AssetFaceResponseDto[boundingBoxY1]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxY2'), 'Required key "AssetFaceResponseDto[boundingBoxY2]" is missing from JSON.'); + assert(json[r'boundingBoxY2'] != null, 'Required key "AssetFaceResponseDto[boundingBoxY2]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "AssetFaceResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "AssetFaceResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'imageHeight'), 'Required key "AssetFaceResponseDto[imageHeight]" is missing from JSON.'); + assert(json[r'imageHeight'] != null, 'Required key "AssetFaceResponseDto[imageHeight]" has a null value in JSON.'); + assert(json.containsKey(r'imageWidth'), 'Required key "AssetFaceResponseDto[imageWidth]" is missing from JSON.'); + assert(json[r'imageWidth'] != null, 'Required key "AssetFaceResponseDto[imageWidth]" has a null value in JSON.'); + assert(json.containsKey(r'person'), 'Required key "AssetFaceResponseDto[person]" is missing from JSON.'); + return true; + }()); + return AssetFaceResponseDto( boundingBoxX1: mapValueOfType(json, r'boundingBoxX1')!, boundingBoxX2: mapValueOfType(json, r'boundingBoxX2')!, @@ -140,7 +161,7 @@ class AssetFaceResponseDto { imageHeight: mapValueOfType(json, r'imageHeight')!, imageWidth: mapValueOfType(json, r'imageWidth')!, person: PersonResponseDto.fromJson(json[r'person']), - sourceType: SourceType.fromJson(json[r'sourceType']), + sourceType: json.containsKey(r'sourceType') ? Optional.present(SourceType.fromJson(json[r'sourceType'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/asset_face_update_dto.dart b/mobile/openapi/lib/model/asset_face_update_dto.dart index 1027627552..e82ef547f6 100644 --- a/mobile/openapi/lib/model/asset_face_update_dto.dart +++ b/mobile/openapi/lib/model/asset_face_update_dto.dart @@ -45,6 +45,15 @@ class AssetFaceUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'data'), 'Required key "AssetFaceUpdateDto[data]" is missing from JSON.'); + assert(json[r'data'] != null, 'Required key "AssetFaceUpdateDto[data]" has a null value in JSON.'); + return true; + }()); + return AssetFaceUpdateDto( data: AssetFaceUpdateItem.listFromJson(json[r'data']), ); diff --git a/mobile/openapi/lib/model/asset_face_update_item.dart b/mobile/openapi/lib/model/asset_face_update_item.dart index a81b21e139..45864ff0db 100644 --- a/mobile/openapi/lib/model/asset_face_update_item.dart +++ b/mobile/openapi/lib/model/asset_face_update_item.dart @@ -52,6 +52,17 @@ class AssetFaceUpdateItem { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "AssetFaceUpdateItem[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "AssetFaceUpdateItem[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'personId'), 'Required key "AssetFaceUpdateItem[personId]" is missing from JSON.'); + assert(json[r'personId'] != null, 'Required key "AssetFaceUpdateItem[personId]" has a null value in JSON.'); + return true; + }()); + return AssetFaceUpdateItem( assetId: mapValueOfType(json, r'assetId')!, personId: mapValueOfType(json, r'personId')!, diff --git a/mobile/openapi/lib/model/asset_ids_dto.dart b/mobile/openapi/lib/model/asset_ids_dto.dart index 85e5cc3aee..307ac6b925 100644 --- a/mobile/openapi/lib/model/asset_ids_dto.dart +++ b/mobile/openapi/lib/model/asset_ids_dto.dart @@ -45,6 +45,15 @@ class AssetIdsDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetIds'), 'Required key "AssetIdsDto[assetIds]" is missing from JSON.'); + assert(json[r'assetIds'] != null, 'Required key "AssetIdsDto[assetIds]" has a null value in JSON.'); + return true; + }()); + return AssetIdsDto( assetIds: json[r'assetIds'] is Iterable ? (json[r'assetIds'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/asset_ids_response_dto.dart b/mobile/openapi/lib/model/asset_ids_response_dto.dart index cafe1b21b9..ed995c38db 100644 --- a/mobile/openapi/lib/model/asset_ids_response_dto.dart +++ b/mobile/openapi/lib/model/asset_ids_response_dto.dart @@ -14,7 +14,7 @@ class AssetIdsResponseDto { /// Returns a new [AssetIdsResponseDto] instance. AssetIdsResponseDto({ required this.assetId, - this.error, + this.error = const Optional.absent(), required this.success, }); @@ -27,7 +27,7 @@ class AssetIdsResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetIdErrorReason? error; + Optional error; /// Whether operation succeeded bool success; @@ -51,10 +51,9 @@ class AssetIdsResponseDto { Map toJson() { final json = {}; json[r'assetId'] = this.assetId; - if (this.error != null) { - json[r'error'] = this.error; - } else { - // json[r'error'] = null; + if (this.error.isPresent) { + final value = this.error.value; + json[r'error'] = value; } json[r'success'] = this.success; return json; @@ -68,9 +67,20 @@ class AssetIdsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "AssetIdsResponseDto[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "AssetIdsResponseDto[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'success'), 'Required key "AssetIdsResponseDto[success]" is missing from JSON.'); + assert(json[r'success'] != null, 'Required key "AssetIdsResponseDto[success]" has a null value in JSON.'); + return true; + }()); + return AssetIdsResponseDto( assetId: mapValueOfType(json, r'assetId')!, - error: AssetIdErrorReason.fromJson(json[r'error']), + error: json.containsKey(r'error') ? Optional.present(AssetIdErrorReason.fromJson(json[r'error'])) : const Optional.absent(), success: mapValueOfType(json, r'success')!, ); } diff --git a/mobile/openapi/lib/model/asset_jobs_dto.dart b/mobile/openapi/lib/model/asset_jobs_dto.dart index 5085e3820c..8f7f88b763 100644 --- a/mobile/openapi/lib/model/asset_jobs_dto.dart +++ b/mobile/openapi/lib/model/asset_jobs_dto.dart @@ -51,6 +51,17 @@ class AssetJobsDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetIds'), 'Required key "AssetJobsDto[assetIds]" is missing from JSON.'); + assert(json[r'assetIds'] != null, 'Required key "AssetJobsDto[assetIds]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "AssetJobsDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "AssetJobsDto[name]" has a null value in JSON.'); + return true; + }()); + return AssetJobsDto( assetIds: json[r'assetIds'] is Iterable ? (json[r'assetIds'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/asset_media_response_dto.dart b/mobile/openapi/lib/model/asset_media_response_dto.dart index 6dc5cd3c92..284f810519 100644 --- a/mobile/openapi/lib/model/asset_media_response_dto.dart +++ b/mobile/openapi/lib/model/asset_media_response_dto.dart @@ -51,6 +51,17 @@ class AssetMediaResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'id'), 'Required key "AssetMediaResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "AssetMediaResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'status'), 'Required key "AssetMediaResponseDto[status]" is missing from JSON.'); + assert(json[r'status'] != null, 'Required key "AssetMediaResponseDto[status]" has a null value in JSON.'); + return true; + }()); + return AssetMediaResponseDto( id: mapValueOfType(json, r'id')!, status: AssetMediaStatus.fromJson(json[r'status'])!, diff --git a/mobile/openapi/lib/model/asset_metadata_bulk_delete_dto.dart b/mobile/openapi/lib/model/asset_metadata_bulk_delete_dto.dart index 6376ebc531..ce6465c85e 100644 --- a/mobile/openapi/lib/model/asset_metadata_bulk_delete_dto.dart +++ b/mobile/openapi/lib/model/asset_metadata_bulk_delete_dto.dart @@ -45,6 +45,15 @@ class AssetMetadataBulkDeleteDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'items'), 'Required key "AssetMetadataBulkDeleteDto[items]" is missing from JSON.'); + assert(json[r'items'] != null, 'Required key "AssetMetadataBulkDeleteDto[items]" has a null value in JSON.'); + return true; + }()); + return AssetMetadataBulkDeleteDto( items: AssetMetadataBulkDeleteItemDto.listFromJson(json[r'items']), ); diff --git a/mobile/openapi/lib/model/asset_metadata_bulk_delete_item_dto.dart b/mobile/openapi/lib/model/asset_metadata_bulk_delete_item_dto.dart index 90417b79e0..e5b522e0f1 100644 --- a/mobile/openapi/lib/model/asset_metadata_bulk_delete_item_dto.dart +++ b/mobile/openapi/lib/model/asset_metadata_bulk_delete_item_dto.dart @@ -52,6 +52,17 @@ class AssetMetadataBulkDeleteItemDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "AssetMetadataBulkDeleteItemDto[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "AssetMetadataBulkDeleteItemDto[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'key'), 'Required key "AssetMetadataBulkDeleteItemDto[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "AssetMetadataBulkDeleteItemDto[key]" has a null value in JSON.'); + return true; + }()); + return AssetMetadataBulkDeleteItemDto( assetId: mapValueOfType(json, r'assetId')!, key: mapValueOfType(json, r'key')!, diff --git a/mobile/openapi/lib/model/asset_metadata_bulk_response_dto.dart b/mobile/openapi/lib/model/asset_metadata_bulk_response_dto.dart index 3e16ed8721..fc8617edbe 100644 --- a/mobile/openapi/lib/model/asset_metadata_bulk_response_dto.dart +++ b/mobile/openapi/lib/model/asset_metadata_bulk_response_dto.dart @@ -68,6 +68,21 @@ class AssetMetadataBulkResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "AssetMetadataBulkResponseDto[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "AssetMetadataBulkResponseDto[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'key'), 'Required key "AssetMetadataBulkResponseDto[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "AssetMetadataBulkResponseDto[key]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "AssetMetadataBulkResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "AssetMetadataBulkResponseDto[updatedAt]" has a null value in JSON.'); + assert(json.containsKey(r'value'), 'Required key "AssetMetadataBulkResponseDto[value]" is missing from JSON.'); + assert(json[r'value'] != null, 'Required key "AssetMetadataBulkResponseDto[value]" has a null value in JSON.'); + return true; + }()); + return AssetMetadataBulkResponseDto( assetId: mapValueOfType(json, r'assetId')!, key: mapValueOfType(json, r'key')!, diff --git a/mobile/openapi/lib/model/asset_metadata_bulk_upsert_dto.dart b/mobile/openapi/lib/model/asset_metadata_bulk_upsert_dto.dart index a5e770b02a..251d2495c5 100644 --- a/mobile/openapi/lib/model/asset_metadata_bulk_upsert_dto.dart +++ b/mobile/openapi/lib/model/asset_metadata_bulk_upsert_dto.dart @@ -45,6 +45,15 @@ class AssetMetadataBulkUpsertDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'items'), 'Required key "AssetMetadataBulkUpsertDto[items]" is missing from JSON.'); + assert(json[r'items'] != null, 'Required key "AssetMetadataBulkUpsertDto[items]" has a null value in JSON.'); + return true; + }()); + return AssetMetadataBulkUpsertDto( items: AssetMetadataBulkUpsertItemDto.listFromJson(json[r'items']), ); diff --git a/mobile/openapi/lib/model/asset_metadata_bulk_upsert_item_dto.dart b/mobile/openapi/lib/model/asset_metadata_bulk_upsert_item_dto.dart index e4eab08bf1..9e331058a6 100644 --- a/mobile/openapi/lib/model/asset_metadata_bulk_upsert_item_dto.dart +++ b/mobile/openapi/lib/model/asset_metadata_bulk_upsert_item_dto.dart @@ -59,6 +59,19 @@ class AssetMetadataBulkUpsertItemDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "AssetMetadataBulkUpsertItemDto[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "AssetMetadataBulkUpsertItemDto[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'key'), 'Required key "AssetMetadataBulkUpsertItemDto[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "AssetMetadataBulkUpsertItemDto[key]" has a null value in JSON.'); + assert(json.containsKey(r'value'), 'Required key "AssetMetadataBulkUpsertItemDto[value]" is missing from JSON.'); + assert(json[r'value'] != null, 'Required key "AssetMetadataBulkUpsertItemDto[value]" has a null value in JSON.'); + return true; + }()); + return AssetMetadataBulkUpsertItemDto( assetId: mapValueOfType(json, r'assetId')!, key: mapValueOfType(json, r'key')!, diff --git a/mobile/openapi/lib/model/asset_metadata_response_dto.dart b/mobile/openapi/lib/model/asset_metadata_response_dto.dart index d3562f5a48..9c0a9733be 100644 --- a/mobile/openapi/lib/model/asset_metadata_response_dto.dart +++ b/mobile/openapi/lib/model/asset_metadata_response_dto.dart @@ -61,6 +61,19 @@ class AssetMetadataResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'key'), 'Required key "AssetMetadataResponseDto[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "AssetMetadataResponseDto[key]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "AssetMetadataResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "AssetMetadataResponseDto[updatedAt]" has a null value in JSON.'); + assert(json.containsKey(r'value'), 'Required key "AssetMetadataResponseDto[value]" is missing from JSON.'); + assert(json[r'value'] != null, 'Required key "AssetMetadataResponseDto[value]" has a null value in JSON.'); + return true; + }()); + return AssetMetadataResponseDto( key: mapValueOfType(json, r'key')!, updatedAt: mapDateTime(json, r'updatedAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, diff --git a/mobile/openapi/lib/model/asset_metadata_upsert_dto.dart b/mobile/openapi/lib/model/asset_metadata_upsert_dto.dart index b1473d4826..e19fbfef1d 100644 --- a/mobile/openapi/lib/model/asset_metadata_upsert_dto.dart +++ b/mobile/openapi/lib/model/asset_metadata_upsert_dto.dart @@ -45,6 +45,15 @@ class AssetMetadataUpsertDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'items'), 'Required key "AssetMetadataUpsertDto[items]" is missing from JSON.'); + assert(json[r'items'] != null, 'Required key "AssetMetadataUpsertDto[items]" has a null value in JSON.'); + return true; + }()); + return AssetMetadataUpsertDto( items: AssetMetadataUpsertItemDto.listFromJson(json[r'items']), ); diff --git a/mobile/openapi/lib/model/asset_metadata_upsert_item_dto.dart b/mobile/openapi/lib/model/asset_metadata_upsert_item_dto.dart index 70de1941f3..6eec200eab 100644 --- a/mobile/openapi/lib/model/asset_metadata_upsert_item_dto.dart +++ b/mobile/openapi/lib/model/asset_metadata_upsert_item_dto.dart @@ -52,6 +52,17 @@ class AssetMetadataUpsertItemDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'key'), 'Required key "AssetMetadataUpsertItemDto[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "AssetMetadataUpsertItemDto[key]" has a null value in JSON.'); + assert(json.containsKey(r'value'), 'Required key "AssetMetadataUpsertItemDto[value]" is missing from JSON.'); + assert(json[r'value'] != null, 'Required key "AssetMetadataUpsertItemDto[value]" has a null value in JSON.'); + return true; + }()); + return AssetMetadataUpsertItemDto( key: mapValueOfType(json, r'key')!, value: mapCastOfType(json, r'value')!, diff --git a/mobile/openapi/lib/model/asset_ocr_response_dto.dart b/mobile/openapi/lib/model/asset_ocr_response_dto.dart index c7937c6eb2..a455237d9f 100644 --- a/mobile/openapi/lib/model/asset_ocr_response_dto.dart +++ b/mobile/openapi/lib/model/asset_ocr_response_dto.dart @@ -127,20 +127,53 @@ class AssetOcrResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "AssetOcrResponseDto[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "AssetOcrResponseDto[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'boxScore'), 'Required key "AssetOcrResponseDto[boxScore]" is missing from JSON.'); + assert(json[r'boxScore'] != null, 'Required key "AssetOcrResponseDto[boxScore]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "AssetOcrResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "AssetOcrResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'text'), 'Required key "AssetOcrResponseDto[text]" is missing from JSON.'); + assert(json[r'text'] != null, 'Required key "AssetOcrResponseDto[text]" has a null value in JSON.'); + assert(json.containsKey(r'textScore'), 'Required key "AssetOcrResponseDto[textScore]" is missing from JSON.'); + assert(json[r'textScore'] != null, 'Required key "AssetOcrResponseDto[textScore]" has a null value in JSON.'); + assert(json.containsKey(r'x1'), 'Required key "AssetOcrResponseDto[x1]" is missing from JSON.'); + assert(json[r'x1'] != null, 'Required key "AssetOcrResponseDto[x1]" has a null value in JSON.'); + assert(json.containsKey(r'x2'), 'Required key "AssetOcrResponseDto[x2]" is missing from JSON.'); + assert(json[r'x2'] != null, 'Required key "AssetOcrResponseDto[x2]" has a null value in JSON.'); + assert(json.containsKey(r'x3'), 'Required key "AssetOcrResponseDto[x3]" is missing from JSON.'); + assert(json[r'x3'] != null, 'Required key "AssetOcrResponseDto[x3]" has a null value in JSON.'); + assert(json.containsKey(r'x4'), 'Required key "AssetOcrResponseDto[x4]" is missing from JSON.'); + assert(json[r'x4'] != null, 'Required key "AssetOcrResponseDto[x4]" has a null value in JSON.'); + assert(json.containsKey(r'y1'), 'Required key "AssetOcrResponseDto[y1]" is missing from JSON.'); + assert(json[r'y1'] != null, 'Required key "AssetOcrResponseDto[y1]" has a null value in JSON.'); + assert(json.containsKey(r'y2'), 'Required key "AssetOcrResponseDto[y2]" is missing from JSON.'); + assert(json[r'y2'] != null, 'Required key "AssetOcrResponseDto[y2]" has a null value in JSON.'); + assert(json.containsKey(r'y3'), 'Required key "AssetOcrResponseDto[y3]" is missing from JSON.'); + assert(json[r'y3'] != null, 'Required key "AssetOcrResponseDto[y3]" has a null value in JSON.'); + assert(json.containsKey(r'y4'), 'Required key "AssetOcrResponseDto[y4]" is missing from JSON.'); + assert(json[r'y4'] != null, 'Required key "AssetOcrResponseDto[y4]" has a null value in JSON.'); + return true; + }()); + return AssetOcrResponseDto( assetId: mapValueOfType(json, r'assetId')!, - boxScore: (mapValueOfType(json, r'boxScore')!).toDouble(), + boxScore: mapValueOfType(json, r'boxScore')!, id: mapValueOfType(json, r'id')!, text: mapValueOfType(json, r'text')!, - textScore: (mapValueOfType(json, r'textScore')!).toDouble(), - x1: (mapValueOfType(json, r'x1')!).toDouble(), - x2: (mapValueOfType(json, r'x2')!).toDouble(), - x3: (mapValueOfType(json, r'x3')!).toDouble(), - x4: (mapValueOfType(json, r'x4')!).toDouble(), - y1: (mapValueOfType(json, r'y1')!).toDouble(), - y2: (mapValueOfType(json, r'y2')!).toDouble(), - y3: (mapValueOfType(json, r'y3')!).toDouble(), - y4: (mapValueOfType(json, r'y4')!).toDouble(), + textScore: mapValueOfType(json, r'textScore')!, + x1: mapValueOfType(json, r'x1')!, + x2: mapValueOfType(json, r'x2')!, + x3: mapValueOfType(json, r'x3')!, + x4: mapValueOfType(json, r'x4')!, + y1: mapValueOfType(json, r'y1')!, + y2: mapValueOfType(json, r'y2')!, + y3: mapValueOfType(json, r'y3')!, + y4: mapValueOfType(json, r'y4')!, ); } return null; diff --git a/mobile/openapi/lib/model/asset_response_dto.dart b/mobile/openapi/lib/model/asset_response_dto.dart index eca87789ce..c75de13eb7 100644 --- a/mobile/openapi/lib/model/asset_response_dto.dart +++ b/mobile/openapi/lib/model/asset_response_dto.dart @@ -15,9 +15,9 @@ class AssetResponseDto { AssetResponseDto({ required this.checksum, required this.createdAt, - this.duplicateId, + this.duplicateId = const Optional.absent(), required this.duration, - this.exifInfo, + this.exifInfo = const Optional.absent(), required this.fileCreatedAt, required this.fileModifiedAt, required this.hasMetadata, @@ -28,18 +28,18 @@ class AssetResponseDto { required this.isFavorite, required this.isOffline, required this.isTrashed, - this.libraryId, - this.livePhotoVideoId, + this.libraryId = const Optional.absent(), + this.livePhotoVideoId = const Optional.absent(), required this.localDateTime, required this.originalFileName, - this.originalMimeType, + this.originalMimeType = const Optional.absent(), required this.originalPath, - this.owner, + this.owner = const Optional.absent(), required this.ownerId, - this.people = const [], - this.resized, - this.stack, - this.tags = const [], + this.people = const Optional.present(const []), + this.resized = const Optional.absent(), + this.stack = const Optional.absent(), + this.tags = const Optional.present(const []), required this.thumbhash, required this.type, required this.updatedAt, @@ -54,7 +54,7 @@ class AssetResponseDto { DateTime createdAt; /// Duplicate group ID - String? duplicateId; + Optional duplicateId; /// Video/gif duration in milliseconds (null for static images) /// @@ -68,7 +68,7 @@ class AssetResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - ExifResponseDto? exifInfo; + Optional exifInfo; /// The actual UTC timestamp when the file was created/captured, preserving timezone information. This is the authoritative timestamp for chronological sorting within timeline groups. Combined with timezone data, this can be used to determine the exact moment the photo was taken. DateTime fileCreatedAt; @@ -104,10 +104,10 @@ class AssetResponseDto { bool isTrashed; /// Library ID - String? libraryId; + Optional libraryId; /// Live photo video ID - String? livePhotoVideoId; + Optional livePhotoVideoId; /// The local date and time when the photo/video was taken, derived from EXIF metadata. This represents the photographer's local time regardless of timezone, stored as a timezone-agnostic timestamp. Used for timeline grouping by \"local\" days and months. DateTime localDateTime; @@ -122,7 +122,7 @@ class AssetResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? originalMimeType; + Optional originalMimeType; /// Original file path String originalPath; @@ -133,12 +133,12 @@ class AssetResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - UserResponseDto? owner; + Optional owner; /// Owner user ID String ownerId; - List people; + Optional?> people; /// Is resized /// @@ -147,11 +147,11 @@ class AssetResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? resized; + Optional resized; - AssetStackResponseDto? stack; + Optional stack; - List tags; + Optional?> tags; /// Thumbhash for thumbnail generation (base64) also used as the c query param for thumbnail cache busting. String? thumbhash; @@ -247,20 +247,18 @@ class AssetResponseDto { final json = {}; json[r'checksum'] = this.checksum; json[r'createdAt'] = this.createdAt.toUtc().toIso8601String(); - if (this.duplicateId != null) { - json[r'duplicateId'] = this.duplicateId; - } else { - // json[r'duplicateId'] = null; + if (this.duplicateId.isPresent) { + final value = this.duplicateId.value; + json[r'duplicateId'] = value; } if (this.duration != null) { json[r'duration'] = this.duration; } else { - // json[r'duration'] = null; + json[r'duration'] = null; } - if (this.exifInfo != null) { - json[r'exifInfo'] = this.exifInfo; - } else { - // json[r'exifInfo'] = null; + if (this.exifInfo.isPresent) { + final value = this.exifInfo.value; + json[r'exifInfo'] = value; } json[r'fileCreatedAt'] = this.fileCreatedAt.toUtc().toIso8601String(); json[r'fileModifiedAt'] = this.fileModifiedAt.toUtc().toIso8601String(); @@ -268,7 +266,7 @@ class AssetResponseDto { if (this.height != null) { json[r'height'] = this.height; } else { - // json[r'height'] = null; + json[r'height'] = null; } json[r'id'] = this.id; json[r'isArchived'] = this.isArchived; @@ -276,46 +274,46 @@ class AssetResponseDto { json[r'isFavorite'] = this.isFavorite; json[r'isOffline'] = this.isOffline; json[r'isTrashed'] = this.isTrashed; - if (this.libraryId != null) { - json[r'libraryId'] = this.libraryId; - } else { - // json[r'libraryId'] = null; + if (this.libraryId.isPresent) { + final value = this.libraryId.value; + json[r'libraryId'] = value; } - if (this.livePhotoVideoId != null) { - json[r'livePhotoVideoId'] = this.livePhotoVideoId; - } else { - // json[r'livePhotoVideoId'] = null; + if (this.livePhotoVideoId.isPresent) { + final value = this.livePhotoVideoId.value; + json[r'livePhotoVideoId'] = value; } json[r'localDateTime'] = this.localDateTime.toUtc().toIso8601String(); json[r'originalFileName'] = this.originalFileName; - if (this.originalMimeType != null) { - json[r'originalMimeType'] = this.originalMimeType; - } else { - // json[r'originalMimeType'] = null; + if (this.originalMimeType.isPresent) { + final value = this.originalMimeType.value; + json[r'originalMimeType'] = value; } json[r'originalPath'] = this.originalPath; - if (this.owner != null) { - json[r'owner'] = this.owner; - } else { - // json[r'owner'] = null; + if (this.owner.isPresent) { + final value = this.owner.value; + json[r'owner'] = value; } json[r'ownerId'] = this.ownerId; - json[r'people'] = this.people; - if (this.resized != null) { - json[r'resized'] = this.resized; - } else { - // json[r'resized'] = null; + if (this.people.isPresent) { + final value = this.people.value; + json[r'people'] = value; } - if (this.stack != null) { - json[r'stack'] = this.stack; - } else { - // json[r'stack'] = null; + if (this.resized.isPresent) { + final value = this.resized.value; + json[r'resized'] = value; + } + if (this.stack.isPresent) { + final value = this.stack.value; + json[r'stack'] = value; + } + if (this.tags.isPresent) { + final value = this.tags.value; + json[r'tags'] = value; } - json[r'tags'] = this.tags; if (this.thumbhash != null) { json[r'thumbhash'] = this.thumbhash; } else { - // json[r'thumbhash'] = null; + json[r'thumbhash'] = null; } json[r'type'] = this.type; json[r'updatedAt'] = this.updatedAt.toUtc().toIso8601String(); @@ -323,7 +321,7 @@ class AssetResponseDto { if (this.width != null) { json[r'width'] = this.width; } else { - // json[r'width'] = null; + json[r'width'] = null; } return json; } @@ -336,12 +334,59 @@ class AssetResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'checksum'), 'Required key "AssetResponseDto[checksum]" is missing from JSON.'); + assert(json[r'checksum'] != null, 'Required key "AssetResponseDto[checksum]" has a null value in JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "AssetResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "AssetResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'duration'), 'Required key "AssetResponseDto[duration]" is missing from JSON.'); + assert(json.containsKey(r'fileCreatedAt'), 'Required key "AssetResponseDto[fileCreatedAt]" is missing from JSON.'); + assert(json[r'fileCreatedAt'] != null, 'Required key "AssetResponseDto[fileCreatedAt]" has a null value in JSON.'); + assert(json.containsKey(r'fileModifiedAt'), 'Required key "AssetResponseDto[fileModifiedAt]" is missing from JSON.'); + assert(json[r'fileModifiedAt'] != null, 'Required key "AssetResponseDto[fileModifiedAt]" has a null value in JSON.'); + assert(json.containsKey(r'hasMetadata'), 'Required key "AssetResponseDto[hasMetadata]" is missing from JSON.'); + assert(json[r'hasMetadata'] != null, 'Required key "AssetResponseDto[hasMetadata]" has a null value in JSON.'); + assert(json.containsKey(r'height'), 'Required key "AssetResponseDto[height]" is missing from JSON.'); + assert(json.containsKey(r'id'), 'Required key "AssetResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "AssetResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'isArchived'), 'Required key "AssetResponseDto[isArchived]" is missing from JSON.'); + assert(json[r'isArchived'] != null, 'Required key "AssetResponseDto[isArchived]" has a null value in JSON.'); + assert(json.containsKey(r'isEdited'), 'Required key "AssetResponseDto[isEdited]" is missing from JSON.'); + assert(json[r'isEdited'] != null, 'Required key "AssetResponseDto[isEdited]" has a null value in JSON.'); + assert(json.containsKey(r'isFavorite'), 'Required key "AssetResponseDto[isFavorite]" is missing from JSON.'); + assert(json[r'isFavorite'] != null, 'Required key "AssetResponseDto[isFavorite]" has a null value in JSON.'); + assert(json.containsKey(r'isOffline'), 'Required key "AssetResponseDto[isOffline]" is missing from JSON.'); + assert(json[r'isOffline'] != null, 'Required key "AssetResponseDto[isOffline]" has a null value in JSON.'); + assert(json.containsKey(r'isTrashed'), 'Required key "AssetResponseDto[isTrashed]" is missing from JSON.'); + assert(json[r'isTrashed'] != null, 'Required key "AssetResponseDto[isTrashed]" has a null value in JSON.'); + assert(json.containsKey(r'localDateTime'), 'Required key "AssetResponseDto[localDateTime]" is missing from JSON.'); + assert(json[r'localDateTime'] != null, 'Required key "AssetResponseDto[localDateTime]" has a null value in JSON.'); + assert(json.containsKey(r'originalFileName'), 'Required key "AssetResponseDto[originalFileName]" is missing from JSON.'); + assert(json[r'originalFileName'] != null, 'Required key "AssetResponseDto[originalFileName]" has a null value in JSON.'); + assert(json.containsKey(r'originalPath'), 'Required key "AssetResponseDto[originalPath]" is missing from JSON.'); + assert(json[r'originalPath'] != null, 'Required key "AssetResponseDto[originalPath]" has a null value in JSON.'); + assert(json.containsKey(r'ownerId'), 'Required key "AssetResponseDto[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "AssetResponseDto[ownerId]" has a null value in JSON.'); + assert(json.containsKey(r'thumbhash'), 'Required key "AssetResponseDto[thumbhash]" is missing from JSON.'); + assert(json.containsKey(r'type'), 'Required key "AssetResponseDto[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "AssetResponseDto[type]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "AssetResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "AssetResponseDto[updatedAt]" has a null value in JSON.'); + assert(json.containsKey(r'visibility'), 'Required key "AssetResponseDto[visibility]" is missing from JSON.'); + assert(json[r'visibility'] != null, 'Required key "AssetResponseDto[visibility]" has a null value in JSON.'); + assert(json.containsKey(r'width'), 'Required key "AssetResponseDto[width]" is missing from JSON.'); + return true; + }()); + return AssetResponseDto( checksum: mapValueOfType(json, r'checksum')!, createdAt: mapDateTime(json, r'createdAt', r'')!, - duplicateId: mapValueOfType(json, r'duplicateId'), + duplicateId: json.containsKey(r'duplicateId') ? Optional.present(mapValueOfType(json, r'duplicateId')) : const Optional.absent(), duration: mapValueOfType(json, r'duration'), - exifInfo: ExifResponseDto.fromJson(json[r'exifInfo']), + exifInfo: json.containsKey(r'exifInfo') ? Optional.present(ExifResponseDto.fromJson(json[r'exifInfo'])) : const Optional.absent(), fileCreatedAt: mapDateTime(json, r'fileCreatedAt', r'')!, fileModifiedAt: mapDateTime(json, r'fileModifiedAt', r'')!, hasMetadata: mapValueOfType(json, r'hasMetadata')!, @@ -352,18 +397,18 @@ class AssetResponseDto { isFavorite: mapValueOfType(json, r'isFavorite')!, isOffline: mapValueOfType(json, r'isOffline')!, isTrashed: mapValueOfType(json, r'isTrashed')!, - libraryId: mapValueOfType(json, r'libraryId'), - livePhotoVideoId: mapValueOfType(json, r'livePhotoVideoId'), + libraryId: json.containsKey(r'libraryId') ? Optional.present(mapValueOfType(json, r'libraryId')) : const Optional.absent(), + livePhotoVideoId: json.containsKey(r'livePhotoVideoId') ? Optional.present(mapValueOfType(json, r'livePhotoVideoId')) : const Optional.absent(), localDateTime: mapDateTime(json, r'localDateTime', r'')!, originalFileName: mapValueOfType(json, r'originalFileName')!, - originalMimeType: mapValueOfType(json, r'originalMimeType'), + originalMimeType: json.containsKey(r'originalMimeType') ? Optional.present(mapValueOfType(json, r'originalMimeType')) : const Optional.absent(), originalPath: mapValueOfType(json, r'originalPath')!, - owner: UserResponseDto.fromJson(json[r'owner']), + owner: json.containsKey(r'owner') ? Optional.present(UserResponseDto.fromJson(json[r'owner'])) : const Optional.absent(), ownerId: mapValueOfType(json, r'ownerId')!, - people: PersonResponseDto.listFromJson(json[r'people']), - resized: mapValueOfType(json, r'resized'), - stack: AssetStackResponseDto.fromJson(json[r'stack']), - tags: TagResponseDto.listFromJson(json[r'tags']), + people: json.containsKey(r'people') ? Optional.present(PersonResponseDto.listFromJson(json[r'people'])) : const Optional.absent(), + resized: json.containsKey(r'resized') ? Optional.present(mapValueOfType(json, r'resized')) : const Optional.absent(), + stack: json.containsKey(r'stack') ? Optional.present(AssetStackResponseDto.fromJson(json[r'stack'])) : const Optional.absent(), + tags: json.containsKey(r'tags') ? Optional.present(TagResponseDto.listFromJson(json[r'tags'])) : const Optional.absent(), thumbhash: mapValueOfType(json, r'thumbhash'), type: AssetTypeEnum.fromJson(json[r'type'])!, updatedAt: mapDateTime(json, r'updatedAt', r'')!, diff --git a/mobile/openapi/lib/model/asset_stack_response_dto.dart b/mobile/openapi/lib/model/asset_stack_response_dto.dart index 96fd66a392..399ea20a82 100644 --- a/mobile/openapi/lib/model/asset_stack_response_dto.dart +++ b/mobile/openapi/lib/model/asset_stack_response_dto.dart @@ -62,6 +62,19 @@ class AssetStackResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetCount'), 'Required key "AssetStackResponseDto[assetCount]" is missing from JSON.'); + assert(json[r'assetCount'] != null, 'Required key "AssetStackResponseDto[assetCount]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "AssetStackResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "AssetStackResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'primaryAssetId'), 'Required key "AssetStackResponseDto[primaryAssetId]" is missing from JSON.'); + assert(json[r'primaryAssetId'] != null, 'Required key "AssetStackResponseDto[primaryAssetId]" has a null value in JSON.'); + return true; + }()); + return AssetStackResponseDto( assetCount: mapValueOfType(json, r'assetCount')!, id: mapValueOfType(json, r'id')!, diff --git a/mobile/openapi/lib/model/asset_stats_response_dto.dart b/mobile/openapi/lib/model/asset_stats_response_dto.dart index df2762a2f3..82ababeda7 100644 --- a/mobile/openapi/lib/model/asset_stats_response_dto.dart +++ b/mobile/openapi/lib/model/asset_stats_response_dto.dart @@ -68,6 +68,19 @@ class AssetStatsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'images'), 'Required key "AssetStatsResponseDto[images]" is missing from JSON.'); + assert(json[r'images'] != null, 'Required key "AssetStatsResponseDto[images]" has a null value in JSON.'); + assert(json.containsKey(r'total'), 'Required key "AssetStatsResponseDto[total]" is missing from JSON.'); + assert(json[r'total'] != null, 'Required key "AssetStatsResponseDto[total]" has a null value in JSON.'); + assert(json.containsKey(r'videos'), 'Required key "AssetStatsResponseDto[videos]" is missing from JSON.'); + assert(json[r'videos'] != null, 'Required key "AssetStatsResponseDto[videos]" has a null value in JSON.'); + return true; + }()); + return AssetStatsResponseDto( images: mapValueOfType(json, r'images')!, total: mapValueOfType(json, r'total')!, diff --git a/mobile/openapi/lib/model/auth_status_response_dto.dart b/mobile/openapi/lib/model/auth_status_response_dto.dart index 23b9d40525..c6336fc609 100644 --- a/mobile/openapi/lib/model/auth_status_response_dto.dart +++ b/mobile/openapi/lib/model/auth_status_response_dto.dart @@ -13,11 +13,11 @@ part of openapi.api; class AuthStatusResponseDto { /// Returns a new [AuthStatusResponseDto] instance. AuthStatusResponseDto({ - this.expiresAt, + this.expiresAt = const Optional.absent(), required this.isElevated, required this.password, required this.pinCode, - this.pinExpiresAt, + this.pinExpiresAt = const Optional.absent(), }); /// Session expiration date @@ -27,7 +27,7 @@ class AuthStatusResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? expiresAt; + Optional expiresAt; /// Is elevated session bool isElevated; @@ -45,7 +45,7 @@ class AuthStatusResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? pinExpiresAt; + Optional pinExpiresAt; @override bool operator ==(Object other) => identical(this, other) || other is AuthStatusResponseDto && @@ -69,18 +69,16 @@ class AuthStatusResponseDto { Map toJson() { final json = {}; - if (this.expiresAt != null) { - json[r'expiresAt'] = this.expiresAt; - } else { - // json[r'expiresAt'] = null; + if (this.expiresAt.isPresent) { + final value = this.expiresAt.value; + json[r'expiresAt'] = value; } json[r'isElevated'] = this.isElevated; json[r'password'] = this.password; json[r'pinCode'] = this.pinCode; - if (this.pinExpiresAt != null) { - json[r'pinExpiresAt'] = this.pinExpiresAt; - } else { - // json[r'pinExpiresAt'] = null; + if (this.pinExpiresAt.isPresent) { + final value = this.pinExpiresAt.value; + json[r'pinExpiresAt'] = value; } return json; } @@ -93,12 +91,25 @@ class AuthStatusResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'isElevated'), 'Required key "AuthStatusResponseDto[isElevated]" is missing from JSON.'); + assert(json[r'isElevated'] != null, 'Required key "AuthStatusResponseDto[isElevated]" has a null value in JSON.'); + assert(json.containsKey(r'password'), 'Required key "AuthStatusResponseDto[password]" is missing from JSON.'); + assert(json[r'password'] != null, 'Required key "AuthStatusResponseDto[password]" has a null value in JSON.'); + assert(json.containsKey(r'pinCode'), 'Required key "AuthStatusResponseDto[pinCode]" is missing from JSON.'); + assert(json[r'pinCode'] != null, 'Required key "AuthStatusResponseDto[pinCode]" has a null value in JSON.'); + return true; + }()); + return AuthStatusResponseDto( - expiresAt: mapValueOfType(json, r'expiresAt'), + expiresAt: json.containsKey(r'expiresAt') ? Optional.present(mapValueOfType(json, r'expiresAt')) : const Optional.absent(), isElevated: mapValueOfType(json, r'isElevated')!, password: mapValueOfType(json, r'password')!, pinCode: mapValueOfType(json, r'pinCode')!, - pinExpiresAt: mapValueOfType(json, r'pinExpiresAt'), + pinExpiresAt: json.containsKey(r'pinExpiresAt') ? Optional.present(mapValueOfType(json, r'pinExpiresAt')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/avatar_update.dart b/mobile/openapi/lib/model/avatar_update.dart index 875eb138a8..1ad7cf8c44 100644 --- a/mobile/openapi/lib/model/avatar_update.dart +++ b/mobile/openapi/lib/model/avatar_update.dart @@ -13,7 +13,7 @@ part of openapi.api; class AvatarUpdate { /// Returns a new [AvatarUpdate] instance. AvatarUpdate({ - this.color, + this.color = const Optional.absent(), }); /// @@ -22,7 +22,7 @@ class AvatarUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - UserAvatarColor? color; + Optional color; @override bool operator ==(Object other) => identical(this, other) || other is AvatarUpdate && @@ -38,10 +38,9 @@ class AvatarUpdate { Map toJson() { final json = {}; - if (this.color != null) { - json[r'color'] = this.color; - } else { - // json[r'color'] = null; + if (this.color.isPresent) { + final value = this.color.value; + json[r'color'] = value; } return json; } @@ -54,8 +53,15 @@ class AvatarUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return AvatarUpdate( - color: UserAvatarColor.fromJson(json[r'color']), + color: json.containsKey(r'color') ? Optional.present(UserAvatarColor.fromJson(json[r'color'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/bulk_id_response_dto.dart b/mobile/openapi/lib/model/bulk_id_response_dto.dart index bb3f1d8856..938af7faac 100644 --- a/mobile/openapi/lib/model/bulk_id_response_dto.dart +++ b/mobile/openapi/lib/model/bulk_id_response_dto.dart @@ -13,8 +13,8 @@ part of openapi.api; class BulkIdResponseDto { /// Returns a new [BulkIdResponseDto] instance. BulkIdResponseDto({ - this.error, - this.errorMessage, + this.error = const Optional.absent(), + this.errorMessage = const Optional.absent(), required this.id, required this.success, }); @@ -25,7 +25,7 @@ class BulkIdResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - BulkIdErrorReason? error; + Optional error; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -33,7 +33,7 @@ class BulkIdResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? errorMessage; + Optional errorMessage; /// ID String id; @@ -61,15 +61,13 @@ class BulkIdResponseDto { Map toJson() { final json = {}; - if (this.error != null) { - json[r'error'] = this.error; - } else { - // json[r'error'] = null; + if (this.error.isPresent) { + final value = this.error.value; + json[r'error'] = value; } - if (this.errorMessage != null) { - json[r'errorMessage'] = this.errorMessage; - } else { - // json[r'errorMessage'] = null; + if (this.errorMessage.isPresent) { + final value = this.errorMessage.value; + json[r'errorMessage'] = value; } json[r'id'] = this.id; json[r'success'] = this.success; @@ -84,9 +82,20 @@ class BulkIdResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'id'), 'Required key "BulkIdResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "BulkIdResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'success'), 'Required key "BulkIdResponseDto[success]" is missing from JSON.'); + assert(json[r'success'] != null, 'Required key "BulkIdResponseDto[success]" has a null value in JSON.'); + return true; + }()); + return BulkIdResponseDto( - error: BulkIdErrorReason.fromJson(json[r'error']), - errorMessage: mapValueOfType(json, r'errorMessage'), + error: json.containsKey(r'error') ? Optional.present(BulkIdErrorReason.fromJson(json[r'error'])) : const Optional.absent(), + errorMessage: json.containsKey(r'errorMessage') ? Optional.present(mapValueOfType(json, r'errorMessage')) : const Optional.absent(), id: mapValueOfType(json, r'id')!, success: mapValueOfType(json, r'success')!, ); diff --git a/mobile/openapi/lib/model/bulk_ids_dto.dart b/mobile/openapi/lib/model/bulk_ids_dto.dart index 7e7864a285..1fb41ebea0 100644 --- a/mobile/openapi/lib/model/bulk_ids_dto.dart +++ b/mobile/openapi/lib/model/bulk_ids_dto.dart @@ -45,6 +45,15 @@ class BulkIdsDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'ids'), 'Required key "BulkIdsDto[ids]" is missing from JSON.'); + assert(json[r'ids'] != null, 'Required key "BulkIdsDto[ids]" has a null value in JSON.'); + return true; + }()); + return BulkIdsDto( ids: json[r'ids'] is Iterable ? (json[r'ids'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/cast_response.dart b/mobile/openapi/lib/model/cast_response.dart index 796138b0bf..94c7f74986 100644 --- a/mobile/openapi/lib/model/cast_response.dart +++ b/mobile/openapi/lib/model/cast_response.dart @@ -45,6 +45,15 @@ class CastResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'gCastEnabled'), 'Required key "CastResponse[gCastEnabled]" is missing from JSON.'); + assert(json[r'gCastEnabled'] != null, 'Required key "CastResponse[gCastEnabled]" has a null value in JSON.'); + return true; + }()); + return CastResponse( gCastEnabled: mapValueOfType(json, r'gCastEnabled')!, ); diff --git a/mobile/openapi/lib/model/cast_update.dart b/mobile/openapi/lib/model/cast_update.dart index 8dbf80f171..1755300308 100644 --- a/mobile/openapi/lib/model/cast_update.dart +++ b/mobile/openapi/lib/model/cast_update.dart @@ -13,7 +13,7 @@ part of openapi.api; class CastUpdate { /// Returns a new [CastUpdate] instance. CastUpdate({ - this.gCastEnabled, + this.gCastEnabled = const Optional.absent(), }); /// Whether Google Cast is enabled @@ -23,7 +23,7 @@ class CastUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? gCastEnabled; + Optional gCastEnabled; @override bool operator ==(Object other) => identical(this, other) || other is CastUpdate && @@ -39,10 +39,9 @@ class CastUpdate { Map toJson() { final json = {}; - if (this.gCastEnabled != null) { - json[r'gCastEnabled'] = this.gCastEnabled; - } else { - // json[r'gCastEnabled'] = null; + if (this.gCastEnabled.isPresent) { + final value = this.gCastEnabled.value; + json[r'gCastEnabled'] = value; } return json; } @@ -55,8 +54,15 @@ class CastUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return CastUpdate( - gCastEnabled: mapValueOfType(json, r'gCastEnabled'), + gCastEnabled: json.containsKey(r'gCastEnabled') ? Optional.present(mapValueOfType(json, r'gCastEnabled')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/change_password_dto.dart b/mobile/openapi/lib/model/change_password_dto.dart index 3dd6e437da..0b9c86a92a 100644 --- a/mobile/openapi/lib/model/change_password_dto.dart +++ b/mobile/openapi/lib/model/change_password_dto.dart @@ -13,13 +13,13 @@ part of openapi.api; class ChangePasswordDto { /// Returns a new [ChangePasswordDto] instance. ChangePasswordDto({ - this.invalidateSessions = false, + this.invalidateSessions = const Optional.present(false), required this.newPassword, required this.password, }); /// Invalidate all other sessions - bool invalidateSessions; + Optional invalidateSessions; /// New password (min 8 characters) String newPassword; @@ -45,7 +45,10 @@ class ChangePasswordDto { Map toJson() { final json = {}; - json[r'invalidateSessions'] = this.invalidateSessions; + if (this.invalidateSessions.isPresent) { + final value = this.invalidateSessions.value; + json[r'invalidateSessions'] = value; + } json[r'newPassword'] = this.newPassword; json[r'password'] = this.password; return json; @@ -59,8 +62,19 @@ class ChangePasswordDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'newPassword'), 'Required key "ChangePasswordDto[newPassword]" is missing from JSON.'); + assert(json[r'newPassword'] != null, 'Required key "ChangePasswordDto[newPassword]" has a null value in JSON.'); + assert(json.containsKey(r'password'), 'Required key "ChangePasswordDto[password]" is missing from JSON.'); + assert(json[r'password'] != null, 'Required key "ChangePasswordDto[password]" has a null value in JSON.'); + return true; + }()); + return ChangePasswordDto( - invalidateSessions: mapValueOfType(json, r'invalidateSessions') ?? false, + invalidateSessions: json.containsKey(r'invalidateSessions') ? Optional.present(mapValueOfType(json, r'invalidateSessions')) : const Optional.absent(), newPassword: mapValueOfType(json, r'newPassword')!, password: mapValueOfType(json, r'password')!, ); diff --git a/mobile/openapi/lib/model/clip_config.dart b/mobile/openapi/lib/model/clip_config.dart index 915e4975ed..2e29ec9e57 100644 --- a/mobile/openapi/lib/model/clip_config.dart +++ b/mobile/openapi/lib/model/clip_config.dart @@ -52,6 +52,17 @@ class CLIPConfig { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "CLIPConfig[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "CLIPConfig[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'modelName'), 'Required key "CLIPConfig[modelName]" is missing from JSON.'); + assert(json[r'modelName'] != null, 'Required key "CLIPConfig[modelName]" has a null value in JSON.'); + return true; + }()); + return CLIPConfig( enabled: mapValueOfType(json, r'enabled')!, modelName: mapValueOfType(json, r'modelName')!, diff --git a/mobile/openapi/lib/model/contributor_count_response_dto.dart b/mobile/openapi/lib/model/contributor_count_response_dto.dart index af5b2cbf68..2e0bfd0df8 100644 --- a/mobile/openapi/lib/model/contributor_count_response_dto.dart +++ b/mobile/openapi/lib/model/contributor_count_response_dto.dart @@ -55,6 +55,17 @@ class ContributorCountResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetCount'), 'Required key "ContributorCountResponseDto[assetCount]" is missing from JSON.'); + assert(json[r'assetCount'] != null, 'Required key "ContributorCountResponseDto[assetCount]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "ContributorCountResponseDto[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "ContributorCountResponseDto[userId]" has a null value in JSON.'); + return true; + }()); + return ContributorCountResponseDto( assetCount: mapValueOfType(json, r'assetCount')!, userId: mapValueOfType(json, r'userId')!, diff --git a/mobile/openapi/lib/model/create_album_dto.dart b/mobile/openapi/lib/model/create_album_dto.dart index 183a41c772..bb2d6507b3 100644 --- a/mobile/openapi/lib/model/create_album_dto.dart +++ b/mobile/openapi/lib/model/create_album_dto.dart @@ -14,19 +14,19 @@ class CreateAlbumDto { /// Returns a new [CreateAlbumDto] instance. CreateAlbumDto({ required this.albumName, - this.albumUsers = const [], - this.assetIds = const [], - this.description, + this.albumUsers = const Optional.present(const []), + this.assetIds = const Optional.present(const []), + this.description = const Optional.absent(), }); /// Album name String albumName; /// Album users - List albumUsers; + Optional?> albumUsers; /// Initial asset IDs - List assetIds; + Optional?> assetIds; /// Album description /// @@ -35,7 +35,7 @@ class CreateAlbumDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? description; + Optional description; @override bool operator ==(Object other) => identical(this, other) || other is CreateAlbumDto && @@ -58,12 +58,17 @@ class CreateAlbumDto { Map toJson() { final json = {}; json[r'albumName'] = this.albumName; - json[r'albumUsers'] = this.albumUsers; - json[r'assetIds'] = this.assetIds; - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.albumUsers.isPresent) { + final value = this.albumUsers.value; + json[r'albumUsers'] = value; + } + if (this.assetIds.isPresent) { + final value = this.assetIds.value; + json[r'assetIds'] = value; + } + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } return json; } @@ -76,13 +81,22 @@ class CreateAlbumDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumName'), 'Required key "CreateAlbumDto[albumName]" is missing from JSON.'); + assert(json[r'albumName'] != null, 'Required key "CreateAlbumDto[albumName]" has a null value in JSON.'); + return true; + }()); + return CreateAlbumDto( albumName: mapValueOfType(json, r'albumName')!, - albumUsers: AlbumUserCreateDto.listFromJson(json[r'albumUsers']), - assetIds: json[r'assetIds'] is Iterable + albumUsers: json.containsKey(r'albumUsers') ? Optional.present(AlbumUserCreateDto.listFromJson(json[r'albumUsers'])) : const Optional.absent(), + assetIds: json.containsKey(r'assetIds') ? Optional.present(json[r'assetIds'] is Iterable ? (json[r'assetIds'] as Iterable).cast().toList(growable: false) - : const [], - description: mapValueOfType(json, r'description'), + : const []) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/create_library_dto.dart b/mobile/openapi/lib/model/create_library_dto.dart index ba12c62d76..0804e4c3f7 100644 --- a/mobile/openapi/lib/model/create_library_dto.dart +++ b/mobile/openapi/lib/model/create_library_dto.dart @@ -13,17 +13,17 @@ part of openapi.api; class CreateLibraryDto { /// Returns a new [CreateLibraryDto] instance. CreateLibraryDto({ - this.exclusionPatterns = const [], - this.importPaths = const [], - this.name, + this.exclusionPatterns = const Optional.present(const []), + this.importPaths = const Optional.present(const []), + this.name = const Optional.absent(), required this.ownerId, }); /// Exclusion patterns (max 128) - List exclusionPatterns; + Optional?> exclusionPatterns; /// Import paths (max 128) - List importPaths; + Optional?> importPaths; /// Library name /// @@ -32,7 +32,7 @@ class CreateLibraryDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? name; + Optional name; /// Owner user ID String ownerId; @@ -57,12 +57,17 @@ class CreateLibraryDto { Map toJson() { final json = {}; - json[r'exclusionPatterns'] = this.exclusionPatterns; - json[r'importPaths'] = this.importPaths; - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.exclusionPatterns.isPresent) { + final value = this.exclusionPatterns.value; + json[r'exclusionPatterns'] = value; + } + if (this.importPaths.isPresent) { + final value = this.importPaths.value; + json[r'importPaths'] = value; + } + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; } json[r'ownerId'] = this.ownerId; return json; @@ -76,14 +81,23 @@ class CreateLibraryDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'ownerId'), 'Required key "CreateLibraryDto[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "CreateLibraryDto[ownerId]" has a null value in JSON.'); + return true; + }()); + return CreateLibraryDto( - exclusionPatterns: json[r'exclusionPatterns'] is Iterable + exclusionPatterns: json.containsKey(r'exclusionPatterns') ? Optional.present(json[r'exclusionPatterns'] is Iterable ? (json[r'exclusionPatterns'] as Iterable).cast().toList(growable: false) - : const [], - importPaths: json[r'importPaths'] is Iterable + : const []) : const Optional.absent(), + importPaths: json.containsKey(r'importPaths') ? Optional.present(json[r'importPaths'] is Iterable ? (json[r'importPaths'] as Iterable).cast().toList(growable: false) - : const [], - name: mapValueOfType(json, r'name'), + : const []) : const Optional.absent(), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), ownerId: mapValueOfType(json, r'ownerId')!, ); } diff --git a/mobile/openapi/lib/model/create_profile_image_response_dto.dart b/mobile/openapi/lib/model/create_profile_image_response_dto.dart index c6ec0d94a0..3bab8c140b 100644 --- a/mobile/openapi/lib/model/create_profile_image_response_dto.dart +++ b/mobile/openapi/lib/model/create_profile_image_response_dto.dart @@ -61,6 +61,19 @@ class CreateProfileImageResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'profileChangedAt'), 'Required key "CreateProfileImageResponseDto[profileChangedAt]" is missing from JSON.'); + assert(json[r'profileChangedAt'] != null, 'Required key "CreateProfileImageResponseDto[profileChangedAt]" has a null value in JSON.'); + assert(json.containsKey(r'profileImagePath'), 'Required key "CreateProfileImageResponseDto[profileImagePath]" is missing from JSON.'); + assert(json[r'profileImagePath'] != null, 'Required key "CreateProfileImageResponseDto[profileImagePath]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "CreateProfileImageResponseDto[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "CreateProfileImageResponseDto[userId]" has a null value in JSON.'); + return true; + }()); + return CreateProfileImageResponseDto( profileChangedAt: mapDateTime(json, r'profileChangedAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, profileImagePath: mapValueOfType(json, r'profileImagePath')!, diff --git a/mobile/openapi/lib/model/crop_parameters.dart b/mobile/openapi/lib/model/crop_parameters.dart index d19c23562b..5c3b0537a8 100644 --- a/mobile/openapi/lib/model/crop_parameters.dart +++ b/mobile/openapi/lib/model/crop_parameters.dart @@ -78,6 +78,21 @@ class CropParameters { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'height'), 'Required key "CropParameters[height]" is missing from JSON.'); + assert(json[r'height'] != null, 'Required key "CropParameters[height]" has a null value in JSON.'); + assert(json.containsKey(r'width'), 'Required key "CropParameters[width]" is missing from JSON.'); + assert(json[r'width'] != null, 'Required key "CropParameters[width]" has a null value in JSON.'); + assert(json.containsKey(r'x'), 'Required key "CropParameters[x]" is missing from JSON.'); + assert(json[r'x'] != null, 'Required key "CropParameters[x]" has a null value in JSON.'); + assert(json.containsKey(r'y'), 'Required key "CropParameters[y]" is missing from JSON.'); + assert(json[r'y'] != null, 'Required key "CropParameters[y]" has a null value in JSON.'); + return true; + }()); + return CropParameters( height: mapValueOfType(json, r'height')!, width: mapValueOfType(json, r'width')!, diff --git a/mobile/openapi/lib/model/database_backup_config.dart b/mobile/openapi/lib/model/database_backup_config.dart index 4beb32849e..0d261c3409 100644 --- a/mobile/openapi/lib/model/database_backup_config.dart +++ b/mobile/openapi/lib/model/database_backup_config.dart @@ -62,6 +62,19 @@ class DatabaseBackupConfig { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'cronExpression'), 'Required key "DatabaseBackupConfig[cronExpression]" is missing from JSON.'); + assert(json[r'cronExpression'] != null, 'Required key "DatabaseBackupConfig[cronExpression]" has a null value in JSON.'); + assert(json.containsKey(r'enabled'), 'Required key "DatabaseBackupConfig[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "DatabaseBackupConfig[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'keepLastAmount'), 'Required key "DatabaseBackupConfig[keepLastAmount]" is missing from JSON.'); + assert(json[r'keepLastAmount'] != null, 'Required key "DatabaseBackupConfig[keepLastAmount]" has a null value in JSON.'); + return true; + }()); + return DatabaseBackupConfig( cronExpression: mapValueOfType(json, r'cronExpression')!, enabled: mapValueOfType(json, r'enabled')!, diff --git a/mobile/openapi/lib/model/database_backup_delete_dto.dart b/mobile/openapi/lib/model/database_backup_delete_dto.dart index c336270b84..270ede8816 100644 --- a/mobile/openapi/lib/model/database_backup_delete_dto.dart +++ b/mobile/openapi/lib/model/database_backup_delete_dto.dart @@ -45,6 +45,15 @@ class DatabaseBackupDeleteDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'backups'), 'Required key "DatabaseBackupDeleteDto[backups]" is missing from JSON.'); + assert(json[r'backups'] != null, 'Required key "DatabaseBackupDeleteDto[backups]" has a null value in JSON.'); + return true; + }()); + return DatabaseBackupDeleteDto( backups: json[r'backups'] is Iterable ? (json[r'backups'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/database_backup_dto.dart b/mobile/openapi/lib/model/database_backup_dto.dart index 5a2590da40..31fc0a0651 100644 --- a/mobile/openapi/lib/model/database_backup_dto.dart +++ b/mobile/openapi/lib/model/database_backup_dto.dart @@ -62,6 +62,19 @@ class DatabaseBackupDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'filename'), 'Required key "DatabaseBackupDto[filename]" is missing from JSON.'); + assert(json[r'filename'] != null, 'Required key "DatabaseBackupDto[filename]" has a null value in JSON.'); + assert(json.containsKey(r'filesize'), 'Required key "DatabaseBackupDto[filesize]" is missing from JSON.'); + assert(json[r'filesize'] != null, 'Required key "DatabaseBackupDto[filesize]" has a null value in JSON.'); + assert(json.containsKey(r'timezone'), 'Required key "DatabaseBackupDto[timezone]" is missing from JSON.'); + assert(json[r'timezone'] != null, 'Required key "DatabaseBackupDto[timezone]" has a null value in JSON.'); + return true; + }()); + return DatabaseBackupDto( filename: mapValueOfType(json, r'filename')!, filesize: mapValueOfType(json, r'filesize')!, diff --git a/mobile/openapi/lib/model/database_backup_list_response_dto.dart b/mobile/openapi/lib/model/database_backup_list_response_dto.dart index de7bf78d5a..c7b59cbfcc 100644 --- a/mobile/openapi/lib/model/database_backup_list_response_dto.dart +++ b/mobile/openapi/lib/model/database_backup_list_response_dto.dart @@ -45,6 +45,15 @@ class DatabaseBackupListResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'backups'), 'Required key "DatabaseBackupListResponseDto[backups]" is missing from JSON.'); + assert(json[r'backups'] != null, 'Required key "DatabaseBackupListResponseDto[backups]" has a null value in JSON.'); + return true; + }()); + return DatabaseBackupListResponseDto( backups: DatabaseBackupDto.listFromJson(json[r'backups']), ); diff --git a/mobile/openapi/lib/model/download_archive_dto.dart b/mobile/openapi/lib/model/download_archive_dto.dart index 20e8527f18..c5d777d7e2 100644 --- a/mobile/openapi/lib/model/download_archive_dto.dart +++ b/mobile/openapi/lib/model/download_archive_dto.dart @@ -14,7 +14,7 @@ class DownloadArchiveDto { /// Returns a new [DownloadArchiveDto] instance. DownloadArchiveDto({ this.assetIds = const [], - this.edited, + this.edited = const Optional.absent(), }); /// Asset IDs @@ -27,7 +27,7 @@ class DownloadArchiveDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? edited; + Optional edited; @override bool operator ==(Object other) => identical(this, other) || other is DownloadArchiveDto && @@ -46,10 +46,9 @@ class DownloadArchiveDto { Map toJson() { final json = {}; json[r'assetIds'] = this.assetIds; - if (this.edited != null) { - json[r'edited'] = this.edited; - } else { - // json[r'edited'] = null; + if (this.edited.isPresent) { + final value = this.edited.value; + json[r'edited'] = value; } return json; } @@ -62,11 +61,20 @@ class DownloadArchiveDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetIds'), 'Required key "DownloadArchiveDto[assetIds]" is missing from JSON.'); + assert(json[r'assetIds'] != null, 'Required key "DownloadArchiveDto[assetIds]" has a null value in JSON.'); + return true; + }()); + return DownloadArchiveDto( assetIds: json[r'assetIds'] is Iterable ? (json[r'assetIds'] as Iterable).cast().toList(growable: false) : const [], - edited: mapValueOfType(json, r'edited'), + edited: json.containsKey(r'edited') ? Optional.present(mapValueOfType(json, r'edited')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/download_archive_info.dart b/mobile/openapi/lib/model/download_archive_info.dart index dcb1258457..6498a06b84 100644 --- a/mobile/openapi/lib/model/download_archive_info.dart +++ b/mobile/openapi/lib/model/download_archive_info.dart @@ -55,6 +55,17 @@ class DownloadArchiveInfo { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetIds'), 'Required key "DownloadArchiveInfo[assetIds]" is missing from JSON.'); + assert(json[r'assetIds'] != null, 'Required key "DownloadArchiveInfo[assetIds]" has a null value in JSON.'); + assert(json.containsKey(r'size'), 'Required key "DownloadArchiveInfo[size]" is missing from JSON.'); + assert(json[r'size'] != null, 'Required key "DownloadArchiveInfo[size]" has a null value in JSON.'); + return true; + }()); + return DownloadArchiveInfo( assetIds: json[r'assetIds'] is Iterable ? (json[r'assetIds'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/download_info_dto.dart b/mobile/openapi/lib/model/download_info_dto.dart index 8a0cebd945..d3b6e76754 100644 --- a/mobile/openapi/lib/model/download_info_dto.dart +++ b/mobile/openapi/lib/model/download_info_dto.dart @@ -13,10 +13,10 @@ part of openapi.api; class DownloadInfoDto { /// Returns a new [DownloadInfoDto] instance. DownloadInfoDto({ - this.albumId, - this.archiveSize, - this.assetIds = const [], - this.userId, + this.albumId = const Optional.absent(), + this.archiveSize = const Optional.absent(), + this.assetIds = const Optional.present(const []), + this.userId = const Optional.absent(), }); /// Album ID to download @@ -26,7 +26,7 @@ class DownloadInfoDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? albumId; + Optional albumId; /// Archive size limit in bytes /// @@ -38,10 +38,10 @@ class DownloadInfoDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? archiveSize; + Optional archiveSize; /// Asset IDs to download - List assetIds; + Optional?> assetIds; /// User ID to download assets from /// @@ -50,7 +50,7 @@ class DownloadInfoDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? userId; + Optional userId; @override bool operator ==(Object other) => identical(this, other) || other is DownloadInfoDto && @@ -72,21 +72,21 @@ class DownloadInfoDto { Map toJson() { final json = {}; - if (this.albumId != null) { - json[r'albumId'] = this.albumId; - } else { - // json[r'albumId'] = null; + if (this.albumId.isPresent) { + final value = this.albumId.value; + json[r'albumId'] = value; } - if (this.archiveSize != null) { - json[r'archiveSize'] = this.archiveSize; - } else { - // json[r'archiveSize'] = null; + if (this.archiveSize.isPresent) { + final value = this.archiveSize.value; + json[r'archiveSize'] = value; } - json[r'assetIds'] = this.assetIds; - if (this.userId != null) { - json[r'userId'] = this.userId; - } else { - // json[r'userId'] = null; + if (this.assetIds.isPresent) { + final value = this.assetIds.value; + json[r'assetIds'] = value; + } + if (this.userId.isPresent) { + final value = this.userId.value; + json[r'userId'] = value; } return json; } @@ -99,13 +99,20 @@ class DownloadInfoDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return DownloadInfoDto( - albumId: mapValueOfType(json, r'albumId'), - archiveSize: mapValueOfType(json, r'archiveSize'), - assetIds: json[r'assetIds'] is Iterable + albumId: json.containsKey(r'albumId') ? Optional.present(mapValueOfType(json, r'albumId')) : const Optional.absent(), + archiveSize: json.containsKey(r'archiveSize') ? Optional.present(json[r'archiveSize'] == null ? null : int.parse('${json[r'archiveSize']}')) : const Optional.absent(), + assetIds: json.containsKey(r'assetIds') ? Optional.present(json[r'assetIds'] is Iterable ? (json[r'assetIds'] as Iterable).cast().toList(growable: false) - : const [], - userId: mapValueOfType(json, r'userId'), + : const []) : const Optional.absent(), + userId: json.containsKey(r'userId') ? Optional.present(mapValueOfType(json, r'userId')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/download_response.dart b/mobile/openapi/lib/model/download_response.dart index bc1d7b4047..a3ad12fa79 100644 --- a/mobile/openapi/lib/model/download_response.dart +++ b/mobile/openapi/lib/model/download_response.dart @@ -55,6 +55,17 @@ class DownloadResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'archiveSize'), 'Required key "DownloadResponse[archiveSize]" is missing from JSON.'); + assert(json[r'archiveSize'] != null, 'Required key "DownloadResponse[archiveSize]" has a null value in JSON.'); + assert(json.containsKey(r'includeEmbeddedVideos'), 'Required key "DownloadResponse[includeEmbeddedVideos]" is missing from JSON.'); + assert(json[r'includeEmbeddedVideos'] != null, 'Required key "DownloadResponse[includeEmbeddedVideos]" has a null value in JSON.'); + return true; + }()); + return DownloadResponse( archiveSize: mapValueOfType(json, r'archiveSize')!, includeEmbeddedVideos: mapValueOfType(json, r'includeEmbeddedVideos')!, diff --git a/mobile/openapi/lib/model/download_response_dto.dart b/mobile/openapi/lib/model/download_response_dto.dart index bfe32307fa..24601d21c5 100644 --- a/mobile/openapi/lib/model/download_response_dto.dart +++ b/mobile/openapi/lib/model/download_response_dto.dart @@ -55,6 +55,17 @@ class DownloadResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'archives'), 'Required key "DownloadResponseDto[archives]" is missing from JSON.'); + assert(json[r'archives'] != null, 'Required key "DownloadResponseDto[archives]" has a null value in JSON.'); + assert(json.containsKey(r'totalSize'), 'Required key "DownloadResponseDto[totalSize]" is missing from JSON.'); + assert(json[r'totalSize'] != null, 'Required key "DownloadResponseDto[totalSize]" has a null value in JSON.'); + return true; + }()); + return DownloadResponseDto( archives: DownloadArchiveInfo.listFromJson(json[r'archives']), totalSize: mapValueOfType(json, r'totalSize')!, diff --git a/mobile/openapi/lib/model/download_update.dart b/mobile/openapi/lib/model/download_update.dart index c5feb9df43..f73b129f2a 100644 --- a/mobile/openapi/lib/model/download_update.dart +++ b/mobile/openapi/lib/model/download_update.dart @@ -13,8 +13,8 @@ part of openapi.api; class DownloadUpdate { /// Returns a new [DownloadUpdate] instance. DownloadUpdate({ - this.archiveSize, - this.includeEmbeddedVideos, + this.archiveSize = const Optional.absent(), + this.includeEmbeddedVideos = const Optional.absent(), }); /// Maximum archive size in bytes @@ -27,7 +27,7 @@ class DownloadUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? archiveSize; + Optional archiveSize; /// Whether to include embedded videos in downloads /// @@ -36,7 +36,7 @@ class DownloadUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? includeEmbeddedVideos; + Optional includeEmbeddedVideos; @override bool operator ==(Object other) => identical(this, other) || other is DownloadUpdate && @@ -54,15 +54,13 @@ class DownloadUpdate { Map toJson() { final json = {}; - if (this.archiveSize != null) { - json[r'archiveSize'] = this.archiveSize; - } else { - // json[r'archiveSize'] = null; + if (this.archiveSize.isPresent) { + final value = this.archiveSize.value; + json[r'archiveSize'] = value; } - if (this.includeEmbeddedVideos != null) { - json[r'includeEmbeddedVideos'] = this.includeEmbeddedVideos; - } else { - // json[r'includeEmbeddedVideos'] = null; + if (this.includeEmbeddedVideos.isPresent) { + final value = this.includeEmbeddedVideos.value; + json[r'includeEmbeddedVideos'] = value; } return json; } @@ -75,9 +73,16 @@ class DownloadUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return DownloadUpdate( - archiveSize: mapValueOfType(json, r'archiveSize'), - includeEmbeddedVideos: mapValueOfType(json, r'includeEmbeddedVideos'), + archiveSize: json.containsKey(r'archiveSize') ? Optional.present(json[r'archiveSize'] == null ? null : int.parse('${json[r'archiveSize']}')) : const Optional.absent(), + includeEmbeddedVideos: json.containsKey(r'includeEmbeddedVideos') ? Optional.present(mapValueOfType(json, r'includeEmbeddedVideos')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/duplicate_detection_config.dart b/mobile/openapi/lib/model/duplicate_detection_config.dart index 43233826ef..9e6c4205a0 100644 --- a/mobile/openapi/lib/model/duplicate_detection_config.dart +++ b/mobile/openapi/lib/model/duplicate_detection_config.dart @@ -55,9 +55,20 @@ class DuplicateDetectionConfig { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "DuplicateDetectionConfig[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "DuplicateDetectionConfig[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'maxDistance'), 'Required key "DuplicateDetectionConfig[maxDistance]" is missing from JSON.'); + assert(json[r'maxDistance'] != null, 'Required key "DuplicateDetectionConfig[maxDistance]" has a null value in JSON.'); + return true; + }()); + return DuplicateDetectionConfig( enabled: mapValueOfType(json, r'enabled')!, - maxDistance: (mapValueOfType(json, r'maxDistance')!).toDouble(), + maxDistance: mapValueOfType(json, r'maxDistance')!, ); } return null; diff --git a/mobile/openapi/lib/model/duplicate_resolve_dto.dart b/mobile/openapi/lib/model/duplicate_resolve_dto.dart index 3466d3a620..2278b38926 100644 --- a/mobile/openapi/lib/model/duplicate_resolve_dto.dart +++ b/mobile/openapi/lib/model/duplicate_resolve_dto.dart @@ -45,6 +45,15 @@ class DuplicateResolveDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'groups'), 'Required key "DuplicateResolveDto[groups]" is missing from JSON.'); + assert(json[r'groups'] != null, 'Required key "DuplicateResolveDto[groups]" has a null value in JSON.'); + return true; + }()); + return DuplicateResolveDto( groups: DuplicateResolveGroupDto.listFromJson(json[r'groups']), ); diff --git a/mobile/openapi/lib/model/duplicate_resolve_group_dto.dart b/mobile/openapi/lib/model/duplicate_resolve_group_dto.dart index 94ca53eb7d..6a64082725 100644 --- a/mobile/openapi/lib/model/duplicate_resolve_group_dto.dart +++ b/mobile/openapi/lib/model/duplicate_resolve_group_dto.dart @@ -58,6 +58,19 @@ class DuplicateResolveGroupDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'duplicateId'), 'Required key "DuplicateResolveGroupDto[duplicateId]" is missing from JSON.'); + assert(json[r'duplicateId'] != null, 'Required key "DuplicateResolveGroupDto[duplicateId]" has a null value in JSON.'); + assert(json.containsKey(r'keepAssetIds'), 'Required key "DuplicateResolveGroupDto[keepAssetIds]" is missing from JSON.'); + assert(json[r'keepAssetIds'] != null, 'Required key "DuplicateResolveGroupDto[keepAssetIds]" has a null value in JSON.'); + assert(json.containsKey(r'trashAssetIds'), 'Required key "DuplicateResolveGroupDto[trashAssetIds]" is missing from JSON.'); + assert(json[r'trashAssetIds'] != null, 'Required key "DuplicateResolveGroupDto[trashAssetIds]" has a null value in JSON.'); + return true; + }()); + return DuplicateResolveGroupDto( duplicateId: mapValueOfType(json, r'duplicateId')!, keepAssetIds: json[r'keepAssetIds'] is Iterable diff --git a/mobile/openapi/lib/model/duplicate_response_dto.dart b/mobile/openapi/lib/model/duplicate_response_dto.dart index f0ddbb4fdd..66bd404708 100644 --- a/mobile/openapi/lib/model/duplicate_response_dto.dart +++ b/mobile/openapi/lib/model/duplicate_response_dto.dart @@ -59,6 +59,19 @@ class DuplicateResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assets'), 'Required key "DuplicateResponseDto[assets]" is missing from JSON.'); + assert(json[r'assets'] != null, 'Required key "DuplicateResponseDto[assets]" has a null value in JSON.'); + assert(json.containsKey(r'duplicateId'), 'Required key "DuplicateResponseDto[duplicateId]" is missing from JSON.'); + assert(json[r'duplicateId'] != null, 'Required key "DuplicateResponseDto[duplicateId]" has a null value in JSON.'); + assert(json.containsKey(r'suggestedKeepAssetIds'), 'Required key "DuplicateResponseDto[suggestedKeepAssetIds]" is missing from JSON.'); + assert(json[r'suggestedKeepAssetIds'] != null, 'Required key "DuplicateResponseDto[suggestedKeepAssetIds]" has a null value in JSON.'); + return true; + }()); + return DuplicateResponseDto( assets: AssetResponseDto.listFromJson(json[r'assets']), duplicateId: mapValueOfType(json, r'duplicateId')!, diff --git a/mobile/openapi/lib/model/email_notifications_response.dart b/mobile/openapi/lib/model/email_notifications_response.dart index 08a3d580c6..814c9f5863 100644 --- a/mobile/openapi/lib/model/email_notifications_response.dart +++ b/mobile/openapi/lib/model/email_notifications_response.dart @@ -59,6 +59,19 @@ class EmailNotificationsResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumInvite'), 'Required key "EmailNotificationsResponse[albumInvite]" is missing from JSON.'); + assert(json[r'albumInvite'] != null, 'Required key "EmailNotificationsResponse[albumInvite]" has a null value in JSON.'); + assert(json.containsKey(r'albumUpdate'), 'Required key "EmailNotificationsResponse[albumUpdate]" is missing from JSON.'); + assert(json[r'albumUpdate'] != null, 'Required key "EmailNotificationsResponse[albumUpdate]" has a null value in JSON.'); + assert(json.containsKey(r'enabled'), 'Required key "EmailNotificationsResponse[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "EmailNotificationsResponse[enabled]" has a null value in JSON.'); + return true; + }()); + return EmailNotificationsResponse( albumInvite: mapValueOfType(json, r'albumInvite')!, albumUpdate: mapValueOfType(json, r'albumUpdate')!, diff --git a/mobile/openapi/lib/model/email_notifications_update.dart b/mobile/openapi/lib/model/email_notifications_update.dart index e158e45598..0e9eaddbcd 100644 --- a/mobile/openapi/lib/model/email_notifications_update.dart +++ b/mobile/openapi/lib/model/email_notifications_update.dart @@ -13,9 +13,9 @@ part of openapi.api; class EmailNotificationsUpdate { /// Returns a new [EmailNotificationsUpdate] instance. EmailNotificationsUpdate({ - this.albumInvite, - this.albumUpdate, - this.enabled, + this.albumInvite = const Optional.absent(), + this.albumUpdate = const Optional.absent(), + this.enabled = const Optional.absent(), }); /// Whether to receive email notifications for album invites @@ -25,7 +25,7 @@ class EmailNotificationsUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? albumInvite; + Optional albumInvite; /// Whether to receive email notifications for album updates /// @@ -34,7 +34,7 @@ class EmailNotificationsUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? albumUpdate; + Optional albumUpdate; /// Whether email notifications are enabled /// @@ -43,7 +43,7 @@ class EmailNotificationsUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; @override bool operator ==(Object other) => identical(this, other) || other is EmailNotificationsUpdate && @@ -63,20 +63,17 @@ class EmailNotificationsUpdate { Map toJson() { final json = {}; - if (this.albumInvite != null) { - json[r'albumInvite'] = this.albumInvite; - } else { - // json[r'albumInvite'] = null; + if (this.albumInvite.isPresent) { + final value = this.albumInvite.value; + json[r'albumInvite'] = value; } - if (this.albumUpdate != null) { - json[r'albumUpdate'] = this.albumUpdate; - } else { - // json[r'albumUpdate'] = null; + if (this.albumUpdate.isPresent) { + final value = this.albumUpdate.value; + json[r'albumUpdate'] = value; } - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } return json; } @@ -89,10 +86,17 @@ class EmailNotificationsUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return EmailNotificationsUpdate( - albumInvite: mapValueOfType(json, r'albumInvite'), - albumUpdate: mapValueOfType(json, r'albumUpdate'), - enabled: mapValueOfType(json, r'enabled'), + albumInvite: json.containsKey(r'albumInvite') ? Optional.present(mapValueOfType(json, r'albumInvite')) : const Optional.absent(), + albumUpdate: json.containsKey(r'albumUpdate') ? Optional.present(mapValueOfType(json, r'albumUpdate')) : const Optional.absent(), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/exif_response_dto.dart b/mobile/openapi/lib/model/exif_response_dto.dart index ed5ffd2958..2b19897c1a 100644 --- a/mobile/openapi/lib/model/exif_response_dto.dart +++ b/mobile/openapi/lib/model/exif_response_dto.dart @@ -13,110 +13,110 @@ part of openapi.api; class ExifResponseDto { /// Returns a new [ExifResponseDto] instance. ExifResponseDto({ - this.city, - this.country, - this.dateTimeOriginal, - this.description, - this.exifImageHeight, - this.exifImageWidth, - this.exposureTime, - this.fNumber, - this.fileSizeInByte, - this.focalLength, - this.iso, - this.latitude, - this.lensModel, - this.longitude, - this.make, - this.model, - this.modifyDate, - this.orientation, - this.projectionType, - this.rating, - this.state, - this.timeZone, + this.city = const Optional.absent(), + this.country = const Optional.absent(), + this.dateTimeOriginal = const Optional.absent(), + this.description = const Optional.absent(), + this.exifImageHeight = const Optional.absent(), + this.exifImageWidth = const Optional.absent(), + this.exposureTime = const Optional.absent(), + this.fNumber = const Optional.absent(), + this.fileSizeInByte = const Optional.absent(), + this.focalLength = const Optional.absent(), + this.iso = const Optional.absent(), + this.latitude = const Optional.absent(), + this.lensModel = const Optional.absent(), + this.longitude = const Optional.absent(), + this.make = const Optional.absent(), + this.model = const Optional.absent(), + this.modifyDate = const Optional.absent(), + this.orientation = const Optional.absent(), + this.projectionType = const Optional.absent(), + this.rating = const Optional.absent(), + this.state = const Optional.absent(), + this.timeZone = const Optional.absent(), }); /// City name - String? city; + Optional city; /// Country name - String? country; + Optional country; /// Original date/time - DateTime? dateTimeOriginal; + Optional dateTimeOriginal; /// Image description - String? description; + Optional description; /// Image height in pixels /// /// Minimum value: 0 /// Maximum value: 9007199254740991 - int? exifImageHeight; + Optional exifImageHeight; /// Image width in pixels /// /// Minimum value: 0 /// Maximum value: 9007199254740991 - int? exifImageWidth; + Optional exifImageWidth; /// Exposure time - String? exposureTime; + Optional exposureTime; /// F-number (aperture) - num? fNumber; + Optional fNumber; /// File size in bytes /// /// Minimum value: 0 /// Maximum value: 9007199254740991 - int? fileSizeInByte; + Optional fileSizeInByte; /// Focal length in mm - num? focalLength; + Optional focalLength; /// ISO sensitivity /// /// Minimum value: -9007199254740991 /// Maximum value: 9007199254740991 - int? iso; + Optional iso; /// GPS latitude - num? latitude; + Optional latitude; /// Lens model - String? lensModel; + Optional lensModel; /// GPS longitude - num? longitude; + Optional longitude; /// Camera make - String? make; + Optional make; /// Camera model - String? model; + Optional model; /// Modification date/time - DateTime? modifyDate; + Optional modifyDate; /// Image orientation - String? orientation; + Optional orientation; /// Projection type - String? projectionType; + Optional projectionType; /// Rating /// /// Minimum value: -9007199254740991 /// Maximum value: 9007199254740991 - int? rating; + Optional rating; /// State/province name - String? state; + Optional state; /// Time zone - String? timeZone; + Optional timeZone; @override bool operator ==(Object other) => identical(this, other) || other is ExifResponseDto && @@ -174,115 +174,93 @@ class ExifResponseDto { Map toJson() { final json = {}; - if (this.city != null) { - json[r'city'] = this.city; - } else { - // json[r'city'] = null; + if (this.city.isPresent) { + final value = this.city.value; + json[r'city'] = value; } - if (this.country != null) { - json[r'country'] = this.country; - } else { - // json[r'country'] = null; + if (this.country.isPresent) { + final value = this.country.value; + json[r'country'] = value; } - if (this.dateTimeOriginal != null) { - json[r'dateTimeOriginal'] = this.dateTimeOriginal!.toUtc().toIso8601String(); - } else { - // json[r'dateTimeOriginal'] = null; + if (this.dateTimeOriginal.isPresent) { + final value = this.dateTimeOriginal.value; + json[r'dateTimeOriginal'] = value == null ? null : value.toUtc().toIso8601String(); } - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - if (this.exifImageHeight != null) { - json[r'exifImageHeight'] = this.exifImageHeight; - } else { - // json[r'exifImageHeight'] = null; + if (this.exifImageHeight.isPresent) { + final value = this.exifImageHeight.value; + json[r'exifImageHeight'] = value; } - if (this.exifImageWidth != null) { - json[r'exifImageWidth'] = this.exifImageWidth; - } else { - // json[r'exifImageWidth'] = null; + if (this.exifImageWidth.isPresent) { + final value = this.exifImageWidth.value; + json[r'exifImageWidth'] = value; } - if (this.exposureTime != null) { - json[r'exposureTime'] = this.exposureTime; - } else { - // json[r'exposureTime'] = null; + if (this.exposureTime.isPresent) { + final value = this.exposureTime.value; + json[r'exposureTime'] = value; } - if (this.fNumber != null) { - json[r'fNumber'] = this.fNumber; - } else { - // json[r'fNumber'] = null; + if (this.fNumber.isPresent) { + final value = this.fNumber.value; + json[r'fNumber'] = value; } - if (this.fileSizeInByte != null) { - json[r'fileSizeInByte'] = this.fileSizeInByte; - } else { - // json[r'fileSizeInByte'] = null; + if (this.fileSizeInByte.isPresent) { + final value = this.fileSizeInByte.value; + json[r'fileSizeInByte'] = value; } - if (this.focalLength != null) { - json[r'focalLength'] = this.focalLength; - } else { - // json[r'focalLength'] = null; + if (this.focalLength.isPresent) { + final value = this.focalLength.value; + json[r'focalLength'] = value; } - if (this.iso != null) { - json[r'iso'] = this.iso; - } else { - // json[r'iso'] = null; + if (this.iso.isPresent) { + final value = this.iso.value; + json[r'iso'] = value; } - if (this.latitude != null) { - json[r'latitude'] = this.latitude; - } else { - // json[r'latitude'] = null; + if (this.latitude.isPresent) { + final value = this.latitude.value; + json[r'latitude'] = value; } - if (this.lensModel != null) { - json[r'lensModel'] = this.lensModel; - } else { - // json[r'lensModel'] = null; + if (this.lensModel.isPresent) { + final value = this.lensModel.value; + json[r'lensModel'] = value; } - if (this.longitude != null) { - json[r'longitude'] = this.longitude; - } else { - // json[r'longitude'] = null; + if (this.longitude.isPresent) { + final value = this.longitude.value; + json[r'longitude'] = value; } - if (this.make != null) { - json[r'make'] = this.make; - } else { - // json[r'make'] = null; + if (this.make.isPresent) { + final value = this.make.value; + json[r'make'] = value; } - if (this.model != null) { - json[r'model'] = this.model; - } else { - // json[r'model'] = null; + if (this.model.isPresent) { + final value = this.model.value; + json[r'model'] = value; } - if (this.modifyDate != null) { - json[r'modifyDate'] = this.modifyDate!.toUtc().toIso8601String(); - } else { - // json[r'modifyDate'] = null; + if (this.modifyDate.isPresent) { + final value = this.modifyDate.value; + json[r'modifyDate'] = value == null ? null : value.toUtc().toIso8601String(); } - if (this.orientation != null) { - json[r'orientation'] = this.orientation; - } else { - // json[r'orientation'] = null; + if (this.orientation.isPresent) { + final value = this.orientation.value; + json[r'orientation'] = value; } - if (this.projectionType != null) { - json[r'projectionType'] = this.projectionType; - } else { - // json[r'projectionType'] = null; + if (this.projectionType.isPresent) { + final value = this.projectionType.value; + json[r'projectionType'] = value; } - if (this.rating != null) { - json[r'rating'] = this.rating; - } else { - // json[r'rating'] = null; + if (this.rating.isPresent) { + final value = this.rating.value; + json[r'rating'] = value; } - if (this.state != null) { - json[r'state'] = this.state; - } else { - // json[r'state'] = null; + if (this.state.isPresent) { + final value = this.state.value; + json[r'state'] = value; } - if (this.timeZone != null) { - json[r'timeZone'] = this.timeZone; - } else { - // json[r'timeZone'] = null; + if (this.timeZone.isPresent) { + final value = this.timeZone.value; + json[r'timeZone'] = value; } return json; } @@ -295,37 +273,36 @@ class ExifResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return ExifResponseDto( - city: mapValueOfType(json, r'city'), - country: mapValueOfType(json, r'country'), - dateTimeOriginal: mapDateTime(json, r'dateTimeOriginal', r''), - description: mapValueOfType(json, r'description'), - exifImageHeight: mapValueOfType(json, r'exifImageHeight'), - exifImageWidth: mapValueOfType(json, r'exifImageWidth'), - exposureTime: mapValueOfType(json, r'exposureTime'), - fNumber: json[r'fNumber'] == null - ? null - : num.parse('${json[r'fNumber']}'), - fileSizeInByte: mapValueOfType(json, r'fileSizeInByte'), - focalLength: json[r'focalLength'] == null - ? null - : num.parse('${json[r'focalLength']}'), - iso: mapValueOfType(json, r'iso'), - latitude: json[r'latitude'] == null - ? null - : num.parse('${json[r'latitude']}'), - lensModel: mapValueOfType(json, r'lensModel'), - longitude: json[r'longitude'] == null - ? null - : num.parse('${json[r'longitude']}'), - make: mapValueOfType(json, r'make'), - model: mapValueOfType(json, r'model'), - modifyDate: mapDateTime(json, r'modifyDate', r''), - orientation: mapValueOfType(json, r'orientation'), - projectionType: mapValueOfType(json, r'projectionType'), - rating: mapValueOfType(json, r'rating'), - state: mapValueOfType(json, r'state'), - timeZone: mapValueOfType(json, r'timeZone'), + city: json.containsKey(r'city') ? Optional.present(mapValueOfType(json, r'city')) : const Optional.absent(), + country: json.containsKey(r'country') ? Optional.present(mapValueOfType(json, r'country')) : const Optional.absent(), + dateTimeOriginal: json.containsKey(r'dateTimeOriginal') ? Optional.present(mapDateTime(json, r'dateTimeOriginal', r'')) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + exifImageHeight: json.containsKey(r'exifImageHeight') ? Optional.present(json[r'exifImageHeight'] == null ? null : int.parse('${json[r'exifImageHeight']}')) : const Optional.absent(), + exifImageWidth: json.containsKey(r'exifImageWidth') ? Optional.present(json[r'exifImageWidth'] == null ? null : int.parse('${json[r'exifImageWidth']}')) : const Optional.absent(), + exposureTime: json.containsKey(r'exposureTime') ? Optional.present(mapValueOfType(json, r'exposureTime')) : const Optional.absent(), + fNumber: json.containsKey(r'fNumber') ? Optional.present(json[r'fNumber'] == null ? null : num.parse('${json[r'fNumber']}')) : const Optional.absent(), + fileSizeInByte: json.containsKey(r'fileSizeInByte') ? Optional.present(json[r'fileSizeInByte'] == null ? null : int.parse('${json[r'fileSizeInByte']}')) : const Optional.absent(), + focalLength: json.containsKey(r'focalLength') ? Optional.present(json[r'focalLength'] == null ? null : num.parse('${json[r'focalLength']}')) : const Optional.absent(), + iso: json.containsKey(r'iso') ? Optional.present(json[r'iso'] == null ? null : int.parse('${json[r'iso']}')) : const Optional.absent(), + latitude: json.containsKey(r'latitude') ? Optional.present(json[r'latitude'] == null ? null : num.parse('${json[r'latitude']}')) : const Optional.absent(), + lensModel: json.containsKey(r'lensModel') ? Optional.present(mapValueOfType(json, r'lensModel')) : const Optional.absent(), + longitude: json.containsKey(r'longitude') ? Optional.present(json[r'longitude'] == null ? null : num.parse('${json[r'longitude']}')) : const Optional.absent(), + make: json.containsKey(r'make') ? Optional.present(mapValueOfType(json, r'make')) : const Optional.absent(), + model: json.containsKey(r'model') ? Optional.present(mapValueOfType(json, r'model')) : const Optional.absent(), + modifyDate: json.containsKey(r'modifyDate') ? Optional.present(mapDateTime(json, r'modifyDate', r'')) : const Optional.absent(), + orientation: json.containsKey(r'orientation') ? Optional.present(mapValueOfType(json, r'orientation')) : const Optional.absent(), + projectionType: json.containsKey(r'projectionType') ? Optional.present(mapValueOfType(json, r'projectionType')) : const Optional.absent(), + rating: json.containsKey(r'rating') ? Optional.present(json[r'rating'] == null ? null : int.parse('${json[r'rating']}')) : const Optional.absent(), + state: json.containsKey(r'state') ? Optional.present(mapValueOfType(json, r'state')) : const Optional.absent(), + timeZone: json.containsKey(r'timeZone') ? Optional.present(mapValueOfType(json, r'timeZone')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/face_dto.dart b/mobile/openapi/lib/model/face_dto.dart index ec5f5c8a6c..95f5914559 100644 --- a/mobile/openapi/lib/model/face_dto.dart +++ b/mobile/openapi/lib/model/face_dto.dart @@ -45,6 +45,15 @@ class FaceDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'id'), 'Required key "FaceDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "FaceDto[id]" has a null value in JSON.'); + return true; + }()); + return FaceDto( id: mapValueOfType(json, r'id')!, ); diff --git a/mobile/openapi/lib/model/facial_recognition_config.dart b/mobile/openapi/lib/model/facial_recognition_config.dart index 66cb542ccf..26115cb948 100644 --- a/mobile/openapi/lib/model/facial_recognition_config.dart +++ b/mobile/openapi/lib/model/facial_recognition_config.dart @@ -82,11 +82,28 @@ class FacialRecognitionConfig { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "FacialRecognitionConfig[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "FacialRecognitionConfig[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'maxDistance'), 'Required key "FacialRecognitionConfig[maxDistance]" is missing from JSON.'); + assert(json[r'maxDistance'] != null, 'Required key "FacialRecognitionConfig[maxDistance]" has a null value in JSON.'); + assert(json.containsKey(r'minFaces'), 'Required key "FacialRecognitionConfig[minFaces]" is missing from JSON.'); + assert(json[r'minFaces'] != null, 'Required key "FacialRecognitionConfig[minFaces]" has a null value in JSON.'); + assert(json.containsKey(r'minScore'), 'Required key "FacialRecognitionConfig[minScore]" is missing from JSON.'); + assert(json[r'minScore'] != null, 'Required key "FacialRecognitionConfig[minScore]" has a null value in JSON.'); + assert(json.containsKey(r'modelName'), 'Required key "FacialRecognitionConfig[modelName]" is missing from JSON.'); + assert(json[r'modelName'] != null, 'Required key "FacialRecognitionConfig[modelName]" has a null value in JSON.'); + return true; + }()); + return FacialRecognitionConfig( enabled: mapValueOfType(json, r'enabled')!, - maxDistance: (mapValueOfType(json, r'maxDistance')!).toDouble(), + maxDistance: mapValueOfType(json, r'maxDistance')!, minFaces: mapValueOfType(json, r'minFaces')!, - minScore: (mapValueOfType(json, r'minScore')!).toDouble(), + minScore: mapValueOfType(json, r'minScore')!, modelName: mapValueOfType(json, r'modelName')!, ); } diff --git a/mobile/openapi/lib/model/folders_response.dart b/mobile/openapi/lib/model/folders_response.dart index 873404c786..c68096eb4b 100644 --- a/mobile/openapi/lib/model/folders_response.dart +++ b/mobile/openapi/lib/model/folders_response.dart @@ -52,6 +52,17 @@ class FoldersResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "FoldersResponse[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "FoldersResponse[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'sidebarWeb'), 'Required key "FoldersResponse[sidebarWeb]" is missing from JSON.'); + assert(json[r'sidebarWeb'] != null, 'Required key "FoldersResponse[sidebarWeb]" has a null value in JSON.'); + return true; + }()); + return FoldersResponse( enabled: mapValueOfType(json, r'enabled')!, sidebarWeb: mapValueOfType(json, r'sidebarWeb')!, diff --git a/mobile/openapi/lib/model/folders_update.dart b/mobile/openapi/lib/model/folders_update.dart index edd58014d4..314907be65 100644 --- a/mobile/openapi/lib/model/folders_update.dart +++ b/mobile/openapi/lib/model/folders_update.dart @@ -13,8 +13,8 @@ part of openapi.api; class FoldersUpdate { /// Returns a new [FoldersUpdate] instance. FoldersUpdate({ - this.enabled, - this.sidebarWeb, + this.enabled = const Optional.absent(), + this.sidebarWeb = const Optional.absent(), }); /// Whether folders are enabled @@ -24,7 +24,7 @@ class FoldersUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; /// Whether folders appear in web sidebar /// @@ -33,7 +33,7 @@ class FoldersUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? sidebarWeb; + Optional sidebarWeb; @override bool operator ==(Object other) => identical(this, other) || other is FoldersUpdate && @@ -51,15 +51,13 @@ class FoldersUpdate { Map toJson() { final json = {}; - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } - if (this.sidebarWeb != null) { - json[r'sidebarWeb'] = this.sidebarWeb; - } else { - // json[r'sidebarWeb'] = null; + if (this.sidebarWeb.isPresent) { + final value = this.sidebarWeb.value; + json[r'sidebarWeb'] = value; } return json; } @@ -72,9 +70,16 @@ class FoldersUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return FoldersUpdate( - enabled: mapValueOfType(json, r'enabled'), - sidebarWeb: mapValueOfType(json, r'sidebarWeb'), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), + sidebarWeb: json.containsKey(r'sidebarWeb') ? Optional.present(mapValueOfType(json, r'sidebarWeb')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/job_create_dto.dart b/mobile/openapi/lib/model/job_create_dto.dart index fe6743cba0..26e0328162 100644 --- a/mobile/openapi/lib/model/job_create_dto.dart +++ b/mobile/openapi/lib/model/job_create_dto.dart @@ -44,6 +44,15 @@ class JobCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'name'), 'Required key "JobCreateDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "JobCreateDto[name]" has a null value in JSON.'); + return true; + }()); + return JobCreateDto( name: ManualJobName.fromJson(json[r'name'])!, ); diff --git a/mobile/openapi/lib/model/job_settings_dto.dart b/mobile/openapi/lib/model/job_settings_dto.dart index 98fe3d3536..cff046c0b2 100644 --- a/mobile/openapi/lib/model/job_settings_dto.dart +++ b/mobile/openapi/lib/model/job_settings_dto.dart @@ -48,6 +48,15 @@ class JobSettingsDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'concurrency'), 'Required key "JobSettingsDto[concurrency]" is missing from JSON.'); + assert(json[r'concurrency'] != null, 'Required key "JobSettingsDto[concurrency]" has a null value in JSON.'); + return true; + }()); + return JobSettingsDto( concurrency: mapValueOfType(json, r'concurrency')!, ); diff --git a/mobile/openapi/lib/model/library_response_dto.dart b/mobile/openapi/lib/model/library_response_dto.dart index 88ebceae24..2dfd29641b 100644 --- a/mobile/openapi/lib/model/library_response_dto.dart +++ b/mobile/openapi/lib/model/library_response_dto.dart @@ -98,7 +98,7 @@ class LibraryResponseDto { ? this.refreshedAt!.millisecondsSinceEpoch : this.refreshedAt!.toUtc().toIso8601String(); } else { - // json[r'refreshedAt'] = null; + json[r'refreshedAt'] = null; } json[r'updatedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.updatedAt.millisecondsSinceEpoch @@ -114,6 +114,30 @@ class LibraryResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetCount'), 'Required key "LibraryResponseDto[assetCount]" is missing from JSON.'); + assert(json[r'assetCount'] != null, 'Required key "LibraryResponseDto[assetCount]" has a null value in JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "LibraryResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "LibraryResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'exclusionPatterns'), 'Required key "LibraryResponseDto[exclusionPatterns]" is missing from JSON.'); + assert(json[r'exclusionPatterns'] != null, 'Required key "LibraryResponseDto[exclusionPatterns]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "LibraryResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "LibraryResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'importPaths'), 'Required key "LibraryResponseDto[importPaths]" is missing from JSON.'); + assert(json[r'importPaths'] != null, 'Required key "LibraryResponseDto[importPaths]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "LibraryResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "LibraryResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'ownerId'), 'Required key "LibraryResponseDto[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "LibraryResponseDto[ownerId]" has a null value in JSON.'); + assert(json.containsKey(r'refreshedAt'), 'Required key "LibraryResponseDto[refreshedAt]" is missing from JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "LibraryResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "LibraryResponseDto[updatedAt]" has a null value in JSON.'); + return true; + }()); + return LibraryResponseDto( assetCount: mapValueOfType(json, r'assetCount')!, createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, diff --git a/mobile/openapi/lib/model/library_stats_response_dto.dart b/mobile/openapi/lib/model/library_stats_response_dto.dart index 55adbc2b49..802529a2ca 100644 --- a/mobile/openapi/lib/model/library_stats_response_dto.dart +++ b/mobile/openapi/lib/model/library_stats_response_dto.dart @@ -78,6 +78,21 @@ class LibraryStatsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'photos'), 'Required key "LibraryStatsResponseDto[photos]" is missing from JSON.'); + assert(json[r'photos'] != null, 'Required key "LibraryStatsResponseDto[photos]" has a null value in JSON.'); + assert(json.containsKey(r'total'), 'Required key "LibraryStatsResponseDto[total]" is missing from JSON.'); + assert(json[r'total'] != null, 'Required key "LibraryStatsResponseDto[total]" has a null value in JSON.'); + assert(json.containsKey(r'usage'), 'Required key "LibraryStatsResponseDto[usage]" is missing from JSON.'); + assert(json[r'usage'] != null, 'Required key "LibraryStatsResponseDto[usage]" has a null value in JSON.'); + assert(json.containsKey(r'videos'), 'Required key "LibraryStatsResponseDto[videos]" is missing from JSON.'); + assert(json[r'videos'] != null, 'Required key "LibraryStatsResponseDto[videos]" has a null value in JSON.'); + return true; + }()); + return LibraryStatsResponseDto( photos: mapValueOfType(json, r'photos')!, total: mapValueOfType(json, r'total')!, diff --git a/mobile/openapi/lib/model/license_key_dto.dart b/mobile/openapi/lib/model/license_key_dto.dart index d1818a2a43..2dfadecb1e 100644 --- a/mobile/openapi/lib/model/license_key_dto.dart +++ b/mobile/openapi/lib/model/license_key_dto.dart @@ -52,6 +52,17 @@ class LicenseKeyDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'activationKey'), 'Required key "LicenseKeyDto[activationKey]" is missing from JSON.'); + assert(json[r'activationKey'] != null, 'Required key "LicenseKeyDto[activationKey]" has a null value in JSON.'); + assert(json.containsKey(r'licenseKey'), 'Required key "LicenseKeyDto[licenseKey]" is missing from JSON.'); + assert(json[r'licenseKey'] != null, 'Required key "LicenseKeyDto[licenseKey]" has a null value in JSON.'); + return true; + }()); + return LicenseKeyDto( activationKey: mapValueOfType(json, r'activationKey')!, licenseKey: mapValueOfType(json, r'licenseKey')!, diff --git a/mobile/openapi/lib/model/login_credential_dto.dart b/mobile/openapi/lib/model/login_credential_dto.dart index 1fdfdc3d40..82101e67b8 100644 --- a/mobile/openapi/lib/model/login_credential_dto.dart +++ b/mobile/openapi/lib/model/login_credential_dto.dart @@ -52,6 +52,17 @@ class LoginCredentialDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'email'), 'Required key "LoginCredentialDto[email]" is missing from JSON.'); + assert(json[r'email'] != null, 'Required key "LoginCredentialDto[email]" has a null value in JSON.'); + assert(json.containsKey(r'password'), 'Required key "LoginCredentialDto[password]" is missing from JSON.'); + assert(json[r'password'] != null, 'Required key "LoginCredentialDto[password]" has a null value in JSON.'); + return true; + }()); + return LoginCredentialDto( email: mapValueOfType(json, r'email')!, password: mapValueOfType(json, r'password')!, diff --git a/mobile/openapi/lib/model/login_response_dto.dart b/mobile/openapi/lib/model/login_response_dto.dart index c6938c2393..d797e5e046 100644 --- a/mobile/openapi/lib/model/login_response_dto.dart +++ b/mobile/openapi/lib/model/login_response_dto.dart @@ -94,6 +94,29 @@ class LoginResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'accessToken'), 'Required key "LoginResponseDto[accessToken]" is missing from JSON.'); + assert(json[r'accessToken'] != null, 'Required key "LoginResponseDto[accessToken]" has a null value in JSON.'); + assert(json.containsKey(r'isAdmin'), 'Required key "LoginResponseDto[isAdmin]" is missing from JSON.'); + assert(json[r'isAdmin'] != null, 'Required key "LoginResponseDto[isAdmin]" has a null value in JSON.'); + assert(json.containsKey(r'isOnboarded'), 'Required key "LoginResponseDto[isOnboarded]" is missing from JSON.'); + assert(json[r'isOnboarded'] != null, 'Required key "LoginResponseDto[isOnboarded]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "LoginResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "LoginResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'profileImagePath'), 'Required key "LoginResponseDto[profileImagePath]" is missing from JSON.'); + assert(json[r'profileImagePath'] != null, 'Required key "LoginResponseDto[profileImagePath]" has a null value in JSON.'); + assert(json.containsKey(r'shouldChangePassword'), 'Required key "LoginResponseDto[shouldChangePassword]" is missing from JSON.'); + assert(json[r'shouldChangePassword'] != null, 'Required key "LoginResponseDto[shouldChangePassword]" has a null value in JSON.'); + assert(json.containsKey(r'userEmail'), 'Required key "LoginResponseDto[userEmail]" is missing from JSON.'); + assert(json[r'userEmail'] != null, 'Required key "LoginResponseDto[userEmail]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "LoginResponseDto[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "LoginResponseDto[userId]" has a null value in JSON.'); + return true; + }()); + return LoginResponseDto( accessToken: mapValueOfType(json, r'accessToken')!, isAdmin: mapValueOfType(json, r'isAdmin')!, diff --git a/mobile/openapi/lib/model/logout_response_dto.dart b/mobile/openapi/lib/model/logout_response_dto.dart index b50db2c28b..d916ae94ea 100644 --- a/mobile/openapi/lib/model/logout_response_dto.dart +++ b/mobile/openapi/lib/model/logout_response_dto.dart @@ -52,6 +52,17 @@ class LogoutResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'redirectUri'), 'Required key "LogoutResponseDto[redirectUri]" is missing from JSON.'); + assert(json[r'redirectUri'] != null, 'Required key "LogoutResponseDto[redirectUri]" has a null value in JSON.'); + assert(json.containsKey(r'successful'), 'Required key "LogoutResponseDto[successful]" is missing from JSON.'); + assert(json[r'successful'] != null, 'Required key "LogoutResponseDto[successful]" has a null value in JSON.'); + return true; + }()); + return LogoutResponseDto( redirectUri: mapValueOfType(json, r'redirectUri')!, successful: mapValueOfType(json, r'successful')!, diff --git a/mobile/openapi/lib/model/machine_learning_availability_checks_dto.dart b/mobile/openapi/lib/model/machine_learning_availability_checks_dto.dart index a9b8608ac1..2669d07491 100644 --- a/mobile/openapi/lib/model/machine_learning_availability_checks_dto.dart +++ b/mobile/openapi/lib/model/machine_learning_availability_checks_dto.dart @@ -61,6 +61,19 @@ class MachineLearningAvailabilityChecksDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "MachineLearningAvailabilityChecksDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "MachineLearningAvailabilityChecksDto[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'interval'), 'Required key "MachineLearningAvailabilityChecksDto[interval]" is missing from JSON.'); + assert(json[r'interval'] != null, 'Required key "MachineLearningAvailabilityChecksDto[interval]" has a null value in JSON.'); + assert(json.containsKey(r'timeout'), 'Required key "MachineLearningAvailabilityChecksDto[timeout]" is missing from JSON.'); + assert(json[r'timeout'] != null, 'Required key "MachineLearningAvailabilityChecksDto[timeout]" has a null value in JSON.'); + return true; + }()); + return MachineLearningAvailabilityChecksDto( enabled: mapValueOfType(json, r'enabled')!, interval: mapValueOfType(json, r'interval')!, diff --git a/mobile/openapi/lib/model/maintenance_auth_dto.dart b/mobile/openapi/lib/model/maintenance_auth_dto.dart index f9511bdd2b..d458526ca9 100644 --- a/mobile/openapi/lib/model/maintenance_auth_dto.dart +++ b/mobile/openapi/lib/model/maintenance_auth_dto.dart @@ -45,6 +45,15 @@ class MaintenanceAuthDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'username'), 'Required key "MaintenanceAuthDto[username]" is missing from JSON.'); + assert(json[r'username'] != null, 'Required key "MaintenanceAuthDto[username]" has a null value in JSON.'); + return true; + }()); + return MaintenanceAuthDto( username: mapValueOfType(json, r'username')!, ); diff --git a/mobile/openapi/lib/model/maintenance_detect_install_response_dto.dart b/mobile/openapi/lib/model/maintenance_detect_install_response_dto.dart index 1c364a6fdc..672cc3cb93 100644 --- a/mobile/openapi/lib/model/maintenance_detect_install_response_dto.dart +++ b/mobile/openapi/lib/model/maintenance_detect_install_response_dto.dart @@ -44,6 +44,15 @@ class MaintenanceDetectInstallResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'storage'), 'Required key "MaintenanceDetectInstallResponseDto[storage]" is missing from JSON.'); + assert(json[r'storage'] != null, 'Required key "MaintenanceDetectInstallResponseDto[storage]" has a null value in JSON.'); + return true; + }()); + return MaintenanceDetectInstallResponseDto( storage: MaintenanceDetectInstallStorageFolderDto.listFromJson(json[r'storage']), ); diff --git a/mobile/openapi/lib/model/maintenance_detect_install_storage_folder_dto.dart b/mobile/openapi/lib/model/maintenance_detect_install_storage_folder_dto.dart index 83182f53d7..942b5ef9d4 100644 --- a/mobile/openapi/lib/model/maintenance_detect_install_storage_folder_dto.dart +++ b/mobile/openapi/lib/model/maintenance_detect_install_storage_folder_dto.dart @@ -68,6 +68,21 @@ class MaintenanceDetectInstallStorageFolderDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'files'), 'Required key "MaintenanceDetectInstallStorageFolderDto[files]" is missing from JSON.'); + assert(json[r'files'] != null, 'Required key "MaintenanceDetectInstallStorageFolderDto[files]" has a null value in JSON.'); + assert(json.containsKey(r'folder'), 'Required key "MaintenanceDetectInstallStorageFolderDto[folder]" is missing from JSON.'); + assert(json[r'folder'] != null, 'Required key "MaintenanceDetectInstallStorageFolderDto[folder]" has a null value in JSON.'); + assert(json.containsKey(r'readable'), 'Required key "MaintenanceDetectInstallStorageFolderDto[readable]" is missing from JSON.'); + assert(json[r'readable'] != null, 'Required key "MaintenanceDetectInstallStorageFolderDto[readable]" has a null value in JSON.'); + assert(json.containsKey(r'writable'), 'Required key "MaintenanceDetectInstallStorageFolderDto[writable]" is missing from JSON.'); + assert(json[r'writable'] != null, 'Required key "MaintenanceDetectInstallStorageFolderDto[writable]" has a null value in JSON.'); + return true; + }()); + return MaintenanceDetectInstallStorageFolderDto( files: mapValueOfType(json, r'files')!, folder: StorageFolder.fromJson(json[r'folder'])!, diff --git a/mobile/openapi/lib/model/maintenance_login_dto.dart b/mobile/openapi/lib/model/maintenance_login_dto.dart index 64cf6b234b..218f3842b1 100644 --- a/mobile/openapi/lib/model/maintenance_login_dto.dart +++ b/mobile/openapi/lib/model/maintenance_login_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class MaintenanceLoginDto { /// Returns a new [MaintenanceLoginDto] instance. MaintenanceLoginDto({ - this.token, + this.token = const Optional.absent(), }); /// Maintenance token @@ -23,7 +23,7 @@ class MaintenanceLoginDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? token; + Optional token; @override bool operator ==(Object other) => identical(this, other) || other is MaintenanceLoginDto && @@ -39,10 +39,9 @@ class MaintenanceLoginDto { Map toJson() { final json = {}; - if (this.token != null) { - json[r'token'] = this.token; - } else { - // json[r'token'] = null; + if (this.token.isPresent) { + final value = this.token.value; + json[r'token'] = value; } return json; } @@ -55,8 +54,15 @@ class MaintenanceLoginDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return MaintenanceLoginDto( - token: mapValueOfType(json, r'token'), + token: json.containsKey(r'token') ? Optional.present(mapValueOfType(json, r'token')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/maintenance_status_response_dto.dart b/mobile/openapi/lib/model/maintenance_status_response_dto.dart index c1c94acd91..9202233947 100644 --- a/mobile/openapi/lib/model/maintenance_status_response_dto.dart +++ b/mobile/openapi/lib/model/maintenance_status_response_dto.dart @@ -15,9 +15,9 @@ class MaintenanceStatusResponseDto { MaintenanceStatusResponseDto({ required this.action, required this.active, - this.error, - this.progress, - this.task, + this.error = const Optional.absent(), + this.progress = const Optional.absent(), + this.task = const Optional.absent(), }); MaintenanceAction action; @@ -30,7 +30,7 @@ class MaintenanceStatusResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? error; + Optional error; /// Minimum value: -9007199254740991 /// Maximum value: 9007199254740991 @@ -40,7 +40,7 @@ class MaintenanceStatusResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? progress; + Optional progress; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -48,7 +48,7 @@ class MaintenanceStatusResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? task; + Optional task; @override bool operator ==(Object other) => identical(this, other) || other is MaintenanceStatusResponseDto && @@ -74,20 +74,17 @@ class MaintenanceStatusResponseDto { final json = {}; json[r'action'] = this.action; json[r'active'] = this.active; - if (this.error != null) { - json[r'error'] = this.error; - } else { - // json[r'error'] = null; + if (this.error.isPresent) { + final value = this.error.value; + json[r'error'] = value; } - if (this.progress != null) { - json[r'progress'] = this.progress; - } else { - // json[r'progress'] = null; + if (this.progress.isPresent) { + final value = this.progress.value; + json[r'progress'] = value; } - if (this.task != null) { - json[r'task'] = this.task; - } else { - // json[r'task'] = null; + if (this.task.isPresent) { + final value = this.task.value; + json[r'task'] = value; } return json; } @@ -100,12 +97,23 @@ class MaintenanceStatusResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'action'), 'Required key "MaintenanceStatusResponseDto[action]" is missing from JSON.'); + assert(json[r'action'] != null, 'Required key "MaintenanceStatusResponseDto[action]" has a null value in JSON.'); + assert(json.containsKey(r'active'), 'Required key "MaintenanceStatusResponseDto[active]" is missing from JSON.'); + assert(json[r'active'] != null, 'Required key "MaintenanceStatusResponseDto[active]" has a null value in JSON.'); + return true; + }()); + return MaintenanceStatusResponseDto( action: MaintenanceAction.fromJson(json[r'action'])!, active: mapValueOfType(json, r'active')!, - error: mapValueOfType(json, r'error'), - progress: mapValueOfType(json, r'progress'), - task: mapValueOfType(json, r'task'), + error: json.containsKey(r'error') ? Optional.present(mapValueOfType(json, r'error')) : const Optional.absent(), + progress: json.containsKey(r'progress') ? Optional.present(json[r'progress'] == null ? null : int.parse('${json[r'progress']}')) : const Optional.absent(), + task: json.containsKey(r'task') ? Optional.present(mapValueOfType(json, r'task')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/map_marker_response_dto.dart b/mobile/openapi/lib/model/map_marker_response_dto.dart index c0a47a5458..c84de2fb73 100644 --- a/mobile/openapi/lib/model/map_marker_response_dto.dart +++ b/mobile/openapi/lib/model/map_marker_response_dto.dart @@ -66,12 +66,12 @@ class MapMarkerResponseDto { if (this.city != null) { json[r'city'] = this.city; } else { - // json[r'city'] = null; + json[r'city'] = null; } if (this.country != null) { json[r'country'] = this.country; } else { - // json[r'country'] = null; + json[r'country'] = null; } json[r'id'] = this.id; json[r'lat'] = this.lat; @@ -79,7 +79,7 @@ class MapMarkerResponseDto { if (this.state != null) { json[r'state'] = this.state; } else { - // json[r'state'] = null; + json[r'state'] = null; } return json; } @@ -92,12 +92,28 @@ class MapMarkerResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'city'), 'Required key "MapMarkerResponseDto[city]" is missing from JSON.'); + assert(json.containsKey(r'country'), 'Required key "MapMarkerResponseDto[country]" is missing from JSON.'); + assert(json.containsKey(r'id'), 'Required key "MapMarkerResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "MapMarkerResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'lat'), 'Required key "MapMarkerResponseDto[lat]" is missing from JSON.'); + assert(json[r'lat'] != null, 'Required key "MapMarkerResponseDto[lat]" has a null value in JSON.'); + assert(json.containsKey(r'lon'), 'Required key "MapMarkerResponseDto[lon]" is missing from JSON.'); + assert(json[r'lon'] != null, 'Required key "MapMarkerResponseDto[lon]" has a null value in JSON.'); + assert(json.containsKey(r'state'), 'Required key "MapMarkerResponseDto[state]" is missing from JSON.'); + return true; + }()); + return MapMarkerResponseDto( city: mapValueOfType(json, r'city'), country: mapValueOfType(json, r'country'), id: mapValueOfType(json, r'id')!, - lat: (mapValueOfType(json, r'lat')!).toDouble(), - lon: (mapValueOfType(json, r'lon')!).toDouble(), + lat: mapValueOfType(json, r'lat')!, + lon: mapValueOfType(json, r'lon')!, state: mapValueOfType(json, r'state'), ); } diff --git a/mobile/openapi/lib/model/map_reverse_geocode_response_dto.dart b/mobile/openapi/lib/model/map_reverse_geocode_response_dto.dart index 85435485e6..aa515a2e10 100644 --- a/mobile/openapi/lib/model/map_reverse_geocode_response_dto.dart +++ b/mobile/openapi/lib/model/map_reverse_geocode_response_dto.dart @@ -48,17 +48,17 @@ class MapReverseGeocodeResponseDto { if (this.city != null) { json[r'city'] = this.city; } else { - // json[r'city'] = null; + json[r'city'] = null; } if (this.country != null) { json[r'country'] = this.country; } else { - // json[r'country'] = null; + json[r'country'] = null; } if (this.state != null) { json[r'state'] = this.state; } else { - // json[r'state'] = null; + json[r'state'] = null; } return json; } @@ -71,6 +71,16 @@ class MapReverseGeocodeResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'city'), 'Required key "MapReverseGeocodeResponseDto[city]" is missing from JSON.'); + assert(json.containsKey(r'country'), 'Required key "MapReverseGeocodeResponseDto[country]" is missing from JSON.'); + assert(json.containsKey(r'state'), 'Required key "MapReverseGeocodeResponseDto[state]" is missing from JSON.'); + return true; + }()); + return MapReverseGeocodeResponseDto( city: mapValueOfType(json, r'city'), country: mapValueOfType(json, r'country'), diff --git a/mobile/openapi/lib/model/memories_response.dart b/mobile/openapi/lib/model/memories_response.dart index 250e214a60..758c59129b 100644 --- a/mobile/openapi/lib/model/memories_response.dart +++ b/mobile/openapi/lib/model/memories_response.dart @@ -55,6 +55,17 @@ class MemoriesResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'duration'), 'Required key "MemoriesResponse[duration]" is missing from JSON.'); + assert(json[r'duration'] != null, 'Required key "MemoriesResponse[duration]" has a null value in JSON.'); + assert(json.containsKey(r'enabled'), 'Required key "MemoriesResponse[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "MemoriesResponse[enabled]" has a null value in JSON.'); + return true; + }()); + return MemoriesResponse( duration: mapValueOfType(json, r'duration')!, enabled: mapValueOfType(json, r'enabled')!, diff --git a/mobile/openapi/lib/model/memories_update.dart b/mobile/openapi/lib/model/memories_update.dart index ede9910d74..f198f38a44 100644 --- a/mobile/openapi/lib/model/memories_update.dart +++ b/mobile/openapi/lib/model/memories_update.dart @@ -13,8 +13,8 @@ part of openapi.api; class MemoriesUpdate { /// Returns a new [MemoriesUpdate] instance. MemoriesUpdate({ - this.duration, - this.enabled, + this.duration = const Optional.absent(), + this.enabled = const Optional.absent(), }); /// Memory duration in seconds @@ -27,7 +27,7 @@ class MemoriesUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? duration; + Optional duration; /// Whether memories are enabled /// @@ -36,7 +36,7 @@ class MemoriesUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; @override bool operator ==(Object other) => identical(this, other) || other is MemoriesUpdate && @@ -54,15 +54,13 @@ class MemoriesUpdate { Map toJson() { final json = {}; - if (this.duration != null) { - json[r'duration'] = this.duration; - } else { - // json[r'duration'] = null; + if (this.duration.isPresent) { + final value = this.duration.value; + json[r'duration'] = value; } - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } return json; } @@ -75,9 +73,16 @@ class MemoriesUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return MemoriesUpdate( - duration: mapValueOfType(json, r'duration'), - enabled: mapValueOfType(json, r'enabled'), + duration: json.containsKey(r'duration') ? Optional.present(json[r'duration'] == null ? null : int.parse('${json[r'duration']}')) : const Optional.absent(), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/memory_create_dto.dart b/mobile/openapi/lib/model/memory_create_dto.dart index b906f6dd1d..4970013034 100644 --- a/mobile/openapi/lib/model/memory_create_dto.dart +++ b/mobile/openapi/lib/model/memory_create_dto.dart @@ -13,18 +13,18 @@ part of openapi.api; class MemoryCreateDto { /// Returns a new [MemoryCreateDto] instance. MemoryCreateDto({ - this.assetIds = const [], + this.assetIds = const Optional.present(const []), required this.data, - this.hideAt, - this.isSaved, + this.hideAt = const Optional.absent(), + this.isSaved = const Optional.absent(), required this.memoryAt, - this.seenAt, - this.showAt, + this.seenAt = const Optional.absent(), + this.showAt = const Optional.absent(), required this.type, }); /// Asset IDs to associate with memory - List assetIds; + Optional?> assetIds; OnThisDayDto data; @@ -35,7 +35,7 @@ class MemoryCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? hideAt; + Optional hideAt; /// Is memory saved /// @@ -44,7 +44,7 @@ class MemoryCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isSaved; + Optional isSaved; /// Memory date DateTime memoryAt; @@ -56,7 +56,7 @@ class MemoryCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? seenAt; + Optional seenAt; /// Date when memory should be shown /// @@ -65,7 +65,7 @@ class MemoryCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? showAt; + Optional showAt; MemoryType type; @@ -97,36 +97,35 @@ class MemoryCreateDto { Map toJson() { final json = {}; - json[r'assetIds'] = this.assetIds; - json[r'data'] = this.data; - if (this.hideAt != null) { - json[r'hideAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.hideAt!.millisecondsSinceEpoch - : this.hideAt!.toUtc().toIso8601String(); - } else { - // json[r'hideAt'] = null; + if (this.assetIds.isPresent) { + final value = this.assetIds.value; + json[r'assetIds'] = value; } - if (this.isSaved != null) { - json[r'isSaved'] = this.isSaved; - } else { - // json[r'isSaved'] = null; + json[r'data'] = this.data; + if (this.hideAt.isPresent) { + final value = this.hideAt.value; + json[r'hideAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); + } + if (this.isSaved.isPresent) { + final value = this.isSaved.value; + json[r'isSaved'] = value; } json[r'memoryAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.memoryAt.millisecondsSinceEpoch : this.memoryAt.toUtc().toIso8601String(); - if (this.seenAt != null) { - json[r'seenAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.seenAt!.millisecondsSinceEpoch - : this.seenAt!.toUtc().toIso8601String(); - } else { - // json[r'seenAt'] = null; + if (this.seenAt.isPresent) { + final value = this.seenAt.value; + json[r'seenAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.showAt != null) { - json[r'showAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.showAt!.millisecondsSinceEpoch - : this.showAt!.toUtc().toIso8601String(); - } else { - // json[r'showAt'] = null; + if (this.showAt.isPresent) { + final value = this.showAt.value; + json[r'showAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } json[r'type'] = this.type; return json; @@ -140,16 +139,29 @@ class MemoryCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'data'), 'Required key "MemoryCreateDto[data]" is missing from JSON.'); + assert(json[r'data'] != null, 'Required key "MemoryCreateDto[data]" has a null value in JSON.'); + assert(json.containsKey(r'memoryAt'), 'Required key "MemoryCreateDto[memoryAt]" is missing from JSON.'); + assert(json[r'memoryAt'] != null, 'Required key "MemoryCreateDto[memoryAt]" has a null value in JSON.'); + assert(json.containsKey(r'type'), 'Required key "MemoryCreateDto[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "MemoryCreateDto[type]" has a null value in JSON.'); + return true; + }()); + return MemoryCreateDto( - assetIds: json[r'assetIds'] is Iterable + assetIds: json.containsKey(r'assetIds') ? Optional.present(json[r'assetIds'] is Iterable ? (json[r'assetIds'] as Iterable).cast().toList(growable: false) - : const [], + : const []) : const Optional.absent(), data: OnThisDayDto.fromJson(json[r'data'])!, - hideAt: mapDateTime(json, r'hideAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - isSaved: mapValueOfType(json, r'isSaved'), + hideAt: json.containsKey(r'hideAt') ? Optional.present(mapDateTime(json, r'hideAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + isSaved: json.containsKey(r'isSaved') ? Optional.present(mapValueOfType(json, r'isSaved')) : const Optional.absent(), memoryAt: mapDateTime(json, r'memoryAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, - seenAt: mapDateTime(json, r'seenAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - showAt: mapDateTime(json, r'showAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), + seenAt: json.containsKey(r'seenAt') ? Optional.present(mapDateTime(json, r'seenAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + showAt: json.containsKey(r'showAt') ? Optional.present(mapDateTime(json, r'showAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), type: MemoryType.fromJson(json[r'type'])!, ); } diff --git a/mobile/openapi/lib/model/memory_response_dto.dart b/mobile/openapi/lib/model/memory_response_dto.dart index e736667d57..d4b0f0e5c7 100644 --- a/mobile/openapi/lib/model/memory_response_dto.dart +++ b/mobile/openapi/lib/model/memory_response_dto.dart @@ -16,14 +16,14 @@ class MemoryResponseDto { this.assets = const [], required this.createdAt, required this.data, - this.deletedAt, - this.hideAt, + this.deletedAt = const Optional.absent(), + this.hideAt = const Optional.absent(), required this.id, required this.isSaved, required this.memoryAt, required this.ownerId, - this.seenAt, - this.showAt, + this.seenAt = const Optional.absent(), + this.showAt = const Optional.absent(), required this.type, required this.updatedAt, }); @@ -42,7 +42,7 @@ class MemoryResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? deletedAt; + Optional deletedAt; /// Date when memory should be hidden /// @@ -51,7 +51,7 @@ class MemoryResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? hideAt; + Optional hideAt; /// Memory ID String id; @@ -72,7 +72,7 @@ class MemoryResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? seenAt; + Optional seenAt; /// Date when memory should be shown /// @@ -81,7 +81,7 @@ class MemoryResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? showAt; + Optional showAt; MemoryType type; @@ -131,19 +131,17 @@ class MemoryResponseDto { ? this.createdAt.millisecondsSinceEpoch : this.createdAt.toUtc().toIso8601String(); json[r'data'] = this.data; - if (this.deletedAt != null) { - json[r'deletedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.deletedAt!.millisecondsSinceEpoch - : this.deletedAt!.toUtc().toIso8601String(); - } else { - // json[r'deletedAt'] = null; + if (this.deletedAt.isPresent) { + final value = this.deletedAt.value; + json[r'deletedAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.hideAt != null) { - json[r'hideAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.hideAt!.millisecondsSinceEpoch - : this.hideAt!.toUtc().toIso8601String(); - } else { - // json[r'hideAt'] = null; + if (this.hideAt.isPresent) { + final value = this.hideAt.value; + json[r'hideAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } json[r'id'] = this.id; json[r'isSaved'] = this.isSaved; @@ -151,19 +149,17 @@ class MemoryResponseDto { ? this.memoryAt.millisecondsSinceEpoch : this.memoryAt.toUtc().toIso8601String(); json[r'ownerId'] = this.ownerId; - if (this.seenAt != null) { - json[r'seenAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.seenAt!.millisecondsSinceEpoch - : this.seenAt!.toUtc().toIso8601String(); - } else { - // json[r'seenAt'] = null; + if (this.seenAt.isPresent) { + final value = this.seenAt.value; + json[r'seenAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.showAt != null) { - json[r'showAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.showAt!.millisecondsSinceEpoch - : this.showAt!.toUtc().toIso8601String(); - } else { - // json[r'showAt'] = null; + if (this.showAt.isPresent) { + final value = this.showAt.value; + json[r'showAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } json[r'type'] = this.type; json[r'updatedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') @@ -180,18 +176,43 @@ class MemoryResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assets'), 'Required key "MemoryResponseDto[assets]" is missing from JSON.'); + assert(json[r'assets'] != null, 'Required key "MemoryResponseDto[assets]" has a null value in JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "MemoryResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "MemoryResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'data'), 'Required key "MemoryResponseDto[data]" is missing from JSON.'); + assert(json[r'data'] != null, 'Required key "MemoryResponseDto[data]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "MemoryResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "MemoryResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'isSaved'), 'Required key "MemoryResponseDto[isSaved]" is missing from JSON.'); + assert(json[r'isSaved'] != null, 'Required key "MemoryResponseDto[isSaved]" has a null value in JSON.'); + assert(json.containsKey(r'memoryAt'), 'Required key "MemoryResponseDto[memoryAt]" is missing from JSON.'); + assert(json[r'memoryAt'] != null, 'Required key "MemoryResponseDto[memoryAt]" has a null value in JSON.'); + assert(json.containsKey(r'ownerId'), 'Required key "MemoryResponseDto[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "MemoryResponseDto[ownerId]" has a null value in JSON.'); + assert(json.containsKey(r'type'), 'Required key "MemoryResponseDto[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "MemoryResponseDto[type]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "MemoryResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "MemoryResponseDto[updatedAt]" has a null value in JSON.'); + return true; + }()); + return MemoryResponseDto( assets: AssetResponseDto.listFromJson(json[r'assets']), createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, data: OnThisDayDto.fromJson(json[r'data'])!, - deletedAt: mapDateTime(json, r'deletedAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - hideAt: mapDateTime(json, r'hideAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), + deletedAt: json.containsKey(r'deletedAt') ? Optional.present(mapDateTime(json, r'deletedAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + hideAt: json.containsKey(r'hideAt') ? Optional.present(mapDateTime(json, r'hideAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), id: mapValueOfType(json, r'id')!, isSaved: mapValueOfType(json, r'isSaved')!, memoryAt: mapDateTime(json, r'memoryAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, ownerId: mapValueOfType(json, r'ownerId')!, - seenAt: mapDateTime(json, r'seenAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - showAt: mapDateTime(json, r'showAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), + seenAt: json.containsKey(r'seenAt') ? Optional.present(mapDateTime(json, r'seenAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + showAt: json.containsKey(r'showAt') ? Optional.present(mapDateTime(json, r'showAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), type: MemoryType.fromJson(json[r'type'])!, updatedAt: mapDateTime(json, r'updatedAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, ); diff --git a/mobile/openapi/lib/model/memory_statistics_response_dto.dart b/mobile/openapi/lib/model/memory_statistics_response_dto.dart index ae542870d9..a56576e9e9 100644 --- a/mobile/openapi/lib/model/memory_statistics_response_dto.dart +++ b/mobile/openapi/lib/model/memory_statistics_response_dto.dart @@ -48,6 +48,15 @@ class MemoryStatisticsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'total'), 'Required key "MemoryStatisticsResponseDto[total]" is missing from JSON.'); + assert(json[r'total'] != null, 'Required key "MemoryStatisticsResponseDto[total]" has a null value in JSON.'); + return true; + }()); + return MemoryStatisticsResponseDto( total: mapValueOfType(json, r'total')!, ); diff --git a/mobile/openapi/lib/model/memory_update_dto.dart b/mobile/openapi/lib/model/memory_update_dto.dart index d8d7e9643b..100a180439 100644 --- a/mobile/openapi/lib/model/memory_update_dto.dart +++ b/mobile/openapi/lib/model/memory_update_dto.dart @@ -13,9 +13,9 @@ part of openapi.api; class MemoryUpdateDto { /// Returns a new [MemoryUpdateDto] instance. MemoryUpdateDto({ - this.isSaved, - this.memoryAt, - this.seenAt, + this.isSaved = const Optional.absent(), + this.memoryAt = const Optional.absent(), + this.seenAt = const Optional.absent(), }); /// Is memory saved @@ -25,7 +25,7 @@ class MemoryUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isSaved; + Optional isSaved; /// Memory date /// @@ -34,7 +34,7 @@ class MemoryUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? memoryAt; + Optional memoryAt; /// Date when memory was seen /// @@ -43,7 +43,7 @@ class MemoryUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? seenAt; + Optional seenAt; @override bool operator ==(Object other) => identical(this, other) || other is MemoryUpdateDto && @@ -63,24 +63,21 @@ class MemoryUpdateDto { Map toJson() { final json = {}; - if (this.isSaved != null) { - json[r'isSaved'] = this.isSaved; - } else { - // json[r'isSaved'] = null; + if (this.isSaved.isPresent) { + final value = this.isSaved.value; + json[r'isSaved'] = value; } - if (this.memoryAt != null) { - json[r'memoryAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.memoryAt!.millisecondsSinceEpoch - : this.memoryAt!.toUtc().toIso8601String(); - } else { - // json[r'memoryAt'] = null; + if (this.memoryAt.isPresent) { + final value = this.memoryAt.value; + json[r'memoryAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.seenAt != null) { - json[r'seenAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.seenAt!.millisecondsSinceEpoch - : this.seenAt!.toUtc().toIso8601String(); - } else { - // json[r'seenAt'] = null; + if (this.seenAt.isPresent) { + final value = this.seenAt.value; + json[r'seenAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } return json; } @@ -93,10 +90,17 @@ class MemoryUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return MemoryUpdateDto( - isSaved: mapValueOfType(json, r'isSaved'), - memoryAt: mapDateTime(json, r'memoryAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - seenAt: mapDateTime(json, r'seenAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), + isSaved: json.containsKey(r'isSaved') ? Optional.present(mapValueOfType(json, r'isSaved')) : const Optional.absent(), + memoryAt: json.containsKey(r'memoryAt') ? Optional.present(mapDateTime(json, r'memoryAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + seenAt: json.containsKey(r'seenAt') ? Optional.present(mapDateTime(json, r'seenAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/merge_person_dto.dart b/mobile/openapi/lib/model/merge_person_dto.dart index 8a647890c3..5c20a40d34 100644 --- a/mobile/openapi/lib/model/merge_person_dto.dart +++ b/mobile/openapi/lib/model/merge_person_dto.dart @@ -45,6 +45,15 @@ class MergePersonDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'ids'), 'Required key "MergePersonDto[ids]" is missing from JSON.'); + assert(json[r'ids'] != null, 'Required key "MergePersonDto[ids]" has a null value in JSON.'); + return true; + }()); + return MergePersonDto( ids: json[r'ids'] is Iterable ? (json[r'ids'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/metadata_search_dto.dart b/mobile/openapi/lib/model/metadata_search_dto.dart index 29b1d5b68d..212fd19469 100644 --- a/mobile/openapi/lib/model/metadata_search_dto.dart +++ b/mobile/openapi/lib/model/metadata_search_dto.dart @@ -13,52 +13,52 @@ part of openapi.api; class MetadataSearchDto { /// Returns a new [MetadataSearchDto] instance. MetadataSearchDto({ - this.albumIds = const [], - this.checksum, - this.city, - this.country, - this.createdAfter, - this.createdBefore, - this.description, - this.encodedVideoPath, - this.id, - this.isEncoded, - this.isFavorite, - this.isMotion, - this.isNotInAlbum, - this.isOffline, - this.lensModel, - this.libraryId, - this.make, - this.model, - this.ocr, - this.order, - this.originalFileName, - this.originalPath, - this.page, - this.personIds = const [], - this.previewPath, - this.rating, - this.size, - this.state, - this.tagIds = const [], - this.takenAfter, - this.takenBefore, - this.thumbnailPath, - this.trashedAfter, - this.trashedBefore, - this.type, - this.updatedAfter, - this.updatedBefore, - this.visibility, - this.withDeleted, - this.withExif, - this.withPeople, - this.withStacked, + this.albumIds = const Optional.present(const []), + this.checksum = const Optional.absent(), + this.city = const Optional.absent(), + this.country = const Optional.absent(), + this.createdAfter = const Optional.absent(), + this.createdBefore = const Optional.absent(), + this.description = const Optional.absent(), + this.encodedVideoPath = const Optional.absent(), + this.id = const Optional.absent(), + this.isEncoded = const Optional.absent(), + this.isFavorite = const Optional.absent(), + this.isMotion = const Optional.absent(), + this.isNotInAlbum = const Optional.absent(), + this.isOffline = const Optional.absent(), + this.lensModel = const Optional.absent(), + this.libraryId = const Optional.absent(), + this.make = const Optional.absent(), + this.model = const Optional.absent(), + this.ocr = const Optional.absent(), + this.order = const Optional.absent(), + this.originalFileName = const Optional.absent(), + this.originalPath = const Optional.absent(), + this.page = const Optional.absent(), + this.personIds = const Optional.present(const []), + this.previewPath = const Optional.absent(), + this.rating = const Optional.absent(), + this.size = const Optional.absent(), + this.state = const Optional.absent(), + this.tagIds = const Optional.present(const []), + this.takenAfter = const Optional.absent(), + this.takenBefore = const Optional.absent(), + this.thumbnailPath = const Optional.absent(), + this.trashedAfter = const Optional.absent(), + this.trashedBefore = const Optional.absent(), + this.type = const Optional.absent(), + this.updatedAfter = const Optional.absent(), + this.updatedBefore = const Optional.absent(), + this.visibility = const Optional.absent(), + this.withDeleted = const Optional.absent(), + this.withExif = const Optional.absent(), + this.withPeople = const Optional.absent(), + this.withStacked = const Optional.absent(), }); /// Filter by album IDs - List albumIds; + Optional?> albumIds; /// Filter by file checksum /// @@ -67,13 +67,13 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? checksum; + Optional checksum; /// Filter by city name - String? city; + Optional city; /// Filter by country name - String? country; + Optional country; /// Filter by creation date (after) /// @@ -82,7 +82,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? createdAfter; + Optional createdAfter; /// Filter by creation date (before) /// @@ -91,7 +91,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? createdBefore; + Optional createdBefore; /// Filter by description text /// @@ -100,7 +100,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? description; + Optional description; /// Filter by encoded video file path /// @@ -109,7 +109,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? encodedVideoPath; + Optional encodedVideoPath; /// Filter by asset ID /// @@ -118,7 +118,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? id; + Optional id; /// Filter by encoded status /// @@ -127,7 +127,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isEncoded; + Optional isEncoded; /// Filter by favorite status /// @@ -136,7 +136,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isFavorite; + Optional isFavorite; /// Filter by motion photo status /// @@ -145,7 +145,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isMotion; + Optional isMotion; /// Filter assets not in any album /// @@ -154,7 +154,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isNotInAlbum; + Optional isNotInAlbum; /// Filter by offline status /// @@ -163,19 +163,19 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isOffline; + Optional isOffline; /// Filter by lens model - String? lensModel; + Optional lensModel; /// Library ID to filter by - String? libraryId; + Optional libraryId; /// Filter by camera make - String? make; + Optional make; /// Filter by camera model - String? model; + Optional model; /// Filter by OCR text content /// @@ -184,7 +184,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? ocr; + Optional ocr; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -192,7 +192,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetOrder? order; + Optional order; /// Filter by original file name /// @@ -201,7 +201,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? originalFileName; + Optional originalFileName; /// Filter by original file path /// @@ -210,7 +210,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? originalPath; + Optional originalPath; /// Page number /// @@ -222,10 +222,10 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? page; + Optional page; /// Filter by person IDs - List personIds; + Optional?> personIds; /// Filter by preview file path /// @@ -234,13 +234,13 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? previewPath; + Optional previewPath; /// Filter by rating [1-5], or null for unrated /// /// Minimum value: -1 /// Maximum value: 5 - int? rating; + Optional rating; /// Number of results to return /// @@ -252,13 +252,13 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? size; + Optional size; /// Filter by state/province name - String? state; + Optional state; /// Filter by tag IDs - List? tagIds; + Optional?> tagIds; /// Filter by taken date (after) /// @@ -267,7 +267,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? takenAfter; + Optional takenAfter; /// Filter by taken date (before) /// @@ -276,7 +276,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? takenBefore; + Optional takenBefore; /// Filter by thumbnail file path /// @@ -285,7 +285,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? thumbnailPath; + Optional thumbnailPath; /// Filter by trash date (after) /// @@ -294,7 +294,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? trashedAfter; + Optional trashedAfter; /// Filter by trash date (before) /// @@ -303,7 +303,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? trashedBefore; + Optional trashedBefore; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -311,7 +311,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetTypeEnum? type; + Optional type; /// Filter by update date (after) /// @@ -320,7 +320,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? updatedAfter; + Optional updatedAfter; /// Filter by update date (before) /// @@ -329,7 +329,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? updatedBefore; + Optional updatedBefore; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -337,7 +337,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetVisibility? visibility; + Optional visibility; /// Include deleted assets /// @@ -346,7 +346,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? withDeleted; + Optional withDeleted; /// Include EXIF data in response /// @@ -355,7 +355,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? withExif; + Optional withExif; /// Include people data in response /// @@ -364,7 +364,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? withPeople; + Optional withPeople; /// Include stacked assets /// @@ -373,7 +373,7 @@ class MetadataSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? withStacked; + Optional withStacked; @override bool operator ==(Object other) => identical(this, other) || other is MetadataSearchDto && @@ -471,223 +471,189 @@ class MetadataSearchDto { Map toJson() { final json = {}; - json[r'albumIds'] = this.albumIds; - if (this.checksum != null) { - json[r'checksum'] = this.checksum; - } else { - // json[r'checksum'] = null; + if (this.albumIds.isPresent) { + final value = this.albumIds.value; + json[r'albumIds'] = value; } - if (this.city != null) { - json[r'city'] = this.city; - } else { - // json[r'city'] = null; + if (this.checksum.isPresent) { + final value = this.checksum.value; + json[r'checksum'] = value; } - if (this.country != null) { - json[r'country'] = this.country; - } else { - // json[r'country'] = null; + if (this.city.isPresent) { + final value = this.city.value; + json[r'city'] = value; } - if (this.createdAfter != null) { - json[r'createdAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.createdAfter!.millisecondsSinceEpoch - : this.createdAfter!.toUtc().toIso8601String(); - } else { - // json[r'createdAfter'] = null; + if (this.country.isPresent) { + final value = this.country.value; + json[r'country'] = value; } - if (this.createdBefore != null) { - json[r'createdBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.createdBefore!.millisecondsSinceEpoch - : this.createdBefore!.toUtc().toIso8601String(); - } else { - // json[r'createdBefore'] = null; + if (this.createdAfter.isPresent) { + final value = this.createdAfter.value; + json[r'createdAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.createdBefore.isPresent) { + final value = this.createdBefore.value; + json[r'createdBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.encodedVideoPath != null) { - json[r'encodedVideoPath'] = this.encodedVideoPath; - } else { - // json[r'encodedVideoPath'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - if (this.id != null) { - json[r'id'] = this.id; - } else { - // json[r'id'] = null; + if (this.encodedVideoPath.isPresent) { + final value = this.encodedVideoPath.value; + json[r'encodedVideoPath'] = value; } - if (this.isEncoded != null) { - json[r'isEncoded'] = this.isEncoded; - } else { - // json[r'isEncoded'] = null; + if (this.id.isPresent) { + final value = this.id.value; + json[r'id'] = value; } - if (this.isFavorite != null) { - json[r'isFavorite'] = this.isFavorite; - } else { - // json[r'isFavorite'] = null; + if (this.isEncoded.isPresent) { + final value = this.isEncoded.value; + json[r'isEncoded'] = value; } - if (this.isMotion != null) { - json[r'isMotion'] = this.isMotion; - } else { - // json[r'isMotion'] = null; + if (this.isFavorite.isPresent) { + final value = this.isFavorite.value; + json[r'isFavorite'] = value; } - if (this.isNotInAlbum != null) { - json[r'isNotInAlbum'] = this.isNotInAlbum; - } else { - // json[r'isNotInAlbum'] = null; + if (this.isMotion.isPresent) { + final value = this.isMotion.value; + json[r'isMotion'] = value; } - if (this.isOffline != null) { - json[r'isOffline'] = this.isOffline; - } else { - // json[r'isOffline'] = null; + if (this.isNotInAlbum.isPresent) { + final value = this.isNotInAlbum.value; + json[r'isNotInAlbum'] = value; } - if (this.lensModel != null) { - json[r'lensModel'] = this.lensModel; - } else { - // json[r'lensModel'] = null; + if (this.isOffline.isPresent) { + final value = this.isOffline.value; + json[r'isOffline'] = value; } - if (this.libraryId != null) { - json[r'libraryId'] = this.libraryId; - } else { - // json[r'libraryId'] = null; + if (this.lensModel.isPresent) { + final value = this.lensModel.value; + json[r'lensModel'] = value; } - if (this.make != null) { - json[r'make'] = this.make; - } else { - // json[r'make'] = null; + if (this.libraryId.isPresent) { + final value = this.libraryId.value; + json[r'libraryId'] = value; } - if (this.model != null) { - json[r'model'] = this.model; - } else { - // json[r'model'] = null; + if (this.make.isPresent) { + final value = this.make.value; + json[r'make'] = value; } - if (this.ocr != null) { - json[r'ocr'] = this.ocr; - } else { - // json[r'ocr'] = null; + if (this.model.isPresent) { + final value = this.model.value; + json[r'model'] = value; } - if (this.order != null) { - json[r'order'] = this.order; - } else { - // json[r'order'] = null; + if (this.ocr.isPresent) { + final value = this.ocr.value; + json[r'ocr'] = value; } - if (this.originalFileName != null) { - json[r'originalFileName'] = this.originalFileName; - } else { - // json[r'originalFileName'] = null; + if (this.order.isPresent) { + final value = this.order.value; + json[r'order'] = value; } - if (this.originalPath != null) { - json[r'originalPath'] = this.originalPath; - } else { - // json[r'originalPath'] = null; + if (this.originalFileName.isPresent) { + final value = this.originalFileName.value; + json[r'originalFileName'] = value; } - if (this.page != null) { - json[r'page'] = this.page; - } else { - // json[r'page'] = null; + if (this.originalPath.isPresent) { + final value = this.originalPath.value; + json[r'originalPath'] = value; } - json[r'personIds'] = this.personIds; - if (this.previewPath != null) { - json[r'previewPath'] = this.previewPath; - } else { - // json[r'previewPath'] = null; + if (this.page.isPresent) { + final value = this.page.value; + json[r'page'] = value; } - if (this.rating != null) { - json[r'rating'] = this.rating; - } else { - // json[r'rating'] = null; + if (this.personIds.isPresent) { + final value = this.personIds.value; + json[r'personIds'] = value; } - if (this.size != null) { - json[r'size'] = this.size; - } else { - // json[r'size'] = null; + if (this.previewPath.isPresent) { + final value = this.previewPath.value; + json[r'previewPath'] = value; } - if (this.state != null) { - json[r'state'] = this.state; - } else { - // json[r'state'] = null; + if (this.rating.isPresent) { + final value = this.rating.value; + json[r'rating'] = value; } - if (this.tagIds != null) { - json[r'tagIds'] = this.tagIds; - } else { - // json[r'tagIds'] = null; + if (this.size.isPresent) { + final value = this.size.value; + json[r'size'] = value; } - if (this.takenAfter != null) { - json[r'takenAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.takenAfter!.millisecondsSinceEpoch - : this.takenAfter!.toUtc().toIso8601String(); - } else { - // json[r'takenAfter'] = null; + if (this.state.isPresent) { + final value = this.state.value; + json[r'state'] = value; } - if (this.takenBefore != null) { - json[r'takenBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.takenBefore!.millisecondsSinceEpoch - : this.takenBefore!.toUtc().toIso8601String(); - } else { - // json[r'takenBefore'] = null; + if (this.tagIds.isPresent) { + final value = this.tagIds.value; + json[r'tagIds'] = value; } - if (this.thumbnailPath != null) { - json[r'thumbnailPath'] = this.thumbnailPath; - } else { - // json[r'thumbnailPath'] = null; + if (this.takenAfter.isPresent) { + final value = this.takenAfter.value; + json[r'takenAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.trashedAfter != null) { - json[r'trashedAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.trashedAfter!.millisecondsSinceEpoch - : this.trashedAfter!.toUtc().toIso8601String(); - } else { - // json[r'trashedAfter'] = null; + if (this.takenBefore.isPresent) { + final value = this.takenBefore.value; + json[r'takenBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.trashedBefore != null) { - json[r'trashedBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.trashedBefore!.millisecondsSinceEpoch - : this.trashedBefore!.toUtc().toIso8601String(); - } else { - // json[r'trashedBefore'] = null; + if (this.thumbnailPath.isPresent) { + final value = this.thumbnailPath.value; + json[r'thumbnailPath'] = value; } - if (this.type != null) { - json[r'type'] = this.type; - } else { - // json[r'type'] = null; + if (this.trashedAfter.isPresent) { + final value = this.trashedAfter.value; + json[r'trashedAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.updatedAfter != null) { - json[r'updatedAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.updatedAfter!.millisecondsSinceEpoch - : this.updatedAfter!.toUtc().toIso8601String(); - } else { - // json[r'updatedAfter'] = null; + if (this.trashedBefore.isPresent) { + final value = this.trashedBefore.value; + json[r'trashedBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.updatedBefore != null) { - json[r'updatedBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.updatedBefore!.millisecondsSinceEpoch - : this.updatedBefore!.toUtc().toIso8601String(); - } else { - // json[r'updatedBefore'] = null; + if (this.type.isPresent) { + final value = this.type.value; + json[r'type'] = value; } - if (this.visibility != null) { - json[r'visibility'] = this.visibility; - } else { - // json[r'visibility'] = null; + if (this.updatedAfter.isPresent) { + final value = this.updatedAfter.value; + json[r'updatedAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.withDeleted != null) { - json[r'withDeleted'] = this.withDeleted; - } else { - // json[r'withDeleted'] = null; + if (this.updatedBefore.isPresent) { + final value = this.updatedBefore.value; + json[r'updatedBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.withExif != null) { - json[r'withExif'] = this.withExif; - } else { - // json[r'withExif'] = null; + if (this.visibility.isPresent) { + final value = this.visibility.value; + json[r'visibility'] = value; } - if (this.withPeople != null) { - json[r'withPeople'] = this.withPeople; - } else { - // json[r'withPeople'] = null; + if (this.withDeleted.isPresent) { + final value = this.withDeleted.value; + json[r'withDeleted'] = value; } - if (this.withStacked != null) { - json[r'withStacked'] = this.withStacked; - } else { - // json[r'withStacked'] = null; + if (this.withExif.isPresent) { + final value = this.withExif.value; + json[r'withExif'] = value; + } + if (this.withPeople.isPresent) { + final value = this.withPeople.value; + json[r'withPeople'] = value; + } + if (this.withStacked.isPresent) { + final value = this.withStacked.value; + json[r'withStacked'] = value; } return json; } @@ -700,55 +666,62 @@ class MetadataSearchDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return MetadataSearchDto( - albumIds: json[r'albumIds'] is Iterable + albumIds: json.containsKey(r'albumIds') ? Optional.present(json[r'albumIds'] is Iterable ? (json[r'albumIds'] as Iterable).cast().toList(growable: false) - : const [], - checksum: mapValueOfType(json, r'checksum'), - city: mapValueOfType(json, r'city'), - country: mapValueOfType(json, r'country'), - createdAfter: mapDateTime(json, r'createdAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - createdBefore: mapDateTime(json, r'createdBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - description: mapValueOfType(json, r'description'), - encodedVideoPath: mapValueOfType(json, r'encodedVideoPath'), - id: mapValueOfType(json, r'id'), - isEncoded: mapValueOfType(json, r'isEncoded'), - isFavorite: mapValueOfType(json, r'isFavorite'), - isMotion: mapValueOfType(json, r'isMotion'), - isNotInAlbum: mapValueOfType(json, r'isNotInAlbum'), - isOffline: mapValueOfType(json, r'isOffline'), - lensModel: mapValueOfType(json, r'lensModel'), - libraryId: mapValueOfType(json, r'libraryId'), - make: mapValueOfType(json, r'make'), - model: mapValueOfType(json, r'model'), - ocr: mapValueOfType(json, r'ocr'), - order: AssetOrder.fromJson(json[r'order']), - originalFileName: mapValueOfType(json, r'originalFileName'), - originalPath: mapValueOfType(json, r'originalPath'), - page: mapValueOfType(json, r'page'), - personIds: json[r'personIds'] is Iterable + : const []) : const Optional.absent(), + checksum: json.containsKey(r'checksum') ? Optional.present(mapValueOfType(json, r'checksum')) : const Optional.absent(), + city: json.containsKey(r'city') ? Optional.present(mapValueOfType(json, r'city')) : const Optional.absent(), + country: json.containsKey(r'country') ? Optional.present(mapValueOfType(json, r'country')) : const Optional.absent(), + createdAfter: json.containsKey(r'createdAfter') ? Optional.present(mapDateTime(json, r'createdAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + createdBefore: json.containsKey(r'createdBefore') ? Optional.present(mapDateTime(json, r'createdBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + encodedVideoPath: json.containsKey(r'encodedVideoPath') ? Optional.present(mapValueOfType(json, r'encodedVideoPath')) : const Optional.absent(), + id: json.containsKey(r'id') ? Optional.present(mapValueOfType(json, r'id')) : const Optional.absent(), + isEncoded: json.containsKey(r'isEncoded') ? Optional.present(mapValueOfType(json, r'isEncoded')) : const Optional.absent(), + isFavorite: json.containsKey(r'isFavorite') ? Optional.present(mapValueOfType(json, r'isFavorite')) : const Optional.absent(), + isMotion: json.containsKey(r'isMotion') ? Optional.present(mapValueOfType(json, r'isMotion')) : const Optional.absent(), + isNotInAlbum: json.containsKey(r'isNotInAlbum') ? Optional.present(mapValueOfType(json, r'isNotInAlbum')) : const Optional.absent(), + isOffline: json.containsKey(r'isOffline') ? Optional.present(mapValueOfType(json, r'isOffline')) : const Optional.absent(), + lensModel: json.containsKey(r'lensModel') ? Optional.present(mapValueOfType(json, r'lensModel')) : const Optional.absent(), + libraryId: json.containsKey(r'libraryId') ? Optional.present(mapValueOfType(json, r'libraryId')) : const Optional.absent(), + make: json.containsKey(r'make') ? Optional.present(mapValueOfType(json, r'make')) : const Optional.absent(), + model: json.containsKey(r'model') ? Optional.present(mapValueOfType(json, r'model')) : const Optional.absent(), + ocr: json.containsKey(r'ocr') ? Optional.present(mapValueOfType(json, r'ocr')) : const Optional.absent(), + order: json.containsKey(r'order') ? Optional.present(AssetOrder.fromJson(json[r'order'])) : const Optional.absent(), + originalFileName: json.containsKey(r'originalFileName') ? Optional.present(mapValueOfType(json, r'originalFileName')) : const Optional.absent(), + originalPath: json.containsKey(r'originalPath') ? Optional.present(mapValueOfType(json, r'originalPath')) : const Optional.absent(), + page: json.containsKey(r'page') ? Optional.present(json[r'page'] == null ? null : int.parse('${json[r'page']}')) : const Optional.absent(), + personIds: json.containsKey(r'personIds') ? Optional.present(json[r'personIds'] is Iterable ? (json[r'personIds'] as Iterable).cast().toList(growable: false) - : const [], - previewPath: mapValueOfType(json, r'previewPath'), - rating: mapValueOfType(json, r'rating'), - size: mapValueOfType(json, r'size'), - state: mapValueOfType(json, r'state'), - tagIds: json[r'tagIds'] is Iterable + : const []) : const Optional.absent(), + previewPath: json.containsKey(r'previewPath') ? Optional.present(mapValueOfType(json, r'previewPath')) : const Optional.absent(), + rating: json.containsKey(r'rating') ? Optional.present(json[r'rating'] == null ? null : int.parse('${json[r'rating']}')) : const Optional.absent(), + size: json.containsKey(r'size') ? Optional.present(json[r'size'] == null ? null : int.parse('${json[r'size']}')) : const Optional.absent(), + state: json.containsKey(r'state') ? Optional.present(mapValueOfType(json, r'state')) : const Optional.absent(), + tagIds: json.containsKey(r'tagIds') ? Optional.present(json[r'tagIds'] is Iterable ? (json[r'tagIds'] as Iterable).cast().toList(growable: false) - : const [], - takenAfter: mapDateTime(json, r'takenAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - takenBefore: mapDateTime(json, r'takenBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - thumbnailPath: mapValueOfType(json, r'thumbnailPath'), - trashedAfter: mapDateTime(json, r'trashedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - trashedBefore: mapDateTime(json, r'trashedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - type: AssetTypeEnum.fromJson(json[r'type']), - updatedAfter: mapDateTime(json, r'updatedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - updatedBefore: mapDateTime(json, r'updatedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - visibility: AssetVisibility.fromJson(json[r'visibility']), - withDeleted: mapValueOfType(json, r'withDeleted'), - withExif: mapValueOfType(json, r'withExif'), - withPeople: mapValueOfType(json, r'withPeople'), - withStacked: mapValueOfType(json, r'withStacked'), + : const []) : const Optional.absent(), + takenAfter: json.containsKey(r'takenAfter') ? Optional.present(mapDateTime(json, r'takenAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + takenBefore: json.containsKey(r'takenBefore') ? Optional.present(mapDateTime(json, r'takenBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + thumbnailPath: json.containsKey(r'thumbnailPath') ? Optional.present(mapValueOfType(json, r'thumbnailPath')) : const Optional.absent(), + trashedAfter: json.containsKey(r'trashedAfter') ? Optional.present(mapDateTime(json, r'trashedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + trashedBefore: json.containsKey(r'trashedBefore') ? Optional.present(mapDateTime(json, r'trashedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + type: json.containsKey(r'type') ? Optional.present(AssetTypeEnum.fromJson(json[r'type'])) : const Optional.absent(), + updatedAfter: json.containsKey(r'updatedAfter') ? Optional.present(mapDateTime(json, r'updatedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + updatedBefore: json.containsKey(r'updatedBefore') ? Optional.present(mapDateTime(json, r'updatedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + visibility: json.containsKey(r'visibility') ? Optional.present(AssetVisibility.fromJson(json[r'visibility'])) : const Optional.absent(), + withDeleted: json.containsKey(r'withDeleted') ? Optional.present(mapValueOfType(json, r'withDeleted')) : const Optional.absent(), + withExif: json.containsKey(r'withExif') ? Optional.present(mapValueOfType(json, r'withExif')) : const Optional.absent(), + withPeople: json.containsKey(r'withPeople') ? Optional.present(mapValueOfType(json, r'withPeople')) : const Optional.absent(), + withStacked: json.containsKey(r'withStacked') ? Optional.present(mapValueOfType(json, r'withStacked')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/mirror_parameters.dart b/mobile/openapi/lib/model/mirror_parameters.dart index 78c3da786c..6bb1901084 100644 --- a/mobile/openapi/lib/model/mirror_parameters.dart +++ b/mobile/openapi/lib/model/mirror_parameters.dart @@ -44,6 +44,15 @@ class MirrorParameters { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'axis'), 'Required key "MirrorParameters[axis]" is missing from JSON.'); + assert(json[r'axis'] != null, 'Required key "MirrorParameters[axis]" has a null value in JSON.'); + return true; + }()); + return MirrorParameters( axis: MirrorAxis.fromJson(json[r'axis'])!, ); diff --git a/mobile/openapi/lib/model/notification_create_dto.dart b/mobile/openapi/lib/model/notification_create_dto.dart index f9771246f9..a297ebdb82 100644 --- a/mobile/openapi/lib/model/notification_create_dto.dart +++ b/mobile/openapi/lib/model/notification_create_dto.dart @@ -13,20 +13,20 @@ part of openapi.api; class NotificationCreateDto { /// Returns a new [NotificationCreateDto] instance. NotificationCreateDto({ - this.data = const {}, - this.description, - this.level, - this.readAt, + this.data = const Optional.present(const {}), + this.description = const Optional.absent(), + this.level = const Optional.absent(), + this.readAt = const Optional.absent(), required this.title, - this.type, + this.type = const Optional.absent(), required this.userId, }); /// Additional notification data - Map data; + Optional?> data; /// Notification description - String? description; + Optional description; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -34,10 +34,10 @@ class NotificationCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - NotificationLevel? level; + Optional level; /// Date when notification was read - DateTime? readAt; + Optional readAt; /// Notification title String title; @@ -48,7 +48,7 @@ class NotificationCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - NotificationType? type; + Optional type; /// User ID to send notification to String userId; @@ -79,29 +79,28 @@ class NotificationCreateDto { Map toJson() { final json = {}; - json[r'data'] = this.data; - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.data.isPresent) { + final value = this.data.value; + json[r'data'] = value; } - if (this.level != null) { - json[r'level'] = this.level; - } else { - // json[r'level'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - if (this.readAt != null) { - json[r'readAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.readAt!.millisecondsSinceEpoch - : this.readAt!.toUtc().toIso8601String(); - } else { - // json[r'readAt'] = null; + if (this.level.isPresent) { + final value = this.level.value; + json[r'level'] = value; + } + if (this.readAt.isPresent) { + final value = this.readAt.value; + json[r'readAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } json[r'title'] = this.title; - if (this.type != null) { - json[r'type'] = this.type; - } else { - // json[r'type'] = null; + if (this.type.isPresent) { + final value = this.type.value; + json[r'type'] = value; } json[r'userId'] = this.userId; return json; @@ -115,13 +114,24 @@ class NotificationCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'title'), 'Required key "NotificationCreateDto[title]" is missing from JSON.'); + assert(json[r'title'] != null, 'Required key "NotificationCreateDto[title]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "NotificationCreateDto[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "NotificationCreateDto[userId]" has a null value in JSON.'); + return true; + }()); + return NotificationCreateDto( - data: mapCastOfType(json, r'data') ?? const {}, - description: mapValueOfType(json, r'description'), - level: NotificationLevel.fromJson(json[r'level']), - readAt: mapDateTime(json, r'readAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), + data: json.containsKey(r'data') ? Optional.present(mapCastOfType(json, r'data')) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + level: json.containsKey(r'level') ? Optional.present(NotificationLevel.fromJson(json[r'level'])) : const Optional.absent(), + readAt: json.containsKey(r'readAt') ? Optional.present(mapDateTime(json, r'readAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), title: mapValueOfType(json, r'title')!, - type: NotificationType.fromJson(json[r'type']), + type: json.containsKey(r'type') ? Optional.present(NotificationType.fromJson(json[r'type'])) : const Optional.absent(), userId: mapValueOfType(json, r'userId')!, ); } diff --git a/mobile/openapi/lib/model/notification_delete_all_dto.dart b/mobile/openapi/lib/model/notification_delete_all_dto.dart index 1b398a4f33..b6d609af0b 100644 --- a/mobile/openapi/lib/model/notification_delete_all_dto.dart +++ b/mobile/openapi/lib/model/notification_delete_all_dto.dart @@ -45,6 +45,15 @@ class NotificationDeleteAllDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'ids'), 'Required key "NotificationDeleteAllDto[ids]" is missing from JSON.'); + assert(json[r'ids'] != null, 'Required key "NotificationDeleteAllDto[ids]" has a null value in JSON.'); + return true; + }()); + return NotificationDeleteAllDto( ids: json[r'ids'] is Iterable ? (json[r'ids'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/notification_dto.dart b/mobile/openapi/lib/model/notification_dto.dart index ad0e79cb27..4563e4b24b 100644 --- a/mobile/openapi/lib/model/notification_dto.dart +++ b/mobile/openapi/lib/model/notification_dto.dart @@ -14,11 +14,11 @@ class NotificationDto { /// Returns a new [NotificationDto] instance. NotificationDto({ required this.createdAt, - this.data = const {}, - this.description, + this.data = const Optional.present(const {}), + this.description = const Optional.absent(), required this.id, required this.level, - this.readAt, + this.readAt = const Optional.absent(), required this.title, required this.type, }); @@ -27,7 +27,7 @@ class NotificationDto { DateTime createdAt; /// Additional notification data - Map data; + Optional?> data; /// Notification description /// @@ -36,7 +36,7 @@ class NotificationDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? description; + Optional description; /// Notification ID String id; @@ -50,7 +50,7 @@ class NotificationDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? readAt; + Optional readAt; /// Notification title String title; @@ -88,20 +88,21 @@ class NotificationDto { json[r'createdAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.createdAt.millisecondsSinceEpoch : this.createdAt.toUtc().toIso8601String(); - json[r'data'] = this.data; - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.data.isPresent) { + final value = this.data.value; + json[r'data'] = value; + } + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } json[r'id'] = this.id; json[r'level'] = this.level; - if (this.readAt != null) { - json[r'readAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.readAt!.millisecondsSinceEpoch - : this.readAt!.toUtc().toIso8601String(); - } else { - // json[r'readAt'] = null; + if (this.readAt.isPresent) { + final value = this.readAt.value; + json[r'readAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } json[r'title'] = this.title; json[r'type'] = this.type; @@ -116,13 +117,30 @@ class NotificationDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'createdAt'), 'Required key "NotificationDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "NotificationDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "NotificationDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "NotificationDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'level'), 'Required key "NotificationDto[level]" is missing from JSON.'); + assert(json[r'level'] != null, 'Required key "NotificationDto[level]" has a null value in JSON.'); + assert(json.containsKey(r'title'), 'Required key "NotificationDto[title]" is missing from JSON.'); + assert(json[r'title'] != null, 'Required key "NotificationDto[title]" has a null value in JSON.'); + assert(json.containsKey(r'type'), 'Required key "NotificationDto[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "NotificationDto[type]" has a null value in JSON.'); + return true; + }()); + return NotificationDto( createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, - data: mapCastOfType(json, r'data') ?? const {}, - description: mapValueOfType(json, r'description'), + data: json.containsKey(r'data') ? Optional.present(mapCastOfType(json, r'data')) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), id: mapValueOfType(json, r'id')!, level: NotificationLevel.fromJson(json[r'level'])!, - readAt: mapDateTime(json, r'readAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), + readAt: json.containsKey(r'readAt') ? Optional.present(mapDateTime(json, r'readAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), title: mapValueOfType(json, r'title')!, type: NotificationType.fromJson(json[r'type'])!, ); diff --git a/mobile/openapi/lib/model/notification_update_all_dto.dart b/mobile/openapi/lib/model/notification_update_all_dto.dart index 5ac61ededc..f66ff23f32 100644 --- a/mobile/openapi/lib/model/notification_update_all_dto.dart +++ b/mobile/openapi/lib/model/notification_update_all_dto.dart @@ -14,14 +14,14 @@ class NotificationUpdateAllDto { /// Returns a new [NotificationUpdateAllDto] instance. NotificationUpdateAllDto({ this.ids = const [], - this.readAt, + this.readAt = const Optional.absent(), }); /// Notification IDs to update List ids; /// Date when notifications were read - DateTime? readAt; + Optional readAt; @override bool operator ==(Object other) => identical(this, other) || other is NotificationUpdateAllDto && @@ -40,12 +40,11 @@ class NotificationUpdateAllDto { Map toJson() { final json = {}; json[r'ids'] = this.ids; - if (this.readAt != null) { - json[r'readAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.readAt!.millisecondsSinceEpoch - : this.readAt!.toUtc().toIso8601String(); - } else { - // json[r'readAt'] = null; + if (this.readAt.isPresent) { + final value = this.readAt.value; + json[r'readAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } return json; } @@ -58,11 +57,20 @@ class NotificationUpdateAllDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'ids'), 'Required key "NotificationUpdateAllDto[ids]" is missing from JSON.'); + assert(json[r'ids'] != null, 'Required key "NotificationUpdateAllDto[ids]" has a null value in JSON.'); + return true; + }()); + return NotificationUpdateAllDto( ids: json[r'ids'] is Iterable ? (json[r'ids'] as Iterable).cast().toList(growable: false) : const [], - readAt: mapDateTime(json, r'readAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), + readAt: json.containsKey(r'readAt') ? Optional.present(mapDateTime(json, r'readAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/notification_update_dto.dart b/mobile/openapi/lib/model/notification_update_dto.dart index c5d949d7b2..5f9d78e3f8 100644 --- a/mobile/openapi/lib/model/notification_update_dto.dart +++ b/mobile/openapi/lib/model/notification_update_dto.dart @@ -13,11 +13,11 @@ part of openapi.api; class NotificationUpdateDto { /// Returns a new [NotificationUpdateDto] instance. NotificationUpdateDto({ - this.readAt, + this.readAt = const Optional.absent(), }); /// Date when notification was read - DateTime? readAt; + Optional readAt; @override bool operator ==(Object other) => identical(this, other) || other is NotificationUpdateDto && @@ -33,12 +33,11 @@ class NotificationUpdateDto { Map toJson() { final json = {}; - if (this.readAt != null) { - json[r'readAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.readAt!.millisecondsSinceEpoch - : this.readAt!.toUtc().toIso8601String(); - } else { - // json[r'readAt'] = null; + if (this.readAt.isPresent) { + final value = this.readAt.value; + json[r'readAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } return json; } @@ -51,8 +50,15 @@ class NotificationUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return NotificationUpdateDto( - readAt: mapDateTime(json, r'readAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), + readAt: json.containsKey(r'readAt') ? Optional.present(mapDateTime(json, r'readAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/o_auth_authorize_response_dto.dart b/mobile/openapi/lib/model/o_auth_authorize_response_dto.dart index 7eedc45673..277cfde5e3 100644 --- a/mobile/openapi/lib/model/o_auth_authorize_response_dto.dart +++ b/mobile/openapi/lib/model/o_auth_authorize_response_dto.dart @@ -45,6 +45,15 @@ class OAuthAuthorizeResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'url'), 'Required key "OAuthAuthorizeResponseDto[url]" is missing from JSON.'); + assert(json[r'url'] != null, 'Required key "OAuthAuthorizeResponseDto[url]" has a null value in JSON.'); + return true; + }()); + return OAuthAuthorizeResponseDto( url: mapValueOfType(json, r'url')!, ); diff --git a/mobile/openapi/lib/model/o_auth_callback_dto.dart b/mobile/openapi/lib/model/o_auth_callback_dto.dart index d94374935a..ea4f42558e 100644 --- a/mobile/openapi/lib/model/o_auth_callback_dto.dart +++ b/mobile/openapi/lib/model/o_auth_callback_dto.dart @@ -13,8 +13,8 @@ part of openapi.api; class OAuthCallbackDto { /// Returns a new [OAuthCallbackDto] instance. OAuthCallbackDto({ - this.codeVerifier, - this.state, + this.codeVerifier = const Optional.absent(), + this.state = const Optional.absent(), required this.url, }); @@ -25,7 +25,7 @@ class OAuthCallbackDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? codeVerifier; + Optional codeVerifier; /// OAuth state parameter /// @@ -34,7 +34,7 @@ class OAuthCallbackDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? state; + Optional state; /// OAuth callback URL String url; @@ -57,15 +57,13 @@ class OAuthCallbackDto { Map toJson() { final json = {}; - if (this.codeVerifier != null) { - json[r'codeVerifier'] = this.codeVerifier; - } else { - // json[r'codeVerifier'] = null; + if (this.codeVerifier.isPresent) { + final value = this.codeVerifier.value; + json[r'codeVerifier'] = value; } - if (this.state != null) { - json[r'state'] = this.state; - } else { - // json[r'state'] = null; + if (this.state.isPresent) { + final value = this.state.value; + json[r'state'] = value; } json[r'url'] = this.url; return json; @@ -79,9 +77,18 @@ class OAuthCallbackDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'url'), 'Required key "OAuthCallbackDto[url]" is missing from JSON.'); + assert(json[r'url'] != null, 'Required key "OAuthCallbackDto[url]" has a null value in JSON.'); + return true; + }()); + return OAuthCallbackDto( - codeVerifier: mapValueOfType(json, r'codeVerifier'), - state: mapValueOfType(json, r'state'), + codeVerifier: json.containsKey(r'codeVerifier') ? Optional.present(mapValueOfType(json, r'codeVerifier')) : const Optional.absent(), + state: json.containsKey(r'state') ? Optional.present(mapValueOfType(json, r'state')) : const Optional.absent(), url: mapValueOfType(json, r'url')!, ); } diff --git a/mobile/openapi/lib/model/o_auth_config_dto.dart b/mobile/openapi/lib/model/o_auth_config_dto.dart index 1c9ce8d5b8..5a291321c1 100644 --- a/mobile/openapi/lib/model/o_auth_config_dto.dart +++ b/mobile/openapi/lib/model/o_auth_config_dto.dart @@ -13,9 +13,9 @@ part of openapi.api; class OAuthConfigDto { /// Returns a new [OAuthConfigDto] instance. OAuthConfigDto({ - this.codeChallenge, + this.codeChallenge = const Optional.absent(), required this.redirectUri, - this.state, + this.state = const Optional.absent(), }); /// OAuth code challenge (PKCE) @@ -25,7 +25,7 @@ class OAuthConfigDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? codeChallenge; + Optional codeChallenge; /// OAuth redirect URI String redirectUri; @@ -37,7 +37,7 @@ class OAuthConfigDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? state; + Optional state; @override bool operator ==(Object other) => identical(this, other) || other is OAuthConfigDto && @@ -57,16 +57,14 @@ class OAuthConfigDto { Map toJson() { final json = {}; - if (this.codeChallenge != null) { - json[r'codeChallenge'] = this.codeChallenge; - } else { - // json[r'codeChallenge'] = null; + if (this.codeChallenge.isPresent) { + final value = this.codeChallenge.value; + json[r'codeChallenge'] = value; } json[r'redirectUri'] = this.redirectUri; - if (this.state != null) { - json[r'state'] = this.state; - } else { - // json[r'state'] = null; + if (this.state.isPresent) { + final value = this.state.value; + json[r'state'] = value; } return json; } @@ -79,10 +77,19 @@ class OAuthConfigDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'redirectUri'), 'Required key "OAuthConfigDto[redirectUri]" is missing from JSON.'); + assert(json[r'redirectUri'] != null, 'Required key "OAuthConfigDto[redirectUri]" has a null value in JSON.'); + return true; + }()); + return OAuthConfigDto( - codeChallenge: mapValueOfType(json, r'codeChallenge'), + codeChallenge: json.containsKey(r'codeChallenge') ? Optional.present(mapValueOfType(json, r'codeChallenge')) : const Optional.absent(), redirectUri: mapValueOfType(json, r'redirectUri')!, - state: mapValueOfType(json, r'state'), + state: json.containsKey(r'state') ? Optional.present(mapValueOfType(json, r'state')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/o_auth_token_endpoint_auth_method.dart b/mobile/openapi/lib/model/o_auth_token_endpoint_auth_method.dart index b63f027af7..414108068a 100644 --- a/mobile/openapi/lib/model/o_auth_token_endpoint_auth_method.dart +++ b/mobile/openapi/lib/model/o_auth_token_endpoint_auth_method.dart @@ -23,13 +23,13 @@ class OAuthTokenEndpointAuthMethod { String toJson() => value; - static const post = OAuthTokenEndpointAuthMethod._(r'client_secret_post'); - static const basic = OAuthTokenEndpointAuthMethod._(r'client_secret_basic'); + static const clientSecretPost = OAuthTokenEndpointAuthMethod._(r'client_secret_post'); + static const clientSecretBasic = OAuthTokenEndpointAuthMethod._(r'client_secret_basic'); /// List of all possible values in this [enum][OAuthTokenEndpointAuthMethod]. static const values = [ - post, - basic, + clientSecretPost, + clientSecretBasic, ]; static OAuthTokenEndpointAuthMethod? fromJson(dynamic value) => OAuthTokenEndpointAuthMethodTypeTransformer().decode(value); @@ -68,8 +68,8 @@ class OAuthTokenEndpointAuthMethodTypeTransformer { OAuthTokenEndpointAuthMethod? decode(dynamic data, {bool allowNull = true}) { if (data != null) { switch (data) { - case r'client_secret_post': return OAuthTokenEndpointAuthMethod.post; - case r'client_secret_basic': return OAuthTokenEndpointAuthMethod.basic; + case r'client_secret_post': return OAuthTokenEndpointAuthMethod.clientSecretPost; + case r'client_secret_basic': return OAuthTokenEndpointAuthMethod.clientSecretBasic; default: if (!allowNull) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/mobile/openapi/lib/model/ocr_config.dart b/mobile/openapi/lib/model/ocr_config.dart index 2ce5646731..63f158e904 100644 --- a/mobile/openapi/lib/model/ocr_config.dart +++ b/mobile/openapi/lib/model/ocr_config.dart @@ -82,11 +82,28 @@ class OcrConfig { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "OcrConfig[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "OcrConfig[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'maxResolution'), 'Required key "OcrConfig[maxResolution]" is missing from JSON.'); + assert(json[r'maxResolution'] != null, 'Required key "OcrConfig[maxResolution]" has a null value in JSON.'); + assert(json.containsKey(r'minDetectionScore'), 'Required key "OcrConfig[minDetectionScore]" is missing from JSON.'); + assert(json[r'minDetectionScore'] != null, 'Required key "OcrConfig[minDetectionScore]" has a null value in JSON.'); + assert(json.containsKey(r'minRecognitionScore'), 'Required key "OcrConfig[minRecognitionScore]" is missing from JSON.'); + assert(json[r'minRecognitionScore'] != null, 'Required key "OcrConfig[minRecognitionScore]" has a null value in JSON.'); + assert(json.containsKey(r'modelName'), 'Required key "OcrConfig[modelName]" is missing from JSON.'); + assert(json[r'modelName'] != null, 'Required key "OcrConfig[modelName]" has a null value in JSON.'); + return true; + }()); + return OcrConfig( enabled: mapValueOfType(json, r'enabled')!, maxResolution: mapValueOfType(json, r'maxResolution')!, - minDetectionScore: (mapValueOfType(json, r'minDetectionScore')!).toDouble(), - minRecognitionScore: (mapValueOfType(json, r'minRecognitionScore')!).toDouble(), + minDetectionScore: mapValueOfType(json, r'minDetectionScore')!, + minRecognitionScore: mapValueOfType(json, r'minRecognitionScore')!, modelName: mapValueOfType(json, r'modelName')!, ); } diff --git a/mobile/openapi/lib/model/on_this_day_dto.dart b/mobile/openapi/lib/model/on_this_day_dto.dart index 77ae96532f..90bfab8213 100644 --- a/mobile/openapi/lib/model/on_this_day_dto.dart +++ b/mobile/openapi/lib/model/on_this_day_dto.dart @@ -48,6 +48,15 @@ class OnThisDayDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'year'), 'Required key "OnThisDayDto[year]" is missing from JSON.'); + assert(json[r'year'] != null, 'Required key "OnThisDayDto[year]" has a null value in JSON.'); + return true; + }()); + return OnThisDayDto( year: mapValueOfType(json, r'year')!, ); diff --git a/mobile/openapi/lib/model/onboarding_dto.dart b/mobile/openapi/lib/model/onboarding_dto.dart index 8499bc9b9a..8f2ce08e61 100644 --- a/mobile/openapi/lib/model/onboarding_dto.dart +++ b/mobile/openapi/lib/model/onboarding_dto.dart @@ -45,6 +45,15 @@ class OnboardingDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'isOnboarded'), 'Required key "OnboardingDto[isOnboarded]" is missing from JSON.'); + assert(json[r'isOnboarded'] != null, 'Required key "OnboardingDto[isOnboarded]" has a null value in JSON.'); + return true; + }()); + return OnboardingDto( isOnboarded: mapValueOfType(json, r'isOnboarded')!, ); diff --git a/mobile/openapi/lib/model/onboarding_response_dto.dart b/mobile/openapi/lib/model/onboarding_response_dto.dart index 2b0dbe2b96..fd47d5f333 100644 --- a/mobile/openapi/lib/model/onboarding_response_dto.dart +++ b/mobile/openapi/lib/model/onboarding_response_dto.dart @@ -45,6 +45,15 @@ class OnboardingResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'isOnboarded'), 'Required key "OnboardingResponseDto[isOnboarded]" is missing from JSON.'); + assert(json[r'isOnboarded'] != null, 'Required key "OnboardingResponseDto[isOnboarded]" has a null value in JSON.'); + return true; + }()); + return OnboardingResponseDto( isOnboarded: mapValueOfType(json, r'isOnboarded')!, ); diff --git a/mobile/openapi/lib/model/partner_create_dto.dart b/mobile/openapi/lib/model/partner_create_dto.dart index 30aa96ff30..5a56497e31 100644 --- a/mobile/openapi/lib/model/partner_create_dto.dart +++ b/mobile/openapi/lib/model/partner_create_dto.dart @@ -45,6 +45,15 @@ class PartnerCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'sharedWithId'), 'Required key "PartnerCreateDto[sharedWithId]" is missing from JSON.'); + assert(json[r'sharedWithId'] != null, 'Required key "PartnerCreateDto[sharedWithId]" has a null value in JSON.'); + return true; + }()); + return PartnerCreateDto( sharedWithId: mapValueOfType(json, r'sharedWithId')!, ); diff --git a/mobile/openapi/lib/model/partner_direction.dart b/mobile/openapi/lib/model/partner_direction.dart index c5e3b308ac..c1e38b8dfe 100644 --- a/mobile/openapi/lib/model/partner_direction.dart +++ b/mobile/openapi/lib/model/partner_direction.dart @@ -23,13 +23,13 @@ class PartnerDirection { String toJson() => value; - static const by = PartnerDirection._(r'shared-by'); - static const with_ = PartnerDirection._(r'shared-with'); + static const sharedBy = PartnerDirection._(r'shared-by'); + static const sharedWith = PartnerDirection._(r'shared-with'); /// List of all possible values in this [enum][PartnerDirection]. static const values = [ - by, - with_, + sharedBy, + sharedWith, ]; static PartnerDirection? fromJson(dynamic value) => PartnerDirectionTypeTransformer().decode(value); @@ -68,8 +68,8 @@ class PartnerDirectionTypeTransformer { PartnerDirection? decode(dynamic data, {bool allowNull = true}) { if (data != null) { switch (data) { - case r'shared-by': return PartnerDirection.by; - case r'shared-with': return PartnerDirection.with_; + case r'shared-by': return PartnerDirection.sharedBy; + case r'shared-with': return PartnerDirection.sharedWith; default: if (!allowNull) { throw ArgumentError('Unknown enum value to decode: $data'); diff --git a/mobile/openapi/lib/model/partner_response_dto.dart b/mobile/openapi/lib/model/partner_response_dto.dart index f4612cc98a..4853ab4f8e 100644 --- a/mobile/openapi/lib/model/partner_response_dto.dart +++ b/mobile/openapi/lib/model/partner_response_dto.dart @@ -16,7 +16,7 @@ class PartnerResponseDto { required this.avatarColor, required this.email, required this.id, - this.inTimeline, + this.inTimeline = const Optional.absent(), required this.name, required this.profileChangedAt, required this.profileImagePath, @@ -37,7 +37,7 @@ class PartnerResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? inTimeline; + Optional inTimeline; /// User name String name; @@ -77,10 +77,9 @@ class PartnerResponseDto { json[r'avatarColor'] = this.avatarColor; json[r'email'] = this.email; json[r'id'] = this.id; - if (this.inTimeline != null) { - json[r'inTimeline'] = this.inTimeline; - } else { - // json[r'inTimeline'] = null; + if (this.inTimeline.isPresent) { + final value = this.inTimeline.value; + json[r'inTimeline'] = value; } json[r'name'] = this.name; json[r'profileChangedAt'] = this.profileChangedAt.toUtc().toIso8601String(); @@ -96,11 +95,30 @@ class PartnerResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'avatarColor'), 'Required key "PartnerResponseDto[avatarColor]" is missing from JSON.'); + assert(json[r'avatarColor'] != null, 'Required key "PartnerResponseDto[avatarColor]" has a null value in JSON.'); + assert(json.containsKey(r'email'), 'Required key "PartnerResponseDto[email]" is missing from JSON.'); + assert(json[r'email'] != null, 'Required key "PartnerResponseDto[email]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "PartnerResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "PartnerResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "PartnerResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "PartnerResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'profileChangedAt'), 'Required key "PartnerResponseDto[profileChangedAt]" is missing from JSON.'); + assert(json[r'profileChangedAt'] != null, 'Required key "PartnerResponseDto[profileChangedAt]" has a null value in JSON.'); + assert(json.containsKey(r'profileImagePath'), 'Required key "PartnerResponseDto[profileImagePath]" is missing from JSON.'); + assert(json[r'profileImagePath'] != null, 'Required key "PartnerResponseDto[profileImagePath]" has a null value in JSON.'); + return true; + }()); + return PartnerResponseDto( avatarColor: UserAvatarColor.fromJson(json[r'avatarColor'])!, email: mapValueOfType(json, r'email')!, id: mapValueOfType(json, r'id')!, - inTimeline: mapValueOfType(json, r'inTimeline'), + inTimeline: json.containsKey(r'inTimeline') ? Optional.present(mapValueOfType(json, r'inTimeline')) : const Optional.absent(), name: mapValueOfType(json, r'name')!, profileChangedAt: mapDateTime(json, r'profileChangedAt', r'')!, profileImagePath: mapValueOfType(json, r'profileImagePath')!, diff --git a/mobile/openapi/lib/model/partner_update_dto.dart b/mobile/openapi/lib/model/partner_update_dto.dart index db3516e3a1..3b67733057 100644 --- a/mobile/openapi/lib/model/partner_update_dto.dart +++ b/mobile/openapi/lib/model/partner_update_dto.dart @@ -45,6 +45,15 @@ class PartnerUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'inTimeline'), 'Required key "PartnerUpdateDto[inTimeline]" is missing from JSON.'); + assert(json[r'inTimeline'] != null, 'Required key "PartnerUpdateDto[inTimeline]" has a null value in JSON.'); + return true; + }()); + return PartnerUpdateDto( inTimeline: mapValueOfType(json, r'inTimeline')!, ); diff --git a/mobile/openapi/lib/model/people_response.dart b/mobile/openapi/lib/model/people_response.dart index 9d5d8ec18a..b4e36c0d24 100644 --- a/mobile/openapi/lib/model/people_response.dart +++ b/mobile/openapi/lib/model/people_response.dart @@ -52,6 +52,17 @@ class PeopleResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "PeopleResponse[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "PeopleResponse[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'sidebarWeb'), 'Required key "PeopleResponse[sidebarWeb]" is missing from JSON.'); + assert(json[r'sidebarWeb'] != null, 'Required key "PeopleResponse[sidebarWeb]" has a null value in JSON.'); + return true; + }()); + return PeopleResponse( enabled: mapValueOfType(json, r'enabled')!, sidebarWeb: mapValueOfType(json, r'sidebarWeb')!, diff --git a/mobile/openapi/lib/model/people_response_dto.dart b/mobile/openapi/lib/model/people_response_dto.dart index 87edc6b4a7..0b6e4f3882 100644 --- a/mobile/openapi/lib/model/people_response_dto.dart +++ b/mobile/openapi/lib/model/people_response_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class PeopleResponseDto { /// Returns a new [PeopleResponseDto] instance. PeopleResponseDto({ - this.hasNextPage, + this.hasNextPage = const Optional.absent(), required this.hidden, this.people = const [], required this.total, @@ -26,7 +26,7 @@ class PeopleResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? hasNextPage; + Optional hasNextPage; /// Number of hidden people /// @@ -62,10 +62,9 @@ class PeopleResponseDto { Map toJson() { final json = {}; - if (this.hasNextPage != null) { - json[r'hasNextPage'] = this.hasNextPage; - } else { - // json[r'hasNextPage'] = null; + if (this.hasNextPage.isPresent) { + final value = this.hasNextPage.value; + json[r'hasNextPage'] = value; } json[r'hidden'] = this.hidden; json[r'people'] = this.people; @@ -81,8 +80,21 @@ class PeopleResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'hidden'), 'Required key "PeopleResponseDto[hidden]" is missing from JSON.'); + assert(json[r'hidden'] != null, 'Required key "PeopleResponseDto[hidden]" has a null value in JSON.'); + assert(json.containsKey(r'people'), 'Required key "PeopleResponseDto[people]" is missing from JSON.'); + assert(json[r'people'] != null, 'Required key "PeopleResponseDto[people]" has a null value in JSON.'); + assert(json.containsKey(r'total'), 'Required key "PeopleResponseDto[total]" is missing from JSON.'); + assert(json[r'total'] != null, 'Required key "PeopleResponseDto[total]" has a null value in JSON.'); + return true; + }()); + return PeopleResponseDto( - hasNextPage: mapValueOfType(json, r'hasNextPage'), + hasNextPage: json.containsKey(r'hasNextPage') ? Optional.present(mapValueOfType(json, r'hasNextPage')) : const Optional.absent(), hidden: mapValueOfType(json, r'hidden')!, people: PersonResponseDto.listFromJson(json[r'people']), total: mapValueOfType(json, r'total')!, diff --git a/mobile/openapi/lib/model/people_update.dart b/mobile/openapi/lib/model/people_update.dart index fe16479bac..ef69f6595a 100644 --- a/mobile/openapi/lib/model/people_update.dart +++ b/mobile/openapi/lib/model/people_update.dart @@ -13,8 +13,8 @@ part of openapi.api; class PeopleUpdate { /// Returns a new [PeopleUpdate] instance. PeopleUpdate({ - this.enabled, - this.sidebarWeb, + this.enabled = const Optional.absent(), + this.sidebarWeb = const Optional.absent(), }); /// Whether people are enabled @@ -24,7 +24,7 @@ class PeopleUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; /// Whether people appear in web sidebar /// @@ -33,7 +33,7 @@ class PeopleUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? sidebarWeb; + Optional sidebarWeb; @override bool operator ==(Object other) => identical(this, other) || other is PeopleUpdate && @@ -51,15 +51,13 @@ class PeopleUpdate { Map toJson() { final json = {}; - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } - if (this.sidebarWeb != null) { - json[r'sidebarWeb'] = this.sidebarWeb; - } else { - // json[r'sidebarWeb'] = null; + if (this.sidebarWeb.isPresent) { + final value = this.sidebarWeb.value; + json[r'sidebarWeb'] = value; } return json; } @@ -72,9 +70,16 @@ class PeopleUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return PeopleUpdate( - enabled: mapValueOfType(json, r'enabled'), - sidebarWeb: mapValueOfType(json, r'sidebarWeb'), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), + sidebarWeb: json.containsKey(r'sidebarWeb') ? Optional.present(mapValueOfType(json, r'sidebarWeb')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/people_update_dto.dart b/mobile/openapi/lib/model/people_update_dto.dart index c9ce74d659..b66ebc43a8 100644 --- a/mobile/openapi/lib/model/people_update_dto.dart +++ b/mobile/openapi/lib/model/people_update_dto.dart @@ -45,6 +45,15 @@ class PeopleUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'people'), 'Required key "PeopleUpdateDto[people]" is missing from JSON.'); + assert(json[r'people'] != null, 'Required key "PeopleUpdateDto[people]" has a null value in JSON.'); + return true; + }()); + return PeopleUpdateDto( people: PeopleUpdateItem.listFromJson(json[r'people']), ); diff --git a/mobile/openapi/lib/model/people_update_item.dart b/mobile/openapi/lib/model/people_update_item.dart index 5e20aeb464..221f42eb9b 100644 --- a/mobile/openapi/lib/model/people_update_item.dart +++ b/mobile/openapi/lib/model/people_update_item.dart @@ -13,20 +13,20 @@ part of openapi.api; class PeopleUpdateItem { /// Returns a new [PeopleUpdateItem] instance. PeopleUpdateItem({ - this.birthDate, - this.color, - this.featureFaceAssetId, + this.birthDate = const Optional.absent(), + this.color = const Optional.absent(), + this.featureFaceAssetId = const Optional.absent(), required this.id, - this.isFavorite, - this.isHidden, - this.name, + this.isFavorite = const Optional.absent(), + this.isHidden = const Optional.absent(), + this.name = const Optional.absent(), }); /// Person date of birth - DateTime? birthDate; + Optional birthDate; /// Person color (hex) - String? color; + Optional color; /// Asset ID used for feature face thumbnail /// @@ -35,7 +35,7 @@ class PeopleUpdateItem { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? featureFaceAssetId; + Optional featureFaceAssetId; /// Person ID String id; @@ -47,7 +47,7 @@ class PeopleUpdateItem { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isFavorite; + Optional isFavorite; /// Person visibility (hidden) /// @@ -56,7 +56,7 @@ class PeopleUpdateItem { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isHidden; + Optional isHidden; /// Person name /// @@ -65,7 +65,7 @@ class PeopleUpdateItem { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? name; + Optional name; @override bool operator ==(Object other) => identical(this, other) || other is PeopleUpdateItem && @@ -93,36 +93,30 @@ class PeopleUpdateItem { Map toJson() { final json = {}; - if (this.birthDate != null) { - json[r'birthDate'] = _dateFormatter.format(this.birthDate!.toUtc()); - } else { - // json[r'birthDate'] = null; + if (this.birthDate.isPresent) { + final value = this.birthDate.value; + json[r'birthDate'] = value == null ? null : _dateFormatter.format(value.toUtc()); } - if (this.color != null) { - json[r'color'] = this.color; - } else { - // json[r'color'] = null; + if (this.color.isPresent) { + final value = this.color.value; + json[r'color'] = value; } - if (this.featureFaceAssetId != null) { - json[r'featureFaceAssetId'] = this.featureFaceAssetId; - } else { - // json[r'featureFaceAssetId'] = null; + if (this.featureFaceAssetId.isPresent) { + final value = this.featureFaceAssetId.value; + json[r'featureFaceAssetId'] = value; } json[r'id'] = this.id; - if (this.isFavorite != null) { - json[r'isFavorite'] = this.isFavorite; - } else { - // json[r'isFavorite'] = null; + if (this.isFavorite.isPresent) { + final value = this.isFavorite.value; + json[r'isFavorite'] = value; } - if (this.isHidden != null) { - json[r'isHidden'] = this.isHidden; - } else { - // json[r'isHidden'] = null; + if (this.isHidden.isPresent) { + final value = this.isHidden.value; + json[r'isHidden'] = value; } - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; } return json; } @@ -135,14 +129,23 @@ class PeopleUpdateItem { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'id'), 'Required key "PeopleUpdateItem[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "PeopleUpdateItem[id]" has a null value in JSON.'); + return true; + }()); + return PeopleUpdateItem( - birthDate: mapDateTime(json, r'birthDate', r''), - color: mapValueOfType(json, r'color'), - featureFaceAssetId: mapValueOfType(json, r'featureFaceAssetId'), + birthDate: json.containsKey(r'birthDate') ? Optional.present(mapDateTime(json, r'birthDate', r'')) : const Optional.absent(), + color: json.containsKey(r'color') ? Optional.present(mapValueOfType(json, r'color')) : const Optional.absent(), + featureFaceAssetId: json.containsKey(r'featureFaceAssetId') ? Optional.present(mapValueOfType(json, r'featureFaceAssetId')) : const Optional.absent(), id: mapValueOfType(json, r'id')!, - isFavorite: mapValueOfType(json, r'isFavorite'), - isHidden: mapValueOfType(json, r'isHidden'), - name: mapValueOfType(json, r'name'), + isFavorite: json.containsKey(r'isFavorite') ? Optional.present(mapValueOfType(json, r'isFavorite')) : const Optional.absent(), + isHidden: json.containsKey(r'isHidden') ? Optional.present(mapValueOfType(json, r'isHidden')) : const Optional.absent(), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/person_create_dto.dart b/mobile/openapi/lib/model/person_create_dto.dart index f2ba702c2f..ec29622206 100644 --- a/mobile/openapi/lib/model/person_create_dto.dart +++ b/mobile/openapi/lib/model/person_create_dto.dart @@ -13,18 +13,18 @@ part of openapi.api; class PersonCreateDto { /// Returns a new [PersonCreateDto] instance. PersonCreateDto({ - this.birthDate, - this.color, - this.isFavorite, - this.isHidden, - this.name, + this.birthDate = const Optional.absent(), + this.color = const Optional.absent(), + this.isFavorite = const Optional.absent(), + this.isHidden = const Optional.absent(), + this.name = const Optional.absent(), }); /// Person date of birth - DateTime? birthDate; + Optional birthDate; /// Person color (hex) - String? color; + Optional color; /// Mark as favorite /// @@ -33,7 +33,7 @@ class PersonCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isFavorite; + Optional isFavorite; /// Person visibility (hidden) /// @@ -42,7 +42,7 @@ class PersonCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isHidden; + Optional isHidden; /// Person name /// @@ -51,7 +51,7 @@ class PersonCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? name; + Optional name; @override bool operator ==(Object other) => identical(this, other) || other is PersonCreateDto && @@ -75,30 +75,25 @@ class PersonCreateDto { Map toJson() { final json = {}; - if (this.birthDate != null) { - json[r'birthDate'] = _dateFormatter.format(this.birthDate!.toUtc()); - } else { - // json[r'birthDate'] = null; + if (this.birthDate.isPresent) { + final value = this.birthDate.value; + json[r'birthDate'] = value == null ? null : _dateFormatter.format(value.toUtc()); } - if (this.color != null) { - json[r'color'] = this.color; - } else { - // json[r'color'] = null; + if (this.color.isPresent) { + final value = this.color.value; + json[r'color'] = value; } - if (this.isFavorite != null) { - json[r'isFavorite'] = this.isFavorite; - } else { - // json[r'isFavorite'] = null; + if (this.isFavorite.isPresent) { + final value = this.isFavorite.value; + json[r'isFavorite'] = value; } - if (this.isHidden != null) { - json[r'isHidden'] = this.isHidden; - } else { - // json[r'isHidden'] = null; + if (this.isHidden.isPresent) { + final value = this.isHidden.value; + json[r'isHidden'] = value; } - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; } return json; } @@ -111,12 +106,19 @@ class PersonCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return PersonCreateDto( - birthDate: mapDateTime(json, r'birthDate', r''), - color: mapValueOfType(json, r'color'), - isFavorite: mapValueOfType(json, r'isFavorite'), - isHidden: mapValueOfType(json, r'isHidden'), - name: mapValueOfType(json, r'name'), + birthDate: json.containsKey(r'birthDate') ? Optional.present(mapDateTime(json, r'birthDate', r'')) : const Optional.absent(), + color: json.containsKey(r'color') ? Optional.present(mapValueOfType(json, r'color')) : const Optional.absent(), + isFavorite: json.containsKey(r'isFavorite') ? Optional.present(mapValueOfType(json, r'isFavorite')) : const Optional.absent(), + isHidden: json.containsKey(r'isHidden') ? Optional.present(mapValueOfType(json, r'isHidden')) : const Optional.absent(), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/person_response_dto.dart b/mobile/openapi/lib/model/person_response_dto.dart index 455dfb98d6..bf045410f3 100644 --- a/mobile/openapi/lib/model/person_response_dto.dart +++ b/mobile/openapi/lib/model/person_response_dto.dart @@ -14,13 +14,13 @@ class PersonResponseDto { /// Returns a new [PersonResponseDto] instance. PersonResponseDto({ required this.birthDate, - this.color, + this.color = const Optional.absent(), required this.id, - this.isFavorite, + this.isFavorite = const Optional.absent(), required this.isHidden, required this.name, required this.thumbnailPath, - this.updatedAt, + this.updatedAt = const Optional.absent(), }); /// Person date of birth @@ -33,7 +33,7 @@ class PersonResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? color; + Optional color; /// Person ID String id; @@ -45,7 +45,7 @@ class PersonResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isFavorite; + Optional isFavorite; /// Is hidden bool isHidden; @@ -63,7 +63,7 @@ class PersonResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? updatedAt; + Optional updatedAt; @override bool operator ==(Object other) => identical(this, other) || other is PersonResponseDto && @@ -96,26 +96,23 @@ class PersonResponseDto { if (this.birthDate != null) { json[r'birthDate'] = _dateFormatter.format(this.birthDate!.toUtc()); } else { - // json[r'birthDate'] = null; + json[r'birthDate'] = null; } - if (this.color != null) { - json[r'color'] = this.color; - } else { - // json[r'color'] = null; + if (this.color.isPresent) { + final value = this.color.value; + json[r'color'] = value; } json[r'id'] = this.id; - if (this.isFavorite != null) { - json[r'isFavorite'] = this.isFavorite; - } else { - // json[r'isFavorite'] = null; + if (this.isFavorite.isPresent) { + final value = this.isFavorite.value; + json[r'isFavorite'] = value; } json[r'isHidden'] = this.isHidden; json[r'name'] = this.name; json[r'thumbnailPath'] = this.thumbnailPath; - if (this.updatedAt != null) { - json[r'updatedAt'] = this.updatedAt!.toUtc().toIso8601String(); - } else { - // json[r'updatedAt'] = null; + if (this.updatedAt.isPresent) { + final value = this.updatedAt.value; + json[r'updatedAt'] = value == null ? null : value.toUtc().toIso8601String(); } return json; } @@ -128,15 +125,31 @@ class PersonResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'birthDate'), 'Required key "PersonResponseDto[birthDate]" is missing from JSON.'); + assert(json.containsKey(r'id'), 'Required key "PersonResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "PersonResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'isHidden'), 'Required key "PersonResponseDto[isHidden]" is missing from JSON.'); + assert(json[r'isHidden'] != null, 'Required key "PersonResponseDto[isHidden]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "PersonResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "PersonResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'thumbnailPath'), 'Required key "PersonResponseDto[thumbnailPath]" is missing from JSON.'); + assert(json[r'thumbnailPath'] != null, 'Required key "PersonResponseDto[thumbnailPath]" has a null value in JSON.'); + return true; + }()); + return PersonResponseDto( birthDate: mapDateTime(json, r'birthDate', r''), - color: mapValueOfType(json, r'color'), + color: json.containsKey(r'color') ? Optional.present(mapValueOfType(json, r'color')) : const Optional.absent(), id: mapValueOfType(json, r'id')!, - isFavorite: mapValueOfType(json, r'isFavorite'), + isFavorite: json.containsKey(r'isFavorite') ? Optional.present(mapValueOfType(json, r'isFavorite')) : const Optional.absent(), isHidden: mapValueOfType(json, r'isHidden')!, name: mapValueOfType(json, r'name')!, thumbnailPath: mapValueOfType(json, r'thumbnailPath')!, - updatedAt: mapDateTime(json, r'updatedAt', r''), + updatedAt: json.containsKey(r'updatedAt') ? Optional.present(mapDateTime(json, r'updatedAt', r'')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/person_statistics_response_dto.dart b/mobile/openapi/lib/model/person_statistics_response_dto.dart index aeac16cc8a..0742d56e2b 100644 --- a/mobile/openapi/lib/model/person_statistics_response_dto.dart +++ b/mobile/openapi/lib/model/person_statistics_response_dto.dart @@ -48,6 +48,15 @@ class PersonStatisticsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assets'), 'Required key "PersonStatisticsResponseDto[assets]" is missing from JSON.'); + assert(json[r'assets'] != null, 'Required key "PersonStatisticsResponseDto[assets]" has a null value in JSON.'); + return true; + }()); + return PersonStatisticsResponseDto( assets: mapValueOfType(json, r'assets')!, ); diff --git a/mobile/openapi/lib/model/person_update_dto.dart b/mobile/openapi/lib/model/person_update_dto.dart index b56940e51d..f8619880c7 100644 --- a/mobile/openapi/lib/model/person_update_dto.dart +++ b/mobile/openapi/lib/model/person_update_dto.dart @@ -13,19 +13,19 @@ part of openapi.api; class PersonUpdateDto { /// Returns a new [PersonUpdateDto] instance. PersonUpdateDto({ - this.birthDate, - this.color, - this.featureFaceAssetId, - this.isFavorite, - this.isHidden, - this.name, + this.birthDate = const Optional.absent(), + this.color = const Optional.absent(), + this.featureFaceAssetId = const Optional.absent(), + this.isFavorite = const Optional.absent(), + this.isHidden = const Optional.absent(), + this.name = const Optional.absent(), }); /// Person date of birth - DateTime? birthDate; + Optional birthDate; /// Person color (hex) - String? color; + Optional color; /// Asset ID used for feature face thumbnail /// @@ -34,7 +34,7 @@ class PersonUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? featureFaceAssetId; + Optional featureFaceAssetId; /// Mark as favorite /// @@ -43,7 +43,7 @@ class PersonUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isFavorite; + Optional isFavorite; /// Person visibility (hidden) /// @@ -52,7 +52,7 @@ class PersonUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isHidden; + Optional isHidden; /// Person name /// @@ -61,7 +61,7 @@ class PersonUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? name; + Optional name; @override bool operator ==(Object other) => identical(this, other) || other is PersonUpdateDto && @@ -87,35 +87,29 @@ class PersonUpdateDto { Map toJson() { final json = {}; - if (this.birthDate != null) { - json[r'birthDate'] = _dateFormatter.format(this.birthDate!.toUtc()); - } else { - // json[r'birthDate'] = null; + if (this.birthDate.isPresent) { + final value = this.birthDate.value; + json[r'birthDate'] = value == null ? null : _dateFormatter.format(value.toUtc()); } - if (this.color != null) { - json[r'color'] = this.color; - } else { - // json[r'color'] = null; + if (this.color.isPresent) { + final value = this.color.value; + json[r'color'] = value; } - if (this.featureFaceAssetId != null) { - json[r'featureFaceAssetId'] = this.featureFaceAssetId; - } else { - // json[r'featureFaceAssetId'] = null; + if (this.featureFaceAssetId.isPresent) { + final value = this.featureFaceAssetId.value; + json[r'featureFaceAssetId'] = value; } - if (this.isFavorite != null) { - json[r'isFavorite'] = this.isFavorite; - } else { - // json[r'isFavorite'] = null; + if (this.isFavorite.isPresent) { + final value = this.isFavorite.value; + json[r'isFavorite'] = value; } - if (this.isHidden != null) { - json[r'isHidden'] = this.isHidden; - } else { - // json[r'isHidden'] = null; + if (this.isHidden.isPresent) { + final value = this.isHidden.value; + json[r'isHidden'] = value; } - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; } return json; } @@ -128,13 +122,20 @@ class PersonUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return PersonUpdateDto( - birthDate: mapDateTime(json, r'birthDate', r''), - color: mapValueOfType(json, r'color'), - featureFaceAssetId: mapValueOfType(json, r'featureFaceAssetId'), - isFavorite: mapValueOfType(json, r'isFavorite'), - isHidden: mapValueOfType(json, r'isHidden'), - name: mapValueOfType(json, r'name'), + birthDate: json.containsKey(r'birthDate') ? Optional.present(mapDateTime(json, r'birthDate', r'')) : const Optional.absent(), + color: json.containsKey(r'color') ? Optional.present(mapValueOfType(json, r'color')) : const Optional.absent(), + featureFaceAssetId: json.containsKey(r'featureFaceAssetId') ? Optional.present(mapValueOfType(json, r'featureFaceAssetId')) : const Optional.absent(), + isFavorite: json.containsKey(r'isFavorite') ? Optional.present(mapValueOfType(json, r'isFavorite')) : const Optional.absent(), + isHidden: json.containsKey(r'isHidden') ? Optional.present(mapValueOfType(json, r'isHidden')) : const Optional.absent(), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/pin_code_change_dto.dart b/mobile/openapi/lib/model/pin_code_change_dto.dart index 068cc9e91b..aed260540d 100644 --- a/mobile/openapi/lib/model/pin_code_change_dto.dart +++ b/mobile/openapi/lib/model/pin_code_change_dto.dart @@ -14,8 +14,8 @@ class PinCodeChangeDto { /// Returns a new [PinCodeChangeDto] instance. PinCodeChangeDto({ required this.newPinCode, - this.password, - this.pinCode, + this.password = const Optional.absent(), + this.pinCode = const Optional.absent(), }); /// New PIN code (4-6 digits) @@ -28,7 +28,7 @@ class PinCodeChangeDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? password; + Optional password; /// New PIN code (4-6 digits) /// @@ -37,7 +37,7 @@ class PinCodeChangeDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? pinCode; + Optional pinCode; @override bool operator ==(Object other) => identical(this, other) || other is PinCodeChangeDto && @@ -58,15 +58,13 @@ class PinCodeChangeDto { Map toJson() { final json = {}; json[r'newPinCode'] = this.newPinCode; - if (this.password != null) { - json[r'password'] = this.password; - } else { - // json[r'password'] = null; + if (this.password.isPresent) { + final value = this.password.value; + json[r'password'] = value; } - if (this.pinCode != null) { - json[r'pinCode'] = this.pinCode; - } else { - // json[r'pinCode'] = null; + if (this.pinCode.isPresent) { + final value = this.pinCode.value; + json[r'pinCode'] = value; } return json; } @@ -79,10 +77,19 @@ class PinCodeChangeDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'newPinCode'), 'Required key "PinCodeChangeDto[newPinCode]" is missing from JSON.'); + assert(json[r'newPinCode'] != null, 'Required key "PinCodeChangeDto[newPinCode]" has a null value in JSON.'); + return true; + }()); + return PinCodeChangeDto( newPinCode: mapValueOfType(json, r'newPinCode')!, - password: mapValueOfType(json, r'password'), - pinCode: mapValueOfType(json, r'pinCode'), + password: json.containsKey(r'password') ? Optional.present(mapValueOfType(json, r'password')) : const Optional.absent(), + pinCode: json.containsKey(r'pinCode') ? Optional.present(mapValueOfType(json, r'pinCode')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/pin_code_reset_dto.dart b/mobile/openapi/lib/model/pin_code_reset_dto.dart index c37be76f18..fd21263a2f 100644 --- a/mobile/openapi/lib/model/pin_code_reset_dto.dart +++ b/mobile/openapi/lib/model/pin_code_reset_dto.dart @@ -13,8 +13,8 @@ part of openapi.api; class PinCodeResetDto { /// Returns a new [PinCodeResetDto] instance. PinCodeResetDto({ - this.password, - this.pinCode, + this.password = const Optional.absent(), + this.pinCode = const Optional.absent(), }); /// User password (required if PIN code is not provided) @@ -24,7 +24,7 @@ class PinCodeResetDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? password; + Optional password; /// New PIN code (4-6 digits) /// @@ -33,7 +33,7 @@ class PinCodeResetDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? pinCode; + Optional pinCode; @override bool operator ==(Object other) => identical(this, other) || other is PinCodeResetDto && @@ -51,15 +51,13 @@ class PinCodeResetDto { Map toJson() { final json = {}; - if (this.password != null) { - json[r'password'] = this.password; - } else { - // json[r'password'] = null; + if (this.password.isPresent) { + final value = this.password.value; + json[r'password'] = value; } - if (this.pinCode != null) { - json[r'pinCode'] = this.pinCode; - } else { - // json[r'pinCode'] = null; + if (this.pinCode.isPresent) { + final value = this.pinCode.value; + json[r'pinCode'] = value; } return json; } @@ -72,9 +70,16 @@ class PinCodeResetDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return PinCodeResetDto( - password: mapValueOfType(json, r'password'), - pinCode: mapValueOfType(json, r'pinCode'), + password: json.containsKey(r'password') ? Optional.present(mapValueOfType(json, r'password')) : const Optional.absent(), + pinCode: json.containsKey(r'pinCode') ? Optional.present(mapValueOfType(json, r'pinCode')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/pin_code_setup_dto.dart b/mobile/openapi/lib/model/pin_code_setup_dto.dart index e2f08f102b..6a79e3846f 100644 --- a/mobile/openapi/lib/model/pin_code_setup_dto.dart +++ b/mobile/openapi/lib/model/pin_code_setup_dto.dart @@ -45,6 +45,15 @@ class PinCodeSetupDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'pinCode'), 'Required key "PinCodeSetupDto[pinCode]" is missing from JSON.'); + assert(json[r'pinCode'] != null, 'Required key "PinCodeSetupDto[pinCode]" has a null value in JSON.'); + return true; + }()); + return PinCodeSetupDto( pinCode: mapValueOfType(json, r'pinCode')!, ); diff --git a/mobile/openapi/lib/model/places_response_dto.dart b/mobile/openapi/lib/model/places_response_dto.dart index 94aa58eba4..484fec901b 100644 --- a/mobile/openapi/lib/model/places_response_dto.dart +++ b/mobile/openapi/lib/model/places_response_dto.dart @@ -13,8 +13,8 @@ part of openapi.api; class PlacesResponseDto { /// Returns a new [PlacesResponseDto] instance. PlacesResponseDto({ - this.admin1name, - this.admin2name, + this.admin1name = const Optional.absent(), + this.admin2name = const Optional.absent(), required this.latitude, required this.longitude, required this.name, @@ -27,7 +27,7 @@ class PlacesResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? admin1name; + Optional admin1name; /// Administrative level 2 name (county/district) /// @@ -36,7 +36,7 @@ class PlacesResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? admin2name; + Optional admin2name; /// Latitude coordinate num latitude; @@ -69,15 +69,13 @@ class PlacesResponseDto { Map toJson() { final json = {}; - if (this.admin1name != null) { - json[r'admin1name'] = this.admin1name; - } else { - // json[r'admin1name'] = null; + if (this.admin1name.isPresent) { + final value = this.admin1name.value; + json[r'admin1name'] = value; } - if (this.admin2name != null) { - json[r'admin2name'] = this.admin2name; - } else { - // json[r'admin2name'] = null; + if (this.admin2name.isPresent) { + final value = this.admin2name.value; + json[r'admin2name'] = value; } json[r'latitude'] = this.latitude; json[r'longitude'] = this.longitude; @@ -93,9 +91,22 @@ class PlacesResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'latitude'), 'Required key "PlacesResponseDto[latitude]" is missing from JSON.'); + assert(json[r'latitude'] != null, 'Required key "PlacesResponseDto[latitude]" has a null value in JSON.'); + assert(json.containsKey(r'longitude'), 'Required key "PlacesResponseDto[longitude]" is missing from JSON.'); + assert(json[r'longitude'] != null, 'Required key "PlacesResponseDto[longitude]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "PlacesResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "PlacesResponseDto[name]" has a null value in JSON.'); + return true; + }()); + return PlacesResponseDto( - admin1name: mapValueOfType(json, r'admin1name'), - admin2name: mapValueOfType(json, r'admin2name'), + admin1name: json.containsKey(r'admin1name') ? Optional.present(mapValueOfType(json, r'admin1name')) : const Optional.absent(), + admin2name: json.containsKey(r'admin2name') ? Optional.present(mapValueOfType(json, r'admin2name')) : const Optional.absent(), latitude: num.parse('${json[r'latitude']}'), longitude: num.parse('${json[r'longitude']}'), name: mapValueOfType(json, r'name')!, diff --git a/mobile/openapi/lib/model/plugin_method_response_dto.dart b/mobile/openapi/lib/model/plugin_method_response_dto.dart index 2887f4cc16..1e0c93d28f 100644 --- a/mobile/openapi/lib/model/plugin_method_response_dto.dart +++ b/mobile/openapi/lib/model/plugin_method_response_dto.dart @@ -17,7 +17,7 @@ class PluginMethodResponseDto { required this.hostFunctions, required this.key, required this.name, - this.schema, + this.schema = const Optional.absent(), required this.title, this.types = const [], this.uiHints = const [], @@ -40,7 +40,7 @@ class PluginMethodResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - Object? schema; + Optional schema; /// Title String title; @@ -83,10 +83,9 @@ class PluginMethodResponseDto { json[r'hostFunctions'] = this.hostFunctions; json[r'key'] = this.key; json[r'name'] = this.name; - if (this.schema != null) { - json[r'schema'] = this.schema; - } else { - // json[r'schema'] = null; + if (this.schema.isPresent) { + final value = this.schema.value; + json[r'schema'] = value; } json[r'title'] = this.title; json[r'types'] = this.types; @@ -102,12 +101,33 @@ class PluginMethodResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'description'), 'Required key "PluginMethodResponseDto[description]" is missing from JSON.'); + assert(json[r'description'] != null, 'Required key "PluginMethodResponseDto[description]" has a null value in JSON.'); + assert(json.containsKey(r'hostFunctions'), 'Required key "PluginMethodResponseDto[hostFunctions]" is missing from JSON.'); + assert(json[r'hostFunctions'] != null, 'Required key "PluginMethodResponseDto[hostFunctions]" has a null value in JSON.'); + assert(json.containsKey(r'key'), 'Required key "PluginMethodResponseDto[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "PluginMethodResponseDto[key]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "PluginMethodResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "PluginMethodResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'title'), 'Required key "PluginMethodResponseDto[title]" is missing from JSON.'); + assert(json[r'title'] != null, 'Required key "PluginMethodResponseDto[title]" has a null value in JSON.'); + assert(json.containsKey(r'types'), 'Required key "PluginMethodResponseDto[types]" is missing from JSON.'); + assert(json[r'types'] != null, 'Required key "PluginMethodResponseDto[types]" has a null value in JSON.'); + assert(json.containsKey(r'uiHints'), 'Required key "PluginMethodResponseDto[uiHints]" is missing from JSON.'); + assert(json[r'uiHints'] != null, 'Required key "PluginMethodResponseDto[uiHints]" has a null value in JSON.'); + return true; + }()); + return PluginMethodResponseDto( description: mapValueOfType(json, r'description')!, hostFunctions: mapValueOfType(json, r'hostFunctions')!, key: mapValueOfType(json, r'key')!, name: mapValueOfType(json, r'name')!, - schema: mapValueOfType(json, r'schema'), + schema: json.containsKey(r'schema') ? Optional.present(mapValueOfType(json, r'schema')) : const Optional.absent(), title: mapValueOfType(json, r'title')!, types: WorkflowType.listFromJson(json[r'types']), uiHints: json[r'uiHints'] is Iterable diff --git a/mobile/openapi/lib/model/plugin_response_dto.dart b/mobile/openapi/lib/model/plugin_response_dto.dart index 1bdb366f9e..01841393ce 100644 --- a/mobile/openapi/lib/model/plugin_response_dto.dart +++ b/mobile/openapi/lib/model/plugin_response_dto.dart @@ -101,6 +101,31 @@ class PluginResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'author'), 'Required key "PluginResponseDto[author]" is missing from JSON.'); + assert(json[r'author'] != null, 'Required key "PluginResponseDto[author]" has a null value in JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "PluginResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "PluginResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'description'), 'Required key "PluginResponseDto[description]" is missing from JSON.'); + assert(json[r'description'] != null, 'Required key "PluginResponseDto[description]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "PluginResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "PluginResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'methods'), 'Required key "PluginResponseDto[methods]" is missing from JSON.'); + assert(json[r'methods'] != null, 'Required key "PluginResponseDto[methods]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "PluginResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "PluginResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'title'), 'Required key "PluginResponseDto[title]" is missing from JSON.'); + assert(json[r'title'] != null, 'Required key "PluginResponseDto[title]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "PluginResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "PluginResponseDto[updatedAt]" has a null value in JSON.'); + assert(json.containsKey(r'version'), 'Required key "PluginResponseDto[version]" is missing from JSON.'); + assert(json[r'version'] != null, 'Required key "PluginResponseDto[version]" has a null value in JSON.'); + return true; + }()); + return PluginResponseDto( author: mapValueOfType(json, r'author')!, createdAt: mapValueOfType(json, r'createdAt')!, diff --git a/mobile/openapi/lib/model/plugin_template_response_dto.dart b/mobile/openapi/lib/model/plugin_template_response_dto.dart index 9f54753f49..20e9600323 100644 --- a/mobile/openapi/lib/model/plugin_template_response_dto.dart +++ b/mobile/openapi/lib/model/plugin_template_response_dto.dart @@ -79,6 +79,25 @@ class PluginTemplateResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'description'), 'Required key "PluginTemplateResponseDto[description]" is missing from JSON.'); + assert(json[r'description'] != null, 'Required key "PluginTemplateResponseDto[description]" has a null value in JSON.'); + assert(json.containsKey(r'key'), 'Required key "PluginTemplateResponseDto[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "PluginTemplateResponseDto[key]" has a null value in JSON.'); + assert(json.containsKey(r'steps'), 'Required key "PluginTemplateResponseDto[steps]" is missing from JSON.'); + assert(json[r'steps'] != null, 'Required key "PluginTemplateResponseDto[steps]" has a null value in JSON.'); + assert(json.containsKey(r'title'), 'Required key "PluginTemplateResponseDto[title]" is missing from JSON.'); + assert(json[r'title'] != null, 'Required key "PluginTemplateResponseDto[title]" has a null value in JSON.'); + assert(json.containsKey(r'trigger'), 'Required key "PluginTemplateResponseDto[trigger]" is missing from JSON.'); + assert(json[r'trigger'] != null, 'Required key "PluginTemplateResponseDto[trigger]" has a null value in JSON.'); + assert(json.containsKey(r'uiHints'), 'Required key "PluginTemplateResponseDto[uiHints]" is missing from JSON.'); + assert(json[r'uiHints'] != null, 'Required key "PluginTemplateResponseDto[uiHints]" has a null value in JSON.'); + return true; + }()); + return PluginTemplateResponseDto( description: mapValueOfType(json, r'description')!, key: mapValueOfType(json, r'key')!, diff --git a/mobile/openapi/lib/model/plugin_template_step_response_dto.dart b/mobile/openapi/lib/model/plugin_template_step_response_dto.dart index b58884d1cd..9010d5a12a 100644 --- a/mobile/openapi/lib/model/plugin_template_step_response_dto.dart +++ b/mobile/openapi/lib/model/plugin_template_step_response_dto.dart @@ -14,7 +14,7 @@ class PluginTemplateStepResponseDto { /// Returns a new [PluginTemplateStepResponseDto] instance. PluginTemplateStepResponseDto({ this.config = const {}, - this.enabled, + this.enabled = const Optional.absent(), required this.method, }); @@ -28,7 +28,7 @@ class PluginTemplateStepResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; /// Step plugin method String method; @@ -54,12 +54,11 @@ class PluginTemplateStepResponseDto { if (this.config != null) { json[r'config'] = this.config; } else { - // json[r'config'] = null; + json[r'config'] = null; } - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } json[r'method'] = this.method; return json; @@ -73,9 +72,19 @@ class PluginTemplateStepResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'config'), 'Required key "PluginTemplateStepResponseDto[config]" is missing from JSON.'); + assert(json.containsKey(r'method'), 'Required key "PluginTemplateStepResponseDto[method]" is missing from JSON.'); + assert(json[r'method'] != null, 'Required key "PluginTemplateStepResponseDto[method]" has a null value in JSON.'); + return true; + }()); + return PluginTemplateStepResponseDto( config: mapCastOfType(json, r'config'), - enabled: mapValueOfType(json, r'enabled'), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), method: mapValueOfType(json, r'method')!, ); } diff --git a/mobile/openapi/lib/model/purchase_response.dart b/mobile/openapi/lib/model/purchase_response.dart index e55c286629..e03c10ef1f 100644 --- a/mobile/openapi/lib/model/purchase_response.dart +++ b/mobile/openapi/lib/model/purchase_response.dart @@ -52,6 +52,17 @@ class PurchaseResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'hideBuyButtonUntil'), 'Required key "PurchaseResponse[hideBuyButtonUntil]" is missing from JSON.'); + assert(json[r'hideBuyButtonUntil'] != null, 'Required key "PurchaseResponse[hideBuyButtonUntil]" has a null value in JSON.'); + assert(json.containsKey(r'showSupportBadge'), 'Required key "PurchaseResponse[showSupportBadge]" is missing from JSON.'); + assert(json[r'showSupportBadge'] != null, 'Required key "PurchaseResponse[showSupportBadge]" has a null value in JSON.'); + return true; + }()); + return PurchaseResponse( hideBuyButtonUntil: mapValueOfType(json, r'hideBuyButtonUntil')!, showSupportBadge: mapValueOfType(json, r'showSupportBadge')!, diff --git a/mobile/openapi/lib/model/purchase_update.dart b/mobile/openapi/lib/model/purchase_update.dart index 913faf9bc4..b13ef4525e 100644 --- a/mobile/openapi/lib/model/purchase_update.dart +++ b/mobile/openapi/lib/model/purchase_update.dart @@ -13,8 +13,8 @@ part of openapi.api; class PurchaseUpdate { /// Returns a new [PurchaseUpdate] instance. PurchaseUpdate({ - this.hideBuyButtonUntil, - this.showSupportBadge, + this.hideBuyButtonUntil = const Optional.absent(), + this.showSupportBadge = const Optional.absent(), }); /// Date until which to hide buy button @@ -24,7 +24,7 @@ class PurchaseUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? hideBuyButtonUntil; + Optional hideBuyButtonUntil; /// Whether to show support badge /// @@ -33,7 +33,7 @@ class PurchaseUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? showSupportBadge; + Optional showSupportBadge; @override bool operator ==(Object other) => identical(this, other) || other is PurchaseUpdate && @@ -51,15 +51,13 @@ class PurchaseUpdate { Map toJson() { final json = {}; - if (this.hideBuyButtonUntil != null) { - json[r'hideBuyButtonUntil'] = this.hideBuyButtonUntil; - } else { - // json[r'hideBuyButtonUntil'] = null; + if (this.hideBuyButtonUntil.isPresent) { + final value = this.hideBuyButtonUntil.value; + json[r'hideBuyButtonUntil'] = value; } - if (this.showSupportBadge != null) { - json[r'showSupportBadge'] = this.showSupportBadge; - } else { - // json[r'showSupportBadge'] = null; + if (this.showSupportBadge.isPresent) { + final value = this.showSupportBadge.value; + json[r'showSupportBadge'] = value; } return json; } @@ -72,9 +70,16 @@ class PurchaseUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return PurchaseUpdate( - hideBuyButtonUntil: mapValueOfType(json, r'hideBuyButtonUntil'), - showSupportBadge: mapValueOfType(json, r'showSupportBadge'), + hideBuyButtonUntil: json.containsKey(r'hideBuyButtonUntil') ? Optional.present(mapValueOfType(json, r'hideBuyButtonUntil')) : const Optional.absent(), + showSupportBadge: json.containsKey(r'showSupportBadge') ? Optional.present(mapValueOfType(json, r'showSupportBadge')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/queue_command_dto.dart b/mobile/openapi/lib/model/queue_command_dto.dart index fb68d85583..aac86aacb0 100644 --- a/mobile/openapi/lib/model/queue_command_dto.dart +++ b/mobile/openapi/lib/model/queue_command_dto.dart @@ -14,7 +14,7 @@ class QueueCommandDto { /// Returns a new [QueueCommandDto] instance. QueueCommandDto({ required this.command, - this.force, + this.force = const Optional.absent(), }); QueueCommand command; @@ -26,7 +26,7 @@ class QueueCommandDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? force; + Optional force; @override bool operator ==(Object other) => identical(this, other) || other is QueueCommandDto && @@ -45,10 +45,9 @@ class QueueCommandDto { Map toJson() { final json = {}; json[r'command'] = this.command; - if (this.force != null) { - json[r'force'] = this.force; - } else { - // json[r'force'] = null; + if (this.force.isPresent) { + final value = this.force.value; + json[r'force'] = value; } return json; } @@ -61,9 +60,18 @@ class QueueCommandDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'command'), 'Required key "QueueCommandDto[command]" is missing from JSON.'); + assert(json[r'command'] != null, 'Required key "QueueCommandDto[command]" has a null value in JSON.'); + return true; + }()); + return QueueCommandDto( command: QueueCommand.fromJson(json[r'command'])!, - force: mapValueOfType(json, r'force'), + force: json.containsKey(r'force') ? Optional.present(mapValueOfType(json, r'force')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/queue_delete_dto.dart b/mobile/openapi/lib/model/queue_delete_dto.dart index d319238f92..0cf1235de3 100644 --- a/mobile/openapi/lib/model/queue_delete_dto.dart +++ b/mobile/openapi/lib/model/queue_delete_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class QueueDeleteDto { /// Returns a new [QueueDeleteDto] instance. QueueDeleteDto({ - this.failed, + this.failed = const Optional.absent(), }); /// If true, will also remove failed jobs from the queue. @@ -23,7 +23,7 @@ class QueueDeleteDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? failed; + Optional failed; @override bool operator ==(Object other) => identical(this, other) || other is QueueDeleteDto && @@ -39,10 +39,9 @@ class QueueDeleteDto { Map toJson() { final json = {}; - if (this.failed != null) { - json[r'failed'] = this.failed; - } else { - // json[r'failed'] = null; + if (this.failed.isPresent) { + final value = this.failed.value; + json[r'failed'] = value; } return json; } @@ -55,8 +54,15 @@ class QueueDeleteDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return QueueDeleteDto( - failed: mapValueOfType(json, r'failed'), + failed: json.containsKey(r'failed') ? Optional.present(mapValueOfType(json, r'failed')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/queue_job_response_dto.dart b/mobile/openapi/lib/model/queue_job_response_dto.dart index 06d433edad..85c05914bf 100644 --- a/mobile/openapi/lib/model/queue_job_response_dto.dart +++ b/mobile/openapi/lib/model/queue_job_response_dto.dart @@ -14,7 +14,7 @@ class QueueJobResponseDto { /// Returns a new [QueueJobResponseDto] instance. QueueJobResponseDto({ this.data = const {}, - this.id, + this.id = const Optional.absent(), required this.name, required this.timestamp, }); @@ -29,7 +29,7 @@ class QueueJobResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? id; + Optional id; JobName name; @@ -60,10 +60,9 @@ class QueueJobResponseDto { Map toJson() { final json = {}; json[r'data'] = this.data; - if (this.id != null) { - json[r'id'] = this.id; - } else { - // json[r'id'] = null; + if (this.id.isPresent) { + final value = this.id.value; + json[r'id'] = value; } json[r'name'] = this.name; json[r'timestamp'] = this.timestamp; @@ -78,9 +77,22 @@ class QueueJobResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'data'), 'Required key "QueueJobResponseDto[data]" is missing from JSON.'); + assert(json[r'data'] != null, 'Required key "QueueJobResponseDto[data]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "QueueJobResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "QueueJobResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'timestamp'), 'Required key "QueueJobResponseDto[timestamp]" is missing from JSON.'); + assert(json[r'timestamp'] != null, 'Required key "QueueJobResponseDto[timestamp]" has a null value in JSON.'); + return true; + }()); + return QueueJobResponseDto( data: mapCastOfType(json, r'data')!, - id: mapValueOfType(json, r'id'), + id: json.containsKey(r'id') ? Optional.present(mapValueOfType(json, r'id')) : const Optional.absent(), name: JobName.fromJson(json[r'name'])!, timestamp: mapValueOfType(json, r'timestamp')!, ); diff --git a/mobile/openapi/lib/model/queue_response_dto.dart b/mobile/openapi/lib/model/queue_response_dto.dart index c88f9fc195..e8bcada6ba 100644 --- a/mobile/openapi/lib/model/queue_response_dto.dart +++ b/mobile/openapi/lib/model/queue_response_dto.dart @@ -57,6 +57,19 @@ class QueueResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'isPaused'), 'Required key "QueueResponseDto[isPaused]" is missing from JSON.'); + assert(json[r'isPaused'] != null, 'Required key "QueueResponseDto[isPaused]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "QueueResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "QueueResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'statistics'), 'Required key "QueueResponseDto[statistics]" is missing from JSON.'); + assert(json[r'statistics'] != null, 'Required key "QueueResponseDto[statistics]" has a null value in JSON.'); + return true; + }()); + return QueueResponseDto( isPaused: mapValueOfType(json, r'isPaused')!, name: QueueName.fromJson(json[r'name'])!, diff --git a/mobile/openapi/lib/model/queue_response_legacy_dto.dart b/mobile/openapi/lib/model/queue_response_legacy_dto.dart index 214b0b31f6..9c18866da4 100644 --- a/mobile/openapi/lib/model/queue_response_legacy_dto.dart +++ b/mobile/openapi/lib/model/queue_response_legacy_dto.dart @@ -50,6 +50,17 @@ class QueueResponseLegacyDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'jobCounts'), 'Required key "QueueResponseLegacyDto[jobCounts]" is missing from JSON.'); + assert(json[r'jobCounts'] != null, 'Required key "QueueResponseLegacyDto[jobCounts]" has a null value in JSON.'); + assert(json.containsKey(r'queueStatus'), 'Required key "QueueResponseLegacyDto[queueStatus]" is missing from JSON.'); + assert(json[r'queueStatus'] != null, 'Required key "QueueResponseLegacyDto[queueStatus]" has a null value in JSON.'); + return true; + }()); + return QueueResponseLegacyDto( jobCounts: QueueStatisticsDto.fromJson(json[r'jobCounts'])!, queueStatus: QueueStatusLegacyDto.fromJson(json[r'queueStatus'])!, diff --git a/mobile/openapi/lib/model/queue_statistics_dto.dart b/mobile/openapi/lib/model/queue_statistics_dto.dart index 86c75f8e7c..4d68c0a32c 100644 --- a/mobile/openapi/lib/model/queue_statistics_dto.dart +++ b/mobile/openapi/lib/model/queue_statistics_dto.dart @@ -98,6 +98,25 @@ class QueueStatisticsDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'active'), 'Required key "QueueStatisticsDto[active]" is missing from JSON.'); + assert(json[r'active'] != null, 'Required key "QueueStatisticsDto[active]" has a null value in JSON.'); + assert(json.containsKey(r'completed'), 'Required key "QueueStatisticsDto[completed]" is missing from JSON.'); + assert(json[r'completed'] != null, 'Required key "QueueStatisticsDto[completed]" has a null value in JSON.'); + assert(json.containsKey(r'delayed'), 'Required key "QueueStatisticsDto[delayed]" is missing from JSON.'); + assert(json[r'delayed'] != null, 'Required key "QueueStatisticsDto[delayed]" has a null value in JSON.'); + assert(json.containsKey(r'failed'), 'Required key "QueueStatisticsDto[failed]" is missing from JSON.'); + assert(json[r'failed'] != null, 'Required key "QueueStatisticsDto[failed]" has a null value in JSON.'); + assert(json.containsKey(r'paused'), 'Required key "QueueStatisticsDto[paused]" is missing from JSON.'); + assert(json[r'paused'] != null, 'Required key "QueueStatisticsDto[paused]" has a null value in JSON.'); + assert(json.containsKey(r'waiting'), 'Required key "QueueStatisticsDto[waiting]" is missing from JSON.'); + assert(json[r'waiting'] != null, 'Required key "QueueStatisticsDto[waiting]" has a null value in JSON.'); + return true; + }()); + return QueueStatisticsDto( active: mapValueOfType(json, r'active')!, completed: mapValueOfType(json, r'completed')!, diff --git a/mobile/openapi/lib/model/queue_status_legacy_dto.dart b/mobile/openapi/lib/model/queue_status_legacy_dto.dart index de6ce63319..ca4b0b0c33 100644 --- a/mobile/openapi/lib/model/queue_status_legacy_dto.dart +++ b/mobile/openapi/lib/model/queue_status_legacy_dto.dart @@ -52,6 +52,17 @@ class QueueStatusLegacyDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'isActive'), 'Required key "QueueStatusLegacyDto[isActive]" is missing from JSON.'); + assert(json[r'isActive'] != null, 'Required key "QueueStatusLegacyDto[isActive]" has a null value in JSON.'); + assert(json.containsKey(r'isPaused'), 'Required key "QueueStatusLegacyDto[isPaused]" is missing from JSON.'); + assert(json[r'isPaused'] != null, 'Required key "QueueStatusLegacyDto[isPaused]" has a null value in JSON.'); + return true; + }()); + return QueueStatusLegacyDto( isActive: mapValueOfType(json, r'isActive')!, isPaused: mapValueOfType(json, r'isPaused')!, diff --git a/mobile/openapi/lib/model/queue_update_dto.dart b/mobile/openapi/lib/model/queue_update_dto.dart index 28aafe95f7..fb6bc41d24 100644 --- a/mobile/openapi/lib/model/queue_update_dto.dart +++ b/mobile/openapi/lib/model/queue_update_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class QueueUpdateDto { /// Returns a new [QueueUpdateDto] instance. QueueUpdateDto({ - this.isPaused, + this.isPaused = const Optional.absent(), }); /// Whether to pause the queue @@ -23,7 +23,7 @@ class QueueUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isPaused; + Optional isPaused; @override bool operator ==(Object other) => identical(this, other) || other is QueueUpdateDto && @@ -39,10 +39,9 @@ class QueueUpdateDto { Map toJson() { final json = {}; - if (this.isPaused != null) { - json[r'isPaused'] = this.isPaused; - } else { - // json[r'isPaused'] = null; + if (this.isPaused.isPresent) { + final value = this.isPaused.value; + json[r'isPaused'] = value; } return json; } @@ -55,8 +54,15 @@ class QueueUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return QueueUpdateDto( - isPaused: mapValueOfType(json, r'isPaused'), + isPaused: json.containsKey(r'isPaused') ? Optional.present(mapValueOfType(json, r'isPaused')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/queues_response_legacy_dto.dart b/mobile/openapi/lib/model/queues_response_legacy_dto.dart index c7bc23cb4d..edd400f0a7 100644 --- a/mobile/openapi/lib/model/queues_response_legacy_dto.dart +++ b/mobile/openapi/lib/model/queues_response_legacy_dto.dart @@ -146,6 +146,49 @@ class QueuesResponseLegacyDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'backgroundTask'), 'Required key "QueuesResponseLegacyDto[backgroundTask]" is missing from JSON.'); + assert(json[r'backgroundTask'] != null, 'Required key "QueuesResponseLegacyDto[backgroundTask]" has a null value in JSON.'); + assert(json.containsKey(r'backupDatabase'), 'Required key "QueuesResponseLegacyDto[backupDatabase]" is missing from JSON.'); + assert(json[r'backupDatabase'] != null, 'Required key "QueuesResponseLegacyDto[backupDatabase]" has a null value in JSON.'); + assert(json.containsKey(r'duplicateDetection'), 'Required key "QueuesResponseLegacyDto[duplicateDetection]" is missing from JSON.'); + assert(json[r'duplicateDetection'] != null, 'Required key "QueuesResponseLegacyDto[duplicateDetection]" has a null value in JSON.'); + assert(json.containsKey(r'editor'), 'Required key "QueuesResponseLegacyDto[editor]" is missing from JSON.'); + assert(json[r'editor'] != null, 'Required key "QueuesResponseLegacyDto[editor]" has a null value in JSON.'); + assert(json.containsKey(r'faceDetection'), 'Required key "QueuesResponseLegacyDto[faceDetection]" is missing from JSON.'); + assert(json[r'faceDetection'] != null, 'Required key "QueuesResponseLegacyDto[faceDetection]" has a null value in JSON.'); + assert(json.containsKey(r'facialRecognition'), 'Required key "QueuesResponseLegacyDto[facialRecognition]" is missing from JSON.'); + assert(json[r'facialRecognition'] != null, 'Required key "QueuesResponseLegacyDto[facialRecognition]" has a null value in JSON.'); + assert(json.containsKey(r'library'), 'Required key "QueuesResponseLegacyDto[library]" is missing from JSON.'); + assert(json[r'library'] != null, 'Required key "QueuesResponseLegacyDto[library]" has a null value in JSON.'); + assert(json.containsKey(r'metadataExtraction'), 'Required key "QueuesResponseLegacyDto[metadataExtraction]" is missing from JSON.'); + assert(json[r'metadataExtraction'] != null, 'Required key "QueuesResponseLegacyDto[metadataExtraction]" has a null value in JSON.'); + assert(json.containsKey(r'migration'), 'Required key "QueuesResponseLegacyDto[migration]" is missing from JSON.'); + assert(json[r'migration'] != null, 'Required key "QueuesResponseLegacyDto[migration]" has a null value in JSON.'); + assert(json.containsKey(r'notifications'), 'Required key "QueuesResponseLegacyDto[notifications]" is missing from JSON.'); + assert(json[r'notifications'] != null, 'Required key "QueuesResponseLegacyDto[notifications]" has a null value in JSON.'); + assert(json.containsKey(r'ocr'), 'Required key "QueuesResponseLegacyDto[ocr]" is missing from JSON.'); + assert(json[r'ocr'] != null, 'Required key "QueuesResponseLegacyDto[ocr]" has a null value in JSON.'); + assert(json.containsKey(r'search'), 'Required key "QueuesResponseLegacyDto[search]" is missing from JSON.'); + assert(json[r'search'] != null, 'Required key "QueuesResponseLegacyDto[search]" has a null value in JSON.'); + assert(json.containsKey(r'sidecar'), 'Required key "QueuesResponseLegacyDto[sidecar]" is missing from JSON.'); + assert(json[r'sidecar'] != null, 'Required key "QueuesResponseLegacyDto[sidecar]" has a null value in JSON.'); + assert(json.containsKey(r'smartSearch'), 'Required key "QueuesResponseLegacyDto[smartSearch]" is missing from JSON.'); + assert(json[r'smartSearch'] != null, 'Required key "QueuesResponseLegacyDto[smartSearch]" has a null value in JSON.'); + assert(json.containsKey(r'storageTemplateMigration'), 'Required key "QueuesResponseLegacyDto[storageTemplateMigration]" is missing from JSON.'); + assert(json[r'storageTemplateMigration'] != null, 'Required key "QueuesResponseLegacyDto[storageTemplateMigration]" has a null value in JSON.'); + assert(json.containsKey(r'thumbnailGeneration'), 'Required key "QueuesResponseLegacyDto[thumbnailGeneration]" is missing from JSON.'); + assert(json[r'thumbnailGeneration'] != null, 'Required key "QueuesResponseLegacyDto[thumbnailGeneration]" has a null value in JSON.'); + assert(json.containsKey(r'videoConversion'), 'Required key "QueuesResponseLegacyDto[videoConversion]" is missing from JSON.'); + assert(json[r'videoConversion'] != null, 'Required key "QueuesResponseLegacyDto[videoConversion]" has a null value in JSON.'); + assert(json.containsKey(r'workflow'), 'Required key "QueuesResponseLegacyDto[workflow]" is missing from JSON.'); + assert(json[r'workflow'] != null, 'Required key "QueuesResponseLegacyDto[workflow]" has a null value in JSON.'); + return true; + }()); + return QueuesResponseLegacyDto( backgroundTask: QueueResponseLegacyDto.fromJson(json[r'backgroundTask'])!, backupDatabase: QueueResponseLegacyDto.fromJson(json[r'backupDatabase'])!, diff --git a/mobile/openapi/lib/model/random_search_dto.dart b/mobile/openapi/lib/model/random_search_dto.dart index 728072639c..bfd7e7f701 100644 --- a/mobile/openapi/lib/model/random_search_dto.dart +++ b/mobile/openapi/lib/model/random_search_dto.dart @@ -13,48 +13,48 @@ part of openapi.api; class RandomSearchDto { /// Returns a new [RandomSearchDto] instance. RandomSearchDto({ - this.albumIds = const [], - this.city, - this.country, - this.createdAfter, - this.createdBefore, - this.isEncoded, - this.isFavorite, - this.isMotion, - this.isNotInAlbum, - this.isOffline, - this.lensModel, - this.libraryId, - this.make, - this.model, - this.ocr, - this.personIds = const [], - this.rating, - this.size, - this.state, - this.tagIds = const [], - this.takenAfter, - this.takenBefore, - this.trashedAfter, - this.trashedBefore, - this.type, - this.updatedAfter, - this.updatedBefore, - this.visibility, - this.withDeleted, - this.withExif, - this.withPeople, - this.withStacked, + this.albumIds = const Optional.present(const []), + this.city = const Optional.absent(), + this.country = const Optional.absent(), + this.createdAfter = const Optional.absent(), + this.createdBefore = const Optional.absent(), + this.isEncoded = const Optional.absent(), + this.isFavorite = const Optional.absent(), + this.isMotion = const Optional.absent(), + this.isNotInAlbum = const Optional.absent(), + this.isOffline = const Optional.absent(), + this.lensModel = const Optional.absent(), + this.libraryId = const Optional.absent(), + this.make = const Optional.absent(), + this.model = const Optional.absent(), + this.ocr = const Optional.absent(), + this.personIds = const Optional.present(const []), + this.rating = const Optional.absent(), + this.size = const Optional.absent(), + this.state = const Optional.absent(), + this.tagIds = const Optional.present(const []), + this.takenAfter = const Optional.absent(), + this.takenBefore = const Optional.absent(), + this.trashedAfter = const Optional.absent(), + this.trashedBefore = const Optional.absent(), + this.type = const Optional.absent(), + this.updatedAfter = const Optional.absent(), + this.updatedBefore = const Optional.absent(), + this.visibility = const Optional.absent(), + this.withDeleted = const Optional.absent(), + this.withExif = const Optional.absent(), + this.withPeople = const Optional.absent(), + this.withStacked = const Optional.absent(), }); /// Filter by album IDs - List albumIds; + Optional?> albumIds; /// Filter by city name - String? city; + Optional city; /// Filter by country name - String? country; + Optional country; /// Filter by creation date (after) /// @@ -63,7 +63,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? createdAfter; + Optional createdAfter; /// Filter by creation date (before) /// @@ -72,7 +72,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? createdBefore; + Optional createdBefore; /// Filter by encoded status /// @@ -81,7 +81,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isEncoded; + Optional isEncoded; /// Filter by favorite status /// @@ -90,7 +90,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isFavorite; + Optional isFavorite; /// Filter by motion photo status /// @@ -99,7 +99,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isMotion; + Optional isMotion; /// Filter assets not in any album /// @@ -108,7 +108,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isNotInAlbum; + Optional isNotInAlbum; /// Filter by offline status /// @@ -117,19 +117,19 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isOffline; + Optional isOffline; /// Filter by lens model - String? lensModel; + Optional lensModel; /// Library ID to filter by - String? libraryId; + Optional libraryId; /// Filter by camera make - String? make; + Optional make; /// Filter by camera model - String? model; + Optional model; /// Filter by OCR text content /// @@ -138,16 +138,16 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? ocr; + Optional ocr; /// Filter by person IDs - List personIds; + Optional?> personIds; /// Filter by rating [1-5], or null for unrated /// /// Minimum value: -1 /// Maximum value: 5 - int? rating; + Optional rating; /// Number of results to return /// @@ -159,13 +159,13 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? size; + Optional size; /// Filter by state/province name - String? state; + Optional state; /// Filter by tag IDs - List? tagIds; + Optional?> tagIds; /// Filter by taken date (after) /// @@ -174,7 +174,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? takenAfter; + Optional takenAfter; /// Filter by taken date (before) /// @@ -183,7 +183,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? takenBefore; + Optional takenBefore; /// Filter by trash date (after) /// @@ -192,7 +192,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? trashedAfter; + Optional trashedAfter; /// Filter by trash date (before) /// @@ -201,7 +201,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? trashedBefore; + Optional trashedBefore; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -209,7 +209,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetTypeEnum? type; + Optional type; /// Filter by update date (after) /// @@ -218,7 +218,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? updatedAfter; + Optional updatedAfter; /// Filter by update date (before) /// @@ -227,7 +227,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? updatedBefore; + Optional updatedBefore; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -235,7 +235,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetVisibility? visibility; + Optional visibility; /// Include deleted assets /// @@ -244,7 +244,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? withDeleted; + Optional withDeleted; /// Include EXIF data in response /// @@ -253,7 +253,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? withExif; + Optional withExif; /// Include people data in response /// @@ -262,7 +262,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? withPeople; + Optional withPeople; /// Include stacked assets /// @@ -271,7 +271,7 @@ class RandomSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? withStacked; + Optional withStacked; @override bool operator ==(Object other) => identical(this, other) || other is RandomSearchDto && @@ -349,173 +349,149 @@ class RandomSearchDto { Map toJson() { final json = {}; - json[r'albumIds'] = this.albumIds; - if (this.city != null) { - json[r'city'] = this.city; - } else { - // json[r'city'] = null; + if (this.albumIds.isPresent) { + final value = this.albumIds.value; + json[r'albumIds'] = value; } - if (this.country != null) { - json[r'country'] = this.country; - } else { - // json[r'country'] = null; + if (this.city.isPresent) { + final value = this.city.value; + json[r'city'] = value; } - if (this.createdAfter != null) { - json[r'createdAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.createdAfter!.millisecondsSinceEpoch - : this.createdAfter!.toUtc().toIso8601String(); - } else { - // json[r'createdAfter'] = null; + if (this.country.isPresent) { + final value = this.country.value; + json[r'country'] = value; } - if (this.createdBefore != null) { - json[r'createdBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.createdBefore!.millisecondsSinceEpoch - : this.createdBefore!.toUtc().toIso8601String(); - } else { - // json[r'createdBefore'] = null; + if (this.createdAfter.isPresent) { + final value = this.createdAfter.value; + json[r'createdAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.isEncoded != null) { - json[r'isEncoded'] = this.isEncoded; - } else { - // json[r'isEncoded'] = null; + if (this.createdBefore.isPresent) { + final value = this.createdBefore.value; + json[r'createdBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.isFavorite != null) { - json[r'isFavorite'] = this.isFavorite; - } else { - // json[r'isFavorite'] = null; + if (this.isEncoded.isPresent) { + final value = this.isEncoded.value; + json[r'isEncoded'] = value; } - if (this.isMotion != null) { - json[r'isMotion'] = this.isMotion; - } else { - // json[r'isMotion'] = null; + if (this.isFavorite.isPresent) { + final value = this.isFavorite.value; + json[r'isFavorite'] = value; } - if (this.isNotInAlbum != null) { - json[r'isNotInAlbum'] = this.isNotInAlbum; - } else { - // json[r'isNotInAlbum'] = null; + if (this.isMotion.isPresent) { + final value = this.isMotion.value; + json[r'isMotion'] = value; } - if (this.isOffline != null) { - json[r'isOffline'] = this.isOffline; - } else { - // json[r'isOffline'] = null; + if (this.isNotInAlbum.isPresent) { + final value = this.isNotInAlbum.value; + json[r'isNotInAlbum'] = value; } - if (this.lensModel != null) { - json[r'lensModel'] = this.lensModel; - } else { - // json[r'lensModel'] = null; + if (this.isOffline.isPresent) { + final value = this.isOffline.value; + json[r'isOffline'] = value; } - if (this.libraryId != null) { - json[r'libraryId'] = this.libraryId; - } else { - // json[r'libraryId'] = null; + if (this.lensModel.isPresent) { + final value = this.lensModel.value; + json[r'lensModel'] = value; } - if (this.make != null) { - json[r'make'] = this.make; - } else { - // json[r'make'] = null; + if (this.libraryId.isPresent) { + final value = this.libraryId.value; + json[r'libraryId'] = value; } - if (this.model != null) { - json[r'model'] = this.model; - } else { - // json[r'model'] = null; + if (this.make.isPresent) { + final value = this.make.value; + json[r'make'] = value; } - if (this.ocr != null) { - json[r'ocr'] = this.ocr; - } else { - // json[r'ocr'] = null; + if (this.model.isPresent) { + final value = this.model.value; + json[r'model'] = value; } - json[r'personIds'] = this.personIds; - if (this.rating != null) { - json[r'rating'] = this.rating; - } else { - // json[r'rating'] = null; + if (this.ocr.isPresent) { + final value = this.ocr.value; + json[r'ocr'] = value; } - if (this.size != null) { - json[r'size'] = this.size; - } else { - // json[r'size'] = null; + if (this.personIds.isPresent) { + final value = this.personIds.value; + json[r'personIds'] = value; } - if (this.state != null) { - json[r'state'] = this.state; - } else { - // json[r'state'] = null; + if (this.rating.isPresent) { + final value = this.rating.value; + json[r'rating'] = value; } - if (this.tagIds != null) { - json[r'tagIds'] = this.tagIds; - } else { - // json[r'tagIds'] = null; + if (this.size.isPresent) { + final value = this.size.value; + json[r'size'] = value; } - if (this.takenAfter != null) { - json[r'takenAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.takenAfter!.millisecondsSinceEpoch - : this.takenAfter!.toUtc().toIso8601String(); - } else { - // json[r'takenAfter'] = null; + if (this.state.isPresent) { + final value = this.state.value; + json[r'state'] = value; } - if (this.takenBefore != null) { - json[r'takenBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.takenBefore!.millisecondsSinceEpoch - : this.takenBefore!.toUtc().toIso8601String(); - } else { - // json[r'takenBefore'] = null; + if (this.tagIds.isPresent) { + final value = this.tagIds.value; + json[r'tagIds'] = value; } - if (this.trashedAfter != null) { - json[r'trashedAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.trashedAfter!.millisecondsSinceEpoch - : this.trashedAfter!.toUtc().toIso8601String(); - } else { - // json[r'trashedAfter'] = null; + if (this.takenAfter.isPresent) { + final value = this.takenAfter.value; + json[r'takenAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.trashedBefore != null) { - json[r'trashedBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.trashedBefore!.millisecondsSinceEpoch - : this.trashedBefore!.toUtc().toIso8601String(); - } else { - // json[r'trashedBefore'] = null; + if (this.takenBefore.isPresent) { + final value = this.takenBefore.value; + json[r'takenBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.type != null) { - json[r'type'] = this.type; - } else { - // json[r'type'] = null; + if (this.trashedAfter.isPresent) { + final value = this.trashedAfter.value; + json[r'trashedAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.updatedAfter != null) { - json[r'updatedAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.updatedAfter!.millisecondsSinceEpoch - : this.updatedAfter!.toUtc().toIso8601String(); - } else { - // json[r'updatedAfter'] = null; + if (this.trashedBefore.isPresent) { + final value = this.trashedBefore.value; + json[r'trashedBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.updatedBefore != null) { - json[r'updatedBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.updatedBefore!.millisecondsSinceEpoch - : this.updatedBefore!.toUtc().toIso8601String(); - } else { - // json[r'updatedBefore'] = null; + if (this.type.isPresent) { + final value = this.type.value; + json[r'type'] = value; } - if (this.visibility != null) { - json[r'visibility'] = this.visibility; - } else { - // json[r'visibility'] = null; + if (this.updatedAfter.isPresent) { + final value = this.updatedAfter.value; + json[r'updatedAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.withDeleted != null) { - json[r'withDeleted'] = this.withDeleted; - } else { - // json[r'withDeleted'] = null; + if (this.updatedBefore.isPresent) { + final value = this.updatedBefore.value; + json[r'updatedBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.withExif != null) { - json[r'withExif'] = this.withExif; - } else { - // json[r'withExif'] = null; + if (this.visibility.isPresent) { + final value = this.visibility.value; + json[r'visibility'] = value; } - if (this.withPeople != null) { - json[r'withPeople'] = this.withPeople; - } else { - // json[r'withPeople'] = null; + if (this.withDeleted.isPresent) { + final value = this.withDeleted.value; + json[r'withDeleted'] = value; } - if (this.withStacked != null) { - json[r'withStacked'] = this.withStacked; - } else { - // json[r'withStacked'] = null; + if (this.withExif.isPresent) { + final value = this.withExif.value; + json[r'withExif'] = value; + } + if (this.withPeople.isPresent) { + final value = this.withPeople.value; + json[r'withPeople'] = value; + } + if (this.withStacked.isPresent) { + final value = this.withStacked.value; + json[r'withStacked'] = value; } return json; } @@ -528,45 +504,52 @@ class RandomSearchDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return RandomSearchDto( - albumIds: json[r'albumIds'] is Iterable + albumIds: json.containsKey(r'albumIds') ? Optional.present(json[r'albumIds'] is Iterable ? (json[r'albumIds'] as Iterable).cast().toList(growable: false) - : const [], - city: mapValueOfType(json, r'city'), - country: mapValueOfType(json, r'country'), - createdAfter: mapDateTime(json, r'createdAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - createdBefore: mapDateTime(json, r'createdBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - isEncoded: mapValueOfType(json, r'isEncoded'), - isFavorite: mapValueOfType(json, r'isFavorite'), - isMotion: mapValueOfType(json, r'isMotion'), - isNotInAlbum: mapValueOfType(json, r'isNotInAlbum'), - isOffline: mapValueOfType(json, r'isOffline'), - lensModel: mapValueOfType(json, r'lensModel'), - libraryId: mapValueOfType(json, r'libraryId'), - make: mapValueOfType(json, r'make'), - model: mapValueOfType(json, r'model'), - ocr: mapValueOfType(json, r'ocr'), - personIds: json[r'personIds'] is Iterable + : const []) : const Optional.absent(), + city: json.containsKey(r'city') ? Optional.present(mapValueOfType(json, r'city')) : const Optional.absent(), + country: json.containsKey(r'country') ? Optional.present(mapValueOfType(json, r'country')) : const Optional.absent(), + createdAfter: json.containsKey(r'createdAfter') ? Optional.present(mapDateTime(json, r'createdAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + createdBefore: json.containsKey(r'createdBefore') ? Optional.present(mapDateTime(json, r'createdBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + isEncoded: json.containsKey(r'isEncoded') ? Optional.present(mapValueOfType(json, r'isEncoded')) : const Optional.absent(), + isFavorite: json.containsKey(r'isFavorite') ? Optional.present(mapValueOfType(json, r'isFavorite')) : const Optional.absent(), + isMotion: json.containsKey(r'isMotion') ? Optional.present(mapValueOfType(json, r'isMotion')) : const Optional.absent(), + isNotInAlbum: json.containsKey(r'isNotInAlbum') ? Optional.present(mapValueOfType(json, r'isNotInAlbum')) : const Optional.absent(), + isOffline: json.containsKey(r'isOffline') ? Optional.present(mapValueOfType(json, r'isOffline')) : const Optional.absent(), + lensModel: json.containsKey(r'lensModel') ? Optional.present(mapValueOfType(json, r'lensModel')) : const Optional.absent(), + libraryId: json.containsKey(r'libraryId') ? Optional.present(mapValueOfType(json, r'libraryId')) : const Optional.absent(), + make: json.containsKey(r'make') ? Optional.present(mapValueOfType(json, r'make')) : const Optional.absent(), + model: json.containsKey(r'model') ? Optional.present(mapValueOfType(json, r'model')) : const Optional.absent(), + ocr: json.containsKey(r'ocr') ? Optional.present(mapValueOfType(json, r'ocr')) : const Optional.absent(), + personIds: json.containsKey(r'personIds') ? Optional.present(json[r'personIds'] is Iterable ? (json[r'personIds'] as Iterable).cast().toList(growable: false) - : const [], - rating: mapValueOfType(json, r'rating'), - size: mapValueOfType(json, r'size'), - state: mapValueOfType(json, r'state'), - tagIds: json[r'tagIds'] is Iterable + : const []) : const Optional.absent(), + rating: json.containsKey(r'rating') ? Optional.present(json[r'rating'] == null ? null : int.parse('${json[r'rating']}')) : const Optional.absent(), + size: json.containsKey(r'size') ? Optional.present(json[r'size'] == null ? null : int.parse('${json[r'size']}')) : const Optional.absent(), + state: json.containsKey(r'state') ? Optional.present(mapValueOfType(json, r'state')) : const Optional.absent(), + tagIds: json.containsKey(r'tagIds') ? Optional.present(json[r'tagIds'] is Iterable ? (json[r'tagIds'] as Iterable).cast().toList(growable: false) - : const [], - takenAfter: mapDateTime(json, r'takenAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - takenBefore: mapDateTime(json, r'takenBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - trashedAfter: mapDateTime(json, r'trashedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - trashedBefore: mapDateTime(json, r'trashedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - type: AssetTypeEnum.fromJson(json[r'type']), - updatedAfter: mapDateTime(json, r'updatedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - updatedBefore: mapDateTime(json, r'updatedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - visibility: AssetVisibility.fromJson(json[r'visibility']), - withDeleted: mapValueOfType(json, r'withDeleted'), - withExif: mapValueOfType(json, r'withExif'), - withPeople: mapValueOfType(json, r'withPeople'), - withStacked: mapValueOfType(json, r'withStacked'), + : const []) : const Optional.absent(), + takenAfter: json.containsKey(r'takenAfter') ? Optional.present(mapDateTime(json, r'takenAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + takenBefore: json.containsKey(r'takenBefore') ? Optional.present(mapDateTime(json, r'takenBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + trashedAfter: json.containsKey(r'trashedAfter') ? Optional.present(mapDateTime(json, r'trashedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + trashedBefore: json.containsKey(r'trashedBefore') ? Optional.present(mapDateTime(json, r'trashedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + type: json.containsKey(r'type') ? Optional.present(AssetTypeEnum.fromJson(json[r'type'])) : const Optional.absent(), + updatedAfter: json.containsKey(r'updatedAfter') ? Optional.present(mapDateTime(json, r'updatedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + updatedBefore: json.containsKey(r'updatedBefore') ? Optional.present(mapDateTime(json, r'updatedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + visibility: json.containsKey(r'visibility') ? Optional.present(AssetVisibility.fromJson(json[r'visibility'])) : const Optional.absent(), + withDeleted: json.containsKey(r'withDeleted') ? Optional.present(mapValueOfType(json, r'withDeleted')) : const Optional.absent(), + withExif: json.containsKey(r'withExif') ? Optional.present(mapValueOfType(json, r'withExif')) : const Optional.absent(), + withPeople: json.containsKey(r'withPeople') ? Optional.present(mapValueOfType(json, r'withPeople')) : const Optional.absent(), + withStacked: json.containsKey(r'withStacked') ? Optional.present(mapValueOfType(json, r'withStacked')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/ratings_response.dart b/mobile/openapi/lib/model/ratings_response.dart index 7b067412bf..67e7dd14c4 100644 --- a/mobile/openapi/lib/model/ratings_response.dart +++ b/mobile/openapi/lib/model/ratings_response.dart @@ -45,6 +45,15 @@ class RatingsResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "RatingsResponse[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "RatingsResponse[enabled]" has a null value in JSON.'); + return true; + }()); + return RatingsResponse( enabled: mapValueOfType(json, r'enabled')!, ); diff --git a/mobile/openapi/lib/model/ratings_update.dart b/mobile/openapi/lib/model/ratings_update.dart index 8079172e21..fd40b0454a 100644 --- a/mobile/openapi/lib/model/ratings_update.dart +++ b/mobile/openapi/lib/model/ratings_update.dart @@ -13,7 +13,7 @@ part of openapi.api; class RatingsUpdate { /// Returns a new [RatingsUpdate] instance. RatingsUpdate({ - this.enabled, + this.enabled = const Optional.absent(), }); /// Whether ratings are enabled @@ -23,7 +23,7 @@ class RatingsUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; @override bool operator ==(Object other) => identical(this, other) || other is RatingsUpdate && @@ -39,10 +39,9 @@ class RatingsUpdate { Map toJson() { final json = {}; - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } return json; } @@ -55,8 +54,15 @@ class RatingsUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return RatingsUpdate( - enabled: mapValueOfType(json, r'enabled'), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/release_event_v1.dart b/mobile/openapi/lib/model/release_event_v1.dart index f26ae3e96e..29221a0b93 100644 --- a/mobile/openapi/lib/model/release_event_v1.dart +++ b/mobile/openapi/lib/model/release_event_v1.dart @@ -70,6 +70,23 @@ class ReleaseEventV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'checkedAt'), 'Required key "ReleaseEventV1[checkedAt]" is missing from JSON.'); + assert(json[r'checkedAt'] != null, 'Required key "ReleaseEventV1[checkedAt]" has a null value in JSON.'); + assert(json.containsKey(r'isAvailable'), 'Required key "ReleaseEventV1[isAvailable]" is missing from JSON.'); + assert(json[r'isAvailable'] != null, 'Required key "ReleaseEventV1[isAvailable]" has a null value in JSON.'); + assert(json.containsKey(r'releaseVersion'), 'Required key "ReleaseEventV1[releaseVersion]" is missing from JSON.'); + assert(json[r'releaseVersion'] != null, 'Required key "ReleaseEventV1[releaseVersion]" has a null value in JSON.'); + assert(json.containsKey(r'serverVersion'), 'Required key "ReleaseEventV1[serverVersion]" is missing from JSON.'); + assert(json[r'serverVersion'] != null, 'Required key "ReleaseEventV1[serverVersion]" has a null value in JSON.'); + assert(json.containsKey(r'type'), 'Required key "ReleaseEventV1[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "ReleaseEventV1[type]" has a null value in JSON.'); + return true; + }()); + return ReleaseEventV1( checkedAt: mapValueOfType(json, r'checkedAt')!, isAvailable: mapValueOfType(json, r'isAvailable')!, diff --git a/mobile/openapi/lib/model/reverse_geocoding_state_response_dto.dart b/mobile/openapi/lib/model/reverse_geocoding_state_response_dto.dart index 6ad8c1a7b9..77db55863f 100644 --- a/mobile/openapi/lib/model/reverse_geocoding_state_response_dto.dart +++ b/mobile/openapi/lib/model/reverse_geocoding_state_response_dto.dart @@ -42,12 +42,12 @@ class ReverseGeocodingStateResponseDto { if (this.lastImportFileName != null) { json[r'lastImportFileName'] = this.lastImportFileName; } else { - // json[r'lastImportFileName'] = null; + json[r'lastImportFileName'] = null; } if (this.lastUpdate != null) { json[r'lastUpdate'] = this.lastUpdate; } else { - // json[r'lastUpdate'] = null; + json[r'lastUpdate'] = null; } return json; } @@ -60,6 +60,15 @@ class ReverseGeocodingStateResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'lastImportFileName'), 'Required key "ReverseGeocodingStateResponseDto[lastImportFileName]" is missing from JSON.'); + assert(json.containsKey(r'lastUpdate'), 'Required key "ReverseGeocodingStateResponseDto[lastUpdate]" is missing from JSON.'); + return true; + }()); + return ReverseGeocodingStateResponseDto( lastImportFileName: mapValueOfType(json, r'lastImportFileName'), lastUpdate: mapValueOfType(json, r'lastUpdate'), diff --git a/mobile/openapi/lib/model/rotate_parameters.dart b/mobile/openapi/lib/model/rotate_parameters.dart index 33609e83e5..bb341b49e6 100644 --- a/mobile/openapi/lib/model/rotate_parameters.dart +++ b/mobile/openapi/lib/model/rotate_parameters.dart @@ -45,6 +45,15 @@ class RotateParameters { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'angle'), 'Required key "RotateParameters[angle]" is missing from JSON.'); + assert(json[r'angle'] != null, 'Required key "RotateParameters[angle]" has a null value in JSON.'); + return true; + }()); + return RotateParameters( angle: num.parse('${json[r'angle']}'), ); diff --git a/mobile/openapi/lib/model/search_album_response_dto.dart b/mobile/openapi/lib/model/search_album_response_dto.dart index c21113ee6d..cb021d804e 100644 --- a/mobile/openapi/lib/model/search_album_response_dto.dart +++ b/mobile/openapi/lib/model/search_album_response_dto.dart @@ -70,6 +70,21 @@ class SearchAlbumResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'count'), 'Required key "SearchAlbumResponseDto[count]" is missing from JSON.'); + assert(json[r'count'] != null, 'Required key "SearchAlbumResponseDto[count]" has a null value in JSON.'); + assert(json.containsKey(r'facets'), 'Required key "SearchAlbumResponseDto[facets]" is missing from JSON.'); + assert(json[r'facets'] != null, 'Required key "SearchAlbumResponseDto[facets]" has a null value in JSON.'); + assert(json.containsKey(r'items'), 'Required key "SearchAlbumResponseDto[items]" is missing from JSON.'); + assert(json[r'items'] != null, 'Required key "SearchAlbumResponseDto[items]" has a null value in JSON.'); + assert(json.containsKey(r'total'), 'Required key "SearchAlbumResponseDto[total]" is missing from JSON.'); + assert(json[r'total'] != null, 'Required key "SearchAlbumResponseDto[total]" has a null value in JSON.'); + return true; + }()); + return SearchAlbumResponseDto( count: mapValueOfType(json, r'count')!, facets: SearchFacetResponseDto.listFromJson(json[r'facets']), diff --git a/mobile/openapi/lib/model/search_asset_response_dto.dart b/mobile/openapi/lib/model/search_asset_response_dto.dart index f4ffade26b..3e4a9c9b03 100644 --- a/mobile/openapi/lib/model/search_asset_response_dto.dart +++ b/mobile/openapi/lib/model/search_asset_response_dto.dart @@ -67,7 +67,7 @@ class SearchAssetResponseDto { if (this.nextPage != null) { json[r'nextPage'] = this.nextPage; } else { - // json[r'nextPage'] = null; + json[r'nextPage'] = null; } json[r'total'] = this.total; return json; @@ -81,6 +81,22 @@ class SearchAssetResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'count'), 'Required key "SearchAssetResponseDto[count]" is missing from JSON.'); + assert(json[r'count'] != null, 'Required key "SearchAssetResponseDto[count]" has a null value in JSON.'); + assert(json.containsKey(r'facets'), 'Required key "SearchAssetResponseDto[facets]" is missing from JSON.'); + assert(json[r'facets'] != null, 'Required key "SearchAssetResponseDto[facets]" has a null value in JSON.'); + assert(json.containsKey(r'items'), 'Required key "SearchAssetResponseDto[items]" is missing from JSON.'); + assert(json[r'items'] != null, 'Required key "SearchAssetResponseDto[items]" has a null value in JSON.'); + assert(json.containsKey(r'nextPage'), 'Required key "SearchAssetResponseDto[nextPage]" is missing from JSON.'); + assert(json.containsKey(r'total'), 'Required key "SearchAssetResponseDto[total]" is missing from JSON.'); + assert(json[r'total'] != null, 'Required key "SearchAssetResponseDto[total]" has a null value in JSON.'); + return true; + }()); + return SearchAssetResponseDto( count: mapValueOfType(json, r'count')!, facets: SearchFacetResponseDto.listFromJson(json[r'facets']), diff --git a/mobile/openapi/lib/model/search_explore_item.dart b/mobile/openapi/lib/model/search_explore_item.dart index 4089011879..a36c90e35d 100644 --- a/mobile/openapi/lib/model/search_explore_item.dart +++ b/mobile/openapi/lib/model/search_explore_item.dart @@ -51,6 +51,17 @@ class SearchExploreItem { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'data'), 'Required key "SearchExploreItem[data]" is missing from JSON.'); + assert(json[r'data'] != null, 'Required key "SearchExploreItem[data]" has a null value in JSON.'); + assert(json.containsKey(r'value'), 'Required key "SearchExploreItem[value]" is missing from JSON.'); + assert(json[r'value'] != null, 'Required key "SearchExploreItem[value]" has a null value in JSON.'); + return true; + }()); + return SearchExploreItem( data: AssetResponseDto.fromJson(json[r'data'])!, value: mapValueOfType(json, r'value')!, diff --git a/mobile/openapi/lib/model/search_explore_response_dto.dart b/mobile/openapi/lib/model/search_explore_response_dto.dart index 07ce26c9b8..9e50bd1cd8 100644 --- a/mobile/openapi/lib/model/search_explore_response_dto.dart +++ b/mobile/openapi/lib/model/search_explore_response_dto.dart @@ -51,6 +51,17 @@ class SearchExploreResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'fieldName'), 'Required key "SearchExploreResponseDto[fieldName]" is missing from JSON.'); + assert(json[r'fieldName'] != null, 'Required key "SearchExploreResponseDto[fieldName]" has a null value in JSON.'); + assert(json.containsKey(r'items'), 'Required key "SearchExploreResponseDto[items]" is missing from JSON.'); + assert(json[r'items'] != null, 'Required key "SearchExploreResponseDto[items]" has a null value in JSON.'); + return true; + }()); + return SearchExploreResponseDto( fieldName: mapValueOfType(json, r'fieldName')!, items: SearchExploreItem.listFromJson(json[r'items']), diff --git a/mobile/openapi/lib/model/search_facet_count_response_dto.dart b/mobile/openapi/lib/model/search_facet_count_response_dto.dart index 62adfaa74a..eb59cdd087 100644 --- a/mobile/openapi/lib/model/search_facet_count_response_dto.dart +++ b/mobile/openapi/lib/model/search_facet_count_response_dto.dart @@ -55,6 +55,17 @@ class SearchFacetCountResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'count'), 'Required key "SearchFacetCountResponseDto[count]" is missing from JSON.'); + assert(json[r'count'] != null, 'Required key "SearchFacetCountResponseDto[count]" has a null value in JSON.'); + assert(json.containsKey(r'value'), 'Required key "SearchFacetCountResponseDto[value]" is missing from JSON.'); + assert(json[r'value'] != null, 'Required key "SearchFacetCountResponseDto[value]" has a null value in JSON.'); + return true; + }()); + return SearchFacetCountResponseDto( count: mapValueOfType(json, r'count')!, value: mapValueOfType(json, r'value')!, diff --git a/mobile/openapi/lib/model/search_facet_response_dto.dart b/mobile/openapi/lib/model/search_facet_response_dto.dart index 51124ef1cf..229a3e894c 100644 --- a/mobile/openapi/lib/model/search_facet_response_dto.dart +++ b/mobile/openapi/lib/model/search_facet_response_dto.dart @@ -51,6 +51,17 @@ class SearchFacetResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'counts'), 'Required key "SearchFacetResponseDto[counts]" is missing from JSON.'); + assert(json[r'counts'] != null, 'Required key "SearchFacetResponseDto[counts]" has a null value in JSON.'); + assert(json.containsKey(r'fieldName'), 'Required key "SearchFacetResponseDto[fieldName]" is missing from JSON.'); + assert(json[r'fieldName'] != null, 'Required key "SearchFacetResponseDto[fieldName]" has a null value in JSON.'); + return true; + }()); + return SearchFacetResponseDto( counts: SearchFacetCountResponseDto.listFromJson(json[r'counts']), fieldName: mapValueOfType(json, r'fieldName')!, diff --git a/mobile/openapi/lib/model/search_response_dto.dart b/mobile/openapi/lib/model/search_response_dto.dart index ca742ae35c..a0395f13a7 100644 --- a/mobile/openapi/lib/model/search_response_dto.dart +++ b/mobile/openapi/lib/model/search_response_dto.dart @@ -50,6 +50,17 @@ class SearchResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albums'), 'Required key "SearchResponseDto[albums]" is missing from JSON.'); + assert(json[r'albums'] != null, 'Required key "SearchResponseDto[albums]" has a null value in JSON.'); + assert(json.containsKey(r'assets'), 'Required key "SearchResponseDto[assets]" is missing from JSON.'); + assert(json[r'assets'] != null, 'Required key "SearchResponseDto[assets]" has a null value in JSON.'); + return true; + }()); + return SearchResponseDto( albums: SearchAlbumResponseDto.fromJson(json[r'albums'])!, assets: SearchAssetResponseDto.fromJson(json[r'assets'])!, diff --git a/mobile/openapi/lib/model/search_statistics_response_dto.dart b/mobile/openapi/lib/model/search_statistics_response_dto.dart index c4d893af05..b456f90e44 100644 --- a/mobile/openapi/lib/model/search_statistics_response_dto.dart +++ b/mobile/openapi/lib/model/search_statistics_response_dto.dart @@ -48,6 +48,15 @@ class SearchStatisticsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'total'), 'Required key "SearchStatisticsResponseDto[total]" is missing from JSON.'); + assert(json[r'total'] != null, 'Required key "SearchStatisticsResponseDto[total]" has a null value in JSON.'); + return true; + }()); + return SearchStatisticsResponseDto( total: mapValueOfType(json, r'total')!, ); diff --git a/mobile/openapi/lib/model/server_about_response_dto.dart b/mobile/openapi/lib/model/server_about_response_dto.dart index 1ae53763fe..ccdd367783 100644 --- a/mobile/openapi/lib/model/server_about_response_dto.dart +++ b/mobile/openapi/lib/model/server_about_response_dto.dart @@ -13,25 +13,25 @@ part of openapi.api; class ServerAboutResponseDto { /// Returns a new [ServerAboutResponseDto] instance. ServerAboutResponseDto({ - this.build, - this.buildImage, - this.buildImageUrl, - this.buildUrl, - this.exiftool, - this.ffmpeg, - this.imagemagick, - this.libvips, + this.build = const Optional.absent(), + this.buildImage = const Optional.absent(), + this.buildImageUrl = const Optional.absent(), + this.buildUrl = const Optional.absent(), + this.exiftool = const Optional.absent(), + this.ffmpeg = const Optional.absent(), + this.imagemagick = const Optional.absent(), + this.libvips = const Optional.absent(), required this.licensed, - this.nodejs, - this.repository, - this.repositoryUrl, - this.sourceCommit, - this.sourceRef, - this.sourceUrl, - this.thirdPartyBugFeatureUrl, - this.thirdPartyDocumentationUrl, - this.thirdPartySourceUrl, - this.thirdPartySupportUrl, + this.nodejs = const Optional.absent(), + this.repository = const Optional.absent(), + this.repositoryUrl = const Optional.absent(), + this.sourceCommit = const Optional.absent(), + this.sourceRef = const Optional.absent(), + this.sourceUrl = const Optional.absent(), + this.thirdPartyBugFeatureUrl = const Optional.absent(), + this.thirdPartyDocumentationUrl = const Optional.absent(), + this.thirdPartySourceUrl = const Optional.absent(), + this.thirdPartySupportUrl = const Optional.absent(), required this.version, required this.versionUrl, }); @@ -43,7 +43,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? build; + Optional build; /// Build image name /// @@ -52,7 +52,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? buildImage; + Optional buildImage; /// Build image URL /// @@ -61,7 +61,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? buildImageUrl; + Optional buildImageUrl; /// Build URL /// @@ -70,7 +70,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? buildUrl; + Optional buildUrl; /// ExifTool version /// @@ -79,7 +79,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? exiftool; + Optional exiftool; /// FFmpeg version /// @@ -88,7 +88,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? ffmpeg; + Optional ffmpeg; /// ImageMagick version /// @@ -97,7 +97,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? imagemagick; + Optional imagemagick; /// libvips version /// @@ -106,7 +106,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? libvips; + Optional libvips; /// Whether the server is licensed bool licensed; @@ -118,7 +118,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? nodejs; + Optional nodejs; /// Repository name /// @@ -127,7 +127,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? repository; + Optional repository; /// Repository URL /// @@ -136,7 +136,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? repositoryUrl; + Optional repositoryUrl; /// Source commit hash /// @@ -145,7 +145,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? sourceCommit; + Optional sourceCommit; /// Source reference (branch/tag) /// @@ -154,7 +154,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? sourceRef; + Optional sourceRef; /// Source URL /// @@ -163,7 +163,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? sourceUrl; + Optional sourceUrl; /// Third-party bug/feature URL /// @@ -172,7 +172,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? thirdPartyBugFeatureUrl; + Optional thirdPartyBugFeatureUrl; /// Third-party documentation URL /// @@ -181,7 +181,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? thirdPartyDocumentationUrl; + Optional thirdPartyDocumentationUrl; /// Third-party source URL /// @@ -190,7 +190,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? thirdPartySourceUrl; + Optional thirdPartySourceUrl; /// Third-party support URL /// @@ -199,7 +199,7 @@ class ServerAboutResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? thirdPartySupportUrl; + Optional thirdPartySupportUrl; /// Server version String version; @@ -261,96 +261,78 @@ class ServerAboutResponseDto { Map toJson() { final json = {}; - if (this.build != null) { - json[r'build'] = this.build; - } else { - // json[r'build'] = null; + if (this.build.isPresent) { + final value = this.build.value; + json[r'build'] = value; } - if (this.buildImage != null) { - json[r'buildImage'] = this.buildImage; - } else { - // json[r'buildImage'] = null; + if (this.buildImage.isPresent) { + final value = this.buildImage.value; + json[r'buildImage'] = value; } - if (this.buildImageUrl != null) { - json[r'buildImageUrl'] = this.buildImageUrl; - } else { - // json[r'buildImageUrl'] = null; + if (this.buildImageUrl.isPresent) { + final value = this.buildImageUrl.value; + json[r'buildImageUrl'] = value; } - if (this.buildUrl != null) { - json[r'buildUrl'] = this.buildUrl; - } else { - // json[r'buildUrl'] = null; + if (this.buildUrl.isPresent) { + final value = this.buildUrl.value; + json[r'buildUrl'] = value; } - if (this.exiftool != null) { - json[r'exiftool'] = this.exiftool; - } else { - // json[r'exiftool'] = null; + if (this.exiftool.isPresent) { + final value = this.exiftool.value; + json[r'exiftool'] = value; } - if (this.ffmpeg != null) { - json[r'ffmpeg'] = this.ffmpeg; - } else { - // json[r'ffmpeg'] = null; + if (this.ffmpeg.isPresent) { + final value = this.ffmpeg.value; + json[r'ffmpeg'] = value; } - if (this.imagemagick != null) { - json[r'imagemagick'] = this.imagemagick; - } else { - // json[r'imagemagick'] = null; + if (this.imagemagick.isPresent) { + final value = this.imagemagick.value; + json[r'imagemagick'] = value; } - if (this.libvips != null) { - json[r'libvips'] = this.libvips; - } else { - // json[r'libvips'] = null; + if (this.libvips.isPresent) { + final value = this.libvips.value; + json[r'libvips'] = value; } json[r'licensed'] = this.licensed; - if (this.nodejs != null) { - json[r'nodejs'] = this.nodejs; - } else { - // json[r'nodejs'] = null; + if (this.nodejs.isPresent) { + final value = this.nodejs.value; + json[r'nodejs'] = value; } - if (this.repository != null) { - json[r'repository'] = this.repository; - } else { - // json[r'repository'] = null; + if (this.repository.isPresent) { + final value = this.repository.value; + json[r'repository'] = value; } - if (this.repositoryUrl != null) { - json[r'repositoryUrl'] = this.repositoryUrl; - } else { - // json[r'repositoryUrl'] = null; + if (this.repositoryUrl.isPresent) { + final value = this.repositoryUrl.value; + json[r'repositoryUrl'] = value; } - if (this.sourceCommit != null) { - json[r'sourceCommit'] = this.sourceCommit; - } else { - // json[r'sourceCommit'] = null; + if (this.sourceCommit.isPresent) { + final value = this.sourceCommit.value; + json[r'sourceCommit'] = value; } - if (this.sourceRef != null) { - json[r'sourceRef'] = this.sourceRef; - } else { - // json[r'sourceRef'] = null; + if (this.sourceRef.isPresent) { + final value = this.sourceRef.value; + json[r'sourceRef'] = value; } - if (this.sourceUrl != null) { - json[r'sourceUrl'] = this.sourceUrl; - } else { - // json[r'sourceUrl'] = null; + if (this.sourceUrl.isPresent) { + final value = this.sourceUrl.value; + json[r'sourceUrl'] = value; } - if (this.thirdPartyBugFeatureUrl != null) { - json[r'thirdPartyBugFeatureUrl'] = this.thirdPartyBugFeatureUrl; - } else { - // json[r'thirdPartyBugFeatureUrl'] = null; + if (this.thirdPartyBugFeatureUrl.isPresent) { + final value = this.thirdPartyBugFeatureUrl.value; + json[r'thirdPartyBugFeatureUrl'] = value; } - if (this.thirdPartyDocumentationUrl != null) { - json[r'thirdPartyDocumentationUrl'] = this.thirdPartyDocumentationUrl; - } else { - // json[r'thirdPartyDocumentationUrl'] = null; + if (this.thirdPartyDocumentationUrl.isPresent) { + final value = this.thirdPartyDocumentationUrl.value; + json[r'thirdPartyDocumentationUrl'] = value; } - if (this.thirdPartySourceUrl != null) { - json[r'thirdPartySourceUrl'] = this.thirdPartySourceUrl; - } else { - // json[r'thirdPartySourceUrl'] = null; + if (this.thirdPartySourceUrl.isPresent) { + final value = this.thirdPartySourceUrl.value; + json[r'thirdPartySourceUrl'] = value; } - if (this.thirdPartySupportUrl != null) { - json[r'thirdPartySupportUrl'] = this.thirdPartySupportUrl; - } else { - // json[r'thirdPartySupportUrl'] = null; + if (this.thirdPartySupportUrl.isPresent) { + final value = this.thirdPartySupportUrl.value; + json[r'thirdPartySupportUrl'] = value; } json[r'version'] = this.version; json[r'versionUrl'] = this.versionUrl; @@ -365,26 +347,39 @@ class ServerAboutResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'licensed'), 'Required key "ServerAboutResponseDto[licensed]" is missing from JSON.'); + assert(json[r'licensed'] != null, 'Required key "ServerAboutResponseDto[licensed]" has a null value in JSON.'); + assert(json.containsKey(r'version'), 'Required key "ServerAboutResponseDto[version]" is missing from JSON.'); + assert(json[r'version'] != null, 'Required key "ServerAboutResponseDto[version]" has a null value in JSON.'); + assert(json.containsKey(r'versionUrl'), 'Required key "ServerAboutResponseDto[versionUrl]" is missing from JSON.'); + assert(json[r'versionUrl'] != null, 'Required key "ServerAboutResponseDto[versionUrl]" has a null value in JSON.'); + return true; + }()); + return ServerAboutResponseDto( - build: mapValueOfType(json, r'build'), - buildImage: mapValueOfType(json, r'buildImage'), - buildImageUrl: mapValueOfType(json, r'buildImageUrl'), - buildUrl: mapValueOfType(json, r'buildUrl'), - exiftool: mapValueOfType(json, r'exiftool'), - ffmpeg: mapValueOfType(json, r'ffmpeg'), - imagemagick: mapValueOfType(json, r'imagemagick'), - libvips: mapValueOfType(json, r'libvips'), + build: json.containsKey(r'build') ? Optional.present(mapValueOfType(json, r'build')) : const Optional.absent(), + buildImage: json.containsKey(r'buildImage') ? Optional.present(mapValueOfType(json, r'buildImage')) : const Optional.absent(), + buildImageUrl: json.containsKey(r'buildImageUrl') ? Optional.present(mapValueOfType(json, r'buildImageUrl')) : const Optional.absent(), + buildUrl: json.containsKey(r'buildUrl') ? Optional.present(mapValueOfType(json, r'buildUrl')) : const Optional.absent(), + exiftool: json.containsKey(r'exiftool') ? Optional.present(mapValueOfType(json, r'exiftool')) : const Optional.absent(), + ffmpeg: json.containsKey(r'ffmpeg') ? Optional.present(mapValueOfType(json, r'ffmpeg')) : const Optional.absent(), + imagemagick: json.containsKey(r'imagemagick') ? Optional.present(mapValueOfType(json, r'imagemagick')) : const Optional.absent(), + libvips: json.containsKey(r'libvips') ? Optional.present(mapValueOfType(json, r'libvips')) : const Optional.absent(), licensed: mapValueOfType(json, r'licensed')!, - nodejs: mapValueOfType(json, r'nodejs'), - repository: mapValueOfType(json, r'repository'), - repositoryUrl: mapValueOfType(json, r'repositoryUrl'), - sourceCommit: mapValueOfType(json, r'sourceCommit'), - sourceRef: mapValueOfType(json, r'sourceRef'), - sourceUrl: mapValueOfType(json, r'sourceUrl'), - thirdPartyBugFeatureUrl: mapValueOfType(json, r'thirdPartyBugFeatureUrl'), - thirdPartyDocumentationUrl: mapValueOfType(json, r'thirdPartyDocumentationUrl'), - thirdPartySourceUrl: mapValueOfType(json, r'thirdPartySourceUrl'), - thirdPartySupportUrl: mapValueOfType(json, r'thirdPartySupportUrl'), + nodejs: json.containsKey(r'nodejs') ? Optional.present(mapValueOfType(json, r'nodejs')) : const Optional.absent(), + repository: json.containsKey(r'repository') ? Optional.present(mapValueOfType(json, r'repository')) : const Optional.absent(), + repositoryUrl: json.containsKey(r'repositoryUrl') ? Optional.present(mapValueOfType(json, r'repositoryUrl')) : const Optional.absent(), + sourceCommit: json.containsKey(r'sourceCommit') ? Optional.present(mapValueOfType(json, r'sourceCommit')) : const Optional.absent(), + sourceRef: json.containsKey(r'sourceRef') ? Optional.present(mapValueOfType(json, r'sourceRef')) : const Optional.absent(), + sourceUrl: json.containsKey(r'sourceUrl') ? Optional.present(mapValueOfType(json, r'sourceUrl')) : const Optional.absent(), + thirdPartyBugFeatureUrl: json.containsKey(r'thirdPartyBugFeatureUrl') ? Optional.present(mapValueOfType(json, r'thirdPartyBugFeatureUrl')) : const Optional.absent(), + thirdPartyDocumentationUrl: json.containsKey(r'thirdPartyDocumentationUrl') ? Optional.present(mapValueOfType(json, r'thirdPartyDocumentationUrl')) : const Optional.absent(), + thirdPartySourceUrl: json.containsKey(r'thirdPartySourceUrl') ? Optional.present(mapValueOfType(json, r'thirdPartySourceUrl')) : const Optional.absent(), + thirdPartySupportUrl: json.containsKey(r'thirdPartySupportUrl') ? Optional.present(mapValueOfType(json, r'thirdPartySupportUrl')) : const Optional.absent(), version: mapValueOfType(json, r'version')!, versionUrl: mapValueOfType(json, r'versionUrl')!, ); diff --git a/mobile/openapi/lib/model/server_apk_links_dto.dart b/mobile/openapi/lib/model/server_apk_links_dto.dart index 2227018468..132bc1eea4 100644 --- a/mobile/openapi/lib/model/server_apk_links_dto.dart +++ b/mobile/openapi/lib/model/server_apk_links_dto.dart @@ -66,6 +66,21 @@ class ServerApkLinksDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'arm64v8a'), 'Required key "ServerApkLinksDto[arm64v8a]" is missing from JSON.'); + assert(json[r'arm64v8a'] != null, 'Required key "ServerApkLinksDto[arm64v8a]" has a null value in JSON.'); + assert(json.containsKey(r'armeabiv7a'), 'Required key "ServerApkLinksDto[armeabiv7a]" is missing from JSON.'); + assert(json[r'armeabiv7a'] != null, 'Required key "ServerApkLinksDto[armeabiv7a]" has a null value in JSON.'); + assert(json.containsKey(r'universal'), 'Required key "ServerApkLinksDto[universal]" is missing from JSON.'); + assert(json[r'universal'] != null, 'Required key "ServerApkLinksDto[universal]" has a null value in JSON.'); + assert(json.containsKey(r'x86_64'), 'Required key "ServerApkLinksDto[x86_64]" is missing from JSON.'); + assert(json[r'x86_64'] != null, 'Required key "ServerApkLinksDto[x86_64]" has a null value in JSON.'); + return true; + }()); + return ServerApkLinksDto( arm64v8a: mapValueOfType(json, r'arm64v8a')!, armeabiv7a: mapValueOfType(json, r'armeabiv7a')!, diff --git a/mobile/openapi/lib/model/server_config_dto.dart b/mobile/openapi/lib/model/server_config_dto.dart index 316edb609f..f394644684 100644 --- a/mobile/openapi/lib/model/server_config_dto.dart +++ b/mobile/openapi/lib/model/server_config_dto.dart @@ -121,6 +121,35 @@ class ServerConfigDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'externalDomain'), 'Required key "ServerConfigDto[externalDomain]" is missing from JSON.'); + assert(json[r'externalDomain'] != null, 'Required key "ServerConfigDto[externalDomain]" has a null value in JSON.'); + assert(json.containsKey(r'isInitialized'), 'Required key "ServerConfigDto[isInitialized]" is missing from JSON.'); + assert(json[r'isInitialized'] != null, 'Required key "ServerConfigDto[isInitialized]" has a null value in JSON.'); + assert(json.containsKey(r'isOnboarded'), 'Required key "ServerConfigDto[isOnboarded]" is missing from JSON.'); + assert(json[r'isOnboarded'] != null, 'Required key "ServerConfigDto[isOnboarded]" has a null value in JSON.'); + assert(json.containsKey(r'loginPageMessage'), 'Required key "ServerConfigDto[loginPageMessage]" is missing from JSON.'); + assert(json[r'loginPageMessage'] != null, 'Required key "ServerConfigDto[loginPageMessage]" has a null value in JSON.'); + assert(json.containsKey(r'maintenanceMode'), 'Required key "ServerConfigDto[maintenanceMode]" is missing from JSON.'); + assert(json[r'maintenanceMode'] != null, 'Required key "ServerConfigDto[maintenanceMode]" has a null value in JSON.'); + assert(json.containsKey(r'mapDarkStyleUrl'), 'Required key "ServerConfigDto[mapDarkStyleUrl]" is missing from JSON.'); + assert(json[r'mapDarkStyleUrl'] != null, 'Required key "ServerConfigDto[mapDarkStyleUrl]" has a null value in JSON.'); + assert(json.containsKey(r'mapLightStyleUrl'), 'Required key "ServerConfigDto[mapLightStyleUrl]" is missing from JSON.'); + assert(json[r'mapLightStyleUrl'] != null, 'Required key "ServerConfigDto[mapLightStyleUrl]" has a null value in JSON.'); + assert(json.containsKey(r'oauthButtonText'), 'Required key "ServerConfigDto[oauthButtonText]" is missing from JSON.'); + assert(json[r'oauthButtonText'] != null, 'Required key "ServerConfigDto[oauthButtonText]" has a null value in JSON.'); + assert(json.containsKey(r'publicUsers'), 'Required key "ServerConfigDto[publicUsers]" is missing from JSON.'); + assert(json[r'publicUsers'] != null, 'Required key "ServerConfigDto[publicUsers]" has a null value in JSON.'); + assert(json.containsKey(r'trashDays'), 'Required key "ServerConfigDto[trashDays]" is missing from JSON.'); + assert(json[r'trashDays'] != null, 'Required key "ServerConfigDto[trashDays]" has a null value in JSON.'); + assert(json.containsKey(r'userDeleteDelay'), 'Required key "ServerConfigDto[userDeleteDelay]" is missing from JSON.'); + assert(json[r'userDeleteDelay'] != null, 'Required key "ServerConfigDto[userDeleteDelay]" has a null value in JSON.'); + return true; + }()); + return ServerConfigDto( externalDomain: mapValueOfType(json, r'externalDomain')!, isInitialized: mapValueOfType(json, r'isInitialized')!, diff --git a/mobile/openapi/lib/model/server_features_dto.dart b/mobile/openapi/lib/model/server_features_dto.dart index 9b75ef2b32..5d38d7b267 100644 --- a/mobile/openapi/lib/model/server_features_dto.dart +++ b/mobile/openapi/lib/model/server_features_dto.dart @@ -150,6 +150,45 @@ class ServerFeaturesDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'configFile'), 'Required key "ServerFeaturesDto[configFile]" is missing from JSON.'); + assert(json[r'configFile'] != null, 'Required key "ServerFeaturesDto[configFile]" has a null value in JSON.'); + assert(json.containsKey(r'duplicateDetection'), 'Required key "ServerFeaturesDto[duplicateDetection]" is missing from JSON.'); + assert(json[r'duplicateDetection'] != null, 'Required key "ServerFeaturesDto[duplicateDetection]" has a null value in JSON.'); + assert(json.containsKey(r'email'), 'Required key "ServerFeaturesDto[email]" is missing from JSON.'); + assert(json[r'email'] != null, 'Required key "ServerFeaturesDto[email]" has a null value in JSON.'); + assert(json.containsKey(r'facialRecognition'), 'Required key "ServerFeaturesDto[facialRecognition]" is missing from JSON.'); + assert(json[r'facialRecognition'] != null, 'Required key "ServerFeaturesDto[facialRecognition]" has a null value in JSON.'); + assert(json.containsKey(r'importFaces'), 'Required key "ServerFeaturesDto[importFaces]" is missing from JSON.'); + assert(json[r'importFaces'] != null, 'Required key "ServerFeaturesDto[importFaces]" has a null value in JSON.'); + assert(json.containsKey(r'map'), 'Required key "ServerFeaturesDto[map]" is missing from JSON.'); + assert(json[r'map'] != null, 'Required key "ServerFeaturesDto[map]" has a null value in JSON.'); + assert(json.containsKey(r'oauth'), 'Required key "ServerFeaturesDto[oauth]" is missing from JSON.'); + assert(json[r'oauth'] != null, 'Required key "ServerFeaturesDto[oauth]" has a null value in JSON.'); + assert(json.containsKey(r'oauthAutoLaunch'), 'Required key "ServerFeaturesDto[oauthAutoLaunch]" is missing from JSON.'); + assert(json[r'oauthAutoLaunch'] != null, 'Required key "ServerFeaturesDto[oauthAutoLaunch]" has a null value in JSON.'); + assert(json.containsKey(r'ocr'), 'Required key "ServerFeaturesDto[ocr]" is missing from JSON.'); + assert(json[r'ocr'] != null, 'Required key "ServerFeaturesDto[ocr]" has a null value in JSON.'); + assert(json.containsKey(r'passwordLogin'), 'Required key "ServerFeaturesDto[passwordLogin]" is missing from JSON.'); + assert(json[r'passwordLogin'] != null, 'Required key "ServerFeaturesDto[passwordLogin]" has a null value in JSON.'); + assert(json.containsKey(r'realtimeTranscoding'), 'Required key "ServerFeaturesDto[realtimeTranscoding]" is missing from JSON.'); + assert(json[r'realtimeTranscoding'] != null, 'Required key "ServerFeaturesDto[realtimeTranscoding]" has a null value in JSON.'); + assert(json.containsKey(r'reverseGeocoding'), 'Required key "ServerFeaturesDto[reverseGeocoding]" is missing from JSON.'); + assert(json[r'reverseGeocoding'] != null, 'Required key "ServerFeaturesDto[reverseGeocoding]" has a null value in JSON.'); + assert(json.containsKey(r'search'), 'Required key "ServerFeaturesDto[search]" is missing from JSON.'); + assert(json[r'search'] != null, 'Required key "ServerFeaturesDto[search]" has a null value in JSON.'); + assert(json.containsKey(r'sidecar'), 'Required key "ServerFeaturesDto[sidecar]" is missing from JSON.'); + assert(json[r'sidecar'] != null, 'Required key "ServerFeaturesDto[sidecar]" has a null value in JSON.'); + assert(json.containsKey(r'smartSearch'), 'Required key "ServerFeaturesDto[smartSearch]" is missing from JSON.'); + assert(json[r'smartSearch'] != null, 'Required key "ServerFeaturesDto[smartSearch]" has a null value in JSON.'); + assert(json.containsKey(r'trash'), 'Required key "ServerFeaturesDto[trash]" is missing from JSON.'); + assert(json[r'trash'] != null, 'Required key "ServerFeaturesDto[trash]" has a null value in JSON.'); + return true; + }()); + return ServerFeaturesDto( configFile: mapValueOfType(json, r'configFile')!, duplicateDetection: mapValueOfType(json, r'duplicateDetection')!, diff --git a/mobile/openapi/lib/model/server_media_types_response_dto.dart b/mobile/openapi/lib/model/server_media_types_response_dto.dart index 6a2aaeb9e1..43eb5ab12b 100644 --- a/mobile/openapi/lib/model/server_media_types_response_dto.dart +++ b/mobile/openapi/lib/model/server_media_types_response_dto.dart @@ -59,6 +59,19 @@ class ServerMediaTypesResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'image'), 'Required key "ServerMediaTypesResponseDto[image]" is missing from JSON.'); + assert(json[r'image'] != null, 'Required key "ServerMediaTypesResponseDto[image]" has a null value in JSON.'); + assert(json.containsKey(r'sidecar'), 'Required key "ServerMediaTypesResponseDto[sidecar]" is missing from JSON.'); + assert(json[r'sidecar'] != null, 'Required key "ServerMediaTypesResponseDto[sidecar]" has a null value in JSON.'); + assert(json.containsKey(r'video'), 'Required key "ServerMediaTypesResponseDto[video]" is missing from JSON.'); + assert(json[r'video'] != null, 'Required key "ServerMediaTypesResponseDto[video]" has a null value in JSON.'); + return true; + }()); + return ServerMediaTypesResponseDto( image: json[r'image'] is Iterable ? (json[r'image'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/server_ping_response.dart b/mobile/openapi/lib/model/server_ping_response.dart index 621ebfa294..d3270396f5 100644 --- a/mobile/openapi/lib/model/server_ping_response.dart +++ b/mobile/openapi/lib/model/server_ping_response.dart @@ -44,6 +44,15 @@ class ServerPingResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'res'), 'Required key "ServerPingResponse[res]" is missing from JSON.'); + assert(json[r'res'] != null, 'Required key "ServerPingResponse[res]" has a null value in JSON.'); + return true; + }()); + return ServerPingResponse( res: mapValueOfType(json, r'res')!, ); diff --git a/mobile/openapi/lib/model/server_stats_response_dto.dart b/mobile/openapi/lib/model/server_stats_response_dto.dart index 605bd74f41..66ae7d5b54 100644 --- a/mobile/openapi/lib/model/server_stats_response_dto.dart +++ b/mobile/openapi/lib/model/server_stats_response_dto.dart @@ -95,6 +95,25 @@ class ServerStatsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'photos'), 'Required key "ServerStatsResponseDto[photos]" is missing from JSON.'); + assert(json[r'photos'] != null, 'Required key "ServerStatsResponseDto[photos]" has a null value in JSON.'); + assert(json.containsKey(r'usage'), 'Required key "ServerStatsResponseDto[usage]" is missing from JSON.'); + assert(json[r'usage'] != null, 'Required key "ServerStatsResponseDto[usage]" has a null value in JSON.'); + assert(json.containsKey(r'usageByUser'), 'Required key "ServerStatsResponseDto[usageByUser]" is missing from JSON.'); + assert(json[r'usageByUser'] != null, 'Required key "ServerStatsResponseDto[usageByUser]" has a null value in JSON.'); + assert(json.containsKey(r'usagePhotos'), 'Required key "ServerStatsResponseDto[usagePhotos]" is missing from JSON.'); + assert(json[r'usagePhotos'] != null, 'Required key "ServerStatsResponseDto[usagePhotos]" has a null value in JSON.'); + assert(json.containsKey(r'usageVideos'), 'Required key "ServerStatsResponseDto[usageVideos]" is missing from JSON.'); + assert(json[r'usageVideos'] != null, 'Required key "ServerStatsResponseDto[usageVideos]" has a null value in JSON.'); + assert(json.containsKey(r'videos'), 'Required key "ServerStatsResponseDto[videos]" is missing from JSON.'); + assert(json[r'videos'] != null, 'Required key "ServerStatsResponseDto[videos]" has a null value in JSON.'); + return true; + }()); + return ServerStatsResponseDto( photos: mapValueOfType(json, r'photos')!, usage: mapValueOfType(json, r'usage')!, diff --git a/mobile/openapi/lib/model/server_storage_response_dto.dart b/mobile/openapi/lib/model/server_storage_response_dto.dart index 4a66d54e37..6b7189cbb4 100644 --- a/mobile/openapi/lib/model/server_storage_response_dto.dart +++ b/mobile/openapi/lib/model/server_storage_response_dto.dart @@ -96,12 +96,33 @@ class ServerStorageResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'diskAvailable'), 'Required key "ServerStorageResponseDto[diskAvailable]" is missing from JSON.'); + assert(json[r'diskAvailable'] != null, 'Required key "ServerStorageResponseDto[diskAvailable]" has a null value in JSON.'); + assert(json.containsKey(r'diskAvailableRaw'), 'Required key "ServerStorageResponseDto[diskAvailableRaw]" is missing from JSON.'); + assert(json[r'diskAvailableRaw'] != null, 'Required key "ServerStorageResponseDto[diskAvailableRaw]" has a null value in JSON.'); + assert(json.containsKey(r'diskSize'), 'Required key "ServerStorageResponseDto[diskSize]" is missing from JSON.'); + assert(json[r'diskSize'] != null, 'Required key "ServerStorageResponseDto[diskSize]" has a null value in JSON.'); + assert(json.containsKey(r'diskSizeRaw'), 'Required key "ServerStorageResponseDto[diskSizeRaw]" is missing from JSON.'); + assert(json[r'diskSizeRaw'] != null, 'Required key "ServerStorageResponseDto[diskSizeRaw]" has a null value in JSON.'); + assert(json.containsKey(r'diskUsagePercentage'), 'Required key "ServerStorageResponseDto[diskUsagePercentage]" is missing from JSON.'); + assert(json[r'diskUsagePercentage'] != null, 'Required key "ServerStorageResponseDto[diskUsagePercentage]" has a null value in JSON.'); + assert(json.containsKey(r'diskUse'), 'Required key "ServerStorageResponseDto[diskUse]" is missing from JSON.'); + assert(json[r'diskUse'] != null, 'Required key "ServerStorageResponseDto[diskUse]" has a null value in JSON.'); + assert(json.containsKey(r'diskUseRaw'), 'Required key "ServerStorageResponseDto[diskUseRaw]" is missing from JSON.'); + assert(json[r'diskUseRaw'] != null, 'Required key "ServerStorageResponseDto[diskUseRaw]" has a null value in JSON.'); + return true; + }()); + return ServerStorageResponseDto( diskAvailable: mapValueOfType(json, r'diskAvailable')!, diskAvailableRaw: mapValueOfType(json, r'diskAvailableRaw')!, diskSize: mapValueOfType(json, r'diskSize')!, diskSizeRaw: mapValueOfType(json, r'diskSizeRaw')!, - diskUsagePercentage: (mapValueOfType(json, r'diskUsagePercentage')!).toDouble(), + diskUsagePercentage: mapValueOfType(json, r'diskUsagePercentage')!, diskUse: mapValueOfType(json, r'diskUse')!, diskUseRaw: mapValueOfType(json, r'diskUseRaw')!, ); diff --git a/mobile/openapi/lib/model/server_version_history_response_dto.dart b/mobile/openapi/lib/model/server_version_history_response_dto.dart index ae5e060cff..b8498b9414 100644 --- a/mobile/openapi/lib/model/server_version_history_response_dto.dart +++ b/mobile/openapi/lib/model/server_version_history_response_dto.dart @@ -61,6 +61,19 @@ class ServerVersionHistoryResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'createdAt'), 'Required key "ServerVersionHistoryResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "ServerVersionHistoryResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "ServerVersionHistoryResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "ServerVersionHistoryResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'version'), 'Required key "ServerVersionHistoryResponseDto[version]" is missing from JSON.'); + assert(json[r'version'] != null, 'Required key "ServerVersionHistoryResponseDto[version]" has a null value in JSON.'); + return true; + }()); + return ServerVersionHistoryResponseDto( createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, id: mapValueOfType(json, r'id')!, diff --git a/mobile/openapi/lib/model/server_version_response_dto.dart b/mobile/openapi/lib/model/server_version_response_dto.dart index eae574f335..06d3ceada6 100644 --- a/mobile/openapi/lib/model/server_version_response_dto.dart +++ b/mobile/openapi/lib/model/server_version_response_dto.dart @@ -69,7 +69,7 @@ class ServerVersionResponseDto { if (this.prerelease != null) { json[r'prerelease'] = this.prerelease; } else { - // json[r'prerelease'] = null; + json[r'prerelease'] = null; } return json; } @@ -82,6 +82,20 @@ class ServerVersionResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'major'), 'Required key "ServerVersionResponseDto[major]" is missing from JSON.'); + assert(json[r'major'] != null, 'Required key "ServerVersionResponseDto[major]" has a null value in JSON.'); + assert(json.containsKey(r'minor'), 'Required key "ServerVersionResponseDto[minor]" is missing from JSON.'); + assert(json[r'minor'] != null, 'Required key "ServerVersionResponseDto[minor]" has a null value in JSON.'); + assert(json.containsKey(r'patch'), 'Required key "ServerVersionResponseDto[patch]" is missing from JSON.'); + assert(json[r'patch'] != null, 'Required key "ServerVersionResponseDto[patch]" has a null value in JSON.'); + assert(json.containsKey(r'prerelease'), 'Required key "ServerVersionResponseDto[prerelease]" is missing from JSON.'); + return true; + }()); + return ServerVersionResponseDto( major: mapValueOfType(json, r'major')!, minor: mapValueOfType(json, r'minor')!, diff --git a/mobile/openapi/lib/model/session_create_dto.dart b/mobile/openapi/lib/model/session_create_dto.dart index 37c07955cd..e2c17b0f2d 100644 --- a/mobile/openapi/lib/model/session_create_dto.dart +++ b/mobile/openapi/lib/model/session_create_dto.dart @@ -13,9 +13,9 @@ part of openapi.api; class SessionCreateDto { /// Returns a new [SessionCreateDto] instance. SessionCreateDto({ - this.deviceOS, - this.deviceType, - this.duration, + this.deviceOS = const Optional.absent(), + this.deviceType = const Optional.absent(), + this.duration = const Optional.absent(), }); /// Device OS @@ -25,7 +25,7 @@ class SessionCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? deviceOS; + Optional deviceOS; /// Device type /// @@ -34,7 +34,7 @@ class SessionCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? deviceType; + Optional deviceType; /// Session duration in seconds /// @@ -46,7 +46,7 @@ class SessionCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? duration; + Optional duration; @override bool operator ==(Object other) => identical(this, other) || other is SessionCreateDto && @@ -66,20 +66,17 @@ class SessionCreateDto { Map toJson() { final json = {}; - if (this.deviceOS != null) { - json[r'deviceOS'] = this.deviceOS; - } else { - // json[r'deviceOS'] = null; + if (this.deviceOS.isPresent) { + final value = this.deviceOS.value; + json[r'deviceOS'] = value; } - if (this.deviceType != null) { - json[r'deviceType'] = this.deviceType; - } else { - // json[r'deviceType'] = null; + if (this.deviceType.isPresent) { + final value = this.deviceType.value; + json[r'deviceType'] = value; } - if (this.duration != null) { - json[r'duration'] = this.duration; - } else { - // json[r'duration'] = null; + if (this.duration.isPresent) { + final value = this.duration.value; + json[r'duration'] = value; } return json; } @@ -92,10 +89,17 @@ class SessionCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return SessionCreateDto( - deviceOS: mapValueOfType(json, r'deviceOS'), - deviceType: mapValueOfType(json, r'deviceType'), - duration: mapValueOfType(json, r'duration'), + deviceOS: json.containsKey(r'deviceOS') ? Optional.present(mapValueOfType(json, r'deviceOS')) : const Optional.absent(), + deviceType: json.containsKey(r'deviceType') ? Optional.present(mapValueOfType(json, r'deviceType')) : const Optional.absent(), + duration: json.containsKey(r'duration') ? Optional.present(json[r'duration'] == null ? null : int.parse('${json[r'duration']}')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/session_create_response_dto.dart b/mobile/openapi/lib/model/session_create_response_dto.dart index f35232b0e8..6be4e7b776 100644 --- a/mobile/openapi/lib/model/session_create_response_dto.dart +++ b/mobile/openapi/lib/model/session_create_response_dto.dart @@ -18,7 +18,7 @@ class SessionCreateResponseDto { required this.current, required this.deviceOS, required this.deviceType, - this.expiresAt, + this.expiresAt = const Optional.absent(), required this.id, required this.isPendingSyncReset, required this.token, @@ -47,7 +47,7 @@ class SessionCreateResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? expiresAt; + Optional expiresAt; /// Session ID String id; @@ -96,16 +96,15 @@ class SessionCreateResponseDto { if (this.appVersion != null) { json[r'appVersion'] = this.appVersion; } else { - // json[r'appVersion'] = null; + json[r'appVersion'] = null; } json[r'createdAt'] = this.createdAt; json[r'current'] = this.current; json[r'deviceOS'] = this.deviceOS; json[r'deviceType'] = this.deviceType; - if (this.expiresAt != null) { - json[r'expiresAt'] = this.expiresAt; - } else { - // json[r'expiresAt'] = null; + if (this.expiresAt.isPresent) { + final value = this.expiresAt.value; + json[r'expiresAt'] = value; } json[r'id'] = this.id; json[r'isPendingSyncReset'] = this.isPendingSyncReset; @@ -122,13 +121,37 @@ class SessionCreateResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'appVersion'), 'Required key "SessionCreateResponseDto[appVersion]" is missing from JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "SessionCreateResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "SessionCreateResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'current'), 'Required key "SessionCreateResponseDto[current]" is missing from JSON.'); + assert(json[r'current'] != null, 'Required key "SessionCreateResponseDto[current]" has a null value in JSON.'); + assert(json.containsKey(r'deviceOS'), 'Required key "SessionCreateResponseDto[deviceOS]" is missing from JSON.'); + assert(json[r'deviceOS'] != null, 'Required key "SessionCreateResponseDto[deviceOS]" has a null value in JSON.'); + assert(json.containsKey(r'deviceType'), 'Required key "SessionCreateResponseDto[deviceType]" is missing from JSON.'); + assert(json[r'deviceType'] != null, 'Required key "SessionCreateResponseDto[deviceType]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "SessionCreateResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SessionCreateResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'isPendingSyncReset'), 'Required key "SessionCreateResponseDto[isPendingSyncReset]" is missing from JSON.'); + assert(json[r'isPendingSyncReset'] != null, 'Required key "SessionCreateResponseDto[isPendingSyncReset]" has a null value in JSON.'); + assert(json.containsKey(r'token'), 'Required key "SessionCreateResponseDto[token]" is missing from JSON.'); + assert(json[r'token'] != null, 'Required key "SessionCreateResponseDto[token]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "SessionCreateResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "SessionCreateResponseDto[updatedAt]" has a null value in JSON.'); + return true; + }()); + return SessionCreateResponseDto( appVersion: mapValueOfType(json, r'appVersion'), createdAt: mapValueOfType(json, r'createdAt')!, current: mapValueOfType(json, r'current')!, deviceOS: mapValueOfType(json, r'deviceOS')!, deviceType: mapValueOfType(json, r'deviceType')!, - expiresAt: mapValueOfType(json, r'expiresAt'), + expiresAt: json.containsKey(r'expiresAt') ? Optional.present(mapValueOfType(json, r'expiresAt')) : const Optional.absent(), id: mapValueOfType(json, r'id')!, isPendingSyncReset: mapValueOfType(json, r'isPendingSyncReset')!, token: mapValueOfType(json, r'token')!, diff --git a/mobile/openapi/lib/model/session_response_dto.dart b/mobile/openapi/lib/model/session_response_dto.dart index ed84160827..42fec30e4a 100644 --- a/mobile/openapi/lib/model/session_response_dto.dart +++ b/mobile/openapi/lib/model/session_response_dto.dart @@ -18,7 +18,7 @@ class SessionResponseDto { required this.current, required this.deviceOS, required this.deviceType, - this.expiresAt, + this.expiresAt = const Optional.absent(), required this.id, required this.isPendingSyncReset, required this.updatedAt, @@ -46,7 +46,7 @@ class SessionResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? expiresAt; + Optional expiresAt; /// Session ID String id; @@ -90,16 +90,15 @@ class SessionResponseDto { if (this.appVersion != null) { json[r'appVersion'] = this.appVersion; } else { - // json[r'appVersion'] = null; + json[r'appVersion'] = null; } json[r'createdAt'] = this.createdAt; json[r'current'] = this.current; json[r'deviceOS'] = this.deviceOS; json[r'deviceType'] = this.deviceType; - if (this.expiresAt != null) { - json[r'expiresAt'] = this.expiresAt; - } else { - // json[r'expiresAt'] = null; + if (this.expiresAt.isPresent) { + final value = this.expiresAt.value; + json[r'expiresAt'] = value; } json[r'id'] = this.id; json[r'isPendingSyncReset'] = this.isPendingSyncReset; @@ -115,13 +114,35 @@ class SessionResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'appVersion'), 'Required key "SessionResponseDto[appVersion]" is missing from JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "SessionResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "SessionResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'current'), 'Required key "SessionResponseDto[current]" is missing from JSON.'); + assert(json[r'current'] != null, 'Required key "SessionResponseDto[current]" has a null value in JSON.'); + assert(json.containsKey(r'deviceOS'), 'Required key "SessionResponseDto[deviceOS]" is missing from JSON.'); + assert(json[r'deviceOS'] != null, 'Required key "SessionResponseDto[deviceOS]" has a null value in JSON.'); + assert(json.containsKey(r'deviceType'), 'Required key "SessionResponseDto[deviceType]" is missing from JSON.'); + assert(json[r'deviceType'] != null, 'Required key "SessionResponseDto[deviceType]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "SessionResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SessionResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'isPendingSyncReset'), 'Required key "SessionResponseDto[isPendingSyncReset]" is missing from JSON.'); + assert(json[r'isPendingSyncReset'] != null, 'Required key "SessionResponseDto[isPendingSyncReset]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "SessionResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "SessionResponseDto[updatedAt]" has a null value in JSON.'); + return true; + }()); + return SessionResponseDto( appVersion: mapValueOfType(json, r'appVersion'), createdAt: mapValueOfType(json, r'createdAt')!, current: mapValueOfType(json, r'current')!, deviceOS: mapValueOfType(json, r'deviceOS')!, deviceType: mapValueOfType(json, r'deviceType')!, - expiresAt: mapValueOfType(json, r'expiresAt'), + expiresAt: json.containsKey(r'expiresAt') ? Optional.present(mapValueOfType(json, r'expiresAt')) : const Optional.absent(), id: mapValueOfType(json, r'id')!, isPendingSyncReset: mapValueOfType(json, r'isPendingSyncReset')!, updatedAt: mapValueOfType(json, r'updatedAt')!, diff --git a/mobile/openapi/lib/model/session_unlock_dto.dart b/mobile/openapi/lib/model/session_unlock_dto.dart index 48ee75fb05..33ea8024b6 100644 --- a/mobile/openapi/lib/model/session_unlock_dto.dart +++ b/mobile/openapi/lib/model/session_unlock_dto.dart @@ -13,8 +13,8 @@ part of openapi.api; class SessionUnlockDto { /// Returns a new [SessionUnlockDto] instance. SessionUnlockDto({ - this.password, - this.pinCode, + this.password = const Optional.absent(), + this.pinCode = const Optional.absent(), }); /// User password (required if PIN code is not provided) @@ -24,7 +24,7 @@ class SessionUnlockDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? password; + Optional password; /// New PIN code (4-6 digits) /// @@ -33,7 +33,7 @@ class SessionUnlockDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? pinCode; + Optional pinCode; @override bool operator ==(Object other) => identical(this, other) || other is SessionUnlockDto && @@ -51,15 +51,13 @@ class SessionUnlockDto { Map toJson() { final json = {}; - if (this.password != null) { - json[r'password'] = this.password; - } else { - // json[r'password'] = null; + if (this.password.isPresent) { + final value = this.password.value; + json[r'password'] = value; } - if (this.pinCode != null) { - json[r'pinCode'] = this.pinCode; - } else { - // json[r'pinCode'] = null; + if (this.pinCode.isPresent) { + final value = this.pinCode.value; + json[r'pinCode'] = value; } return json; } @@ -72,9 +70,16 @@ class SessionUnlockDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return SessionUnlockDto( - password: mapValueOfType(json, r'password'), - pinCode: mapValueOfType(json, r'pinCode'), + password: json.containsKey(r'password') ? Optional.present(mapValueOfType(json, r'password')) : const Optional.absent(), + pinCode: json.containsKey(r'pinCode') ? Optional.present(mapValueOfType(json, r'pinCode')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/session_update_dto.dart b/mobile/openapi/lib/model/session_update_dto.dart index 3ab430deaa..7741f25810 100644 --- a/mobile/openapi/lib/model/session_update_dto.dart +++ b/mobile/openapi/lib/model/session_update_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class SessionUpdateDto { /// Returns a new [SessionUpdateDto] instance. SessionUpdateDto({ - this.isPendingSyncReset, + this.isPendingSyncReset = const Optional.absent(), }); /// Reset pending sync state @@ -23,7 +23,7 @@ class SessionUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isPendingSyncReset; + Optional isPendingSyncReset; @override bool operator ==(Object other) => identical(this, other) || other is SessionUpdateDto && @@ -39,10 +39,9 @@ class SessionUpdateDto { Map toJson() { final json = {}; - if (this.isPendingSyncReset != null) { - json[r'isPendingSyncReset'] = this.isPendingSyncReset; - } else { - // json[r'isPendingSyncReset'] = null; + if (this.isPendingSyncReset.isPresent) { + final value = this.isPendingSyncReset.value; + json[r'isPendingSyncReset'] = value; } return json; } @@ -55,8 +54,15 @@ class SessionUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return SessionUpdateDto( - isPendingSyncReset: mapValueOfType(json, r'isPendingSyncReset'), + isPendingSyncReset: json.containsKey(r'isPendingSyncReset') ? Optional.present(mapValueOfType(json, r'isPendingSyncReset')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/set_maintenance_mode_dto.dart b/mobile/openapi/lib/model/set_maintenance_mode_dto.dart index e7c9dc0d63..ae125770da 100644 --- a/mobile/openapi/lib/model/set_maintenance_mode_dto.dart +++ b/mobile/openapi/lib/model/set_maintenance_mode_dto.dart @@ -14,7 +14,7 @@ class SetMaintenanceModeDto { /// Returns a new [SetMaintenanceModeDto] instance. SetMaintenanceModeDto({ required this.action, - this.restoreBackupFilename, + this.restoreBackupFilename = const Optional.absent(), }); MaintenanceAction action; @@ -26,7 +26,7 @@ class SetMaintenanceModeDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? restoreBackupFilename; + Optional restoreBackupFilename; @override bool operator ==(Object other) => identical(this, other) || other is SetMaintenanceModeDto && @@ -45,10 +45,9 @@ class SetMaintenanceModeDto { Map toJson() { final json = {}; json[r'action'] = this.action; - if (this.restoreBackupFilename != null) { - json[r'restoreBackupFilename'] = this.restoreBackupFilename; - } else { - // json[r'restoreBackupFilename'] = null; + if (this.restoreBackupFilename.isPresent) { + final value = this.restoreBackupFilename.value; + json[r'restoreBackupFilename'] = value; } return json; } @@ -61,9 +60,18 @@ class SetMaintenanceModeDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'action'), 'Required key "SetMaintenanceModeDto[action]" is missing from JSON.'); + assert(json[r'action'] != null, 'Required key "SetMaintenanceModeDto[action]" has a null value in JSON.'); + return true; + }()); + return SetMaintenanceModeDto( action: MaintenanceAction.fromJson(json[r'action'])!, - restoreBackupFilename: mapValueOfType(json, r'restoreBackupFilename'), + restoreBackupFilename: json.containsKey(r'restoreBackupFilename') ? Optional.present(mapValueOfType(json, r'restoreBackupFilename')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/shared_link_create_dto.dart b/mobile/openapi/lib/model/shared_link_create_dto.dart index a32714d556..b53da2d78e 100644 --- a/mobile/openapi/lib/model/shared_link_create_dto.dart +++ b/mobile/openapi/lib/model/shared_link_create_dto.dart @@ -13,15 +13,15 @@ part of openapi.api; class SharedLinkCreateDto { /// Returns a new [SharedLinkCreateDto] instance. SharedLinkCreateDto({ - this.albumId, - this.allowDownload = true, - this.allowUpload, - this.assetIds = const [], - this.description, - this.expiresAt, - this.password, - this.showMetadata = true, - this.slug, + this.albumId = const Optional.absent(), + this.allowDownload = const Optional.present(true), + this.allowUpload = const Optional.absent(), + this.assetIds = const Optional.present(const []), + this.description = const Optional.absent(), + this.expiresAt = const Optional.absent(), + this.password = const Optional.absent(), + this.showMetadata = const Optional.present(true), + this.slug = const Optional.absent(), required this.type, }); @@ -32,10 +32,10 @@ class SharedLinkCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? albumId; + Optional albumId; /// Allow downloads - bool allowDownload; + Optional allowDownload; /// Allow uploads /// @@ -44,25 +44,25 @@ class SharedLinkCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? allowUpload; + Optional allowUpload; /// Asset IDs (for individual assets) - List assetIds; + Optional?> assetIds; /// Link description - String? description; + Optional description; /// Expiration date - DateTime? expiresAt; + Optional expiresAt; /// Link password - String? password; + Optional password; /// Show metadata - bool showMetadata; + Optional showMetadata; /// Custom URL slug - String? slug; + Optional slug; SharedLinkType type; @@ -98,40 +98,43 @@ class SharedLinkCreateDto { Map toJson() { final json = {}; - if (this.albumId != null) { - json[r'albumId'] = this.albumId; - } else { - // json[r'albumId'] = null; + if (this.albumId.isPresent) { + final value = this.albumId.value; + json[r'albumId'] = value; } - json[r'allowDownload'] = this.allowDownload; - if (this.allowUpload != null) { - json[r'allowUpload'] = this.allowUpload; - } else { - // json[r'allowUpload'] = null; + if (this.allowDownload.isPresent) { + final value = this.allowDownload.value; + json[r'allowDownload'] = value; } - json[r'assetIds'] = this.assetIds; - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.allowUpload.isPresent) { + final value = this.allowUpload.value; + json[r'allowUpload'] = value; } - if (this.expiresAt != null) { - json[r'expiresAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.expiresAt!.millisecondsSinceEpoch - : this.expiresAt!.toUtc().toIso8601String(); - } else { - // json[r'expiresAt'] = null; + if (this.assetIds.isPresent) { + final value = this.assetIds.value; + json[r'assetIds'] = value; } - if (this.password != null) { - json[r'password'] = this.password; - } else { - // json[r'password'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - json[r'showMetadata'] = this.showMetadata; - if (this.slug != null) { - json[r'slug'] = this.slug; - } else { - // json[r'slug'] = null; + if (this.expiresAt.isPresent) { + final value = this.expiresAt.value; + json[r'expiresAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); + } + if (this.password.isPresent) { + final value = this.password.value; + json[r'password'] = value; + } + if (this.showMetadata.isPresent) { + final value = this.showMetadata.value; + json[r'showMetadata'] = value; + } + if (this.slug.isPresent) { + final value = this.slug.value; + json[r'slug'] = value; } json[r'type'] = this.type; return json; @@ -145,18 +148,27 @@ class SharedLinkCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'type'), 'Required key "SharedLinkCreateDto[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "SharedLinkCreateDto[type]" has a null value in JSON.'); + return true; + }()); + return SharedLinkCreateDto( - albumId: mapValueOfType(json, r'albumId'), - allowDownload: mapValueOfType(json, r'allowDownload') ?? true, - allowUpload: mapValueOfType(json, r'allowUpload'), - assetIds: json[r'assetIds'] is Iterable + albumId: json.containsKey(r'albumId') ? Optional.present(mapValueOfType(json, r'albumId')) : const Optional.absent(), + allowDownload: json.containsKey(r'allowDownload') ? Optional.present(mapValueOfType(json, r'allowDownload')) : const Optional.absent(), + allowUpload: json.containsKey(r'allowUpload') ? Optional.present(mapValueOfType(json, r'allowUpload')) : const Optional.absent(), + assetIds: json.containsKey(r'assetIds') ? Optional.present(json[r'assetIds'] is Iterable ? (json[r'assetIds'] as Iterable).cast().toList(growable: false) - : const [], - description: mapValueOfType(json, r'description'), - expiresAt: mapDateTime(json, r'expiresAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - password: mapValueOfType(json, r'password'), - showMetadata: mapValueOfType(json, r'showMetadata') ?? true, - slug: mapValueOfType(json, r'slug'), + : const []) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + expiresAt: json.containsKey(r'expiresAt') ? Optional.present(mapDateTime(json, r'expiresAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + password: json.containsKey(r'password') ? Optional.present(mapValueOfType(json, r'password')) : const Optional.absent(), + showMetadata: json.containsKey(r'showMetadata') ? Optional.present(mapValueOfType(json, r'showMetadata')) : const Optional.absent(), + slug: json.containsKey(r'slug') ? Optional.present(mapValueOfType(json, r'slug')) : const Optional.absent(), type: SharedLinkType.fromJson(json[r'type'])!, ); } diff --git a/mobile/openapi/lib/model/shared_link_edit_dto.dart b/mobile/openapi/lib/model/shared_link_edit_dto.dart index 11d6cdd52e..d6e74f2a43 100644 --- a/mobile/openapi/lib/model/shared_link_edit_dto.dart +++ b/mobile/openapi/lib/model/shared_link_edit_dto.dart @@ -13,14 +13,14 @@ part of openapi.api; class SharedLinkEditDto { /// Returns a new [SharedLinkEditDto] instance. SharedLinkEditDto({ - this.allowDownload, - this.allowUpload, - this.changeExpiryTime, - this.description, - this.expiresAt, - this.password, - this.showMetadata, - this.slug, + this.allowDownload = const Optional.absent(), + this.allowUpload = const Optional.absent(), + this.changeExpiryTime = const Optional.absent(), + this.description = const Optional.absent(), + this.expiresAt = const Optional.absent(), + this.password = const Optional.absent(), + this.showMetadata = const Optional.absent(), + this.slug = const Optional.absent(), }); /// Allow downloads @@ -30,7 +30,7 @@ class SharedLinkEditDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? allowDownload; + Optional allowDownload; /// Allow uploads /// @@ -39,7 +39,7 @@ class SharedLinkEditDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? allowUpload; + Optional allowUpload; /// Whether to change the expiry time. Few clients cannot send null to set the expiryTime to never. Setting this flag and not sending expiryAt is considered as null instead. Clients that can send null values can ignore this. /// @@ -48,16 +48,16 @@ class SharedLinkEditDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? changeExpiryTime; + Optional changeExpiryTime; /// Link description - String? description; + Optional description; /// Expiration date - DateTime? expiresAt; + Optional expiresAt; /// Link password - String? password; + Optional password; /// Show metadata /// @@ -66,10 +66,10 @@ class SharedLinkEditDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? showMetadata; + Optional showMetadata; /// Custom URL slug - String? slug; + Optional slug; @override bool operator ==(Object other) => identical(this, other) || other is SharedLinkEditDto && @@ -99,47 +99,39 @@ class SharedLinkEditDto { Map toJson() { final json = {}; - if (this.allowDownload != null) { - json[r'allowDownload'] = this.allowDownload; - } else { - // json[r'allowDownload'] = null; + if (this.allowDownload.isPresent) { + final value = this.allowDownload.value; + json[r'allowDownload'] = value; } - if (this.allowUpload != null) { - json[r'allowUpload'] = this.allowUpload; - } else { - // json[r'allowUpload'] = null; + if (this.allowUpload.isPresent) { + final value = this.allowUpload.value; + json[r'allowUpload'] = value; } - if (this.changeExpiryTime != null) { - json[r'changeExpiryTime'] = this.changeExpiryTime; - } else { - // json[r'changeExpiryTime'] = null; + if (this.changeExpiryTime.isPresent) { + final value = this.changeExpiryTime.value; + json[r'changeExpiryTime'] = value; } - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - if (this.expiresAt != null) { - json[r'expiresAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.expiresAt!.millisecondsSinceEpoch - : this.expiresAt!.toUtc().toIso8601String(); - } else { - // json[r'expiresAt'] = null; + if (this.expiresAt.isPresent) { + final value = this.expiresAt.value; + json[r'expiresAt'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.password != null) { - json[r'password'] = this.password; - } else { - // json[r'password'] = null; + if (this.password.isPresent) { + final value = this.password.value; + json[r'password'] = value; } - if (this.showMetadata != null) { - json[r'showMetadata'] = this.showMetadata; - } else { - // json[r'showMetadata'] = null; + if (this.showMetadata.isPresent) { + final value = this.showMetadata.value; + json[r'showMetadata'] = value; } - if (this.slug != null) { - json[r'slug'] = this.slug; - } else { - // json[r'slug'] = null; + if (this.slug.isPresent) { + final value = this.slug.value; + json[r'slug'] = value; } return json; } @@ -152,15 +144,22 @@ class SharedLinkEditDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return SharedLinkEditDto( - allowDownload: mapValueOfType(json, r'allowDownload'), - allowUpload: mapValueOfType(json, r'allowUpload'), - changeExpiryTime: mapValueOfType(json, r'changeExpiryTime'), - description: mapValueOfType(json, r'description'), - expiresAt: mapDateTime(json, r'expiresAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - password: mapValueOfType(json, r'password'), - showMetadata: mapValueOfType(json, r'showMetadata'), - slug: mapValueOfType(json, r'slug'), + allowDownload: json.containsKey(r'allowDownload') ? Optional.present(mapValueOfType(json, r'allowDownload')) : const Optional.absent(), + allowUpload: json.containsKey(r'allowUpload') ? Optional.present(mapValueOfType(json, r'allowUpload')) : const Optional.absent(), + changeExpiryTime: json.containsKey(r'changeExpiryTime') ? Optional.present(mapValueOfType(json, r'changeExpiryTime')) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + expiresAt: json.containsKey(r'expiresAt') ? Optional.present(mapDateTime(json, r'expiresAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + password: json.containsKey(r'password') ? Optional.present(mapValueOfType(json, r'password')) : const Optional.absent(), + showMetadata: json.containsKey(r'showMetadata') ? Optional.present(mapValueOfType(json, r'showMetadata')) : const Optional.absent(), + slug: json.containsKey(r'slug') ? Optional.present(mapValueOfType(json, r'slug')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/shared_link_login_dto.dart b/mobile/openapi/lib/model/shared_link_login_dto.dart index 1ab1bc9349..5727dc6115 100644 --- a/mobile/openapi/lib/model/shared_link_login_dto.dart +++ b/mobile/openapi/lib/model/shared_link_login_dto.dart @@ -45,6 +45,15 @@ class SharedLinkLoginDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'password'), 'Required key "SharedLinkLoginDto[password]" is missing from JSON.'); + assert(json[r'password'] != null, 'Required key "SharedLinkLoginDto[password]" has a null value in JSON.'); + return true; + }()); + return SharedLinkLoginDto( password: mapValueOfType(json, r'password')!, ); diff --git a/mobile/openapi/lib/model/shared_link_response_dto.dart b/mobile/openapi/lib/model/shared_link_response_dto.dart index bad0966ca2..c8239b89d9 100644 --- a/mobile/openapi/lib/model/shared_link_response_dto.dart +++ b/mobile/openapi/lib/model/shared_link_response_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class SharedLinkResponseDto { /// Returns a new [SharedLinkResponseDto] instance. SharedLinkResponseDto({ - this.album, + this.album = const Optional.absent(), required this.allowDownload, required this.allowUpload, this.assets = const [], @@ -35,7 +35,7 @@ class SharedLinkResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AlbumResponseDto? album; + Optional album; /// Allow downloads bool allowDownload; @@ -114,10 +114,9 @@ class SharedLinkResponseDto { Map toJson() { final json = {}; - if (this.album != null) { - json[r'album'] = this.album; - } else { - // json[r'album'] = null; + if (this.album.isPresent) { + final value = this.album.value; + json[r'album'] = value; } json[r'allowDownload'] = this.allowDownload; json[r'allowUpload'] = this.allowUpload; @@ -128,27 +127,27 @@ class SharedLinkResponseDto { if (this.description != null) { json[r'description'] = this.description; } else { - // json[r'description'] = null; + json[r'description'] = null; } if (this.expiresAt != null) { json[r'expiresAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.expiresAt!.millisecondsSinceEpoch : this.expiresAt!.toUtc().toIso8601String(); } else { - // json[r'expiresAt'] = null; + json[r'expiresAt'] = null; } json[r'id'] = this.id; json[r'key'] = this.key; if (this.password != null) { json[r'password'] = this.password; } else { - // json[r'password'] = null; + json[r'password'] = null; } json[r'showMetadata'] = this.showMetadata; if (this.slug != null) { json[r'slug'] = this.slug; } else { - // json[r'slug'] = null; + json[r'slug'] = null; } json[r'type'] = this.type; json[r'userId'] = this.userId; @@ -163,8 +162,37 @@ class SharedLinkResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'allowDownload'), 'Required key "SharedLinkResponseDto[allowDownload]" is missing from JSON.'); + assert(json[r'allowDownload'] != null, 'Required key "SharedLinkResponseDto[allowDownload]" has a null value in JSON.'); + assert(json.containsKey(r'allowUpload'), 'Required key "SharedLinkResponseDto[allowUpload]" is missing from JSON.'); + assert(json[r'allowUpload'] != null, 'Required key "SharedLinkResponseDto[allowUpload]" has a null value in JSON.'); + assert(json.containsKey(r'assets'), 'Required key "SharedLinkResponseDto[assets]" is missing from JSON.'); + assert(json[r'assets'] != null, 'Required key "SharedLinkResponseDto[assets]" has a null value in JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "SharedLinkResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "SharedLinkResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'description'), 'Required key "SharedLinkResponseDto[description]" is missing from JSON.'); + assert(json.containsKey(r'expiresAt'), 'Required key "SharedLinkResponseDto[expiresAt]" is missing from JSON.'); + assert(json.containsKey(r'id'), 'Required key "SharedLinkResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SharedLinkResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'key'), 'Required key "SharedLinkResponseDto[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "SharedLinkResponseDto[key]" has a null value in JSON.'); + assert(json.containsKey(r'password'), 'Required key "SharedLinkResponseDto[password]" is missing from JSON.'); + assert(json.containsKey(r'showMetadata'), 'Required key "SharedLinkResponseDto[showMetadata]" is missing from JSON.'); + assert(json[r'showMetadata'] != null, 'Required key "SharedLinkResponseDto[showMetadata]" has a null value in JSON.'); + assert(json.containsKey(r'slug'), 'Required key "SharedLinkResponseDto[slug]" is missing from JSON.'); + assert(json.containsKey(r'type'), 'Required key "SharedLinkResponseDto[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "SharedLinkResponseDto[type]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "SharedLinkResponseDto[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "SharedLinkResponseDto[userId]" has a null value in JSON.'); + return true; + }()); + return SharedLinkResponseDto( - album: AlbumResponseDto.fromJson(json[r'album']), + album: json.containsKey(r'album') ? Optional.present(AlbumResponseDto.fromJson(json[r'album'])) : const Optional.absent(), allowDownload: mapValueOfType(json, r'allowDownload')!, allowUpload: mapValueOfType(json, r'allowUpload')!, assets: AssetResponseDto.listFromJson(json[r'assets']), diff --git a/mobile/openapi/lib/model/shared_links_response.dart b/mobile/openapi/lib/model/shared_links_response.dart index 2b32a57540..da7a6fa4e1 100644 --- a/mobile/openapi/lib/model/shared_links_response.dart +++ b/mobile/openapi/lib/model/shared_links_response.dart @@ -52,6 +52,17 @@ class SharedLinksResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "SharedLinksResponse[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SharedLinksResponse[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'sidebarWeb'), 'Required key "SharedLinksResponse[sidebarWeb]" is missing from JSON.'); + assert(json[r'sidebarWeb'] != null, 'Required key "SharedLinksResponse[sidebarWeb]" has a null value in JSON.'); + return true; + }()); + return SharedLinksResponse( enabled: mapValueOfType(json, r'enabled')!, sidebarWeb: mapValueOfType(json, r'sidebarWeb')!, diff --git a/mobile/openapi/lib/model/shared_links_update.dart b/mobile/openapi/lib/model/shared_links_update.dart index 8e792b4f49..f1a70caef1 100644 --- a/mobile/openapi/lib/model/shared_links_update.dart +++ b/mobile/openapi/lib/model/shared_links_update.dart @@ -13,8 +13,8 @@ part of openapi.api; class SharedLinksUpdate { /// Returns a new [SharedLinksUpdate] instance. SharedLinksUpdate({ - this.enabled, - this.sidebarWeb, + this.enabled = const Optional.absent(), + this.sidebarWeb = const Optional.absent(), }); /// Whether shared links are enabled @@ -24,7 +24,7 @@ class SharedLinksUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; /// Whether shared links appear in web sidebar /// @@ -33,7 +33,7 @@ class SharedLinksUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? sidebarWeb; + Optional sidebarWeb; @override bool operator ==(Object other) => identical(this, other) || other is SharedLinksUpdate && @@ -51,15 +51,13 @@ class SharedLinksUpdate { Map toJson() { final json = {}; - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } - if (this.sidebarWeb != null) { - json[r'sidebarWeb'] = this.sidebarWeb; - } else { - // json[r'sidebarWeb'] = null; + if (this.sidebarWeb.isPresent) { + final value = this.sidebarWeb.value; + json[r'sidebarWeb'] = value; } return json; } @@ -72,9 +70,16 @@ class SharedLinksUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return SharedLinksUpdate( - enabled: mapValueOfType(json, r'enabled'), - sidebarWeb: mapValueOfType(json, r'sidebarWeb'), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), + sidebarWeb: json.containsKey(r'sidebarWeb') ? Optional.present(mapValueOfType(json, r'sidebarWeb')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/sign_up_dto.dart b/mobile/openapi/lib/model/sign_up_dto.dart index 54c8fa07d2..6e36f52962 100644 --- a/mobile/openapi/lib/model/sign_up_dto.dart +++ b/mobile/openapi/lib/model/sign_up_dto.dart @@ -59,6 +59,19 @@ class SignUpDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'email'), 'Required key "SignUpDto[email]" is missing from JSON.'); + assert(json[r'email'] != null, 'Required key "SignUpDto[email]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "SignUpDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "SignUpDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'password'), 'Required key "SignUpDto[password]" is missing from JSON.'); + assert(json[r'password'] != null, 'Required key "SignUpDto[password]" has a null value in JSON.'); + return true; + }()); + return SignUpDto( email: mapValueOfType(json, r'email')!, name: mapValueOfType(json, r'name')!, diff --git a/mobile/openapi/lib/model/smart_search_dto.dart b/mobile/openapi/lib/model/smart_search_dto.dart index 9bbb4a25f0..c737f06ae2 100644 --- a/mobile/openapi/lib/model/smart_search_dto.dart +++ b/mobile/openapi/lib/model/smart_search_dto.dart @@ -13,50 +13,50 @@ part of openapi.api; class SmartSearchDto { /// Returns a new [SmartSearchDto] instance. SmartSearchDto({ - this.albumIds = const [], - this.city, - this.country, - this.createdAfter, - this.createdBefore, - this.isEncoded, - this.isFavorite, - this.isMotion, - this.isNotInAlbum, - this.isOffline, - this.language, - this.lensModel, - this.libraryId, - this.make, - this.model, - this.ocr, - this.page, - this.personIds = const [], - this.query, - this.queryAssetId, - this.rating, - this.size, - this.state, - this.tagIds = const [], - this.takenAfter, - this.takenBefore, - this.trashedAfter, - this.trashedBefore, - this.type, - this.updatedAfter, - this.updatedBefore, - this.visibility, - this.withDeleted, - this.withExif, + this.albumIds = const Optional.present(const []), + this.city = const Optional.absent(), + this.country = const Optional.absent(), + this.createdAfter = const Optional.absent(), + this.createdBefore = const Optional.absent(), + this.isEncoded = const Optional.absent(), + this.isFavorite = const Optional.absent(), + this.isMotion = const Optional.absent(), + this.isNotInAlbum = const Optional.absent(), + this.isOffline = const Optional.absent(), + this.language = const Optional.absent(), + this.lensModel = const Optional.absent(), + this.libraryId = const Optional.absent(), + this.make = const Optional.absent(), + this.model = const Optional.absent(), + this.ocr = const Optional.absent(), + this.page = const Optional.absent(), + this.personIds = const Optional.present(const []), + this.query = const Optional.absent(), + this.queryAssetId = const Optional.absent(), + this.rating = const Optional.absent(), + this.size = const Optional.absent(), + this.state = const Optional.absent(), + this.tagIds = const Optional.present(const []), + this.takenAfter = const Optional.absent(), + this.takenBefore = const Optional.absent(), + this.trashedAfter = const Optional.absent(), + this.trashedBefore = const Optional.absent(), + this.type = const Optional.absent(), + this.updatedAfter = const Optional.absent(), + this.updatedBefore = const Optional.absent(), + this.visibility = const Optional.absent(), + this.withDeleted = const Optional.absent(), + this.withExif = const Optional.absent(), }); /// Filter by album IDs - List albumIds; + Optional?> albumIds; /// Filter by city name - String? city; + Optional city; /// Filter by country name - String? country; + Optional country; /// Filter by creation date (after) /// @@ -65,7 +65,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? createdAfter; + Optional createdAfter; /// Filter by creation date (before) /// @@ -74,7 +74,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? createdBefore; + Optional createdBefore; /// Filter by encoded status /// @@ -83,7 +83,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isEncoded; + Optional isEncoded; /// Filter by favorite status /// @@ -92,7 +92,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isFavorite; + Optional isFavorite; /// Filter by motion photo status /// @@ -101,7 +101,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isMotion; + Optional isMotion; /// Filter assets not in any album /// @@ -110,7 +110,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isNotInAlbum; + Optional isNotInAlbum; /// Filter by offline status /// @@ -119,7 +119,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isOffline; + Optional isOffline; /// Search language code /// @@ -128,19 +128,19 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? language; + Optional language; /// Filter by lens model - String? lensModel; + Optional lensModel; /// Library ID to filter by - String? libraryId; + Optional libraryId; /// Filter by camera make - String? make; + Optional make; /// Filter by camera model - String? model; + Optional model; /// Filter by OCR text content /// @@ -149,7 +149,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? ocr; + Optional ocr; /// Page number /// @@ -161,10 +161,10 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? page; + Optional page; /// Filter by person IDs - List personIds; + Optional?> personIds; /// Natural language search query /// @@ -173,7 +173,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? query; + Optional query; /// Asset ID to use as search reference /// @@ -182,13 +182,13 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? queryAssetId; + Optional queryAssetId; /// Filter by rating [1-5], or null for unrated /// /// Minimum value: -1 /// Maximum value: 5 - int? rating; + Optional rating; /// Number of results to return /// @@ -200,13 +200,13 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - int? size; + Optional size; /// Filter by state/province name - String? state; + Optional state; /// Filter by tag IDs - List? tagIds; + Optional?> tagIds; /// Filter by taken date (after) /// @@ -215,7 +215,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? takenAfter; + Optional takenAfter; /// Filter by taken date (before) /// @@ -224,7 +224,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? takenBefore; + Optional takenBefore; /// Filter by trash date (after) /// @@ -233,7 +233,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? trashedAfter; + Optional trashedAfter; /// Filter by trash date (before) /// @@ -242,7 +242,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? trashedBefore; + Optional trashedBefore; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -250,7 +250,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetTypeEnum? type; + Optional type; /// Filter by update date (after) /// @@ -259,7 +259,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? updatedAfter; + Optional updatedAfter; /// Filter by update date (before) /// @@ -268,7 +268,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? updatedBefore; + Optional updatedBefore; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -276,7 +276,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetVisibility? visibility; + Optional visibility; /// Include deleted assets /// @@ -285,7 +285,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? withDeleted; + Optional withDeleted; /// Include EXIF data in response /// @@ -294,7 +294,7 @@ class SmartSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? withExif; + Optional withExif; @override bool operator ==(Object other) => identical(this, other) || other is SmartSearchDto && @@ -376,183 +376,157 @@ class SmartSearchDto { Map toJson() { final json = {}; - json[r'albumIds'] = this.albumIds; - if (this.city != null) { - json[r'city'] = this.city; - } else { - // json[r'city'] = null; + if (this.albumIds.isPresent) { + final value = this.albumIds.value; + json[r'albumIds'] = value; } - if (this.country != null) { - json[r'country'] = this.country; - } else { - // json[r'country'] = null; + if (this.city.isPresent) { + final value = this.city.value; + json[r'city'] = value; } - if (this.createdAfter != null) { - json[r'createdAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.createdAfter!.millisecondsSinceEpoch - : this.createdAfter!.toUtc().toIso8601String(); - } else { - // json[r'createdAfter'] = null; + if (this.country.isPresent) { + final value = this.country.value; + json[r'country'] = value; } - if (this.createdBefore != null) { - json[r'createdBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.createdBefore!.millisecondsSinceEpoch - : this.createdBefore!.toUtc().toIso8601String(); - } else { - // json[r'createdBefore'] = null; + if (this.createdAfter.isPresent) { + final value = this.createdAfter.value; + json[r'createdAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.isEncoded != null) { - json[r'isEncoded'] = this.isEncoded; - } else { - // json[r'isEncoded'] = null; + if (this.createdBefore.isPresent) { + final value = this.createdBefore.value; + json[r'createdBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.isFavorite != null) { - json[r'isFavorite'] = this.isFavorite; - } else { - // json[r'isFavorite'] = null; + if (this.isEncoded.isPresent) { + final value = this.isEncoded.value; + json[r'isEncoded'] = value; } - if (this.isMotion != null) { - json[r'isMotion'] = this.isMotion; - } else { - // json[r'isMotion'] = null; + if (this.isFavorite.isPresent) { + final value = this.isFavorite.value; + json[r'isFavorite'] = value; } - if (this.isNotInAlbum != null) { - json[r'isNotInAlbum'] = this.isNotInAlbum; - } else { - // json[r'isNotInAlbum'] = null; + if (this.isMotion.isPresent) { + final value = this.isMotion.value; + json[r'isMotion'] = value; } - if (this.isOffline != null) { - json[r'isOffline'] = this.isOffline; - } else { - // json[r'isOffline'] = null; + if (this.isNotInAlbum.isPresent) { + final value = this.isNotInAlbum.value; + json[r'isNotInAlbum'] = value; } - if (this.language != null) { - json[r'language'] = this.language; - } else { - // json[r'language'] = null; + if (this.isOffline.isPresent) { + final value = this.isOffline.value; + json[r'isOffline'] = value; } - if (this.lensModel != null) { - json[r'lensModel'] = this.lensModel; - } else { - // json[r'lensModel'] = null; + if (this.language.isPresent) { + final value = this.language.value; + json[r'language'] = value; } - if (this.libraryId != null) { - json[r'libraryId'] = this.libraryId; - } else { - // json[r'libraryId'] = null; + if (this.lensModel.isPresent) { + final value = this.lensModel.value; + json[r'lensModel'] = value; } - if (this.make != null) { - json[r'make'] = this.make; - } else { - // json[r'make'] = null; + if (this.libraryId.isPresent) { + final value = this.libraryId.value; + json[r'libraryId'] = value; } - if (this.model != null) { - json[r'model'] = this.model; - } else { - // json[r'model'] = null; + if (this.make.isPresent) { + final value = this.make.value; + json[r'make'] = value; } - if (this.ocr != null) { - json[r'ocr'] = this.ocr; - } else { - // json[r'ocr'] = null; + if (this.model.isPresent) { + final value = this.model.value; + json[r'model'] = value; } - if (this.page != null) { - json[r'page'] = this.page; - } else { - // json[r'page'] = null; + if (this.ocr.isPresent) { + final value = this.ocr.value; + json[r'ocr'] = value; } - json[r'personIds'] = this.personIds; - if (this.query != null) { - json[r'query'] = this.query; - } else { - // json[r'query'] = null; + if (this.page.isPresent) { + final value = this.page.value; + json[r'page'] = value; } - if (this.queryAssetId != null) { - json[r'queryAssetId'] = this.queryAssetId; - } else { - // json[r'queryAssetId'] = null; + if (this.personIds.isPresent) { + final value = this.personIds.value; + json[r'personIds'] = value; } - if (this.rating != null) { - json[r'rating'] = this.rating; - } else { - // json[r'rating'] = null; + if (this.query.isPresent) { + final value = this.query.value; + json[r'query'] = value; } - if (this.size != null) { - json[r'size'] = this.size; - } else { - // json[r'size'] = null; + if (this.queryAssetId.isPresent) { + final value = this.queryAssetId.value; + json[r'queryAssetId'] = value; } - if (this.state != null) { - json[r'state'] = this.state; - } else { - // json[r'state'] = null; + if (this.rating.isPresent) { + final value = this.rating.value; + json[r'rating'] = value; } - if (this.tagIds != null) { - json[r'tagIds'] = this.tagIds; - } else { - // json[r'tagIds'] = null; + if (this.size.isPresent) { + final value = this.size.value; + json[r'size'] = value; } - if (this.takenAfter != null) { - json[r'takenAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.takenAfter!.millisecondsSinceEpoch - : this.takenAfter!.toUtc().toIso8601String(); - } else { - // json[r'takenAfter'] = null; + if (this.state.isPresent) { + final value = this.state.value; + json[r'state'] = value; } - if (this.takenBefore != null) { - json[r'takenBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.takenBefore!.millisecondsSinceEpoch - : this.takenBefore!.toUtc().toIso8601String(); - } else { - // json[r'takenBefore'] = null; + if (this.tagIds.isPresent) { + final value = this.tagIds.value; + json[r'tagIds'] = value; } - if (this.trashedAfter != null) { - json[r'trashedAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.trashedAfter!.millisecondsSinceEpoch - : this.trashedAfter!.toUtc().toIso8601String(); - } else { - // json[r'trashedAfter'] = null; + if (this.takenAfter.isPresent) { + final value = this.takenAfter.value; + json[r'takenAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.trashedBefore != null) { - json[r'trashedBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.trashedBefore!.millisecondsSinceEpoch - : this.trashedBefore!.toUtc().toIso8601String(); - } else { - // json[r'trashedBefore'] = null; + if (this.takenBefore.isPresent) { + final value = this.takenBefore.value; + json[r'takenBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.type != null) { - json[r'type'] = this.type; - } else { - // json[r'type'] = null; + if (this.trashedAfter.isPresent) { + final value = this.trashedAfter.value; + json[r'trashedAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.updatedAfter != null) { - json[r'updatedAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.updatedAfter!.millisecondsSinceEpoch - : this.updatedAfter!.toUtc().toIso8601String(); - } else { - // json[r'updatedAfter'] = null; + if (this.trashedBefore.isPresent) { + final value = this.trashedBefore.value; + json[r'trashedBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.updatedBefore != null) { - json[r'updatedBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.updatedBefore!.millisecondsSinceEpoch - : this.updatedBefore!.toUtc().toIso8601String(); - } else { - // json[r'updatedBefore'] = null; + if (this.type.isPresent) { + final value = this.type.value; + json[r'type'] = value; } - if (this.visibility != null) { - json[r'visibility'] = this.visibility; - } else { - // json[r'visibility'] = null; + if (this.updatedAfter.isPresent) { + final value = this.updatedAfter.value; + json[r'updatedAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.withDeleted != null) { - json[r'withDeleted'] = this.withDeleted; - } else { - // json[r'withDeleted'] = null; + if (this.updatedBefore.isPresent) { + final value = this.updatedBefore.value; + json[r'updatedBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.withExif != null) { - json[r'withExif'] = this.withExif; - } else { - // json[r'withExif'] = null; + if (this.visibility.isPresent) { + final value = this.visibility.value; + json[r'visibility'] = value; + } + if (this.withDeleted.isPresent) { + final value = this.withDeleted.value; + json[r'withDeleted'] = value; + } + if (this.withExif.isPresent) { + final value = this.withExif.value; + json[r'withExif'] = value; } return json; } @@ -565,47 +539,54 @@ class SmartSearchDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return SmartSearchDto( - albumIds: json[r'albumIds'] is Iterable + albumIds: json.containsKey(r'albumIds') ? Optional.present(json[r'albumIds'] is Iterable ? (json[r'albumIds'] as Iterable).cast().toList(growable: false) - : const [], - city: mapValueOfType(json, r'city'), - country: mapValueOfType(json, r'country'), - createdAfter: mapDateTime(json, r'createdAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - createdBefore: mapDateTime(json, r'createdBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - isEncoded: mapValueOfType(json, r'isEncoded'), - isFavorite: mapValueOfType(json, r'isFavorite'), - isMotion: mapValueOfType(json, r'isMotion'), - isNotInAlbum: mapValueOfType(json, r'isNotInAlbum'), - isOffline: mapValueOfType(json, r'isOffline'), - language: mapValueOfType(json, r'language'), - lensModel: mapValueOfType(json, r'lensModel'), - libraryId: mapValueOfType(json, r'libraryId'), - make: mapValueOfType(json, r'make'), - model: mapValueOfType(json, r'model'), - ocr: mapValueOfType(json, r'ocr'), - page: mapValueOfType(json, r'page'), - personIds: json[r'personIds'] is Iterable + : const []) : const Optional.absent(), + city: json.containsKey(r'city') ? Optional.present(mapValueOfType(json, r'city')) : const Optional.absent(), + country: json.containsKey(r'country') ? Optional.present(mapValueOfType(json, r'country')) : const Optional.absent(), + createdAfter: json.containsKey(r'createdAfter') ? Optional.present(mapDateTime(json, r'createdAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + createdBefore: json.containsKey(r'createdBefore') ? Optional.present(mapDateTime(json, r'createdBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + isEncoded: json.containsKey(r'isEncoded') ? Optional.present(mapValueOfType(json, r'isEncoded')) : const Optional.absent(), + isFavorite: json.containsKey(r'isFavorite') ? Optional.present(mapValueOfType(json, r'isFavorite')) : const Optional.absent(), + isMotion: json.containsKey(r'isMotion') ? Optional.present(mapValueOfType(json, r'isMotion')) : const Optional.absent(), + isNotInAlbum: json.containsKey(r'isNotInAlbum') ? Optional.present(mapValueOfType(json, r'isNotInAlbum')) : const Optional.absent(), + isOffline: json.containsKey(r'isOffline') ? Optional.present(mapValueOfType(json, r'isOffline')) : const Optional.absent(), + language: json.containsKey(r'language') ? Optional.present(mapValueOfType(json, r'language')) : const Optional.absent(), + lensModel: json.containsKey(r'lensModel') ? Optional.present(mapValueOfType(json, r'lensModel')) : const Optional.absent(), + libraryId: json.containsKey(r'libraryId') ? Optional.present(mapValueOfType(json, r'libraryId')) : const Optional.absent(), + make: json.containsKey(r'make') ? Optional.present(mapValueOfType(json, r'make')) : const Optional.absent(), + model: json.containsKey(r'model') ? Optional.present(mapValueOfType(json, r'model')) : const Optional.absent(), + ocr: json.containsKey(r'ocr') ? Optional.present(mapValueOfType(json, r'ocr')) : const Optional.absent(), + page: json.containsKey(r'page') ? Optional.present(json[r'page'] == null ? null : int.parse('${json[r'page']}')) : const Optional.absent(), + personIds: json.containsKey(r'personIds') ? Optional.present(json[r'personIds'] is Iterable ? (json[r'personIds'] as Iterable).cast().toList(growable: false) - : const [], - query: mapValueOfType(json, r'query'), - queryAssetId: mapValueOfType(json, r'queryAssetId'), - rating: mapValueOfType(json, r'rating'), - size: mapValueOfType(json, r'size'), - state: mapValueOfType(json, r'state'), - tagIds: json[r'tagIds'] is Iterable + : const []) : const Optional.absent(), + query: json.containsKey(r'query') ? Optional.present(mapValueOfType(json, r'query')) : const Optional.absent(), + queryAssetId: json.containsKey(r'queryAssetId') ? Optional.present(mapValueOfType(json, r'queryAssetId')) : const Optional.absent(), + rating: json.containsKey(r'rating') ? Optional.present(json[r'rating'] == null ? null : int.parse('${json[r'rating']}')) : const Optional.absent(), + size: json.containsKey(r'size') ? Optional.present(json[r'size'] == null ? null : int.parse('${json[r'size']}')) : const Optional.absent(), + state: json.containsKey(r'state') ? Optional.present(mapValueOfType(json, r'state')) : const Optional.absent(), + tagIds: json.containsKey(r'tagIds') ? Optional.present(json[r'tagIds'] is Iterable ? (json[r'tagIds'] as Iterable).cast().toList(growable: false) - : const [], - takenAfter: mapDateTime(json, r'takenAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - takenBefore: mapDateTime(json, r'takenBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - trashedAfter: mapDateTime(json, r'trashedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - trashedBefore: mapDateTime(json, r'trashedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - type: AssetTypeEnum.fromJson(json[r'type']), - updatedAfter: mapDateTime(json, r'updatedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - updatedBefore: mapDateTime(json, r'updatedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - visibility: AssetVisibility.fromJson(json[r'visibility']), - withDeleted: mapValueOfType(json, r'withDeleted'), - withExif: mapValueOfType(json, r'withExif'), + : const []) : const Optional.absent(), + takenAfter: json.containsKey(r'takenAfter') ? Optional.present(mapDateTime(json, r'takenAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + takenBefore: json.containsKey(r'takenBefore') ? Optional.present(mapDateTime(json, r'takenBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + trashedAfter: json.containsKey(r'trashedAfter') ? Optional.present(mapDateTime(json, r'trashedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + trashedBefore: json.containsKey(r'trashedBefore') ? Optional.present(mapDateTime(json, r'trashedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + type: json.containsKey(r'type') ? Optional.present(AssetTypeEnum.fromJson(json[r'type'])) : const Optional.absent(), + updatedAfter: json.containsKey(r'updatedAfter') ? Optional.present(mapDateTime(json, r'updatedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + updatedBefore: json.containsKey(r'updatedBefore') ? Optional.present(mapDateTime(json, r'updatedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + visibility: json.containsKey(r'visibility') ? Optional.present(AssetVisibility.fromJson(json[r'visibility'])) : const Optional.absent(), + withDeleted: json.containsKey(r'withDeleted') ? Optional.present(mapValueOfType(json, r'withDeleted')) : const Optional.absent(), + withExif: json.containsKey(r'withExif') ? Optional.present(mapValueOfType(json, r'withExif')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/stack_create_dto.dart b/mobile/openapi/lib/model/stack_create_dto.dart index 6b08c83401..02081fbeed 100644 --- a/mobile/openapi/lib/model/stack_create_dto.dart +++ b/mobile/openapi/lib/model/stack_create_dto.dart @@ -45,6 +45,15 @@ class StackCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetIds'), 'Required key "StackCreateDto[assetIds]" is missing from JSON.'); + assert(json[r'assetIds'] != null, 'Required key "StackCreateDto[assetIds]" has a null value in JSON.'); + return true; + }()); + return StackCreateDto( assetIds: json[r'assetIds'] is Iterable ? (json[r'assetIds'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/stack_response_dto.dart b/mobile/openapi/lib/model/stack_response_dto.dart index 326f83a03d..33f5fe2189 100644 --- a/mobile/openapi/lib/model/stack_response_dto.dart +++ b/mobile/openapi/lib/model/stack_response_dto.dart @@ -58,6 +58,19 @@ class StackResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assets'), 'Required key "StackResponseDto[assets]" is missing from JSON.'); + assert(json[r'assets'] != null, 'Required key "StackResponseDto[assets]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "StackResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "StackResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'primaryAssetId'), 'Required key "StackResponseDto[primaryAssetId]" is missing from JSON.'); + assert(json[r'primaryAssetId'] != null, 'Required key "StackResponseDto[primaryAssetId]" has a null value in JSON.'); + return true; + }()); + return StackResponseDto( assets: AssetResponseDto.listFromJson(json[r'assets']), id: mapValueOfType(json, r'id')!, diff --git a/mobile/openapi/lib/model/stack_update_dto.dart b/mobile/openapi/lib/model/stack_update_dto.dart index e81c204f97..0bcd42be4e 100644 --- a/mobile/openapi/lib/model/stack_update_dto.dart +++ b/mobile/openapi/lib/model/stack_update_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class StackUpdateDto { /// Returns a new [StackUpdateDto] instance. StackUpdateDto({ - this.primaryAssetId, + this.primaryAssetId = const Optional.absent(), }); /// Primary asset ID @@ -23,7 +23,7 @@ class StackUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? primaryAssetId; + Optional primaryAssetId; @override bool operator ==(Object other) => identical(this, other) || other is StackUpdateDto && @@ -39,10 +39,9 @@ class StackUpdateDto { Map toJson() { final json = {}; - if (this.primaryAssetId != null) { - json[r'primaryAssetId'] = this.primaryAssetId; - } else { - // json[r'primaryAssetId'] = null; + if (this.primaryAssetId.isPresent) { + final value = this.primaryAssetId.value; + json[r'primaryAssetId'] = value; } return json; } @@ -55,8 +54,15 @@ class StackUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return StackUpdateDto( - primaryAssetId: mapValueOfType(json, r'primaryAssetId'), + primaryAssetId: json.containsKey(r'primaryAssetId') ? Optional.present(mapValueOfType(json, r'primaryAssetId')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/statistics_search_dto.dart b/mobile/openapi/lib/model/statistics_search_dto.dart index f276e3717b..48b5d7c087 100644 --- a/mobile/openapi/lib/model/statistics_search_dto.dart +++ b/mobile/openapi/lib/model/statistics_search_dto.dart @@ -13,44 +13,44 @@ part of openapi.api; class StatisticsSearchDto { /// Returns a new [StatisticsSearchDto] instance. StatisticsSearchDto({ - this.albumIds = const [], - this.city, - this.country, - this.createdAfter, - this.createdBefore, - this.description, - this.isEncoded, - this.isFavorite, - this.isMotion, - this.isNotInAlbum, - this.isOffline, - this.lensModel, - this.libraryId, - this.make, - this.model, - this.ocr, - this.personIds = const [], - this.rating, - this.state, - this.tagIds = const [], - this.takenAfter, - this.takenBefore, - this.trashedAfter, - this.trashedBefore, - this.type, - this.updatedAfter, - this.updatedBefore, - this.visibility, + this.albumIds = const Optional.present(const []), + this.city = const Optional.absent(), + this.country = const Optional.absent(), + this.createdAfter = const Optional.absent(), + this.createdBefore = const Optional.absent(), + this.description = const Optional.absent(), + this.isEncoded = const Optional.absent(), + this.isFavorite = const Optional.absent(), + this.isMotion = const Optional.absent(), + this.isNotInAlbum = const Optional.absent(), + this.isOffline = const Optional.absent(), + this.lensModel = const Optional.absent(), + this.libraryId = const Optional.absent(), + this.make = const Optional.absent(), + this.model = const Optional.absent(), + this.ocr = const Optional.absent(), + this.personIds = const Optional.present(const []), + this.rating = const Optional.absent(), + this.state = const Optional.absent(), + this.tagIds = const Optional.present(const []), + this.takenAfter = const Optional.absent(), + this.takenBefore = const Optional.absent(), + this.trashedAfter = const Optional.absent(), + this.trashedBefore = const Optional.absent(), + this.type = const Optional.absent(), + this.updatedAfter = const Optional.absent(), + this.updatedBefore = const Optional.absent(), + this.visibility = const Optional.absent(), }); /// Filter by album IDs - List albumIds; + Optional?> albumIds; /// Filter by city name - String? city; + Optional city; /// Filter by country name - String? country; + Optional country; /// Filter by creation date (after) /// @@ -59,7 +59,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? createdAfter; + Optional createdAfter; /// Filter by creation date (before) /// @@ -68,7 +68,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? createdBefore; + Optional createdBefore; /// Filter by description text /// @@ -77,7 +77,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? description; + Optional description; /// Filter by encoded status /// @@ -86,7 +86,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isEncoded; + Optional isEncoded; /// Filter by favorite status /// @@ -95,7 +95,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isFavorite; + Optional isFavorite; /// Filter by motion photo status /// @@ -104,7 +104,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isMotion; + Optional isMotion; /// Filter assets not in any album /// @@ -113,7 +113,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isNotInAlbum; + Optional isNotInAlbum; /// Filter by offline status /// @@ -122,19 +122,19 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isOffline; + Optional isOffline; /// Filter by lens model - String? lensModel; + Optional lensModel; /// Library ID to filter by - String? libraryId; + Optional libraryId; /// Filter by camera make - String? make; + Optional make; /// Filter by camera model - String? model; + Optional model; /// Filter by OCR text content /// @@ -143,22 +143,22 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? ocr; + Optional ocr; /// Filter by person IDs - List personIds; + Optional?> personIds; /// Filter by rating [1-5], or null for unrated /// /// Minimum value: -1 /// Maximum value: 5 - int? rating; + Optional rating; /// Filter by state/province name - String? state; + Optional state; /// Filter by tag IDs - List? tagIds; + Optional?> tagIds; /// Filter by taken date (after) /// @@ -167,7 +167,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? takenAfter; + Optional takenAfter; /// Filter by taken date (before) /// @@ -176,7 +176,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? takenBefore; + Optional takenBefore; /// Filter by trash date (after) /// @@ -185,7 +185,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? trashedAfter; + Optional trashedAfter; /// Filter by trash date (before) /// @@ -194,7 +194,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? trashedBefore; + Optional trashedBefore; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -202,7 +202,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetTypeEnum? type; + Optional type; /// Filter by update date (after) /// @@ -211,7 +211,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? updatedAfter; + Optional updatedAfter; /// Filter by update date (before) /// @@ -220,7 +220,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DateTime? updatedBefore; + Optional updatedBefore; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -228,7 +228,7 @@ class StatisticsSearchDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetVisibility? visibility; + Optional visibility; @override bool operator ==(Object other) => identical(this, other) || other is StatisticsSearchDto && @@ -298,153 +298,133 @@ class StatisticsSearchDto { Map toJson() { final json = {}; - json[r'albumIds'] = this.albumIds; - if (this.city != null) { - json[r'city'] = this.city; - } else { - // json[r'city'] = null; + if (this.albumIds.isPresent) { + final value = this.albumIds.value; + json[r'albumIds'] = value; } - if (this.country != null) { - json[r'country'] = this.country; - } else { - // json[r'country'] = null; + if (this.city.isPresent) { + final value = this.city.value; + json[r'city'] = value; } - if (this.createdAfter != null) { - json[r'createdAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.createdAfter!.millisecondsSinceEpoch - : this.createdAfter!.toUtc().toIso8601String(); - } else { - // json[r'createdAfter'] = null; + if (this.country.isPresent) { + final value = this.country.value; + json[r'country'] = value; } - if (this.createdBefore != null) { - json[r'createdBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.createdBefore!.millisecondsSinceEpoch - : this.createdBefore!.toUtc().toIso8601String(); - } else { - // json[r'createdBefore'] = null; + if (this.createdAfter.isPresent) { + final value = this.createdAfter.value; + json[r'createdAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.createdBefore.isPresent) { + final value = this.createdBefore.value; + json[r'createdBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.isEncoded != null) { - json[r'isEncoded'] = this.isEncoded; - } else { - // json[r'isEncoded'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - if (this.isFavorite != null) { - json[r'isFavorite'] = this.isFavorite; - } else { - // json[r'isFavorite'] = null; + if (this.isEncoded.isPresent) { + final value = this.isEncoded.value; + json[r'isEncoded'] = value; } - if (this.isMotion != null) { - json[r'isMotion'] = this.isMotion; - } else { - // json[r'isMotion'] = null; + if (this.isFavorite.isPresent) { + final value = this.isFavorite.value; + json[r'isFavorite'] = value; } - if (this.isNotInAlbum != null) { - json[r'isNotInAlbum'] = this.isNotInAlbum; - } else { - // json[r'isNotInAlbum'] = null; + if (this.isMotion.isPresent) { + final value = this.isMotion.value; + json[r'isMotion'] = value; } - if (this.isOffline != null) { - json[r'isOffline'] = this.isOffline; - } else { - // json[r'isOffline'] = null; + if (this.isNotInAlbum.isPresent) { + final value = this.isNotInAlbum.value; + json[r'isNotInAlbum'] = value; } - if (this.lensModel != null) { - json[r'lensModel'] = this.lensModel; - } else { - // json[r'lensModel'] = null; + if (this.isOffline.isPresent) { + final value = this.isOffline.value; + json[r'isOffline'] = value; } - if (this.libraryId != null) { - json[r'libraryId'] = this.libraryId; - } else { - // json[r'libraryId'] = null; + if (this.lensModel.isPresent) { + final value = this.lensModel.value; + json[r'lensModel'] = value; } - if (this.make != null) { - json[r'make'] = this.make; - } else { - // json[r'make'] = null; + if (this.libraryId.isPresent) { + final value = this.libraryId.value; + json[r'libraryId'] = value; } - if (this.model != null) { - json[r'model'] = this.model; - } else { - // json[r'model'] = null; + if (this.make.isPresent) { + final value = this.make.value; + json[r'make'] = value; } - if (this.ocr != null) { - json[r'ocr'] = this.ocr; - } else { - // json[r'ocr'] = null; + if (this.model.isPresent) { + final value = this.model.value; + json[r'model'] = value; } - json[r'personIds'] = this.personIds; - if (this.rating != null) { - json[r'rating'] = this.rating; - } else { - // json[r'rating'] = null; + if (this.ocr.isPresent) { + final value = this.ocr.value; + json[r'ocr'] = value; } - if (this.state != null) { - json[r'state'] = this.state; - } else { - // json[r'state'] = null; + if (this.personIds.isPresent) { + final value = this.personIds.value; + json[r'personIds'] = value; } - if (this.tagIds != null) { - json[r'tagIds'] = this.tagIds; - } else { - // json[r'tagIds'] = null; + if (this.rating.isPresent) { + final value = this.rating.value; + json[r'rating'] = value; } - if (this.takenAfter != null) { - json[r'takenAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.takenAfter!.millisecondsSinceEpoch - : this.takenAfter!.toUtc().toIso8601String(); - } else { - // json[r'takenAfter'] = null; + if (this.state.isPresent) { + final value = this.state.value; + json[r'state'] = value; } - if (this.takenBefore != null) { - json[r'takenBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.takenBefore!.millisecondsSinceEpoch - : this.takenBefore!.toUtc().toIso8601String(); - } else { - // json[r'takenBefore'] = null; + if (this.tagIds.isPresent) { + final value = this.tagIds.value; + json[r'tagIds'] = value; } - if (this.trashedAfter != null) { - json[r'trashedAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.trashedAfter!.millisecondsSinceEpoch - : this.trashedAfter!.toUtc().toIso8601String(); - } else { - // json[r'trashedAfter'] = null; + if (this.takenAfter.isPresent) { + final value = this.takenAfter.value; + json[r'takenAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.trashedBefore != null) { - json[r'trashedBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.trashedBefore!.millisecondsSinceEpoch - : this.trashedBefore!.toUtc().toIso8601String(); - } else { - // json[r'trashedBefore'] = null; + if (this.takenBefore.isPresent) { + final value = this.takenBefore.value; + json[r'takenBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.type != null) { - json[r'type'] = this.type; - } else { - // json[r'type'] = null; + if (this.trashedAfter.isPresent) { + final value = this.trashedAfter.value; + json[r'trashedAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.updatedAfter != null) { - json[r'updatedAfter'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.updatedAfter!.millisecondsSinceEpoch - : this.updatedAfter!.toUtc().toIso8601String(); - } else { - // json[r'updatedAfter'] = null; + if (this.trashedBefore.isPresent) { + final value = this.trashedBefore.value; + json[r'trashedBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); } - if (this.updatedBefore != null) { - json[r'updatedBefore'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') - ? this.updatedBefore!.millisecondsSinceEpoch - : this.updatedBefore!.toUtc().toIso8601String(); - } else { - // json[r'updatedBefore'] = null; + if (this.type.isPresent) { + final value = this.type.value; + json[r'type'] = value; } - if (this.visibility != null) { - json[r'visibility'] = this.visibility; - } else { - // json[r'visibility'] = null; + if (this.updatedAfter.isPresent) { + final value = this.updatedAfter.value; + json[r'updatedAfter'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); + } + if (this.updatedBefore.isPresent) { + final value = this.updatedBefore.value; + json[r'updatedBefore'] = value == null ? null : (_isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); + } + if (this.visibility.isPresent) { + final value = this.visibility.value; + json[r'visibility'] = value; } return json; } @@ -457,41 +437,48 @@ class StatisticsSearchDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return StatisticsSearchDto( - albumIds: json[r'albumIds'] is Iterable + albumIds: json.containsKey(r'albumIds') ? Optional.present(json[r'albumIds'] is Iterable ? (json[r'albumIds'] as Iterable).cast().toList(growable: false) - : const [], - city: mapValueOfType(json, r'city'), - country: mapValueOfType(json, r'country'), - createdAfter: mapDateTime(json, r'createdAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - createdBefore: mapDateTime(json, r'createdBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - description: mapValueOfType(json, r'description'), - isEncoded: mapValueOfType(json, r'isEncoded'), - isFavorite: mapValueOfType(json, r'isFavorite'), - isMotion: mapValueOfType(json, r'isMotion'), - isNotInAlbum: mapValueOfType(json, r'isNotInAlbum'), - isOffline: mapValueOfType(json, r'isOffline'), - lensModel: mapValueOfType(json, r'lensModel'), - libraryId: mapValueOfType(json, r'libraryId'), - make: mapValueOfType(json, r'make'), - model: mapValueOfType(json, r'model'), - ocr: mapValueOfType(json, r'ocr'), - personIds: json[r'personIds'] is Iterable + : const []) : const Optional.absent(), + city: json.containsKey(r'city') ? Optional.present(mapValueOfType(json, r'city')) : const Optional.absent(), + country: json.containsKey(r'country') ? Optional.present(mapValueOfType(json, r'country')) : const Optional.absent(), + createdAfter: json.containsKey(r'createdAfter') ? Optional.present(mapDateTime(json, r'createdAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + createdBefore: json.containsKey(r'createdBefore') ? Optional.present(mapDateTime(json, r'createdBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + isEncoded: json.containsKey(r'isEncoded') ? Optional.present(mapValueOfType(json, r'isEncoded')) : const Optional.absent(), + isFavorite: json.containsKey(r'isFavorite') ? Optional.present(mapValueOfType(json, r'isFavorite')) : const Optional.absent(), + isMotion: json.containsKey(r'isMotion') ? Optional.present(mapValueOfType(json, r'isMotion')) : const Optional.absent(), + isNotInAlbum: json.containsKey(r'isNotInAlbum') ? Optional.present(mapValueOfType(json, r'isNotInAlbum')) : const Optional.absent(), + isOffline: json.containsKey(r'isOffline') ? Optional.present(mapValueOfType(json, r'isOffline')) : const Optional.absent(), + lensModel: json.containsKey(r'lensModel') ? Optional.present(mapValueOfType(json, r'lensModel')) : const Optional.absent(), + libraryId: json.containsKey(r'libraryId') ? Optional.present(mapValueOfType(json, r'libraryId')) : const Optional.absent(), + make: json.containsKey(r'make') ? Optional.present(mapValueOfType(json, r'make')) : const Optional.absent(), + model: json.containsKey(r'model') ? Optional.present(mapValueOfType(json, r'model')) : const Optional.absent(), + ocr: json.containsKey(r'ocr') ? Optional.present(mapValueOfType(json, r'ocr')) : const Optional.absent(), + personIds: json.containsKey(r'personIds') ? Optional.present(json[r'personIds'] is Iterable ? (json[r'personIds'] as Iterable).cast().toList(growable: false) - : const [], - rating: mapValueOfType(json, r'rating'), - state: mapValueOfType(json, r'state'), - tagIds: json[r'tagIds'] is Iterable + : const []) : const Optional.absent(), + rating: json.containsKey(r'rating') ? Optional.present(json[r'rating'] == null ? null : int.parse('${json[r'rating']}')) : const Optional.absent(), + state: json.containsKey(r'state') ? Optional.present(mapValueOfType(json, r'state')) : const Optional.absent(), + tagIds: json.containsKey(r'tagIds') ? Optional.present(json[r'tagIds'] is Iterable ? (json[r'tagIds'] as Iterable).cast().toList(growable: false) - : const [], - takenAfter: mapDateTime(json, r'takenAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - takenBefore: mapDateTime(json, r'takenBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - trashedAfter: mapDateTime(json, r'trashedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - trashedBefore: mapDateTime(json, r'trashedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - type: AssetTypeEnum.fromJson(json[r'type']), - updatedAfter: mapDateTime(json, r'updatedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - updatedBefore: mapDateTime(json, r'updatedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), - visibility: AssetVisibility.fromJson(json[r'visibility']), + : const []) : const Optional.absent(), + takenAfter: json.containsKey(r'takenAfter') ? Optional.present(mapDateTime(json, r'takenAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + takenBefore: json.containsKey(r'takenBefore') ? Optional.present(mapDateTime(json, r'takenBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + trashedAfter: json.containsKey(r'trashedAfter') ? Optional.present(mapDateTime(json, r'trashedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + trashedBefore: json.containsKey(r'trashedBefore') ? Optional.present(mapDateTime(json, r'trashedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + type: json.containsKey(r'type') ? Optional.present(AssetTypeEnum.fromJson(json[r'type'])) : const Optional.absent(), + updatedAfter: json.containsKey(r'updatedAfter') ? Optional.present(mapDateTime(json, r'updatedAfter', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + updatedBefore: json.containsKey(r'updatedBefore') ? Optional.present(mapDateTime(json, r'updatedBefore', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')) : const Optional.absent(), + visibility: json.containsKey(r'visibility') ? Optional.present(AssetVisibility.fromJson(json[r'visibility'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/sync_ack_delete_dto.dart b/mobile/openapi/lib/model/sync_ack_delete_dto.dart index b72ae8c5a6..a24da75f1a 100644 --- a/mobile/openapi/lib/model/sync_ack_delete_dto.dart +++ b/mobile/openapi/lib/model/sync_ack_delete_dto.dart @@ -13,11 +13,11 @@ part of openapi.api; class SyncAckDeleteDto { /// Returns a new [SyncAckDeleteDto] instance. SyncAckDeleteDto({ - this.types = const [], + this.types = const Optional.present(const []), }); /// Sync entity types to delete acks for - List types; + Optional?> types; @override bool operator ==(Object other) => identical(this, other) || other is SyncAckDeleteDto && @@ -33,7 +33,10 @@ class SyncAckDeleteDto { Map toJson() { final json = {}; - json[r'types'] = this.types; + if (this.types.isPresent) { + final value = this.types.value; + json[r'types'] = value; + } return json; } @@ -45,8 +48,15 @@ class SyncAckDeleteDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return SyncAckDeleteDto( - types: SyncEntityType.listFromJson(json[r'types']), + types: json.containsKey(r'types') ? Optional.present(SyncEntityType.listFromJson(json[r'types'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/sync_ack_dto.dart b/mobile/openapi/lib/model/sync_ack_dto.dart index fa7e20a832..e3c21927d1 100644 --- a/mobile/openapi/lib/model/sync_ack_dto.dart +++ b/mobile/openapi/lib/model/sync_ack_dto.dart @@ -51,6 +51,17 @@ class SyncAckDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'ack'), 'Required key "SyncAckDto[ack]" is missing from JSON.'); + assert(json[r'ack'] != null, 'Required key "SyncAckDto[ack]" has a null value in JSON.'); + assert(json.containsKey(r'type'), 'Required key "SyncAckDto[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "SyncAckDto[type]" has a null value in JSON.'); + return true; + }()); + return SyncAckDto( ack: mapValueOfType(json, r'ack')!, type: SyncEntityType.fromJson(json[r'type'])!, diff --git a/mobile/openapi/lib/model/sync_ack_set_dto.dart b/mobile/openapi/lib/model/sync_ack_set_dto.dart index 531a9dc763..af596bed4e 100644 --- a/mobile/openapi/lib/model/sync_ack_set_dto.dart +++ b/mobile/openapi/lib/model/sync_ack_set_dto.dart @@ -45,6 +45,15 @@ class SyncAckSetDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'acks'), 'Required key "SyncAckSetDto[acks]" is missing from JSON.'); + assert(json[r'acks'] != null, 'Required key "SyncAckSetDto[acks]" has a null value in JSON.'); + return true; + }()); + return SyncAckSetDto( acks: json[r'acks'] is Iterable ? (json[r'acks'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/sync_album_delete_v1.dart b/mobile/openapi/lib/model/sync_album_delete_v1.dart index a6fdf5c68c..975c28387e 100644 --- a/mobile/openapi/lib/model/sync_album_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_album_delete_v1.dart @@ -45,6 +45,15 @@ class SyncAlbumDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumId'), 'Required key "SyncAlbumDeleteV1[albumId]" is missing from JSON.'); + assert(json[r'albumId'] != null, 'Required key "SyncAlbumDeleteV1[albumId]" has a null value in JSON.'); + return true; + }()); + return SyncAlbumDeleteV1( albumId: mapValueOfType(json, r'albumId')!, ); diff --git a/mobile/openapi/lib/model/sync_album_to_asset_delete_v1.dart b/mobile/openapi/lib/model/sync_album_to_asset_delete_v1.dart index 08952b90ed..2e36c0c8ec 100644 --- a/mobile/openapi/lib/model/sync_album_to_asset_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_album_to_asset_delete_v1.dart @@ -52,6 +52,17 @@ class SyncAlbumToAssetDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumId'), 'Required key "SyncAlbumToAssetDeleteV1[albumId]" is missing from JSON.'); + assert(json[r'albumId'] != null, 'Required key "SyncAlbumToAssetDeleteV1[albumId]" has a null value in JSON.'); + assert(json.containsKey(r'assetId'), 'Required key "SyncAlbumToAssetDeleteV1[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncAlbumToAssetDeleteV1[assetId]" has a null value in JSON.'); + return true; + }()); + return SyncAlbumToAssetDeleteV1( albumId: mapValueOfType(json, r'albumId')!, assetId: mapValueOfType(json, r'assetId')!, diff --git a/mobile/openapi/lib/model/sync_album_to_asset_v1.dart b/mobile/openapi/lib/model/sync_album_to_asset_v1.dart index 5f38b35088..a043e25eb9 100644 --- a/mobile/openapi/lib/model/sync_album_to_asset_v1.dart +++ b/mobile/openapi/lib/model/sync_album_to_asset_v1.dart @@ -52,6 +52,17 @@ class SyncAlbumToAssetV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumId'), 'Required key "SyncAlbumToAssetV1[albumId]" is missing from JSON.'); + assert(json[r'albumId'] != null, 'Required key "SyncAlbumToAssetV1[albumId]" has a null value in JSON.'); + assert(json.containsKey(r'assetId'), 'Required key "SyncAlbumToAssetV1[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncAlbumToAssetV1[assetId]" has a null value in JSON.'); + return true; + }()); + return SyncAlbumToAssetV1( albumId: mapValueOfType(json, r'albumId')!, assetId: mapValueOfType(json, r'assetId')!, diff --git a/mobile/openapi/lib/model/sync_album_user_delete_v1.dart b/mobile/openapi/lib/model/sync_album_user_delete_v1.dart index 526bcc6b6e..2f37889bcc 100644 --- a/mobile/openapi/lib/model/sync_album_user_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_album_user_delete_v1.dart @@ -52,6 +52,17 @@ class SyncAlbumUserDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumId'), 'Required key "SyncAlbumUserDeleteV1[albumId]" is missing from JSON.'); + assert(json[r'albumId'] != null, 'Required key "SyncAlbumUserDeleteV1[albumId]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "SyncAlbumUserDeleteV1[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "SyncAlbumUserDeleteV1[userId]" has a null value in JSON.'); + return true; + }()); + return SyncAlbumUserDeleteV1( albumId: mapValueOfType(json, r'albumId')!, userId: mapValueOfType(json, r'userId')!, diff --git a/mobile/openapi/lib/model/sync_album_user_v1.dart b/mobile/openapi/lib/model/sync_album_user_v1.dart index 1efe7da029..03aee5cfa2 100644 --- a/mobile/openapi/lib/model/sync_album_user_v1.dart +++ b/mobile/openapi/lib/model/sync_album_user_v1.dart @@ -58,6 +58,19 @@ class SyncAlbumUserV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumId'), 'Required key "SyncAlbumUserV1[albumId]" is missing from JSON.'); + assert(json[r'albumId'] != null, 'Required key "SyncAlbumUserV1[albumId]" has a null value in JSON.'); + assert(json.containsKey(r'role'), 'Required key "SyncAlbumUserV1[role]" is missing from JSON.'); + assert(json[r'role'] != null, 'Required key "SyncAlbumUserV1[role]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "SyncAlbumUserV1[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "SyncAlbumUserV1[userId]" has a null value in JSON.'); + return true; + }()); + return SyncAlbumUserV1( albumId: mapValueOfType(json, r'albumId')!, role: AlbumUserRole.fromJson(json[r'role'])!, diff --git a/mobile/openapi/lib/model/sync_album_v1.dart b/mobile/openapi/lib/model/sync_album_v1.dart index 17b2bda02b..63a71e83cf 100644 --- a/mobile/openapi/lib/model/sync_album_v1.dart +++ b/mobile/openapi/lib/model/sync_album_v1.dart @@ -92,7 +92,7 @@ class SyncAlbumV1 { if (this.thumbnailAssetId != null) { json[r'thumbnailAssetId'] = this.thumbnailAssetId; } else { - // json[r'thumbnailAssetId'] = null; + json[r'thumbnailAssetId'] = null; } json[r'updatedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.updatedAt.millisecondsSinceEpoch @@ -108,6 +108,30 @@ class SyncAlbumV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'createdAt'), 'Required key "SyncAlbumV1[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "SyncAlbumV1[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'description'), 'Required key "SyncAlbumV1[description]" is missing from JSON.'); + assert(json[r'description'] != null, 'Required key "SyncAlbumV1[description]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncAlbumV1[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncAlbumV1[id]" has a null value in JSON.'); + assert(json.containsKey(r'isActivityEnabled'), 'Required key "SyncAlbumV1[isActivityEnabled]" is missing from JSON.'); + assert(json[r'isActivityEnabled'] != null, 'Required key "SyncAlbumV1[isActivityEnabled]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "SyncAlbumV1[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "SyncAlbumV1[name]" has a null value in JSON.'); + assert(json.containsKey(r'order'), 'Required key "SyncAlbumV1[order]" is missing from JSON.'); + assert(json[r'order'] != null, 'Required key "SyncAlbumV1[order]" has a null value in JSON.'); + assert(json.containsKey(r'ownerId'), 'Required key "SyncAlbumV1[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "SyncAlbumV1[ownerId]" has a null value in JSON.'); + assert(json.containsKey(r'thumbnailAssetId'), 'Required key "SyncAlbumV1[thumbnailAssetId]" is missing from JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "SyncAlbumV1[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "SyncAlbumV1[updatedAt]" has a null value in JSON.'); + return true; + }()); + return SyncAlbumV1( createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, description: mapValueOfType(json, r'description')!, diff --git a/mobile/openapi/lib/model/sync_album_v2.dart b/mobile/openapi/lib/model/sync_album_v2.dart index 67c65a190b..32cfb6b4f8 100644 --- a/mobile/openapi/lib/model/sync_album_v2.dart +++ b/mobile/openapi/lib/model/sync_album_v2.dart @@ -85,7 +85,7 @@ class SyncAlbumV2 { if (this.thumbnailAssetId != null) { json[r'thumbnailAssetId'] = this.thumbnailAssetId; } else { - // json[r'thumbnailAssetId'] = null; + json[r'thumbnailAssetId'] = null; } json[r'updatedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.updatedAt.millisecondsSinceEpoch @@ -101,6 +101,28 @@ class SyncAlbumV2 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'createdAt'), 'Required key "SyncAlbumV2[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "SyncAlbumV2[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'description'), 'Required key "SyncAlbumV2[description]" is missing from JSON.'); + assert(json[r'description'] != null, 'Required key "SyncAlbumV2[description]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncAlbumV2[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncAlbumV2[id]" has a null value in JSON.'); + assert(json.containsKey(r'isActivityEnabled'), 'Required key "SyncAlbumV2[isActivityEnabled]" is missing from JSON.'); + assert(json[r'isActivityEnabled'] != null, 'Required key "SyncAlbumV2[isActivityEnabled]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "SyncAlbumV2[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "SyncAlbumV2[name]" has a null value in JSON.'); + assert(json.containsKey(r'order'), 'Required key "SyncAlbumV2[order]" is missing from JSON.'); + assert(json[r'order'] != null, 'Required key "SyncAlbumV2[order]" has a null value in JSON.'); + assert(json.containsKey(r'thumbnailAssetId'), 'Required key "SyncAlbumV2[thumbnailAssetId]" is missing from JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "SyncAlbumV2[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "SyncAlbumV2[updatedAt]" has a null value in JSON.'); + return true; + }()); + return SyncAlbumV2( createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, description: mapValueOfType(json, r'description')!, diff --git a/mobile/openapi/lib/model/sync_asset_delete_v1.dart b/mobile/openapi/lib/model/sync_asset_delete_v1.dart index 1d5a947774..f64e70783b 100644 --- a/mobile/openapi/lib/model/sync_asset_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_asset_delete_v1.dart @@ -45,6 +45,15 @@ class SyncAssetDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "SyncAssetDeleteV1[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncAssetDeleteV1[assetId]" has a null value in JSON.'); + return true; + }()); + return SyncAssetDeleteV1( assetId: mapValueOfType(json, r'assetId')!, ); diff --git a/mobile/openapi/lib/model/sync_asset_edit_delete_v1.dart b/mobile/openapi/lib/model/sync_asset_edit_delete_v1.dart index e0c98bfef3..303c0d8b59 100644 --- a/mobile/openapi/lib/model/sync_asset_edit_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_asset_edit_delete_v1.dart @@ -45,6 +45,15 @@ class SyncAssetEditDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'editId'), 'Required key "SyncAssetEditDeleteV1[editId]" is missing from JSON.'); + assert(json[r'editId'] != null, 'Required key "SyncAssetEditDeleteV1[editId]" has a null value in JSON.'); + return true; + }()); + return SyncAssetEditDeleteV1( editId: mapValueOfType(json, r'editId')!, ); diff --git a/mobile/openapi/lib/model/sync_asset_edit_v1.dart b/mobile/openapi/lib/model/sync_asset_edit_v1.dart index 8acfad5f6a..056bbaefc9 100644 --- a/mobile/openapi/lib/model/sync_asset_edit_v1.dart +++ b/mobile/openapi/lib/model/sync_asset_edit_v1.dart @@ -75,6 +75,23 @@ class SyncAssetEditV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'action'), 'Required key "SyncAssetEditV1[action]" is missing from JSON.'); + assert(json[r'action'] != null, 'Required key "SyncAssetEditV1[action]" has a null value in JSON.'); + assert(json.containsKey(r'assetId'), 'Required key "SyncAssetEditV1[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncAssetEditV1[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncAssetEditV1[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncAssetEditV1[id]" has a null value in JSON.'); + assert(json.containsKey(r'parameters'), 'Required key "SyncAssetEditV1[parameters]" is missing from JSON.'); + assert(json[r'parameters'] != null, 'Required key "SyncAssetEditV1[parameters]" has a null value in JSON.'); + assert(json.containsKey(r'sequence'), 'Required key "SyncAssetEditV1[sequence]" is missing from JSON.'); + assert(json[r'sequence'] != null, 'Required key "SyncAssetEditV1[sequence]" has a null value in JSON.'); + return true; + }()); + return SyncAssetEditV1( action: AssetEditAction.fromJson(json[r'action'])!, assetId: mapValueOfType(json, r'assetId')!, diff --git a/mobile/openapi/lib/model/sync_asset_exif_v1.dart b/mobile/openapi/lib/model/sync_asset_exif_v1.dart index caaeed7fb3..4b0fc9e2dd 100644 --- a/mobile/openapi/lib/model/sync_asset_exif_v1.dart +++ b/mobile/openapi/lib/model/sync_asset_exif_v1.dart @@ -196,126 +196,126 @@ class SyncAssetExifV1 { if (this.city != null) { json[r'city'] = this.city; } else { - // json[r'city'] = null; + json[r'city'] = null; } if (this.country != null) { json[r'country'] = this.country; } else { - // json[r'country'] = null; + json[r'country'] = null; } if (this.dateTimeOriginal != null) { json[r'dateTimeOriginal'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.dateTimeOriginal!.millisecondsSinceEpoch : this.dateTimeOriginal!.toUtc().toIso8601String(); } else { - // json[r'dateTimeOriginal'] = null; + json[r'dateTimeOriginal'] = null; } if (this.description != null) { json[r'description'] = this.description; } else { - // json[r'description'] = null; + json[r'description'] = null; } if (this.exifImageHeight != null) { json[r'exifImageHeight'] = this.exifImageHeight; } else { - // json[r'exifImageHeight'] = null; + json[r'exifImageHeight'] = null; } if (this.exifImageWidth != null) { json[r'exifImageWidth'] = this.exifImageWidth; } else { - // json[r'exifImageWidth'] = null; + json[r'exifImageWidth'] = null; } if (this.exposureTime != null) { json[r'exposureTime'] = this.exposureTime; } else { - // json[r'exposureTime'] = null; + json[r'exposureTime'] = null; } if (this.fNumber != null) { json[r'fNumber'] = this.fNumber; } else { - // json[r'fNumber'] = null; + json[r'fNumber'] = null; } if (this.fileSizeInByte != null) { json[r'fileSizeInByte'] = this.fileSizeInByte; } else { - // json[r'fileSizeInByte'] = null; + json[r'fileSizeInByte'] = null; } if (this.focalLength != null) { json[r'focalLength'] = this.focalLength; } else { - // json[r'focalLength'] = null; + json[r'focalLength'] = null; } if (this.fps != null) { json[r'fps'] = this.fps; } else { - // json[r'fps'] = null; + json[r'fps'] = null; } if (this.iso != null) { json[r'iso'] = this.iso; } else { - // json[r'iso'] = null; + json[r'iso'] = null; } if (this.latitude != null) { json[r'latitude'] = this.latitude; } else { - // json[r'latitude'] = null; + json[r'latitude'] = null; } if (this.lensModel != null) { json[r'lensModel'] = this.lensModel; } else { - // json[r'lensModel'] = null; + json[r'lensModel'] = null; } if (this.longitude != null) { json[r'longitude'] = this.longitude; } else { - // json[r'longitude'] = null; + json[r'longitude'] = null; } if (this.make != null) { json[r'make'] = this.make; } else { - // json[r'make'] = null; + json[r'make'] = null; } if (this.model != null) { json[r'model'] = this.model; } else { - // json[r'model'] = null; + json[r'model'] = null; } if (this.modifyDate != null) { json[r'modifyDate'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.modifyDate!.millisecondsSinceEpoch : this.modifyDate!.toUtc().toIso8601String(); } else { - // json[r'modifyDate'] = null; + json[r'modifyDate'] = null; } if (this.orientation != null) { json[r'orientation'] = this.orientation; } else { - // json[r'orientation'] = null; + json[r'orientation'] = null; } if (this.profileDescription != null) { json[r'profileDescription'] = this.profileDescription; } else { - // json[r'profileDescription'] = null; + json[r'profileDescription'] = null; } if (this.projectionType != null) { json[r'projectionType'] = this.projectionType; } else { - // json[r'projectionType'] = null; + json[r'projectionType'] = null; } if (this.rating != null) { json[r'rating'] = this.rating; } else { - // json[r'rating'] = null; + json[r'rating'] = null; } if (this.state != null) { json[r'state'] = this.state; } else { - // json[r'state'] = null; + json[r'state'] = null; } if (this.timeZone != null) { json[r'timeZone'] = this.timeZone; } else { - // json[r'timeZone'] = null; + json[r'timeZone'] = null; } return json; } @@ -328,6 +328,39 @@ class SyncAssetExifV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "SyncAssetExifV1[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncAssetExifV1[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'city'), 'Required key "SyncAssetExifV1[city]" is missing from JSON.'); + assert(json.containsKey(r'country'), 'Required key "SyncAssetExifV1[country]" is missing from JSON.'); + assert(json.containsKey(r'dateTimeOriginal'), 'Required key "SyncAssetExifV1[dateTimeOriginal]" is missing from JSON.'); + assert(json.containsKey(r'description'), 'Required key "SyncAssetExifV1[description]" is missing from JSON.'); + assert(json.containsKey(r'exifImageHeight'), 'Required key "SyncAssetExifV1[exifImageHeight]" is missing from JSON.'); + assert(json.containsKey(r'exifImageWidth'), 'Required key "SyncAssetExifV1[exifImageWidth]" is missing from JSON.'); + assert(json.containsKey(r'exposureTime'), 'Required key "SyncAssetExifV1[exposureTime]" is missing from JSON.'); + assert(json.containsKey(r'fNumber'), 'Required key "SyncAssetExifV1[fNumber]" is missing from JSON.'); + assert(json.containsKey(r'fileSizeInByte'), 'Required key "SyncAssetExifV1[fileSizeInByte]" is missing from JSON.'); + assert(json.containsKey(r'focalLength'), 'Required key "SyncAssetExifV1[focalLength]" is missing from JSON.'); + assert(json.containsKey(r'fps'), 'Required key "SyncAssetExifV1[fps]" is missing from JSON.'); + assert(json.containsKey(r'iso'), 'Required key "SyncAssetExifV1[iso]" is missing from JSON.'); + assert(json.containsKey(r'latitude'), 'Required key "SyncAssetExifV1[latitude]" is missing from JSON.'); + assert(json.containsKey(r'lensModel'), 'Required key "SyncAssetExifV1[lensModel]" is missing from JSON.'); + assert(json.containsKey(r'longitude'), 'Required key "SyncAssetExifV1[longitude]" is missing from JSON.'); + assert(json.containsKey(r'make'), 'Required key "SyncAssetExifV1[make]" is missing from JSON.'); + assert(json.containsKey(r'model'), 'Required key "SyncAssetExifV1[model]" is missing from JSON.'); + assert(json.containsKey(r'modifyDate'), 'Required key "SyncAssetExifV1[modifyDate]" is missing from JSON.'); + assert(json.containsKey(r'orientation'), 'Required key "SyncAssetExifV1[orientation]" is missing from JSON.'); + assert(json.containsKey(r'profileDescription'), 'Required key "SyncAssetExifV1[profileDescription]" is missing from JSON.'); + assert(json.containsKey(r'projectionType'), 'Required key "SyncAssetExifV1[projectionType]" is missing from JSON.'); + assert(json.containsKey(r'rating'), 'Required key "SyncAssetExifV1[rating]" is missing from JSON.'); + assert(json.containsKey(r'state'), 'Required key "SyncAssetExifV1[state]" is missing from JSON.'); + assert(json.containsKey(r'timeZone'), 'Required key "SyncAssetExifV1[timeZone]" is missing from JSON.'); + return true; + }()); + return SyncAssetExifV1( assetId: mapValueOfType(json, r'assetId')!, city: mapValueOfType(json, r'city'), @@ -337,14 +370,14 @@ class SyncAssetExifV1 { exifImageHeight: mapValueOfType(json, r'exifImageHeight'), exifImageWidth: mapValueOfType(json, r'exifImageWidth'), exposureTime: mapValueOfType(json, r'exposureTime'), - fNumber: (mapValueOfType(json, r'fNumber'))?.toDouble(), + fNumber: mapValueOfType(json, r'fNumber'), fileSizeInByte: mapValueOfType(json, r'fileSizeInByte'), - focalLength: (mapValueOfType(json, r'focalLength'))?.toDouble(), - fps: (mapValueOfType(json, r'fps'))?.toDouble(), + focalLength: mapValueOfType(json, r'focalLength'), + fps: mapValueOfType(json, r'fps'), iso: mapValueOfType(json, r'iso'), - latitude: (mapValueOfType(json, r'latitude'))?.toDouble(), + latitude: mapValueOfType(json, r'latitude'), lensModel: mapValueOfType(json, r'lensModel'), - longitude: (mapValueOfType(json, r'longitude'))?.toDouble(), + longitude: mapValueOfType(json, r'longitude'), make: mapValueOfType(json, r'make'), model: mapValueOfType(json, r'model'), modifyDate: mapDateTime(json, r'modifyDate', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), diff --git a/mobile/openapi/lib/model/sync_asset_face_delete_v1.dart b/mobile/openapi/lib/model/sync_asset_face_delete_v1.dart index 9cfb8814a7..34fde86c85 100644 --- a/mobile/openapi/lib/model/sync_asset_face_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_asset_face_delete_v1.dart @@ -45,6 +45,15 @@ class SyncAssetFaceDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetFaceId'), 'Required key "SyncAssetFaceDeleteV1[assetFaceId]" is missing from JSON.'); + assert(json[r'assetFaceId'] != null, 'Required key "SyncAssetFaceDeleteV1[assetFaceId]" has a null value in JSON.'); + return true; + }()); + return SyncAssetFaceDeleteV1( assetFaceId: mapValueOfType(json, r'assetFaceId')!, ); diff --git a/mobile/openapi/lib/model/sync_asset_face_v1.dart b/mobile/openapi/lib/model/sync_asset_face_v1.dart index c3f74ff2cd..c5b1be2c63 100644 --- a/mobile/openapi/lib/model/sync_asset_face_v1.dart +++ b/mobile/openapi/lib/model/sync_asset_face_v1.dart @@ -116,7 +116,7 @@ class SyncAssetFaceV1 { if (this.personId != null) { json[r'personId'] = this.personId; } else { - // json[r'personId'] = null; + json[r'personId'] = null; } json[r'sourceType'] = this.sourceType; return json; @@ -130,6 +130,32 @@ class SyncAssetFaceV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "SyncAssetFaceV1[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncAssetFaceV1[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxX1'), 'Required key "SyncAssetFaceV1[boundingBoxX1]" is missing from JSON.'); + assert(json[r'boundingBoxX1'] != null, 'Required key "SyncAssetFaceV1[boundingBoxX1]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxX2'), 'Required key "SyncAssetFaceV1[boundingBoxX2]" is missing from JSON.'); + assert(json[r'boundingBoxX2'] != null, 'Required key "SyncAssetFaceV1[boundingBoxX2]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxY1'), 'Required key "SyncAssetFaceV1[boundingBoxY1]" is missing from JSON.'); + assert(json[r'boundingBoxY1'] != null, 'Required key "SyncAssetFaceV1[boundingBoxY1]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxY2'), 'Required key "SyncAssetFaceV1[boundingBoxY2]" is missing from JSON.'); + assert(json[r'boundingBoxY2'] != null, 'Required key "SyncAssetFaceV1[boundingBoxY2]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncAssetFaceV1[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncAssetFaceV1[id]" has a null value in JSON.'); + assert(json.containsKey(r'imageHeight'), 'Required key "SyncAssetFaceV1[imageHeight]" is missing from JSON.'); + assert(json[r'imageHeight'] != null, 'Required key "SyncAssetFaceV1[imageHeight]" has a null value in JSON.'); + assert(json.containsKey(r'imageWidth'), 'Required key "SyncAssetFaceV1[imageWidth]" is missing from JSON.'); + assert(json[r'imageWidth'] != null, 'Required key "SyncAssetFaceV1[imageWidth]" has a null value in JSON.'); + assert(json.containsKey(r'personId'), 'Required key "SyncAssetFaceV1[personId]" is missing from JSON.'); + assert(json.containsKey(r'sourceType'), 'Required key "SyncAssetFaceV1[sourceType]" is missing from JSON.'); + assert(json[r'sourceType'] != null, 'Required key "SyncAssetFaceV1[sourceType]" has a null value in JSON.'); + return true; + }()); + return SyncAssetFaceV1( assetId: mapValueOfType(json, r'assetId')!, boundingBoxX1: mapValueOfType(json, r'boundingBoxX1')!, diff --git a/mobile/openapi/lib/model/sync_asset_face_v2.dart b/mobile/openapi/lib/model/sync_asset_face_v2.dart index aeefc2ece9..e46ef63733 100644 --- a/mobile/openapi/lib/model/sync_asset_face_v2.dart +++ b/mobile/openapi/lib/model/sync_asset_face_v2.dart @@ -127,7 +127,7 @@ class SyncAssetFaceV2 { ? this.deletedAt!.millisecondsSinceEpoch : this.deletedAt!.toUtc().toIso8601String(); } else { - // json[r'deletedAt'] = null; + json[r'deletedAt'] = null; } json[r'id'] = this.id; json[r'imageHeight'] = this.imageHeight; @@ -136,7 +136,7 @@ class SyncAssetFaceV2 { if (this.personId != null) { json[r'personId'] = this.personId; } else { - // json[r'personId'] = null; + json[r'personId'] = null; } json[r'sourceType'] = this.sourceType; return json; @@ -150,6 +150,35 @@ class SyncAssetFaceV2 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "SyncAssetFaceV2[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncAssetFaceV2[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxX1'), 'Required key "SyncAssetFaceV2[boundingBoxX1]" is missing from JSON.'); + assert(json[r'boundingBoxX1'] != null, 'Required key "SyncAssetFaceV2[boundingBoxX1]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxX2'), 'Required key "SyncAssetFaceV2[boundingBoxX2]" is missing from JSON.'); + assert(json[r'boundingBoxX2'] != null, 'Required key "SyncAssetFaceV2[boundingBoxX2]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxY1'), 'Required key "SyncAssetFaceV2[boundingBoxY1]" is missing from JSON.'); + assert(json[r'boundingBoxY1'] != null, 'Required key "SyncAssetFaceV2[boundingBoxY1]" has a null value in JSON.'); + assert(json.containsKey(r'boundingBoxY2'), 'Required key "SyncAssetFaceV2[boundingBoxY2]" is missing from JSON.'); + assert(json[r'boundingBoxY2'] != null, 'Required key "SyncAssetFaceV2[boundingBoxY2]" has a null value in JSON.'); + assert(json.containsKey(r'deletedAt'), 'Required key "SyncAssetFaceV2[deletedAt]" is missing from JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncAssetFaceV2[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncAssetFaceV2[id]" has a null value in JSON.'); + assert(json.containsKey(r'imageHeight'), 'Required key "SyncAssetFaceV2[imageHeight]" is missing from JSON.'); + assert(json[r'imageHeight'] != null, 'Required key "SyncAssetFaceV2[imageHeight]" has a null value in JSON.'); + assert(json.containsKey(r'imageWidth'), 'Required key "SyncAssetFaceV2[imageWidth]" is missing from JSON.'); + assert(json[r'imageWidth'] != null, 'Required key "SyncAssetFaceV2[imageWidth]" has a null value in JSON.'); + assert(json.containsKey(r'isVisible'), 'Required key "SyncAssetFaceV2[isVisible]" is missing from JSON.'); + assert(json[r'isVisible'] != null, 'Required key "SyncAssetFaceV2[isVisible]" has a null value in JSON.'); + assert(json.containsKey(r'personId'), 'Required key "SyncAssetFaceV2[personId]" is missing from JSON.'); + assert(json.containsKey(r'sourceType'), 'Required key "SyncAssetFaceV2[sourceType]" is missing from JSON.'); + assert(json[r'sourceType'] != null, 'Required key "SyncAssetFaceV2[sourceType]" has a null value in JSON.'); + return true; + }()); + return SyncAssetFaceV2( assetId: mapValueOfType(json, r'assetId')!, boundingBoxX1: mapValueOfType(json, r'boundingBoxX1')!, diff --git a/mobile/openapi/lib/model/sync_asset_metadata_delete_v1.dart b/mobile/openapi/lib/model/sync_asset_metadata_delete_v1.dart index 326555ef13..febe9cede3 100644 --- a/mobile/openapi/lib/model/sync_asset_metadata_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_asset_metadata_delete_v1.dart @@ -52,6 +52,17 @@ class SyncAssetMetadataDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "SyncAssetMetadataDeleteV1[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncAssetMetadataDeleteV1[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'key'), 'Required key "SyncAssetMetadataDeleteV1[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "SyncAssetMetadataDeleteV1[key]" has a null value in JSON.'); + return true; + }()); + return SyncAssetMetadataDeleteV1( assetId: mapValueOfType(json, r'assetId')!, key: mapValueOfType(json, r'key')!, diff --git a/mobile/openapi/lib/model/sync_asset_metadata_v1.dart b/mobile/openapi/lib/model/sync_asset_metadata_v1.dart index 08d7eae49b..c03bdbbe8f 100644 --- a/mobile/openapi/lib/model/sync_asset_metadata_v1.dart +++ b/mobile/openapi/lib/model/sync_asset_metadata_v1.dart @@ -59,6 +59,19 @@ class SyncAssetMetadataV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "SyncAssetMetadataV1[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncAssetMetadataV1[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'key'), 'Required key "SyncAssetMetadataV1[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "SyncAssetMetadataV1[key]" has a null value in JSON.'); + assert(json.containsKey(r'value'), 'Required key "SyncAssetMetadataV1[value]" is missing from JSON.'); + assert(json[r'value'] != null, 'Required key "SyncAssetMetadataV1[value]" has a null value in JSON.'); + return true; + }()); + return SyncAssetMetadataV1( assetId: mapValueOfType(json, r'assetId')!, key: mapValueOfType(json, r'key')!, diff --git a/mobile/openapi/lib/model/sync_asset_v1.dart b/mobile/openapi/lib/model/sync_asset_v1.dart index 9a7a3a1f16..974f79c3ab 100644 --- a/mobile/openapi/lib/model/sync_asset_v1.dart +++ b/mobile/openapi/lib/model/sync_asset_v1.dart @@ -157,38 +157,38 @@ class SyncAssetV1 { ? this.createdAt!.millisecondsSinceEpoch : this.createdAt!.toUtc().toIso8601String(); } else { - // json[r'createdAt'] = null; + json[r'createdAt'] = null; } if (this.deletedAt != null) { json[r'deletedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.deletedAt!.millisecondsSinceEpoch : this.deletedAt!.toUtc().toIso8601String(); } else { - // json[r'deletedAt'] = null; + json[r'deletedAt'] = null; } if (this.duration != null) { json[r'duration'] = this.duration; } else { - // json[r'duration'] = null; + json[r'duration'] = null; } if (this.fileCreatedAt != null) { json[r'fileCreatedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.fileCreatedAt!.millisecondsSinceEpoch : this.fileCreatedAt!.toUtc().toIso8601String(); } else { - // json[r'fileCreatedAt'] = null; + json[r'fileCreatedAt'] = null; } if (this.fileModifiedAt != null) { json[r'fileModifiedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.fileModifiedAt!.millisecondsSinceEpoch : this.fileModifiedAt!.toUtc().toIso8601String(); } else { - // json[r'fileModifiedAt'] = null; + json[r'fileModifiedAt'] = null; } if (this.height != null) { json[r'height'] = this.height; } else { - // json[r'height'] = null; + json[r'height'] = null; } json[r'id'] = this.id; json[r'isEdited'] = this.isEdited; @@ -196,38 +196,38 @@ class SyncAssetV1 { if (this.libraryId != null) { json[r'libraryId'] = this.libraryId; } else { - // json[r'libraryId'] = null; + json[r'libraryId'] = null; } if (this.livePhotoVideoId != null) { json[r'livePhotoVideoId'] = this.livePhotoVideoId; } else { - // json[r'livePhotoVideoId'] = null; + json[r'livePhotoVideoId'] = null; } if (this.localDateTime != null) { json[r'localDateTime'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.localDateTime!.millisecondsSinceEpoch : this.localDateTime!.toUtc().toIso8601String(); } else { - // json[r'localDateTime'] = null; + json[r'localDateTime'] = null; } json[r'originalFileName'] = this.originalFileName; json[r'ownerId'] = this.ownerId; if (this.stackId != null) { json[r'stackId'] = this.stackId; } else { - // json[r'stackId'] = null; + json[r'stackId'] = null; } if (this.thumbhash != null) { json[r'thumbhash'] = this.thumbhash; } else { - // json[r'thumbhash'] = null; + json[r'thumbhash'] = null; } json[r'type'] = this.type; json[r'visibility'] = this.visibility; if (this.width != null) { json[r'width'] = this.width; } else { - // json[r'width'] = null; + json[r'width'] = null; } return json; } @@ -240,6 +240,41 @@ class SyncAssetV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'checksum'), 'Required key "SyncAssetV1[checksum]" is missing from JSON.'); + assert(json[r'checksum'] != null, 'Required key "SyncAssetV1[checksum]" has a null value in JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "SyncAssetV1[createdAt]" is missing from JSON.'); + assert(json.containsKey(r'deletedAt'), 'Required key "SyncAssetV1[deletedAt]" is missing from JSON.'); + assert(json.containsKey(r'duration'), 'Required key "SyncAssetV1[duration]" is missing from JSON.'); + assert(json.containsKey(r'fileCreatedAt'), 'Required key "SyncAssetV1[fileCreatedAt]" is missing from JSON.'); + assert(json.containsKey(r'fileModifiedAt'), 'Required key "SyncAssetV1[fileModifiedAt]" is missing from JSON.'); + assert(json.containsKey(r'height'), 'Required key "SyncAssetV1[height]" is missing from JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncAssetV1[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncAssetV1[id]" has a null value in JSON.'); + assert(json.containsKey(r'isEdited'), 'Required key "SyncAssetV1[isEdited]" is missing from JSON.'); + assert(json[r'isEdited'] != null, 'Required key "SyncAssetV1[isEdited]" has a null value in JSON.'); + assert(json.containsKey(r'isFavorite'), 'Required key "SyncAssetV1[isFavorite]" is missing from JSON.'); + assert(json[r'isFavorite'] != null, 'Required key "SyncAssetV1[isFavorite]" has a null value in JSON.'); + assert(json.containsKey(r'libraryId'), 'Required key "SyncAssetV1[libraryId]" is missing from JSON.'); + assert(json.containsKey(r'livePhotoVideoId'), 'Required key "SyncAssetV1[livePhotoVideoId]" is missing from JSON.'); + assert(json.containsKey(r'localDateTime'), 'Required key "SyncAssetV1[localDateTime]" is missing from JSON.'); + assert(json.containsKey(r'originalFileName'), 'Required key "SyncAssetV1[originalFileName]" is missing from JSON.'); + assert(json[r'originalFileName'] != null, 'Required key "SyncAssetV1[originalFileName]" has a null value in JSON.'); + assert(json.containsKey(r'ownerId'), 'Required key "SyncAssetV1[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "SyncAssetV1[ownerId]" has a null value in JSON.'); + assert(json.containsKey(r'stackId'), 'Required key "SyncAssetV1[stackId]" is missing from JSON.'); + assert(json.containsKey(r'thumbhash'), 'Required key "SyncAssetV1[thumbhash]" is missing from JSON.'); + assert(json.containsKey(r'type'), 'Required key "SyncAssetV1[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "SyncAssetV1[type]" has a null value in JSON.'); + assert(json.containsKey(r'visibility'), 'Required key "SyncAssetV1[visibility]" is missing from JSON.'); + assert(json[r'visibility'] != null, 'Required key "SyncAssetV1[visibility]" has a null value in JSON.'); + assert(json.containsKey(r'width'), 'Required key "SyncAssetV1[width]" is missing from JSON.'); + return true; + }()); + return SyncAssetV1( checksum: mapValueOfType(json, r'checksum')!, createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), diff --git a/mobile/openapi/lib/model/sync_asset_v2.dart b/mobile/openapi/lib/model/sync_asset_v2.dart index 7d1dfa298e..263aee5bb3 100644 --- a/mobile/openapi/lib/model/sync_asset_v2.dart +++ b/mobile/openapi/lib/model/sync_asset_v2.dart @@ -160,38 +160,38 @@ class SyncAssetV2 { ? this.createdAt!.millisecondsSinceEpoch : this.createdAt!.toUtc().toIso8601String(); } else { - // json[r'createdAt'] = null; + json[r'createdAt'] = null; } if (this.deletedAt != null) { json[r'deletedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.deletedAt!.millisecondsSinceEpoch : this.deletedAt!.toUtc().toIso8601String(); } else { - // json[r'deletedAt'] = null; + json[r'deletedAt'] = null; } if (this.duration != null) { json[r'duration'] = this.duration; } else { - // json[r'duration'] = null; + json[r'duration'] = null; } if (this.fileCreatedAt != null) { json[r'fileCreatedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.fileCreatedAt!.millisecondsSinceEpoch : this.fileCreatedAt!.toUtc().toIso8601String(); } else { - // json[r'fileCreatedAt'] = null; + json[r'fileCreatedAt'] = null; } if (this.fileModifiedAt != null) { json[r'fileModifiedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.fileModifiedAt!.millisecondsSinceEpoch : this.fileModifiedAt!.toUtc().toIso8601String(); } else { - // json[r'fileModifiedAt'] = null; + json[r'fileModifiedAt'] = null; } if (this.height != null) { json[r'height'] = this.height; } else { - // json[r'height'] = null; + json[r'height'] = null; } json[r'id'] = this.id; json[r'isEdited'] = this.isEdited; @@ -199,38 +199,38 @@ class SyncAssetV2 { if (this.libraryId != null) { json[r'libraryId'] = this.libraryId; } else { - // json[r'libraryId'] = null; + json[r'libraryId'] = null; } if (this.livePhotoVideoId != null) { json[r'livePhotoVideoId'] = this.livePhotoVideoId; } else { - // json[r'livePhotoVideoId'] = null; + json[r'livePhotoVideoId'] = null; } if (this.localDateTime != null) { json[r'localDateTime'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.localDateTime!.millisecondsSinceEpoch : this.localDateTime!.toUtc().toIso8601String(); } else { - // json[r'localDateTime'] = null; + json[r'localDateTime'] = null; } json[r'originalFileName'] = this.originalFileName; json[r'ownerId'] = this.ownerId; if (this.stackId != null) { json[r'stackId'] = this.stackId; } else { - // json[r'stackId'] = null; + json[r'stackId'] = null; } if (this.thumbhash != null) { json[r'thumbhash'] = this.thumbhash; } else { - // json[r'thumbhash'] = null; + json[r'thumbhash'] = null; } json[r'type'] = this.type; json[r'visibility'] = this.visibility; if (this.width != null) { json[r'width'] = this.width; } else { - // json[r'width'] = null; + json[r'width'] = null; } return json; } @@ -243,6 +243,41 @@ class SyncAssetV2 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'checksum'), 'Required key "SyncAssetV2[checksum]" is missing from JSON.'); + assert(json[r'checksum'] != null, 'Required key "SyncAssetV2[checksum]" has a null value in JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "SyncAssetV2[createdAt]" is missing from JSON.'); + assert(json.containsKey(r'deletedAt'), 'Required key "SyncAssetV2[deletedAt]" is missing from JSON.'); + assert(json.containsKey(r'duration'), 'Required key "SyncAssetV2[duration]" is missing from JSON.'); + assert(json.containsKey(r'fileCreatedAt'), 'Required key "SyncAssetV2[fileCreatedAt]" is missing from JSON.'); + assert(json.containsKey(r'fileModifiedAt'), 'Required key "SyncAssetV2[fileModifiedAt]" is missing from JSON.'); + assert(json.containsKey(r'height'), 'Required key "SyncAssetV2[height]" is missing from JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncAssetV2[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncAssetV2[id]" has a null value in JSON.'); + assert(json.containsKey(r'isEdited'), 'Required key "SyncAssetV2[isEdited]" is missing from JSON.'); + assert(json[r'isEdited'] != null, 'Required key "SyncAssetV2[isEdited]" has a null value in JSON.'); + assert(json.containsKey(r'isFavorite'), 'Required key "SyncAssetV2[isFavorite]" is missing from JSON.'); + assert(json[r'isFavorite'] != null, 'Required key "SyncAssetV2[isFavorite]" has a null value in JSON.'); + assert(json.containsKey(r'libraryId'), 'Required key "SyncAssetV2[libraryId]" is missing from JSON.'); + assert(json.containsKey(r'livePhotoVideoId'), 'Required key "SyncAssetV2[livePhotoVideoId]" is missing from JSON.'); + assert(json.containsKey(r'localDateTime'), 'Required key "SyncAssetV2[localDateTime]" is missing from JSON.'); + assert(json.containsKey(r'originalFileName'), 'Required key "SyncAssetV2[originalFileName]" is missing from JSON.'); + assert(json[r'originalFileName'] != null, 'Required key "SyncAssetV2[originalFileName]" has a null value in JSON.'); + assert(json.containsKey(r'ownerId'), 'Required key "SyncAssetV2[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "SyncAssetV2[ownerId]" has a null value in JSON.'); + assert(json.containsKey(r'stackId'), 'Required key "SyncAssetV2[stackId]" is missing from JSON.'); + assert(json.containsKey(r'thumbhash'), 'Required key "SyncAssetV2[thumbhash]" is missing from JSON.'); + assert(json.containsKey(r'type'), 'Required key "SyncAssetV2[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "SyncAssetV2[type]" has a null value in JSON.'); + assert(json.containsKey(r'visibility'), 'Required key "SyncAssetV2[visibility]" is missing from JSON.'); + assert(json[r'visibility'] != null, 'Required key "SyncAssetV2[visibility]" has a null value in JSON.'); + assert(json.containsKey(r'width'), 'Required key "SyncAssetV2[width]" is missing from JSON.'); + return true; + }()); + return SyncAssetV2( checksum: mapValueOfType(json, r'checksum')!, createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), diff --git a/mobile/openapi/lib/model/sync_auth_user_v1.dart b/mobile/openapi/lib/model/sync_auth_user_v1.dart index c64d82bfbd..031128b6e1 100644 --- a/mobile/openapi/lib/model/sync_auth_user_v1.dart +++ b/mobile/openapi/lib/model/sync_auth_user_v1.dart @@ -13,7 +13,7 @@ part of openapi.api; class SyncAuthUserV1 { /// Returns a new [SyncAuthUserV1] instance. SyncAuthUserV1({ - this.avatarColor, + this.avatarColor = const Optional.absent(), required this.deletedAt, required this.email, required this.hasProfileImage, @@ -28,7 +28,7 @@ class SyncAuthUserV1 { required this.storageLabel, }); - UserAvatarColor? avatarColor; + Optional avatarColor; /// User deleted at DateTime? deletedAt; @@ -110,17 +110,16 @@ class SyncAuthUserV1 { Map toJson() { final json = {}; - if (this.avatarColor != null) { - json[r'avatarColor'] = this.avatarColor; - } else { - // json[r'avatarColor'] = null; + if (this.avatarColor.isPresent) { + final value = this.avatarColor.value; + json[r'avatarColor'] = value; } if (this.deletedAt != null) { json[r'deletedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.deletedAt!.millisecondsSinceEpoch : this.deletedAt!.toUtc().toIso8601String(); } else { - // json[r'deletedAt'] = null; + json[r'deletedAt'] = null; } json[r'email'] = this.email; json[r'hasProfileImage'] = this.hasProfileImage; @@ -131,7 +130,7 @@ class SyncAuthUserV1 { if (this.pinCode != null) { json[r'pinCode'] = this.pinCode; } else { - // json[r'pinCode'] = null; + json[r'pinCode'] = null; } json[r'profileChangedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.profileChangedAt.millisecondsSinceEpoch @@ -139,13 +138,13 @@ class SyncAuthUserV1 { if (this.quotaSizeInBytes != null) { json[r'quotaSizeInBytes'] = this.quotaSizeInBytes; } else { - // json[r'quotaSizeInBytes'] = null; + json[r'quotaSizeInBytes'] = null; } json[r'quotaUsageInBytes'] = this.quotaUsageInBytes; if (this.storageLabel != null) { json[r'storageLabel'] = this.storageLabel; } else { - // json[r'storageLabel'] = null; + json[r'storageLabel'] = null; } return json; } @@ -158,8 +157,35 @@ class SyncAuthUserV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'deletedAt'), 'Required key "SyncAuthUserV1[deletedAt]" is missing from JSON.'); + assert(json.containsKey(r'email'), 'Required key "SyncAuthUserV1[email]" is missing from JSON.'); + assert(json[r'email'] != null, 'Required key "SyncAuthUserV1[email]" has a null value in JSON.'); + assert(json.containsKey(r'hasProfileImage'), 'Required key "SyncAuthUserV1[hasProfileImage]" is missing from JSON.'); + assert(json[r'hasProfileImage'] != null, 'Required key "SyncAuthUserV1[hasProfileImage]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncAuthUserV1[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncAuthUserV1[id]" has a null value in JSON.'); + assert(json.containsKey(r'isAdmin'), 'Required key "SyncAuthUserV1[isAdmin]" is missing from JSON.'); + assert(json[r'isAdmin'] != null, 'Required key "SyncAuthUserV1[isAdmin]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "SyncAuthUserV1[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "SyncAuthUserV1[name]" has a null value in JSON.'); + assert(json.containsKey(r'oauthId'), 'Required key "SyncAuthUserV1[oauthId]" is missing from JSON.'); + assert(json[r'oauthId'] != null, 'Required key "SyncAuthUserV1[oauthId]" has a null value in JSON.'); + assert(json.containsKey(r'pinCode'), 'Required key "SyncAuthUserV1[pinCode]" is missing from JSON.'); + assert(json.containsKey(r'profileChangedAt'), 'Required key "SyncAuthUserV1[profileChangedAt]" is missing from JSON.'); + assert(json[r'profileChangedAt'] != null, 'Required key "SyncAuthUserV1[profileChangedAt]" has a null value in JSON.'); + assert(json.containsKey(r'quotaSizeInBytes'), 'Required key "SyncAuthUserV1[quotaSizeInBytes]" is missing from JSON.'); + assert(json.containsKey(r'quotaUsageInBytes'), 'Required key "SyncAuthUserV1[quotaUsageInBytes]" is missing from JSON.'); + assert(json[r'quotaUsageInBytes'] != null, 'Required key "SyncAuthUserV1[quotaUsageInBytes]" has a null value in JSON.'); + assert(json.containsKey(r'storageLabel'), 'Required key "SyncAuthUserV1[storageLabel]" is missing from JSON.'); + return true; + }()); + return SyncAuthUserV1( - avatarColor: UserAvatarColor.fromJson(json[r'avatarColor']), + avatarColor: json.containsKey(r'avatarColor') ? Optional.present(UserAvatarColor.fromJson(json[r'avatarColor'])) : const Optional.absent(), deletedAt: mapDateTime(json, r'deletedAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), email: mapValueOfType(json, r'email')!, hasProfileImage: mapValueOfType(json, r'hasProfileImage')!, diff --git a/mobile/openapi/lib/model/sync_memory_asset_delete_v1.dart b/mobile/openapi/lib/model/sync_memory_asset_delete_v1.dart index c37682d02d..cfde0aa9c1 100644 --- a/mobile/openapi/lib/model/sync_memory_asset_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_memory_asset_delete_v1.dart @@ -52,6 +52,17 @@ class SyncMemoryAssetDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "SyncMemoryAssetDeleteV1[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncMemoryAssetDeleteV1[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'memoryId'), 'Required key "SyncMemoryAssetDeleteV1[memoryId]" is missing from JSON.'); + assert(json[r'memoryId'] != null, 'Required key "SyncMemoryAssetDeleteV1[memoryId]" has a null value in JSON.'); + return true; + }()); + return SyncMemoryAssetDeleteV1( assetId: mapValueOfType(json, r'assetId')!, memoryId: mapValueOfType(json, r'memoryId')!, diff --git a/mobile/openapi/lib/model/sync_memory_asset_v1.dart b/mobile/openapi/lib/model/sync_memory_asset_v1.dart index 2cfab98afd..2f03fedd50 100644 --- a/mobile/openapi/lib/model/sync_memory_asset_v1.dart +++ b/mobile/openapi/lib/model/sync_memory_asset_v1.dart @@ -52,6 +52,17 @@ class SyncMemoryAssetV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetId'), 'Required key "SyncMemoryAssetV1[assetId]" is missing from JSON.'); + assert(json[r'assetId'] != null, 'Required key "SyncMemoryAssetV1[assetId]" has a null value in JSON.'); + assert(json.containsKey(r'memoryId'), 'Required key "SyncMemoryAssetV1[memoryId]" is missing from JSON.'); + assert(json[r'memoryId'] != null, 'Required key "SyncMemoryAssetV1[memoryId]" has a null value in JSON.'); + return true; + }()); + return SyncMemoryAssetV1( assetId: mapValueOfType(json, r'assetId')!, memoryId: mapValueOfType(json, r'memoryId')!, diff --git a/mobile/openapi/lib/model/sync_memory_delete_v1.dart b/mobile/openapi/lib/model/sync_memory_delete_v1.dart index d5f63ec8fa..d3b0da5841 100644 --- a/mobile/openapi/lib/model/sync_memory_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_memory_delete_v1.dart @@ -45,6 +45,15 @@ class SyncMemoryDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'memoryId'), 'Required key "SyncMemoryDeleteV1[memoryId]" is missing from JSON.'); + assert(json[r'memoryId'] != null, 'Required key "SyncMemoryDeleteV1[memoryId]" has a null value in JSON.'); + return true; + }()); + return SyncMemoryDeleteV1( memoryId: mapValueOfType(json, r'memoryId')!, ); diff --git a/mobile/openapi/lib/model/sync_memory_v1.dart b/mobile/openapi/lib/model/sync_memory_v1.dart index 855340f4d7..0d908374df 100644 --- a/mobile/openapi/lib/model/sync_memory_v1.dart +++ b/mobile/openapi/lib/model/sync_memory_v1.dart @@ -107,14 +107,14 @@ class SyncMemoryV1 { ? this.deletedAt!.millisecondsSinceEpoch : this.deletedAt!.toUtc().toIso8601String(); } else { - // json[r'deletedAt'] = null; + json[r'deletedAt'] = null; } if (this.hideAt != null) { json[r'hideAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.hideAt!.millisecondsSinceEpoch : this.hideAt!.toUtc().toIso8601String(); } else { - // json[r'hideAt'] = null; + json[r'hideAt'] = null; } json[r'id'] = this.id; json[r'isSaved'] = this.isSaved; @@ -127,14 +127,14 @@ class SyncMemoryV1 { ? this.seenAt!.millisecondsSinceEpoch : this.seenAt!.toUtc().toIso8601String(); } else { - // json[r'seenAt'] = null; + json[r'seenAt'] = null; } if (this.showAt != null) { json[r'showAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.showAt!.millisecondsSinceEpoch : this.showAt!.toUtc().toIso8601String(); } else { - // json[r'showAt'] = null; + json[r'showAt'] = null; } json[r'type'] = this.type; json[r'updatedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') @@ -151,6 +151,33 @@ class SyncMemoryV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'createdAt'), 'Required key "SyncMemoryV1[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "SyncMemoryV1[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'data'), 'Required key "SyncMemoryV1[data]" is missing from JSON.'); + assert(json[r'data'] != null, 'Required key "SyncMemoryV1[data]" has a null value in JSON.'); + assert(json.containsKey(r'deletedAt'), 'Required key "SyncMemoryV1[deletedAt]" is missing from JSON.'); + assert(json.containsKey(r'hideAt'), 'Required key "SyncMemoryV1[hideAt]" is missing from JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncMemoryV1[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncMemoryV1[id]" has a null value in JSON.'); + assert(json.containsKey(r'isSaved'), 'Required key "SyncMemoryV1[isSaved]" is missing from JSON.'); + assert(json[r'isSaved'] != null, 'Required key "SyncMemoryV1[isSaved]" has a null value in JSON.'); + assert(json.containsKey(r'memoryAt'), 'Required key "SyncMemoryV1[memoryAt]" is missing from JSON.'); + assert(json[r'memoryAt'] != null, 'Required key "SyncMemoryV1[memoryAt]" has a null value in JSON.'); + assert(json.containsKey(r'ownerId'), 'Required key "SyncMemoryV1[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "SyncMemoryV1[ownerId]" has a null value in JSON.'); + assert(json.containsKey(r'seenAt'), 'Required key "SyncMemoryV1[seenAt]" is missing from JSON.'); + assert(json.containsKey(r'showAt'), 'Required key "SyncMemoryV1[showAt]" is missing from JSON.'); + assert(json.containsKey(r'type'), 'Required key "SyncMemoryV1[type]" is missing from JSON.'); + assert(json[r'type'] != null, 'Required key "SyncMemoryV1[type]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "SyncMemoryV1[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "SyncMemoryV1[updatedAt]" has a null value in JSON.'); + return true; + }()); + return SyncMemoryV1( createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, data: mapCastOfType(json, r'data')!, diff --git a/mobile/openapi/lib/model/sync_partner_delete_v1.dart b/mobile/openapi/lib/model/sync_partner_delete_v1.dart index 64dfb4eb98..74f0289655 100644 --- a/mobile/openapi/lib/model/sync_partner_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_partner_delete_v1.dart @@ -52,6 +52,17 @@ class SyncPartnerDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'sharedById'), 'Required key "SyncPartnerDeleteV1[sharedById]" is missing from JSON.'); + assert(json[r'sharedById'] != null, 'Required key "SyncPartnerDeleteV1[sharedById]" has a null value in JSON.'); + assert(json.containsKey(r'sharedWithId'), 'Required key "SyncPartnerDeleteV1[sharedWithId]" is missing from JSON.'); + assert(json[r'sharedWithId'] != null, 'Required key "SyncPartnerDeleteV1[sharedWithId]" has a null value in JSON.'); + return true; + }()); + return SyncPartnerDeleteV1( sharedById: mapValueOfType(json, r'sharedById')!, sharedWithId: mapValueOfType(json, r'sharedWithId')!, diff --git a/mobile/openapi/lib/model/sync_partner_v1.dart b/mobile/openapi/lib/model/sync_partner_v1.dart index 9f9c3d14c1..6ee102864f 100644 --- a/mobile/openapi/lib/model/sync_partner_v1.dart +++ b/mobile/openapi/lib/model/sync_partner_v1.dart @@ -59,6 +59,19 @@ class SyncPartnerV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'inTimeline'), 'Required key "SyncPartnerV1[inTimeline]" is missing from JSON.'); + assert(json[r'inTimeline'] != null, 'Required key "SyncPartnerV1[inTimeline]" has a null value in JSON.'); + assert(json.containsKey(r'sharedById'), 'Required key "SyncPartnerV1[sharedById]" is missing from JSON.'); + assert(json[r'sharedById'] != null, 'Required key "SyncPartnerV1[sharedById]" has a null value in JSON.'); + assert(json.containsKey(r'sharedWithId'), 'Required key "SyncPartnerV1[sharedWithId]" is missing from JSON.'); + assert(json[r'sharedWithId'] != null, 'Required key "SyncPartnerV1[sharedWithId]" has a null value in JSON.'); + return true; + }()); + return SyncPartnerV1( inTimeline: mapValueOfType(json, r'inTimeline')!, sharedById: mapValueOfType(json, r'sharedById')!, diff --git a/mobile/openapi/lib/model/sync_person_delete_v1.dart b/mobile/openapi/lib/model/sync_person_delete_v1.dart index 526bc26187..c4aadce95f 100644 --- a/mobile/openapi/lib/model/sync_person_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_person_delete_v1.dart @@ -45,6 +45,15 @@ class SyncPersonDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'personId'), 'Required key "SyncPersonDeleteV1[personId]" is missing from JSON.'); + assert(json[r'personId'] != null, 'Required key "SyncPersonDeleteV1[personId]" has a null value in JSON.'); + return true; + }()); + return SyncPersonDeleteV1( personId: mapValueOfType(json, r'personId')!, ); diff --git a/mobile/openapi/lib/model/sync_person_v1.dart b/mobile/openapi/lib/model/sync_person_v1.dart index 1bd6f4a160..36b5ba9cc5 100644 --- a/mobile/openapi/lib/model/sync_person_v1.dart +++ b/mobile/openapi/lib/model/sync_person_v1.dart @@ -92,12 +92,12 @@ class SyncPersonV1 { ? this.birthDate!.millisecondsSinceEpoch : this.birthDate!.toUtc().toIso8601String(); } else { - // json[r'birthDate'] = null; + json[r'birthDate'] = null; } if (this.color != null) { json[r'color'] = this.color; } else { - // json[r'color'] = null; + json[r'color'] = null; } json[r'createdAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.createdAt.millisecondsSinceEpoch @@ -105,7 +105,7 @@ class SyncPersonV1 { if (this.faceAssetId != null) { json[r'faceAssetId'] = this.faceAssetId; } else { - // json[r'faceAssetId'] = null; + json[r'faceAssetId'] = null; } json[r'id'] = this.id; json[r'isFavorite'] = this.isFavorite; @@ -126,6 +126,30 @@ class SyncPersonV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'birthDate'), 'Required key "SyncPersonV1[birthDate]" is missing from JSON.'); + assert(json.containsKey(r'color'), 'Required key "SyncPersonV1[color]" is missing from JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "SyncPersonV1[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "SyncPersonV1[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'faceAssetId'), 'Required key "SyncPersonV1[faceAssetId]" is missing from JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncPersonV1[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncPersonV1[id]" has a null value in JSON.'); + assert(json.containsKey(r'isFavorite'), 'Required key "SyncPersonV1[isFavorite]" is missing from JSON.'); + assert(json[r'isFavorite'] != null, 'Required key "SyncPersonV1[isFavorite]" has a null value in JSON.'); + assert(json.containsKey(r'isHidden'), 'Required key "SyncPersonV1[isHidden]" is missing from JSON.'); + assert(json[r'isHidden'] != null, 'Required key "SyncPersonV1[isHidden]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "SyncPersonV1[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "SyncPersonV1[name]" has a null value in JSON.'); + assert(json.containsKey(r'ownerId'), 'Required key "SyncPersonV1[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "SyncPersonV1[ownerId]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "SyncPersonV1[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "SyncPersonV1[updatedAt]" has a null value in JSON.'); + return true; + }()); + return SyncPersonV1( birthDate: mapDateTime(json, r'birthDate', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), color: mapValueOfType(json, r'color'), diff --git a/mobile/openapi/lib/model/sync_stack_delete_v1.dart b/mobile/openapi/lib/model/sync_stack_delete_v1.dart index 2a7398291a..59807f8df2 100644 --- a/mobile/openapi/lib/model/sync_stack_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_stack_delete_v1.dart @@ -45,6 +45,15 @@ class SyncStackDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'stackId'), 'Required key "SyncStackDeleteV1[stackId]" is missing from JSON.'); + assert(json[r'stackId'] != null, 'Required key "SyncStackDeleteV1[stackId]" has a null value in JSON.'); + return true; + }()); + return SyncStackDeleteV1( stackId: mapValueOfType(json, r'stackId')!, ); diff --git a/mobile/openapi/lib/model/sync_stack_v1.dart b/mobile/openapi/lib/model/sync_stack_v1.dart index 3e79a55134..72d86d27e2 100644 --- a/mobile/openapi/lib/model/sync_stack_v1.dart +++ b/mobile/openapi/lib/model/sync_stack_v1.dart @@ -77,6 +77,23 @@ class SyncStackV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'createdAt'), 'Required key "SyncStackV1[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "SyncStackV1[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncStackV1[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncStackV1[id]" has a null value in JSON.'); + assert(json.containsKey(r'ownerId'), 'Required key "SyncStackV1[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "SyncStackV1[ownerId]" has a null value in JSON.'); + assert(json.containsKey(r'primaryAssetId'), 'Required key "SyncStackV1[primaryAssetId]" is missing from JSON.'); + assert(json[r'primaryAssetId'] != null, 'Required key "SyncStackV1[primaryAssetId]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "SyncStackV1[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "SyncStackV1[updatedAt]" has a null value in JSON.'); + return true; + }()); + return SyncStackV1( createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, id: mapValueOfType(json, r'id')!, diff --git a/mobile/openapi/lib/model/sync_stream_dto.dart b/mobile/openapi/lib/model/sync_stream_dto.dart index 932477cb15..3992c857a0 100644 --- a/mobile/openapi/lib/model/sync_stream_dto.dart +++ b/mobile/openapi/lib/model/sync_stream_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class SyncStreamDto { /// Returns a new [SyncStreamDto] instance. SyncStreamDto({ - this.reset, + this.reset = const Optional.absent(), this.types = const [], }); @@ -24,7 +24,7 @@ class SyncStreamDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? reset; + Optional reset; /// Sync request types List types; @@ -45,10 +45,9 @@ class SyncStreamDto { Map toJson() { final json = {}; - if (this.reset != null) { - json[r'reset'] = this.reset; - } else { - // json[r'reset'] = null; + if (this.reset.isPresent) { + final value = this.reset.value; + json[r'reset'] = value; } json[r'types'] = this.types; return json; @@ -62,8 +61,17 @@ class SyncStreamDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'types'), 'Required key "SyncStreamDto[types]" is missing from JSON.'); + assert(json[r'types'] != null, 'Required key "SyncStreamDto[types]" has a null value in JSON.'); + return true; + }()); + return SyncStreamDto( - reset: mapValueOfType(json, r'reset'), + reset: json.containsKey(r'reset') ? Optional.present(mapValueOfType(json, r'reset')) : const Optional.absent(), types: SyncRequestType.listFromJson(json[r'types']), ); } diff --git a/mobile/openapi/lib/model/sync_user_delete_v1.dart b/mobile/openapi/lib/model/sync_user_delete_v1.dart index bbbdc147dd..b8aeb8fa10 100644 --- a/mobile/openapi/lib/model/sync_user_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_user_delete_v1.dart @@ -45,6 +45,15 @@ class SyncUserDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'userId'), 'Required key "SyncUserDeleteV1[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "SyncUserDeleteV1[userId]" has a null value in JSON.'); + return true; + }()); + return SyncUserDeleteV1( userId: mapValueOfType(json, r'userId')!, ); diff --git a/mobile/openapi/lib/model/sync_user_metadata_delete_v1.dart b/mobile/openapi/lib/model/sync_user_metadata_delete_v1.dart index 67976108e1..6515e1f9c6 100644 --- a/mobile/openapi/lib/model/sync_user_metadata_delete_v1.dart +++ b/mobile/openapi/lib/model/sync_user_metadata_delete_v1.dart @@ -51,6 +51,17 @@ class SyncUserMetadataDeleteV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'key'), 'Required key "SyncUserMetadataDeleteV1[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "SyncUserMetadataDeleteV1[key]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "SyncUserMetadataDeleteV1[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "SyncUserMetadataDeleteV1[userId]" has a null value in JSON.'); + return true; + }()); + return SyncUserMetadataDeleteV1( key: UserMetadataKey.fromJson(json[r'key'])!, userId: mapValueOfType(json, r'userId')!, diff --git a/mobile/openapi/lib/model/sync_user_metadata_v1.dart b/mobile/openapi/lib/model/sync_user_metadata_v1.dart index ddde7c0513..8b441a8393 100644 --- a/mobile/openapi/lib/model/sync_user_metadata_v1.dart +++ b/mobile/openapi/lib/model/sync_user_metadata_v1.dart @@ -58,6 +58,19 @@ class SyncUserMetadataV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'key'), 'Required key "SyncUserMetadataV1[key]" is missing from JSON.'); + assert(json[r'key'] != null, 'Required key "SyncUserMetadataV1[key]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "SyncUserMetadataV1[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "SyncUserMetadataV1[userId]" has a null value in JSON.'); + assert(json.containsKey(r'value'), 'Required key "SyncUserMetadataV1[value]" is missing from JSON.'); + assert(json[r'value'] != null, 'Required key "SyncUserMetadataV1[value]" has a null value in JSON.'); + return true; + }()); + return SyncUserMetadataV1( key: UserMetadataKey.fromJson(json[r'key'])!, userId: mapValueOfType(json, r'userId')!, diff --git a/mobile/openapi/lib/model/sync_user_v1.dart b/mobile/openapi/lib/model/sync_user_v1.dart index 0a81593547..0fb9100b5f 100644 --- a/mobile/openapi/lib/model/sync_user_v1.dart +++ b/mobile/openapi/lib/model/sync_user_v1.dart @@ -13,7 +13,7 @@ part of openapi.api; class SyncUserV1 { /// Returns a new [SyncUserV1] instance. SyncUserV1({ - this.avatarColor, + this.avatarColor = const Optional.absent(), required this.deletedAt, required this.email, required this.hasProfileImage, @@ -22,7 +22,7 @@ class SyncUserV1 { required this.profileChangedAt, }); - UserAvatarColor? avatarColor; + Optional avatarColor; /// User deleted at DateTime? deletedAt; @@ -68,17 +68,16 @@ class SyncUserV1 { Map toJson() { final json = {}; - if (this.avatarColor != null) { - json[r'avatarColor'] = this.avatarColor; - } else { - // json[r'avatarColor'] = null; + if (this.avatarColor.isPresent) { + final value = this.avatarColor.value; + json[r'avatarColor'] = value; } if (this.deletedAt != null) { json[r'deletedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.deletedAt!.millisecondsSinceEpoch : this.deletedAt!.toUtc().toIso8601String(); } else { - // json[r'deletedAt'] = null; + json[r'deletedAt'] = null; } json[r'email'] = this.email; json[r'hasProfileImage'] = this.hasProfileImage; @@ -98,8 +97,26 @@ class SyncUserV1 { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'deletedAt'), 'Required key "SyncUserV1[deletedAt]" is missing from JSON.'); + assert(json.containsKey(r'email'), 'Required key "SyncUserV1[email]" is missing from JSON.'); + assert(json[r'email'] != null, 'Required key "SyncUserV1[email]" has a null value in JSON.'); + assert(json.containsKey(r'hasProfileImage'), 'Required key "SyncUserV1[hasProfileImage]" is missing from JSON.'); + assert(json[r'hasProfileImage'] != null, 'Required key "SyncUserV1[hasProfileImage]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "SyncUserV1[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "SyncUserV1[id]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "SyncUserV1[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "SyncUserV1[name]" has a null value in JSON.'); + assert(json.containsKey(r'profileChangedAt'), 'Required key "SyncUserV1[profileChangedAt]" is missing from JSON.'); + assert(json[r'profileChangedAt'] != null, 'Required key "SyncUserV1[profileChangedAt]" has a null value in JSON.'); + return true; + }()); + return SyncUserV1( - avatarColor: UserAvatarColor.fromJson(json[r'avatarColor']), + avatarColor: json.containsKey(r'avatarColor') ? Optional.present(UserAvatarColor.fromJson(json[r'avatarColor'])) : const Optional.absent(), deletedAt: mapDateTime(json, r'deletedAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/'), email: mapValueOfType(json, r'email')!, hasProfileImage: mapValueOfType(json, r'hasProfileImage')!, diff --git a/mobile/openapi/lib/model/system_config_backups_dto.dart b/mobile/openapi/lib/model/system_config_backups_dto.dart index 82cd6e59eb..79aebd50a3 100644 --- a/mobile/openapi/lib/model/system_config_backups_dto.dart +++ b/mobile/openapi/lib/model/system_config_backups_dto.dart @@ -44,6 +44,15 @@ class SystemConfigBackupsDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'database'), 'Required key "SystemConfigBackupsDto[database]" is missing from JSON.'); + assert(json[r'database'] != null, 'Required key "SystemConfigBackupsDto[database]" has a null value in JSON.'); + return true; + }()); + return SystemConfigBackupsDto( database: DatabaseBackupConfig.fromJson(json[r'database'])!, ); diff --git a/mobile/openapi/lib/model/system_config_dto.dart b/mobile/openapi/lib/model/system_config_dto.dart index 38dbb30f0c..7cf5de161d 100644 --- a/mobile/openapi/lib/model/system_config_dto.dart +++ b/mobile/openapi/lib/model/system_config_dto.dart @@ -164,6 +164,55 @@ class SystemConfigDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'backup'), 'Required key "SystemConfigDto[backup]" is missing from JSON.'); + assert(json[r'backup'] != null, 'Required key "SystemConfigDto[backup]" has a null value in JSON.'); + assert(json.containsKey(r'ffmpeg'), 'Required key "SystemConfigDto[ffmpeg]" is missing from JSON.'); + assert(json[r'ffmpeg'] != null, 'Required key "SystemConfigDto[ffmpeg]" has a null value in JSON.'); + assert(json.containsKey(r'image'), 'Required key "SystemConfigDto[image]" is missing from JSON.'); + assert(json[r'image'] != null, 'Required key "SystemConfigDto[image]" has a null value in JSON.'); + assert(json.containsKey(r'job'), 'Required key "SystemConfigDto[job]" is missing from JSON.'); + assert(json[r'job'] != null, 'Required key "SystemConfigDto[job]" has a null value in JSON.'); + assert(json.containsKey(r'library'), 'Required key "SystemConfigDto[library]" is missing from JSON.'); + assert(json[r'library'] != null, 'Required key "SystemConfigDto[library]" has a null value in JSON.'); + assert(json.containsKey(r'logging'), 'Required key "SystemConfigDto[logging]" is missing from JSON.'); + assert(json[r'logging'] != null, 'Required key "SystemConfigDto[logging]" has a null value in JSON.'); + assert(json.containsKey(r'machineLearning'), 'Required key "SystemConfigDto[machineLearning]" is missing from JSON.'); + assert(json[r'machineLearning'] != null, 'Required key "SystemConfigDto[machineLearning]" has a null value in JSON.'); + assert(json.containsKey(r'map'), 'Required key "SystemConfigDto[map]" is missing from JSON.'); + assert(json[r'map'] != null, 'Required key "SystemConfigDto[map]" has a null value in JSON.'); + assert(json.containsKey(r'metadata'), 'Required key "SystemConfigDto[metadata]" is missing from JSON.'); + assert(json[r'metadata'] != null, 'Required key "SystemConfigDto[metadata]" has a null value in JSON.'); + assert(json.containsKey(r'newVersionCheck'), 'Required key "SystemConfigDto[newVersionCheck]" is missing from JSON.'); + assert(json[r'newVersionCheck'] != null, 'Required key "SystemConfigDto[newVersionCheck]" has a null value in JSON.'); + assert(json.containsKey(r'nightlyTasks'), 'Required key "SystemConfigDto[nightlyTasks]" is missing from JSON.'); + assert(json[r'nightlyTasks'] != null, 'Required key "SystemConfigDto[nightlyTasks]" has a null value in JSON.'); + assert(json.containsKey(r'notifications'), 'Required key "SystemConfigDto[notifications]" is missing from JSON.'); + assert(json[r'notifications'] != null, 'Required key "SystemConfigDto[notifications]" has a null value in JSON.'); + assert(json.containsKey(r'oauth'), 'Required key "SystemConfigDto[oauth]" is missing from JSON.'); + assert(json[r'oauth'] != null, 'Required key "SystemConfigDto[oauth]" has a null value in JSON.'); + assert(json.containsKey(r'passwordLogin'), 'Required key "SystemConfigDto[passwordLogin]" is missing from JSON.'); + assert(json[r'passwordLogin'] != null, 'Required key "SystemConfigDto[passwordLogin]" has a null value in JSON.'); + assert(json.containsKey(r'reverseGeocoding'), 'Required key "SystemConfigDto[reverseGeocoding]" is missing from JSON.'); + assert(json[r'reverseGeocoding'] != null, 'Required key "SystemConfigDto[reverseGeocoding]" has a null value in JSON.'); + assert(json.containsKey(r'server'), 'Required key "SystemConfigDto[server]" is missing from JSON.'); + assert(json[r'server'] != null, 'Required key "SystemConfigDto[server]" has a null value in JSON.'); + assert(json.containsKey(r'storageTemplate'), 'Required key "SystemConfigDto[storageTemplate]" is missing from JSON.'); + assert(json[r'storageTemplate'] != null, 'Required key "SystemConfigDto[storageTemplate]" has a null value in JSON.'); + assert(json.containsKey(r'templates'), 'Required key "SystemConfigDto[templates]" is missing from JSON.'); + assert(json[r'templates'] != null, 'Required key "SystemConfigDto[templates]" has a null value in JSON.'); + assert(json.containsKey(r'theme'), 'Required key "SystemConfigDto[theme]" is missing from JSON.'); + assert(json[r'theme'] != null, 'Required key "SystemConfigDto[theme]" has a null value in JSON.'); + assert(json.containsKey(r'trash'), 'Required key "SystemConfigDto[trash]" is missing from JSON.'); + assert(json[r'trash'] != null, 'Required key "SystemConfigDto[trash]" has a null value in JSON.'); + assert(json.containsKey(r'user'), 'Required key "SystemConfigDto[user]" is missing from JSON.'); + assert(json[r'user'] != null, 'Required key "SystemConfigDto[user]" has a null value in JSON.'); + return true; + }()); + return SystemConfigDto( backup: SystemConfigBackupsDto.fromJson(json[r'backup'])!, ffmpeg: SystemConfigFFmpegDto.fromJson(json[r'ffmpeg'])!, diff --git a/mobile/openapi/lib/model/system_config_f_fmpeg_dto.dart b/mobile/openapi/lib/model/system_config_f_fmpeg_dto.dart index 79da8da97f..dc220cd813 100644 --- a/mobile/openapi/lib/model/system_config_f_fmpeg_dto.dart +++ b/mobile/openapi/lib/model/system_config_f_fmpeg_dto.dart @@ -200,6 +200,57 @@ class SystemConfigFFmpegDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'accel'), 'Required key "SystemConfigFFmpegDto[accel]" is missing from JSON.'); + assert(json[r'accel'] != null, 'Required key "SystemConfigFFmpegDto[accel]" has a null value in JSON.'); + assert(json.containsKey(r'accelDecode'), 'Required key "SystemConfigFFmpegDto[accelDecode]" is missing from JSON.'); + assert(json[r'accelDecode'] != null, 'Required key "SystemConfigFFmpegDto[accelDecode]" has a null value in JSON.'); + assert(json.containsKey(r'acceptedAudioCodecs'), 'Required key "SystemConfigFFmpegDto[acceptedAudioCodecs]" is missing from JSON.'); + assert(json[r'acceptedAudioCodecs'] != null, 'Required key "SystemConfigFFmpegDto[acceptedAudioCodecs]" has a null value in JSON.'); + assert(json.containsKey(r'acceptedContainers'), 'Required key "SystemConfigFFmpegDto[acceptedContainers]" is missing from JSON.'); + assert(json[r'acceptedContainers'] != null, 'Required key "SystemConfigFFmpegDto[acceptedContainers]" has a null value in JSON.'); + assert(json.containsKey(r'acceptedVideoCodecs'), 'Required key "SystemConfigFFmpegDto[acceptedVideoCodecs]" is missing from JSON.'); + assert(json[r'acceptedVideoCodecs'] != null, 'Required key "SystemConfigFFmpegDto[acceptedVideoCodecs]" has a null value in JSON.'); + assert(json.containsKey(r'bframes'), 'Required key "SystemConfigFFmpegDto[bframes]" is missing from JSON.'); + assert(json[r'bframes'] != null, 'Required key "SystemConfigFFmpegDto[bframes]" has a null value in JSON.'); + assert(json.containsKey(r'cqMode'), 'Required key "SystemConfigFFmpegDto[cqMode]" is missing from JSON.'); + assert(json[r'cqMode'] != null, 'Required key "SystemConfigFFmpegDto[cqMode]" has a null value in JSON.'); + assert(json.containsKey(r'crf'), 'Required key "SystemConfigFFmpegDto[crf]" is missing from JSON.'); + assert(json[r'crf'] != null, 'Required key "SystemConfigFFmpegDto[crf]" has a null value in JSON.'); + assert(json.containsKey(r'gopSize'), 'Required key "SystemConfigFFmpegDto[gopSize]" is missing from JSON.'); + assert(json[r'gopSize'] != null, 'Required key "SystemConfigFFmpegDto[gopSize]" has a null value in JSON.'); + assert(json.containsKey(r'maxBitrate'), 'Required key "SystemConfigFFmpegDto[maxBitrate]" is missing from JSON.'); + assert(json[r'maxBitrate'] != null, 'Required key "SystemConfigFFmpegDto[maxBitrate]" has a null value in JSON.'); + assert(json.containsKey(r'preferredHwDevice'), 'Required key "SystemConfigFFmpegDto[preferredHwDevice]" is missing from JSON.'); + assert(json[r'preferredHwDevice'] != null, 'Required key "SystemConfigFFmpegDto[preferredHwDevice]" has a null value in JSON.'); + assert(json.containsKey(r'preset'), 'Required key "SystemConfigFFmpegDto[preset]" is missing from JSON.'); + assert(json[r'preset'] != null, 'Required key "SystemConfigFFmpegDto[preset]" has a null value in JSON.'); + assert(json.containsKey(r'realtime'), 'Required key "SystemConfigFFmpegDto[realtime]" is missing from JSON.'); + assert(json[r'realtime'] != null, 'Required key "SystemConfigFFmpegDto[realtime]" has a null value in JSON.'); + assert(json.containsKey(r'refs'), 'Required key "SystemConfigFFmpegDto[refs]" is missing from JSON.'); + assert(json[r'refs'] != null, 'Required key "SystemConfigFFmpegDto[refs]" has a null value in JSON.'); + assert(json.containsKey(r'targetAudioCodec'), 'Required key "SystemConfigFFmpegDto[targetAudioCodec]" is missing from JSON.'); + assert(json[r'targetAudioCodec'] != null, 'Required key "SystemConfigFFmpegDto[targetAudioCodec]" has a null value in JSON.'); + assert(json.containsKey(r'targetResolution'), 'Required key "SystemConfigFFmpegDto[targetResolution]" is missing from JSON.'); + assert(json[r'targetResolution'] != null, 'Required key "SystemConfigFFmpegDto[targetResolution]" has a null value in JSON.'); + assert(json.containsKey(r'targetVideoCodec'), 'Required key "SystemConfigFFmpegDto[targetVideoCodec]" is missing from JSON.'); + assert(json[r'targetVideoCodec'] != null, 'Required key "SystemConfigFFmpegDto[targetVideoCodec]" has a null value in JSON.'); + assert(json.containsKey(r'temporalAQ'), 'Required key "SystemConfigFFmpegDto[temporalAQ]" is missing from JSON.'); + assert(json[r'temporalAQ'] != null, 'Required key "SystemConfigFFmpegDto[temporalAQ]" has a null value in JSON.'); + assert(json.containsKey(r'threads'), 'Required key "SystemConfigFFmpegDto[threads]" is missing from JSON.'); + assert(json[r'threads'] != null, 'Required key "SystemConfigFFmpegDto[threads]" has a null value in JSON.'); + assert(json.containsKey(r'tonemap'), 'Required key "SystemConfigFFmpegDto[tonemap]" is missing from JSON.'); + assert(json[r'tonemap'] != null, 'Required key "SystemConfigFFmpegDto[tonemap]" has a null value in JSON.'); + assert(json.containsKey(r'transcode'), 'Required key "SystemConfigFFmpegDto[transcode]" is missing from JSON.'); + assert(json[r'transcode'] != null, 'Required key "SystemConfigFFmpegDto[transcode]" has a null value in JSON.'); + assert(json.containsKey(r'twoPass'), 'Required key "SystemConfigFFmpegDto[twoPass]" is missing from JSON.'); + assert(json[r'twoPass'] != null, 'Required key "SystemConfigFFmpegDto[twoPass]" has a null value in JSON.'); + return true; + }()); + return SystemConfigFFmpegDto( accel: TranscodeHWAccel.fromJson(json[r'accel'])!, accelDecode: mapValueOfType(json, r'accelDecode')!, diff --git a/mobile/openapi/lib/model/system_config_f_fmpeg_realtime_dto.dart b/mobile/openapi/lib/model/system_config_f_fmpeg_realtime_dto.dart index 1a8669912e..7bab3588fa 100644 --- a/mobile/openapi/lib/model/system_config_f_fmpeg_realtime_dto.dart +++ b/mobile/openapi/lib/model/system_config_f_fmpeg_realtime_dto.dart @@ -45,6 +45,15 @@ class SystemConfigFFmpegRealtimeDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigFFmpegRealtimeDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigFFmpegRealtimeDto[enabled]" has a null value in JSON.'); + return true; + }()); + return SystemConfigFFmpegRealtimeDto( enabled: mapValueOfType(json, r'enabled')!, ); diff --git a/mobile/openapi/lib/model/system_config_faces_dto.dart b/mobile/openapi/lib/model/system_config_faces_dto.dart index f57303c310..d4d1bb5978 100644 --- a/mobile/openapi/lib/model/system_config_faces_dto.dart +++ b/mobile/openapi/lib/model/system_config_faces_dto.dart @@ -45,6 +45,15 @@ class SystemConfigFacesDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'import'), 'Required key "SystemConfigFacesDto[import]" is missing from JSON.'); + assert(json[r'import'] != null, 'Required key "SystemConfigFacesDto[import]" has a null value in JSON.'); + return true; + }()); + return SystemConfigFacesDto( import_: mapValueOfType(json, r'import')!, ); diff --git a/mobile/openapi/lib/model/system_config_generated_fullsize_image_dto.dart b/mobile/openapi/lib/model/system_config_generated_fullsize_image_dto.dart index d78f8fadd5..0011506618 100644 --- a/mobile/openapi/lib/model/system_config_generated_fullsize_image_dto.dart +++ b/mobile/openapi/lib/model/system_config_generated_fullsize_image_dto.dart @@ -15,7 +15,7 @@ class SystemConfigGeneratedFullsizeImageDto { SystemConfigGeneratedFullsizeImageDto({ required this.enabled, required this.format, - this.progressive, + this.progressive = const Optional.absent(), required this.quality, }); @@ -31,7 +31,7 @@ class SystemConfigGeneratedFullsizeImageDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? progressive; + Optional progressive; /// Quality /// @@ -61,10 +61,9 @@ class SystemConfigGeneratedFullsizeImageDto { final json = {}; json[r'enabled'] = this.enabled; json[r'format'] = this.format; - if (this.progressive != null) { - json[r'progressive'] = this.progressive; - } else { - // json[r'progressive'] = null; + if (this.progressive.isPresent) { + final value = this.progressive.value; + json[r'progressive'] = value; } json[r'quality'] = this.quality; return json; @@ -78,10 +77,23 @@ class SystemConfigGeneratedFullsizeImageDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigGeneratedFullsizeImageDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigGeneratedFullsizeImageDto[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'format'), 'Required key "SystemConfigGeneratedFullsizeImageDto[format]" is missing from JSON.'); + assert(json[r'format'] != null, 'Required key "SystemConfigGeneratedFullsizeImageDto[format]" has a null value in JSON.'); + assert(json.containsKey(r'quality'), 'Required key "SystemConfigGeneratedFullsizeImageDto[quality]" is missing from JSON.'); + assert(json[r'quality'] != null, 'Required key "SystemConfigGeneratedFullsizeImageDto[quality]" has a null value in JSON.'); + return true; + }()); + return SystemConfigGeneratedFullsizeImageDto( enabled: mapValueOfType(json, r'enabled')!, format: ImageFormat.fromJson(json[r'format'])!, - progressive: mapValueOfType(json, r'progressive'), + progressive: json.containsKey(r'progressive') ? Optional.present(mapValueOfType(json, r'progressive')) : const Optional.absent(), quality: mapValueOfType(json, r'quality')!, ); } diff --git a/mobile/openapi/lib/model/system_config_generated_image_dto.dart b/mobile/openapi/lib/model/system_config_generated_image_dto.dart index 2571c0cab0..67d3630fc6 100644 --- a/mobile/openapi/lib/model/system_config_generated_image_dto.dart +++ b/mobile/openapi/lib/model/system_config_generated_image_dto.dart @@ -14,7 +14,7 @@ class SystemConfigGeneratedImageDto { /// Returns a new [SystemConfigGeneratedImageDto] instance. SystemConfigGeneratedImageDto({ required this.format, - this.progressive, + this.progressive = const Optional.absent(), required this.quality, required this.size, }); @@ -28,7 +28,7 @@ class SystemConfigGeneratedImageDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? progressive; + Optional progressive; /// Quality /// @@ -63,10 +63,9 @@ class SystemConfigGeneratedImageDto { Map toJson() { final json = {}; json[r'format'] = this.format; - if (this.progressive != null) { - json[r'progressive'] = this.progressive; - } else { - // json[r'progressive'] = null; + if (this.progressive.isPresent) { + final value = this.progressive.value; + json[r'progressive'] = value; } json[r'quality'] = this.quality; json[r'size'] = this.size; @@ -81,9 +80,22 @@ class SystemConfigGeneratedImageDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'format'), 'Required key "SystemConfigGeneratedImageDto[format]" is missing from JSON.'); + assert(json[r'format'] != null, 'Required key "SystemConfigGeneratedImageDto[format]" has a null value in JSON.'); + assert(json.containsKey(r'quality'), 'Required key "SystemConfigGeneratedImageDto[quality]" is missing from JSON.'); + assert(json[r'quality'] != null, 'Required key "SystemConfigGeneratedImageDto[quality]" has a null value in JSON.'); + assert(json.containsKey(r'size'), 'Required key "SystemConfigGeneratedImageDto[size]" is missing from JSON.'); + assert(json[r'size'] != null, 'Required key "SystemConfigGeneratedImageDto[size]" has a null value in JSON.'); + return true; + }()); + return SystemConfigGeneratedImageDto( format: ImageFormat.fromJson(json[r'format'])!, - progressive: mapValueOfType(json, r'progressive'), + progressive: json.containsKey(r'progressive') ? Optional.present(mapValueOfType(json, r'progressive')) : const Optional.absent(), quality: mapValueOfType(json, r'quality')!, size: mapValueOfType(json, r'size')!, ); diff --git a/mobile/openapi/lib/model/system_config_image_dto.dart b/mobile/openapi/lib/model/system_config_image_dto.dart index 668b740872..3384745186 100644 --- a/mobile/openapi/lib/model/system_config_image_dto.dart +++ b/mobile/openapi/lib/model/system_config_image_dto.dart @@ -69,6 +69,23 @@ class SystemConfigImageDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'colorspace'), 'Required key "SystemConfigImageDto[colorspace]" is missing from JSON.'); + assert(json[r'colorspace'] != null, 'Required key "SystemConfigImageDto[colorspace]" has a null value in JSON.'); + assert(json.containsKey(r'extractEmbedded'), 'Required key "SystemConfigImageDto[extractEmbedded]" is missing from JSON.'); + assert(json[r'extractEmbedded'] != null, 'Required key "SystemConfigImageDto[extractEmbedded]" has a null value in JSON.'); + assert(json.containsKey(r'fullsize'), 'Required key "SystemConfigImageDto[fullsize]" is missing from JSON.'); + assert(json[r'fullsize'] != null, 'Required key "SystemConfigImageDto[fullsize]" has a null value in JSON.'); + assert(json.containsKey(r'preview'), 'Required key "SystemConfigImageDto[preview]" is missing from JSON.'); + assert(json[r'preview'] != null, 'Required key "SystemConfigImageDto[preview]" has a null value in JSON.'); + assert(json.containsKey(r'thumbnail'), 'Required key "SystemConfigImageDto[thumbnail]" is missing from JSON.'); + assert(json[r'thumbnail'] != null, 'Required key "SystemConfigImageDto[thumbnail]" has a null value in JSON.'); + return true; + }()); + return SystemConfigImageDto( colorspace: Colorspace.fromJson(json[r'colorspace'])!, extractEmbedded: mapValueOfType(json, r'extractEmbedded')!, diff --git a/mobile/openapi/lib/model/system_config_job_dto.dart b/mobile/openapi/lib/model/system_config_job_dto.dart index d54db6809f..268c8a3e57 100644 --- a/mobile/openapi/lib/model/system_config_job_dto.dart +++ b/mobile/openapi/lib/model/system_config_job_dto.dart @@ -122,6 +122,41 @@ class SystemConfigJobDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'backgroundTask'), 'Required key "SystemConfigJobDto[backgroundTask]" is missing from JSON.'); + assert(json[r'backgroundTask'] != null, 'Required key "SystemConfigJobDto[backgroundTask]" has a null value in JSON.'); + assert(json.containsKey(r'editor'), 'Required key "SystemConfigJobDto[editor]" is missing from JSON.'); + assert(json[r'editor'] != null, 'Required key "SystemConfigJobDto[editor]" has a null value in JSON.'); + assert(json.containsKey(r'faceDetection'), 'Required key "SystemConfigJobDto[faceDetection]" is missing from JSON.'); + assert(json[r'faceDetection'] != null, 'Required key "SystemConfigJobDto[faceDetection]" has a null value in JSON.'); + assert(json.containsKey(r'library'), 'Required key "SystemConfigJobDto[library]" is missing from JSON.'); + assert(json[r'library'] != null, 'Required key "SystemConfigJobDto[library]" has a null value in JSON.'); + assert(json.containsKey(r'metadataExtraction'), 'Required key "SystemConfigJobDto[metadataExtraction]" is missing from JSON.'); + assert(json[r'metadataExtraction'] != null, 'Required key "SystemConfigJobDto[metadataExtraction]" has a null value in JSON.'); + assert(json.containsKey(r'migration'), 'Required key "SystemConfigJobDto[migration]" is missing from JSON.'); + assert(json[r'migration'] != null, 'Required key "SystemConfigJobDto[migration]" has a null value in JSON.'); + assert(json.containsKey(r'notifications'), 'Required key "SystemConfigJobDto[notifications]" is missing from JSON.'); + assert(json[r'notifications'] != null, 'Required key "SystemConfigJobDto[notifications]" has a null value in JSON.'); + assert(json.containsKey(r'ocr'), 'Required key "SystemConfigJobDto[ocr]" is missing from JSON.'); + assert(json[r'ocr'] != null, 'Required key "SystemConfigJobDto[ocr]" has a null value in JSON.'); + assert(json.containsKey(r'search'), 'Required key "SystemConfigJobDto[search]" is missing from JSON.'); + assert(json[r'search'] != null, 'Required key "SystemConfigJobDto[search]" has a null value in JSON.'); + assert(json.containsKey(r'sidecar'), 'Required key "SystemConfigJobDto[sidecar]" is missing from JSON.'); + assert(json[r'sidecar'] != null, 'Required key "SystemConfigJobDto[sidecar]" has a null value in JSON.'); + assert(json.containsKey(r'smartSearch'), 'Required key "SystemConfigJobDto[smartSearch]" is missing from JSON.'); + assert(json[r'smartSearch'] != null, 'Required key "SystemConfigJobDto[smartSearch]" has a null value in JSON.'); + assert(json.containsKey(r'thumbnailGeneration'), 'Required key "SystemConfigJobDto[thumbnailGeneration]" is missing from JSON.'); + assert(json[r'thumbnailGeneration'] != null, 'Required key "SystemConfigJobDto[thumbnailGeneration]" has a null value in JSON.'); + assert(json.containsKey(r'videoConversion'), 'Required key "SystemConfigJobDto[videoConversion]" is missing from JSON.'); + assert(json[r'videoConversion'] != null, 'Required key "SystemConfigJobDto[videoConversion]" has a null value in JSON.'); + assert(json.containsKey(r'workflow'), 'Required key "SystemConfigJobDto[workflow]" is missing from JSON.'); + assert(json[r'workflow'] != null, 'Required key "SystemConfigJobDto[workflow]" has a null value in JSON.'); + return true; + }()); + return SystemConfigJobDto( backgroundTask: JobSettingsDto.fromJson(json[r'backgroundTask'])!, editor: JobSettingsDto.fromJson(json[r'editor'])!, diff --git a/mobile/openapi/lib/model/system_config_library_dto.dart b/mobile/openapi/lib/model/system_config_library_dto.dart index e728b0bf20..b3b22447ca 100644 --- a/mobile/openapi/lib/model/system_config_library_dto.dart +++ b/mobile/openapi/lib/model/system_config_library_dto.dart @@ -50,6 +50,17 @@ class SystemConfigLibraryDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'scan'), 'Required key "SystemConfigLibraryDto[scan]" is missing from JSON.'); + assert(json[r'scan'] != null, 'Required key "SystemConfigLibraryDto[scan]" has a null value in JSON.'); + assert(json.containsKey(r'watch'), 'Required key "SystemConfigLibraryDto[watch]" is missing from JSON.'); + assert(json[r'watch'] != null, 'Required key "SystemConfigLibraryDto[watch]" has a null value in JSON.'); + return true; + }()); + return SystemConfigLibraryDto( scan: SystemConfigLibraryScanDto.fromJson(json[r'scan'])!, watch: SystemConfigLibraryWatchDto.fromJson(json[r'watch'])!, diff --git a/mobile/openapi/lib/model/system_config_library_scan_dto.dart b/mobile/openapi/lib/model/system_config_library_scan_dto.dart index 003000d2ec..f544d995f0 100644 --- a/mobile/openapi/lib/model/system_config_library_scan_dto.dart +++ b/mobile/openapi/lib/model/system_config_library_scan_dto.dart @@ -52,6 +52,17 @@ class SystemConfigLibraryScanDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'cronExpression'), 'Required key "SystemConfigLibraryScanDto[cronExpression]" is missing from JSON.'); + assert(json[r'cronExpression'] != null, 'Required key "SystemConfigLibraryScanDto[cronExpression]" has a null value in JSON.'); + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigLibraryScanDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigLibraryScanDto[enabled]" has a null value in JSON.'); + return true; + }()); + return SystemConfigLibraryScanDto( cronExpression: mapValueOfType(json, r'cronExpression')!, enabled: mapValueOfType(json, r'enabled')!, diff --git a/mobile/openapi/lib/model/system_config_library_watch_dto.dart b/mobile/openapi/lib/model/system_config_library_watch_dto.dart index b4f171bd25..aead455ad7 100644 --- a/mobile/openapi/lib/model/system_config_library_watch_dto.dart +++ b/mobile/openapi/lib/model/system_config_library_watch_dto.dart @@ -45,6 +45,15 @@ class SystemConfigLibraryWatchDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigLibraryWatchDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigLibraryWatchDto[enabled]" has a null value in JSON.'); + return true; + }()); + return SystemConfigLibraryWatchDto( enabled: mapValueOfType(json, r'enabled')!, ); diff --git a/mobile/openapi/lib/model/system_config_logging_dto.dart b/mobile/openapi/lib/model/system_config_logging_dto.dart index 54278893db..10e6c4ea2d 100644 --- a/mobile/openapi/lib/model/system_config_logging_dto.dart +++ b/mobile/openapi/lib/model/system_config_logging_dto.dart @@ -51,6 +51,17 @@ class SystemConfigLoggingDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigLoggingDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigLoggingDto[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'level'), 'Required key "SystemConfigLoggingDto[level]" is missing from JSON.'); + assert(json[r'level'] != null, 'Required key "SystemConfigLoggingDto[level]" has a null value in JSON.'); + return true; + }()); + return SystemConfigLoggingDto( enabled: mapValueOfType(json, r'enabled')!, level: LogLevel.fromJson(json[r'level'])!, diff --git a/mobile/openapi/lib/model/system_config_machine_learning_dto.dart b/mobile/openapi/lib/model/system_config_machine_learning_dto.dart index 6162e72b8f..4e9ea9bc7c 100644 --- a/mobile/openapi/lib/model/system_config_machine_learning_dto.dart +++ b/mobile/openapi/lib/model/system_config_machine_learning_dto.dart @@ -82,6 +82,27 @@ class SystemConfigMachineLearningDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'availabilityChecks'), 'Required key "SystemConfigMachineLearningDto[availabilityChecks]" is missing from JSON.'); + assert(json[r'availabilityChecks'] != null, 'Required key "SystemConfigMachineLearningDto[availabilityChecks]" has a null value in JSON.'); + assert(json.containsKey(r'clip'), 'Required key "SystemConfigMachineLearningDto[clip]" is missing from JSON.'); + assert(json[r'clip'] != null, 'Required key "SystemConfigMachineLearningDto[clip]" has a null value in JSON.'); + assert(json.containsKey(r'duplicateDetection'), 'Required key "SystemConfigMachineLearningDto[duplicateDetection]" is missing from JSON.'); + assert(json[r'duplicateDetection'] != null, 'Required key "SystemConfigMachineLearningDto[duplicateDetection]" has a null value in JSON.'); + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigMachineLearningDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigMachineLearningDto[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'facialRecognition'), 'Required key "SystemConfigMachineLearningDto[facialRecognition]" is missing from JSON.'); + assert(json[r'facialRecognition'] != null, 'Required key "SystemConfigMachineLearningDto[facialRecognition]" has a null value in JSON.'); + assert(json.containsKey(r'ocr'), 'Required key "SystemConfigMachineLearningDto[ocr]" is missing from JSON.'); + assert(json[r'ocr'] != null, 'Required key "SystemConfigMachineLearningDto[ocr]" has a null value in JSON.'); + assert(json.containsKey(r'urls'), 'Required key "SystemConfigMachineLearningDto[urls]" is missing from JSON.'); + assert(json[r'urls'] != null, 'Required key "SystemConfigMachineLearningDto[urls]" has a null value in JSON.'); + return true; + }()); + return SystemConfigMachineLearningDto( availabilityChecks: MachineLearningAvailabilityChecksDto.fromJson(json[r'availabilityChecks'])!, clip: CLIPConfig.fromJson(json[r'clip'])!, diff --git a/mobile/openapi/lib/model/system_config_map_dto.dart b/mobile/openapi/lib/model/system_config_map_dto.dart index 7a2fbb516b..14621356a2 100644 --- a/mobile/openapi/lib/model/system_config_map_dto.dart +++ b/mobile/openapi/lib/model/system_config_map_dto.dart @@ -59,6 +59,19 @@ class SystemConfigMapDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'darkStyle'), 'Required key "SystemConfigMapDto[darkStyle]" is missing from JSON.'); + assert(json[r'darkStyle'] != null, 'Required key "SystemConfigMapDto[darkStyle]" has a null value in JSON.'); + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigMapDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigMapDto[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'lightStyle'), 'Required key "SystemConfigMapDto[lightStyle]" is missing from JSON.'); + assert(json[r'lightStyle'] != null, 'Required key "SystemConfigMapDto[lightStyle]" has a null value in JSON.'); + return true; + }()); + return SystemConfigMapDto( darkStyle: mapValueOfType(json, r'darkStyle')!, enabled: mapValueOfType(json, r'enabled')!, diff --git a/mobile/openapi/lib/model/system_config_metadata_dto.dart b/mobile/openapi/lib/model/system_config_metadata_dto.dart index 3c32fc551d..6c69700782 100644 --- a/mobile/openapi/lib/model/system_config_metadata_dto.dart +++ b/mobile/openapi/lib/model/system_config_metadata_dto.dart @@ -44,6 +44,15 @@ class SystemConfigMetadataDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'faces'), 'Required key "SystemConfigMetadataDto[faces]" is missing from JSON.'); + assert(json[r'faces'] != null, 'Required key "SystemConfigMetadataDto[faces]" has a null value in JSON.'); + return true; + }()); + return SystemConfigMetadataDto( faces: SystemConfigFacesDto.fromJson(json[r'faces'])!, ); diff --git a/mobile/openapi/lib/model/system_config_new_version_check_dto.dart b/mobile/openapi/lib/model/system_config_new_version_check_dto.dart index 17ae9577e8..80deddca40 100644 --- a/mobile/openapi/lib/model/system_config_new_version_check_dto.dart +++ b/mobile/openapi/lib/model/system_config_new_version_check_dto.dart @@ -51,6 +51,17 @@ class SystemConfigNewVersionCheckDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'channel'), 'Required key "SystemConfigNewVersionCheckDto[channel]" is missing from JSON.'); + assert(json[r'channel'] != null, 'Required key "SystemConfigNewVersionCheckDto[channel]" has a null value in JSON.'); + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigNewVersionCheckDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigNewVersionCheckDto[enabled]" has a null value in JSON.'); + return true; + }()); + return SystemConfigNewVersionCheckDto( channel: ReleaseChannel.fromJson(json[r'channel'])!, enabled: mapValueOfType(json, r'enabled')!, diff --git a/mobile/openapi/lib/model/system_config_nightly_tasks_dto.dart b/mobile/openapi/lib/model/system_config_nightly_tasks_dto.dart index 0db417427f..cbe12e14a3 100644 --- a/mobile/openapi/lib/model/system_config_nightly_tasks_dto.dart +++ b/mobile/openapi/lib/model/system_config_nightly_tasks_dto.dart @@ -80,6 +80,25 @@ class SystemConfigNightlyTasksDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'clusterNewFaces'), 'Required key "SystemConfigNightlyTasksDto[clusterNewFaces]" is missing from JSON.'); + assert(json[r'clusterNewFaces'] != null, 'Required key "SystemConfigNightlyTasksDto[clusterNewFaces]" has a null value in JSON.'); + assert(json.containsKey(r'databaseCleanup'), 'Required key "SystemConfigNightlyTasksDto[databaseCleanup]" is missing from JSON.'); + assert(json[r'databaseCleanup'] != null, 'Required key "SystemConfigNightlyTasksDto[databaseCleanup]" has a null value in JSON.'); + assert(json.containsKey(r'generateMemories'), 'Required key "SystemConfigNightlyTasksDto[generateMemories]" is missing from JSON.'); + assert(json[r'generateMemories'] != null, 'Required key "SystemConfigNightlyTasksDto[generateMemories]" has a null value in JSON.'); + assert(json.containsKey(r'missingThumbnails'), 'Required key "SystemConfigNightlyTasksDto[missingThumbnails]" is missing from JSON.'); + assert(json[r'missingThumbnails'] != null, 'Required key "SystemConfigNightlyTasksDto[missingThumbnails]" has a null value in JSON.'); + assert(json.containsKey(r'startTime'), 'Required key "SystemConfigNightlyTasksDto[startTime]" is missing from JSON.'); + assert(json[r'startTime'] != null, 'Required key "SystemConfigNightlyTasksDto[startTime]" has a null value in JSON.'); + assert(json.containsKey(r'syncQuotaUsage'), 'Required key "SystemConfigNightlyTasksDto[syncQuotaUsage]" is missing from JSON.'); + assert(json[r'syncQuotaUsage'] != null, 'Required key "SystemConfigNightlyTasksDto[syncQuotaUsage]" has a null value in JSON.'); + return true; + }()); + return SystemConfigNightlyTasksDto( clusterNewFaces: mapValueOfType(json, r'clusterNewFaces')!, databaseCleanup: mapValueOfType(json, r'databaseCleanup')!, diff --git a/mobile/openapi/lib/model/system_config_notifications_dto.dart b/mobile/openapi/lib/model/system_config_notifications_dto.dart index 35d3d31833..86560e81ea 100644 --- a/mobile/openapi/lib/model/system_config_notifications_dto.dart +++ b/mobile/openapi/lib/model/system_config_notifications_dto.dart @@ -44,6 +44,15 @@ class SystemConfigNotificationsDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'smtp'), 'Required key "SystemConfigNotificationsDto[smtp]" is missing from JSON.'); + assert(json[r'smtp'] != null, 'Required key "SystemConfigNotificationsDto[smtp]" has a null value in JSON.'); + return true; + }()); + return SystemConfigNotificationsDto( smtp: SystemConfigSmtpDto.fromJson(json[r'smtp'])!, ); diff --git a/mobile/openapi/lib/model/system_config_o_auth_dto.dart b/mobile/openapi/lib/model/system_config_o_auth_dto.dart index c65de03391..37c87e84c1 100644 --- a/mobile/openapi/lib/model/system_config_o_auth_dto.dart +++ b/mobile/openapi/lib/model/system_config_o_auth_dto.dart @@ -167,7 +167,7 @@ class SystemConfigOAuthDto { if (this.defaultStorageQuota != null) { json[r'defaultStorageQuota'] = this.defaultStorageQuota; } else { - // json[r'defaultStorageQuota'] = null; + json[r'defaultStorageQuota'] = null; } json[r'enabled'] = this.enabled; json[r'endSessionEndpoint'] = this.endSessionEndpoint; @@ -194,6 +194,54 @@ class SystemConfigOAuthDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'allowInsecureRequests'), 'Required key "SystemConfigOAuthDto[allowInsecureRequests]" is missing from JSON.'); + assert(json[r'allowInsecureRequests'] != null, 'Required key "SystemConfigOAuthDto[allowInsecureRequests]" has a null value in JSON.'); + assert(json.containsKey(r'autoLaunch'), 'Required key "SystemConfigOAuthDto[autoLaunch]" is missing from JSON.'); + assert(json[r'autoLaunch'] != null, 'Required key "SystemConfigOAuthDto[autoLaunch]" has a null value in JSON.'); + assert(json.containsKey(r'autoRegister'), 'Required key "SystemConfigOAuthDto[autoRegister]" is missing from JSON.'); + assert(json[r'autoRegister'] != null, 'Required key "SystemConfigOAuthDto[autoRegister]" has a null value in JSON.'); + assert(json.containsKey(r'buttonText'), 'Required key "SystemConfigOAuthDto[buttonText]" is missing from JSON.'); + assert(json[r'buttonText'] != null, 'Required key "SystemConfigOAuthDto[buttonText]" has a null value in JSON.'); + assert(json.containsKey(r'clientId'), 'Required key "SystemConfigOAuthDto[clientId]" is missing from JSON.'); + assert(json[r'clientId'] != null, 'Required key "SystemConfigOAuthDto[clientId]" has a null value in JSON.'); + assert(json.containsKey(r'clientSecret'), 'Required key "SystemConfigOAuthDto[clientSecret]" is missing from JSON.'); + assert(json[r'clientSecret'] != null, 'Required key "SystemConfigOAuthDto[clientSecret]" has a null value in JSON.'); + assert(json.containsKey(r'defaultStorageQuota'), 'Required key "SystemConfigOAuthDto[defaultStorageQuota]" is missing from JSON.'); + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigOAuthDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigOAuthDto[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'endSessionEndpoint'), 'Required key "SystemConfigOAuthDto[endSessionEndpoint]" is missing from JSON.'); + assert(json[r'endSessionEndpoint'] != null, 'Required key "SystemConfigOAuthDto[endSessionEndpoint]" has a null value in JSON.'); + assert(json.containsKey(r'issuerUrl'), 'Required key "SystemConfigOAuthDto[issuerUrl]" is missing from JSON.'); + assert(json[r'issuerUrl'] != null, 'Required key "SystemConfigOAuthDto[issuerUrl]" has a null value in JSON.'); + assert(json.containsKey(r'mobileOverrideEnabled'), 'Required key "SystemConfigOAuthDto[mobileOverrideEnabled]" is missing from JSON.'); + assert(json[r'mobileOverrideEnabled'] != null, 'Required key "SystemConfigOAuthDto[mobileOverrideEnabled]" has a null value in JSON.'); + assert(json.containsKey(r'mobileRedirectUri'), 'Required key "SystemConfigOAuthDto[mobileRedirectUri]" is missing from JSON.'); + assert(json[r'mobileRedirectUri'] != null, 'Required key "SystemConfigOAuthDto[mobileRedirectUri]" has a null value in JSON.'); + assert(json.containsKey(r'profileSigningAlgorithm'), 'Required key "SystemConfigOAuthDto[profileSigningAlgorithm]" is missing from JSON.'); + assert(json[r'profileSigningAlgorithm'] != null, 'Required key "SystemConfigOAuthDto[profileSigningAlgorithm]" has a null value in JSON.'); + assert(json.containsKey(r'prompt'), 'Required key "SystemConfigOAuthDto[prompt]" is missing from JSON.'); + assert(json[r'prompt'] != null, 'Required key "SystemConfigOAuthDto[prompt]" has a null value in JSON.'); + assert(json.containsKey(r'roleClaim'), 'Required key "SystemConfigOAuthDto[roleClaim]" is missing from JSON.'); + assert(json[r'roleClaim'] != null, 'Required key "SystemConfigOAuthDto[roleClaim]" has a null value in JSON.'); + assert(json.containsKey(r'scope'), 'Required key "SystemConfigOAuthDto[scope]" is missing from JSON.'); + assert(json[r'scope'] != null, 'Required key "SystemConfigOAuthDto[scope]" has a null value in JSON.'); + assert(json.containsKey(r'signingAlgorithm'), 'Required key "SystemConfigOAuthDto[signingAlgorithm]" is missing from JSON.'); + assert(json[r'signingAlgorithm'] != null, 'Required key "SystemConfigOAuthDto[signingAlgorithm]" has a null value in JSON.'); + assert(json.containsKey(r'storageLabelClaim'), 'Required key "SystemConfigOAuthDto[storageLabelClaim]" is missing from JSON.'); + assert(json[r'storageLabelClaim'] != null, 'Required key "SystemConfigOAuthDto[storageLabelClaim]" has a null value in JSON.'); + assert(json.containsKey(r'storageQuotaClaim'), 'Required key "SystemConfigOAuthDto[storageQuotaClaim]" is missing from JSON.'); + assert(json[r'storageQuotaClaim'] != null, 'Required key "SystemConfigOAuthDto[storageQuotaClaim]" has a null value in JSON.'); + assert(json.containsKey(r'timeout'), 'Required key "SystemConfigOAuthDto[timeout]" is missing from JSON.'); + assert(json[r'timeout'] != null, 'Required key "SystemConfigOAuthDto[timeout]" has a null value in JSON.'); + assert(json.containsKey(r'tokenEndpointAuthMethod'), 'Required key "SystemConfigOAuthDto[tokenEndpointAuthMethod]" is missing from JSON.'); + assert(json[r'tokenEndpointAuthMethod'] != null, 'Required key "SystemConfigOAuthDto[tokenEndpointAuthMethod]" has a null value in JSON.'); + return true; + }()); + return SystemConfigOAuthDto( allowInsecureRequests: mapValueOfType(json, r'allowInsecureRequests')!, autoLaunch: mapValueOfType(json, r'autoLaunch')!, diff --git a/mobile/openapi/lib/model/system_config_password_login_dto.dart b/mobile/openapi/lib/model/system_config_password_login_dto.dart index 1328a6acaa..8a0ff150b5 100644 --- a/mobile/openapi/lib/model/system_config_password_login_dto.dart +++ b/mobile/openapi/lib/model/system_config_password_login_dto.dart @@ -45,6 +45,15 @@ class SystemConfigPasswordLoginDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigPasswordLoginDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigPasswordLoginDto[enabled]" has a null value in JSON.'); + return true; + }()); + return SystemConfigPasswordLoginDto( enabled: mapValueOfType(json, r'enabled')!, ); diff --git a/mobile/openapi/lib/model/system_config_reverse_geocoding_dto.dart b/mobile/openapi/lib/model/system_config_reverse_geocoding_dto.dart index 0374e19be1..794f515677 100644 --- a/mobile/openapi/lib/model/system_config_reverse_geocoding_dto.dart +++ b/mobile/openapi/lib/model/system_config_reverse_geocoding_dto.dart @@ -45,6 +45,15 @@ class SystemConfigReverseGeocodingDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigReverseGeocodingDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigReverseGeocodingDto[enabled]" has a null value in JSON.'); + return true; + }()); + return SystemConfigReverseGeocodingDto( enabled: mapValueOfType(json, r'enabled')!, ); diff --git a/mobile/openapi/lib/model/system_config_server_dto.dart b/mobile/openapi/lib/model/system_config_server_dto.dart index 200f75f7c6..220276eab5 100644 --- a/mobile/openapi/lib/model/system_config_server_dto.dart +++ b/mobile/openapi/lib/model/system_config_server_dto.dart @@ -59,6 +59,19 @@ class SystemConfigServerDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'externalDomain'), 'Required key "SystemConfigServerDto[externalDomain]" is missing from JSON.'); + assert(json[r'externalDomain'] != null, 'Required key "SystemConfigServerDto[externalDomain]" has a null value in JSON.'); + assert(json.containsKey(r'loginPageMessage'), 'Required key "SystemConfigServerDto[loginPageMessage]" is missing from JSON.'); + assert(json[r'loginPageMessage'] != null, 'Required key "SystemConfigServerDto[loginPageMessage]" has a null value in JSON.'); + assert(json.containsKey(r'publicUsers'), 'Required key "SystemConfigServerDto[publicUsers]" is missing from JSON.'); + assert(json[r'publicUsers'] != null, 'Required key "SystemConfigServerDto[publicUsers]" has a null value in JSON.'); + return true; + }()); + return SystemConfigServerDto( externalDomain: mapValueOfType(json, r'externalDomain')!, loginPageMessage: mapValueOfType(json, r'loginPageMessage')!, diff --git a/mobile/openapi/lib/model/system_config_smtp_dto.dart b/mobile/openapi/lib/model/system_config_smtp_dto.dart index a3d14cda63..a86b2ea268 100644 --- a/mobile/openapi/lib/model/system_config_smtp_dto.dart +++ b/mobile/openapi/lib/model/system_config_smtp_dto.dart @@ -65,6 +65,21 @@ class SystemConfigSmtpDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigSmtpDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigSmtpDto[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'from'), 'Required key "SystemConfigSmtpDto[from]" is missing from JSON.'); + assert(json[r'from'] != null, 'Required key "SystemConfigSmtpDto[from]" has a null value in JSON.'); + assert(json.containsKey(r'replyTo'), 'Required key "SystemConfigSmtpDto[replyTo]" is missing from JSON.'); + assert(json[r'replyTo'] != null, 'Required key "SystemConfigSmtpDto[replyTo]" has a null value in JSON.'); + assert(json.containsKey(r'transport'), 'Required key "SystemConfigSmtpDto[transport]" is missing from JSON.'); + assert(json[r'transport'] != null, 'Required key "SystemConfigSmtpDto[transport]" has a null value in JSON.'); + return true; + }()); + return SystemConfigSmtpDto( enabled: mapValueOfType(json, r'enabled')!, from: mapValueOfType(json, r'from')!, diff --git a/mobile/openapi/lib/model/system_config_smtp_transport_dto.dart b/mobile/openapi/lib/model/system_config_smtp_transport_dto.dart index 266e3f3c86..5d31b642b5 100644 --- a/mobile/openapi/lib/model/system_config_smtp_transport_dto.dart +++ b/mobile/openapi/lib/model/system_config_smtp_transport_dto.dart @@ -83,6 +83,25 @@ class SystemConfigSmtpTransportDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'host'), 'Required key "SystemConfigSmtpTransportDto[host]" is missing from JSON.'); + assert(json[r'host'] != null, 'Required key "SystemConfigSmtpTransportDto[host]" has a null value in JSON.'); + assert(json.containsKey(r'ignoreCert'), 'Required key "SystemConfigSmtpTransportDto[ignoreCert]" is missing from JSON.'); + assert(json[r'ignoreCert'] != null, 'Required key "SystemConfigSmtpTransportDto[ignoreCert]" has a null value in JSON.'); + assert(json.containsKey(r'password'), 'Required key "SystemConfigSmtpTransportDto[password]" is missing from JSON.'); + assert(json[r'password'] != null, 'Required key "SystemConfigSmtpTransportDto[password]" has a null value in JSON.'); + assert(json.containsKey(r'port'), 'Required key "SystemConfigSmtpTransportDto[port]" is missing from JSON.'); + assert(json[r'port'] != null, 'Required key "SystemConfigSmtpTransportDto[port]" has a null value in JSON.'); + assert(json.containsKey(r'secure'), 'Required key "SystemConfigSmtpTransportDto[secure]" is missing from JSON.'); + assert(json[r'secure'] != null, 'Required key "SystemConfigSmtpTransportDto[secure]" has a null value in JSON.'); + assert(json.containsKey(r'username'), 'Required key "SystemConfigSmtpTransportDto[username]" is missing from JSON.'); + assert(json[r'username'] != null, 'Required key "SystemConfigSmtpTransportDto[username]" has a null value in JSON.'); + return true; + }()); + return SystemConfigSmtpTransportDto( host: mapValueOfType(json, r'host')!, ignoreCert: mapValueOfType(json, r'ignoreCert')!, diff --git a/mobile/openapi/lib/model/system_config_storage_template_dto.dart b/mobile/openapi/lib/model/system_config_storage_template_dto.dart index f9f37e48ad..af04abab6e 100644 --- a/mobile/openapi/lib/model/system_config_storage_template_dto.dart +++ b/mobile/openapi/lib/model/system_config_storage_template_dto.dart @@ -59,6 +59,19 @@ class SystemConfigStorageTemplateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigStorageTemplateDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigStorageTemplateDto[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'hashVerificationEnabled'), 'Required key "SystemConfigStorageTemplateDto[hashVerificationEnabled]" is missing from JSON.'); + assert(json[r'hashVerificationEnabled'] != null, 'Required key "SystemConfigStorageTemplateDto[hashVerificationEnabled]" has a null value in JSON.'); + assert(json.containsKey(r'template'), 'Required key "SystemConfigStorageTemplateDto[template]" is missing from JSON.'); + assert(json[r'template'] != null, 'Required key "SystemConfigStorageTemplateDto[template]" has a null value in JSON.'); + return true; + }()); + return SystemConfigStorageTemplateDto( enabled: mapValueOfType(json, r'enabled')!, hashVerificationEnabled: mapValueOfType(json, r'hashVerificationEnabled')!, diff --git a/mobile/openapi/lib/model/system_config_template_emails_dto.dart b/mobile/openapi/lib/model/system_config_template_emails_dto.dart index d29ca1fac3..421aeba578 100644 --- a/mobile/openapi/lib/model/system_config_template_emails_dto.dart +++ b/mobile/openapi/lib/model/system_config_template_emails_dto.dart @@ -59,6 +59,19 @@ class SystemConfigTemplateEmailsDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albumInviteTemplate'), 'Required key "SystemConfigTemplateEmailsDto[albumInviteTemplate]" is missing from JSON.'); + assert(json[r'albumInviteTemplate'] != null, 'Required key "SystemConfigTemplateEmailsDto[albumInviteTemplate]" has a null value in JSON.'); + assert(json.containsKey(r'albumUpdateTemplate'), 'Required key "SystemConfigTemplateEmailsDto[albumUpdateTemplate]" is missing from JSON.'); + assert(json[r'albumUpdateTemplate'] != null, 'Required key "SystemConfigTemplateEmailsDto[albumUpdateTemplate]" has a null value in JSON.'); + assert(json.containsKey(r'welcomeTemplate'), 'Required key "SystemConfigTemplateEmailsDto[welcomeTemplate]" is missing from JSON.'); + assert(json[r'welcomeTemplate'] != null, 'Required key "SystemConfigTemplateEmailsDto[welcomeTemplate]" has a null value in JSON.'); + return true; + }()); + return SystemConfigTemplateEmailsDto( albumInviteTemplate: mapValueOfType(json, r'albumInviteTemplate')!, albumUpdateTemplate: mapValueOfType(json, r'albumUpdateTemplate')!, diff --git a/mobile/openapi/lib/model/system_config_template_storage_option_dto.dart b/mobile/openapi/lib/model/system_config_template_storage_option_dto.dart index 6f81513039..c251ececdc 100644 --- a/mobile/openapi/lib/model/system_config_template_storage_option_dto.dart +++ b/mobile/openapi/lib/model/system_config_template_storage_option_dto.dart @@ -94,6 +94,29 @@ class SystemConfigTemplateStorageOptionDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'dayOptions'), 'Required key "SystemConfigTemplateStorageOptionDto[dayOptions]" is missing from JSON.'); + assert(json[r'dayOptions'] != null, 'Required key "SystemConfigTemplateStorageOptionDto[dayOptions]" has a null value in JSON.'); + assert(json.containsKey(r'hourOptions'), 'Required key "SystemConfigTemplateStorageOptionDto[hourOptions]" is missing from JSON.'); + assert(json[r'hourOptions'] != null, 'Required key "SystemConfigTemplateStorageOptionDto[hourOptions]" has a null value in JSON.'); + assert(json.containsKey(r'minuteOptions'), 'Required key "SystemConfigTemplateStorageOptionDto[minuteOptions]" is missing from JSON.'); + assert(json[r'minuteOptions'] != null, 'Required key "SystemConfigTemplateStorageOptionDto[minuteOptions]" has a null value in JSON.'); + assert(json.containsKey(r'monthOptions'), 'Required key "SystemConfigTemplateStorageOptionDto[monthOptions]" is missing from JSON.'); + assert(json[r'monthOptions'] != null, 'Required key "SystemConfigTemplateStorageOptionDto[monthOptions]" has a null value in JSON.'); + assert(json.containsKey(r'presetOptions'), 'Required key "SystemConfigTemplateStorageOptionDto[presetOptions]" is missing from JSON.'); + assert(json[r'presetOptions'] != null, 'Required key "SystemConfigTemplateStorageOptionDto[presetOptions]" has a null value in JSON.'); + assert(json.containsKey(r'secondOptions'), 'Required key "SystemConfigTemplateStorageOptionDto[secondOptions]" is missing from JSON.'); + assert(json[r'secondOptions'] != null, 'Required key "SystemConfigTemplateStorageOptionDto[secondOptions]" has a null value in JSON.'); + assert(json.containsKey(r'weekOptions'), 'Required key "SystemConfigTemplateStorageOptionDto[weekOptions]" is missing from JSON.'); + assert(json[r'weekOptions'] != null, 'Required key "SystemConfigTemplateStorageOptionDto[weekOptions]" has a null value in JSON.'); + assert(json.containsKey(r'yearOptions'), 'Required key "SystemConfigTemplateStorageOptionDto[yearOptions]" is missing from JSON.'); + assert(json[r'yearOptions'] != null, 'Required key "SystemConfigTemplateStorageOptionDto[yearOptions]" has a null value in JSON.'); + return true; + }()); + return SystemConfigTemplateStorageOptionDto( dayOptions: json[r'dayOptions'] is Iterable ? (json[r'dayOptions'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/system_config_templates_dto.dart b/mobile/openapi/lib/model/system_config_templates_dto.dart index a5e8834978..259497d510 100644 --- a/mobile/openapi/lib/model/system_config_templates_dto.dart +++ b/mobile/openapi/lib/model/system_config_templates_dto.dart @@ -44,6 +44,15 @@ class SystemConfigTemplatesDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'email'), 'Required key "SystemConfigTemplatesDto[email]" is missing from JSON.'); + assert(json[r'email'] != null, 'Required key "SystemConfigTemplatesDto[email]" has a null value in JSON.'); + return true; + }()); + return SystemConfigTemplatesDto( email: SystemConfigTemplateEmailsDto.fromJson(json[r'email'])!, ); diff --git a/mobile/openapi/lib/model/system_config_theme_dto.dart b/mobile/openapi/lib/model/system_config_theme_dto.dart index fca38f71fb..866cc858bb 100644 --- a/mobile/openapi/lib/model/system_config_theme_dto.dart +++ b/mobile/openapi/lib/model/system_config_theme_dto.dart @@ -45,6 +45,15 @@ class SystemConfigThemeDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'customCss'), 'Required key "SystemConfigThemeDto[customCss]" is missing from JSON.'); + assert(json[r'customCss'] != null, 'Required key "SystemConfigThemeDto[customCss]" has a null value in JSON.'); + return true; + }()); + return SystemConfigThemeDto( customCss: mapValueOfType(json, r'customCss')!, ); diff --git a/mobile/openapi/lib/model/system_config_trash_dto.dart b/mobile/openapi/lib/model/system_config_trash_dto.dart index 790710751f..0310636360 100644 --- a/mobile/openapi/lib/model/system_config_trash_dto.dart +++ b/mobile/openapi/lib/model/system_config_trash_dto.dart @@ -55,6 +55,17 @@ class SystemConfigTrashDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'days'), 'Required key "SystemConfigTrashDto[days]" is missing from JSON.'); + assert(json[r'days'] != null, 'Required key "SystemConfigTrashDto[days]" has a null value in JSON.'); + assert(json.containsKey(r'enabled'), 'Required key "SystemConfigTrashDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "SystemConfigTrashDto[enabled]" has a null value in JSON.'); + return true; + }()); + return SystemConfigTrashDto( days: mapValueOfType(json, r'days')!, enabled: mapValueOfType(json, r'enabled')!, diff --git a/mobile/openapi/lib/model/system_config_user_dto.dart b/mobile/openapi/lib/model/system_config_user_dto.dart index dc553e7369..a6a4b50e9f 100644 --- a/mobile/openapi/lib/model/system_config_user_dto.dart +++ b/mobile/openapi/lib/model/system_config_user_dto.dart @@ -48,6 +48,15 @@ class SystemConfigUserDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'deleteDelay'), 'Required key "SystemConfigUserDto[deleteDelay]" is missing from JSON.'); + assert(json[r'deleteDelay'] != null, 'Required key "SystemConfigUserDto[deleteDelay]" has a null value in JSON.'); + return true; + }()); + return SystemConfigUserDto( deleteDelay: mapValueOfType(json, r'deleteDelay')!, ); diff --git a/mobile/openapi/lib/model/tag_bulk_assets_dto.dart b/mobile/openapi/lib/model/tag_bulk_assets_dto.dart index 16abc3bcdc..c6652b4bf2 100644 --- a/mobile/openapi/lib/model/tag_bulk_assets_dto.dart +++ b/mobile/openapi/lib/model/tag_bulk_assets_dto.dart @@ -52,6 +52,17 @@ class TagBulkAssetsDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'assetIds'), 'Required key "TagBulkAssetsDto[assetIds]" is missing from JSON.'); + assert(json[r'assetIds'] != null, 'Required key "TagBulkAssetsDto[assetIds]" has a null value in JSON.'); + assert(json.containsKey(r'tagIds'), 'Required key "TagBulkAssetsDto[tagIds]" is missing from JSON.'); + assert(json[r'tagIds'] != null, 'Required key "TagBulkAssetsDto[tagIds]" has a null value in JSON.'); + return true; + }()); + return TagBulkAssetsDto( assetIds: json[r'assetIds'] is Iterable ? (json[r'assetIds'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/tag_bulk_assets_response_dto.dart b/mobile/openapi/lib/model/tag_bulk_assets_response_dto.dart index 4d689f01a1..ed404aa60f 100644 --- a/mobile/openapi/lib/model/tag_bulk_assets_response_dto.dart +++ b/mobile/openapi/lib/model/tag_bulk_assets_response_dto.dart @@ -48,6 +48,15 @@ class TagBulkAssetsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'count'), 'Required key "TagBulkAssetsResponseDto[count]" is missing from JSON.'); + assert(json[r'count'] != null, 'Required key "TagBulkAssetsResponseDto[count]" has a null value in JSON.'); + return true; + }()); + return TagBulkAssetsResponseDto( count: mapValueOfType(json, r'count')!, ); diff --git a/mobile/openapi/lib/model/tag_create_dto.dart b/mobile/openapi/lib/model/tag_create_dto.dart index e05b29f1ed..63ba67c312 100644 --- a/mobile/openapi/lib/model/tag_create_dto.dart +++ b/mobile/openapi/lib/model/tag_create_dto.dart @@ -13,19 +13,19 @@ part of openapi.api; class TagCreateDto { /// Returns a new [TagCreateDto] instance. TagCreateDto({ - this.color, + this.color = const Optional.absent(), required this.name, - this.parentId, + this.parentId = const Optional.absent(), }); /// Tag color (hex) - String? color; + Optional color; /// Tag name String name; /// Parent tag ID - String? parentId; + Optional parentId; @override bool operator ==(Object other) => identical(this, other) || other is TagCreateDto && @@ -45,16 +45,14 @@ class TagCreateDto { Map toJson() { final json = {}; - if (this.color != null) { - json[r'color'] = this.color; - } else { - // json[r'color'] = null; + if (this.color.isPresent) { + final value = this.color.value; + json[r'color'] = value; } json[r'name'] = this.name; - if (this.parentId != null) { - json[r'parentId'] = this.parentId; - } else { - // json[r'parentId'] = null; + if (this.parentId.isPresent) { + final value = this.parentId.value; + json[r'parentId'] = value; } return json; } @@ -67,10 +65,19 @@ class TagCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'name'), 'Required key "TagCreateDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "TagCreateDto[name]" has a null value in JSON.'); + return true; + }()); + return TagCreateDto( - color: mapValueOfType(json, r'color'), + color: json.containsKey(r'color') ? Optional.present(mapValueOfType(json, r'color')) : const Optional.absent(), name: mapValueOfType(json, r'name')!, - parentId: mapValueOfType(json, r'parentId'), + parentId: json.containsKey(r'parentId') ? Optional.present(mapValueOfType(json, r'parentId')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/tag_response_dto.dart b/mobile/openapi/lib/model/tag_response_dto.dart index 9a71912153..d2558748ef 100644 --- a/mobile/openapi/lib/model/tag_response_dto.dart +++ b/mobile/openapi/lib/model/tag_response_dto.dart @@ -13,11 +13,11 @@ part of openapi.api; class TagResponseDto { /// Returns a new [TagResponseDto] instance. TagResponseDto({ - this.color, + this.color = const Optional.absent(), required this.createdAt, required this.id, required this.name, - this.parentId, + this.parentId = const Optional.absent(), required this.updatedAt, required this.value, }); @@ -29,7 +29,7 @@ class TagResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? color; + Optional color; /// Creation date DateTime createdAt; @@ -47,7 +47,7 @@ class TagResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? parentId; + Optional parentId; /// Last update date DateTime updatedAt; @@ -81,18 +81,16 @@ class TagResponseDto { Map toJson() { final json = {}; - if (this.color != null) { - json[r'color'] = this.color; - } else { - // json[r'color'] = null; + if (this.color.isPresent) { + final value = this.color.value; + json[r'color'] = value; } json[r'createdAt'] = this.createdAt.toUtc().toIso8601String(); json[r'id'] = this.id; json[r'name'] = this.name; - if (this.parentId != null) { - json[r'parentId'] = this.parentId; - } else { - // json[r'parentId'] = null; + if (this.parentId.isPresent) { + final value = this.parentId.value; + json[r'parentId'] = value; } json[r'updatedAt'] = this.updatedAt.toUtc().toIso8601String(); json[r'value'] = this.value; @@ -107,12 +105,29 @@ class TagResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'createdAt'), 'Required key "TagResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "TagResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "TagResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "TagResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "TagResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "TagResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "TagResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "TagResponseDto[updatedAt]" has a null value in JSON.'); + assert(json.containsKey(r'value'), 'Required key "TagResponseDto[value]" is missing from JSON.'); + assert(json[r'value'] != null, 'Required key "TagResponseDto[value]" has a null value in JSON.'); + return true; + }()); + return TagResponseDto( - color: mapValueOfType(json, r'color'), + color: json.containsKey(r'color') ? Optional.present(mapValueOfType(json, r'color')) : const Optional.absent(), createdAt: mapDateTime(json, r'createdAt', r'')!, id: mapValueOfType(json, r'id')!, name: mapValueOfType(json, r'name')!, - parentId: mapValueOfType(json, r'parentId'), + parentId: json.containsKey(r'parentId') ? Optional.present(mapValueOfType(json, r'parentId')) : const Optional.absent(), updatedAt: mapDateTime(json, r'updatedAt', r'')!, value: mapValueOfType(json, r'value')!, ); diff --git a/mobile/openapi/lib/model/tag_update_dto.dart b/mobile/openapi/lib/model/tag_update_dto.dart index 98cb6af523..8bafdecf63 100644 --- a/mobile/openapi/lib/model/tag_update_dto.dart +++ b/mobile/openapi/lib/model/tag_update_dto.dart @@ -13,11 +13,11 @@ part of openapi.api; class TagUpdateDto { /// Returns a new [TagUpdateDto] instance. TagUpdateDto({ - this.color, + this.color = const Optional.absent(), }); /// Tag color (hex) - String? color; + Optional color; @override bool operator ==(Object other) => identical(this, other) || other is TagUpdateDto && @@ -33,10 +33,9 @@ class TagUpdateDto { Map toJson() { final json = {}; - if (this.color != null) { - json[r'color'] = this.color; - } else { - // json[r'color'] = null; + if (this.color.isPresent) { + final value = this.color.value; + json[r'color'] = value; } return json; } @@ -49,8 +48,15 @@ class TagUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return TagUpdateDto( - color: mapValueOfType(json, r'color'), + color: json.containsKey(r'color') ? Optional.present(mapValueOfType(json, r'color')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/tag_upsert_dto.dart b/mobile/openapi/lib/model/tag_upsert_dto.dart index 3581ef1e8f..5409964883 100644 --- a/mobile/openapi/lib/model/tag_upsert_dto.dart +++ b/mobile/openapi/lib/model/tag_upsert_dto.dart @@ -45,6 +45,15 @@ class TagUpsertDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'tags'), 'Required key "TagUpsertDto[tags]" is missing from JSON.'); + assert(json[r'tags'] != null, 'Required key "TagUpsertDto[tags]" has a null value in JSON.'); + return true; + }()); + return TagUpsertDto( tags: json[r'tags'] is Iterable ? (json[r'tags'] as Iterable).cast().toList(growable: false) diff --git a/mobile/openapi/lib/model/tags_response.dart b/mobile/openapi/lib/model/tags_response.dart index 8a3ac17474..1eebe9407d 100644 --- a/mobile/openapi/lib/model/tags_response.dart +++ b/mobile/openapi/lib/model/tags_response.dart @@ -52,6 +52,17 @@ class TagsResponse { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'enabled'), 'Required key "TagsResponse[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "TagsResponse[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'sidebarWeb'), 'Required key "TagsResponse[sidebarWeb]" is missing from JSON.'); + assert(json[r'sidebarWeb'] != null, 'Required key "TagsResponse[sidebarWeb]" has a null value in JSON.'); + return true; + }()); + return TagsResponse( enabled: mapValueOfType(json, r'enabled')!, sidebarWeb: mapValueOfType(json, r'sidebarWeb')!, diff --git a/mobile/openapi/lib/model/tags_update.dart b/mobile/openapi/lib/model/tags_update.dart index e42357e3d4..d9138e40d6 100644 --- a/mobile/openapi/lib/model/tags_update.dart +++ b/mobile/openapi/lib/model/tags_update.dart @@ -13,8 +13,8 @@ part of openapi.api; class TagsUpdate { /// Returns a new [TagsUpdate] instance. TagsUpdate({ - this.enabled, - this.sidebarWeb, + this.enabled = const Optional.absent(), + this.sidebarWeb = const Optional.absent(), }); /// Whether tags are enabled @@ -24,7 +24,7 @@ class TagsUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; /// Whether tags appear in web sidebar /// @@ -33,7 +33,7 @@ class TagsUpdate { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? sidebarWeb; + Optional sidebarWeb; @override bool operator ==(Object other) => identical(this, other) || other is TagsUpdate && @@ -51,15 +51,13 @@ class TagsUpdate { Map toJson() { final json = {}; - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } - if (this.sidebarWeb != null) { - json[r'sidebarWeb'] = this.sidebarWeb; - } else { - // json[r'sidebarWeb'] = null; + if (this.sidebarWeb.isPresent) { + final value = this.sidebarWeb.value; + json[r'sidebarWeb'] = value; } return json; } @@ -72,9 +70,16 @@ class TagsUpdate { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return TagsUpdate( - enabled: mapValueOfType(json, r'enabled'), - sidebarWeb: mapValueOfType(json, r'sidebarWeb'), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), + sidebarWeb: json.containsKey(r'sidebarWeb') ? Optional.present(mapValueOfType(json, r'sidebarWeb')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/template_dto.dart b/mobile/openapi/lib/model/template_dto.dart index b1eab848ed..6309a489c8 100644 --- a/mobile/openapi/lib/model/template_dto.dart +++ b/mobile/openapi/lib/model/template_dto.dart @@ -45,6 +45,15 @@ class TemplateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'template'), 'Required key "TemplateDto[template]" is missing from JSON.'); + assert(json[r'template'] != null, 'Required key "TemplateDto[template]" has a null value in JSON.'); + return true; + }()); + return TemplateDto( template: mapValueOfType(json, r'template')!, ); diff --git a/mobile/openapi/lib/model/template_response_dto.dart b/mobile/openapi/lib/model/template_response_dto.dart index f19c1eae7d..ed004f5edf 100644 --- a/mobile/openapi/lib/model/template_response_dto.dart +++ b/mobile/openapi/lib/model/template_response_dto.dart @@ -52,6 +52,17 @@ class TemplateResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'html'), 'Required key "TemplateResponseDto[html]" is missing from JSON.'); + assert(json[r'html'] != null, 'Required key "TemplateResponseDto[html]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "TemplateResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "TemplateResponseDto[name]" has a null value in JSON.'); + return true; + }()); + return TemplateResponseDto( html: mapValueOfType(json, r'html')!, name: mapValueOfType(json, r'name')!, diff --git a/mobile/openapi/lib/model/test_email_response_dto.dart b/mobile/openapi/lib/model/test_email_response_dto.dart index e14783f3c4..f877646bf0 100644 --- a/mobile/openapi/lib/model/test_email_response_dto.dart +++ b/mobile/openapi/lib/model/test_email_response_dto.dart @@ -45,6 +45,15 @@ class TestEmailResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'messageId'), 'Required key "TestEmailResponseDto[messageId]" is missing from JSON.'); + assert(json[r'messageId'] != null, 'Required key "TestEmailResponseDto[messageId]" has a null value in JSON.'); + return true; + }()); + return TestEmailResponseDto( messageId: mapValueOfType(json, r'messageId')!, ); diff --git a/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart b/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart index 32e08a9ea0..5f74761751 100644 --- a/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart +++ b/mobile/openapi/lib/model/time_bucket_asset_response_dto.dart @@ -13,8 +13,8 @@ part of openapi.api; class TimeBucketAssetResponseDto { /// Returns a new [TimeBucketAssetResponseDto] instance. TimeBucketAssetResponseDto({ - this.city = const [], - this.country = const [], + this.city = const Optional.present(const []), + this.country = const Optional.present(const []), this.createdAt = const [], this.duration = const [], this.fileCreatedAt = const [], @@ -22,29 +22,29 @@ class TimeBucketAssetResponseDto { this.isFavorite = const [], this.isImage = const [], this.isTrashed = const [], - this.latitude = const [], + this.latitude = const Optional.present(const []), this.livePhotoVideoId = const [], this.localOffsetHours = const [], - this.longitude = const [], + this.longitude = const Optional.present(const []), this.ownerId = const [], this.projectionType = const [], this.ratio = const [], - this.stack = const [], + this.stack = const Optional.present(const []), this.thumbhash = const [], this.visibility = const [], }); /// Array of city names extracted from EXIF GPS data - List city; + Optional?> city; /// Array of country names extracted from EXIF GPS data - List country; + Optional?> country; /// Array of UTC timestamps when each asset was originally uploaded to Immich List createdAt; /// Array of video/gif durations in milliseconds (null for static images) - List duration; + List duration; /// Array of file creation timestamps in UTC List fileCreatedAt; @@ -62,31 +62,31 @@ class TimeBucketAssetResponseDto { List isTrashed; /// Array of latitude coordinates extracted from EXIF GPS data - List latitude; + Optional?> latitude; /// Array of live photo video asset IDs (null for non-live photos) - List livePhotoVideoId; + List livePhotoVideoId; /// Array of UTC offset hours at the time each photo was taken. Positive values are east of UTC, negative values are west of UTC. Values may be fractional (e.g., 5.5 for +05:30, -9.75 for -09:45). Applying this offset to 'fileCreatedAt' will give you the time the photo was taken from the photographer's perspective. List localOffsetHours; /// Array of longitude coordinates extracted from EXIF GPS data - List longitude; + Optional?> longitude; /// Array of owner IDs for each asset List ownerId; /// Array of projection types for 360° content (e.g., \"EQUIRECTANGULAR\", \"CUBEFACE\", \"CYLINDRICAL\") - List projectionType; + List projectionType; /// Array of aspect ratios (width/height) for each asset List ratio; /// Array of stack information as [stackId, assetCount] tuples (null for non-stacked assets) - List?> stack; + Optional?>?> stack; /// Array of BlurHash strings for generating asset previews (base64 encoded) - List thumbhash; + List thumbhash; /// Array of visibility statuses for each asset (e.g., ARCHIVE, TIMELINE, HIDDEN, LOCKED) List visibility; @@ -141,8 +141,14 @@ class TimeBucketAssetResponseDto { Map toJson() { final json = {}; - json[r'city'] = this.city; - json[r'country'] = this.country; + if (this.city.isPresent) { + final value = this.city.value; + json[r'city'] = value; + } + if (this.country.isPresent) { + final value = this.country.value; + json[r'country'] = value; + } json[r'createdAt'] = this.createdAt; json[r'duration'] = this.duration; json[r'fileCreatedAt'] = this.fileCreatedAt; @@ -150,14 +156,23 @@ class TimeBucketAssetResponseDto { json[r'isFavorite'] = this.isFavorite; json[r'isImage'] = this.isImage; json[r'isTrashed'] = this.isTrashed; - json[r'latitude'] = this.latitude; + if (this.latitude.isPresent) { + final value = this.latitude.value; + json[r'latitude'] = value; + } json[r'livePhotoVideoId'] = this.livePhotoVideoId; json[r'localOffsetHours'] = this.localOffsetHours; - json[r'longitude'] = this.longitude; + if (this.longitude.isPresent) { + final value = this.longitude.value; + json[r'longitude'] = value; + } json[r'ownerId'] = this.ownerId; json[r'projectionType'] = this.projectionType; json[r'ratio'] = this.ratio; - json[r'stack'] = this.stack; + if (this.stack.isPresent) { + final value = this.stack.value; + json[r'stack'] = value; + } json[r'thumbhash'] = this.thumbhash; json[r'visibility'] = this.visibility; return json; @@ -171,13 +186,48 @@ class TimeBucketAssetResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'createdAt'), 'Required key "TimeBucketAssetResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "TimeBucketAssetResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'duration'), 'Required key "TimeBucketAssetResponseDto[duration]" is missing from JSON.'); + assert(json[r'duration'] != null, 'Required key "TimeBucketAssetResponseDto[duration]" has a null value in JSON.'); + assert(json.containsKey(r'fileCreatedAt'), 'Required key "TimeBucketAssetResponseDto[fileCreatedAt]" is missing from JSON.'); + assert(json[r'fileCreatedAt'] != null, 'Required key "TimeBucketAssetResponseDto[fileCreatedAt]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "TimeBucketAssetResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "TimeBucketAssetResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'isFavorite'), 'Required key "TimeBucketAssetResponseDto[isFavorite]" is missing from JSON.'); + assert(json[r'isFavorite'] != null, 'Required key "TimeBucketAssetResponseDto[isFavorite]" has a null value in JSON.'); + assert(json.containsKey(r'isImage'), 'Required key "TimeBucketAssetResponseDto[isImage]" is missing from JSON.'); + assert(json[r'isImage'] != null, 'Required key "TimeBucketAssetResponseDto[isImage]" has a null value in JSON.'); + assert(json.containsKey(r'isTrashed'), 'Required key "TimeBucketAssetResponseDto[isTrashed]" is missing from JSON.'); + assert(json[r'isTrashed'] != null, 'Required key "TimeBucketAssetResponseDto[isTrashed]" has a null value in JSON.'); + assert(json.containsKey(r'livePhotoVideoId'), 'Required key "TimeBucketAssetResponseDto[livePhotoVideoId]" is missing from JSON.'); + assert(json[r'livePhotoVideoId'] != null, 'Required key "TimeBucketAssetResponseDto[livePhotoVideoId]" has a null value in JSON.'); + assert(json.containsKey(r'localOffsetHours'), 'Required key "TimeBucketAssetResponseDto[localOffsetHours]" is missing from JSON.'); + assert(json[r'localOffsetHours'] != null, 'Required key "TimeBucketAssetResponseDto[localOffsetHours]" has a null value in JSON.'); + assert(json.containsKey(r'ownerId'), 'Required key "TimeBucketAssetResponseDto[ownerId]" is missing from JSON.'); + assert(json[r'ownerId'] != null, 'Required key "TimeBucketAssetResponseDto[ownerId]" has a null value in JSON.'); + assert(json.containsKey(r'projectionType'), 'Required key "TimeBucketAssetResponseDto[projectionType]" is missing from JSON.'); + assert(json[r'projectionType'] != null, 'Required key "TimeBucketAssetResponseDto[projectionType]" has a null value in JSON.'); + assert(json.containsKey(r'ratio'), 'Required key "TimeBucketAssetResponseDto[ratio]" is missing from JSON.'); + assert(json[r'ratio'] != null, 'Required key "TimeBucketAssetResponseDto[ratio]" has a null value in JSON.'); + assert(json.containsKey(r'thumbhash'), 'Required key "TimeBucketAssetResponseDto[thumbhash]" is missing from JSON.'); + assert(json[r'thumbhash'] != null, 'Required key "TimeBucketAssetResponseDto[thumbhash]" has a null value in JSON.'); + assert(json.containsKey(r'visibility'), 'Required key "TimeBucketAssetResponseDto[visibility]" is missing from JSON.'); + assert(json[r'visibility'] != null, 'Required key "TimeBucketAssetResponseDto[visibility]" has a null value in JSON.'); + return true; + }()); + return TimeBucketAssetResponseDto( - city: json[r'city'] is Iterable + city: json.containsKey(r'city') ? Optional.present(json[r'city'] is Iterable ? (json[r'city'] as Iterable).cast().toList(growable: false) - : const [], - country: json[r'country'] is Iterable + : const []) : const Optional.absent(), + country: json.containsKey(r'country') ? Optional.present(json[r'country'] is Iterable ? (json[r'country'] as Iterable).cast().toList(growable: false) - : const [], + : const []) : const Optional.absent(), createdAt: json[r'createdAt'] is Iterable ? (json[r'createdAt'] as Iterable).cast().toList(growable: false) : const [], @@ -199,18 +249,18 @@ class TimeBucketAssetResponseDto { isTrashed: json[r'isTrashed'] is Iterable ? (json[r'isTrashed'] as Iterable).cast().toList(growable: false) : const [], - latitude: json[r'latitude'] is Iterable + latitude: json.containsKey(r'latitude') ? Optional.present(json[r'latitude'] is Iterable ? (json[r'latitude'] as Iterable).cast().toList(growable: false) - : const [], + : const []) : const Optional.absent(), livePhotoVideoId: json[r'livePhotoVideoId'] is Iterable ? (json[r'livePhotoVideoId'] as Iterable).cast().toList(growable: false) : const [], localOffsetHours: json[r'localOffsetHours'] is Iterable ? (json[r'localOffsetHours'] as Iterable).cast().toList(growable: false) : const [], - longitude: json[r'longitude'] is Iterable + longitude: json.containsKey(r'longitude') ? Optional.present(json[r'longitude'] is Iterable ? (json[r'longitude'] as Iterable).cast().toList(growable: false) - : const [], + : const []) : const Optional.absent(), ownerId: json[r'ownerId'] is Iterable ? (json[r'ownerId'] as Iterable).cast().toList(growable: false) : const [], @@ -220,11 +270,11 @@ class TimeBucketAssetResponseDto { ratio: json[r'ratio'] is Iterable ? (json[r'ratio'] as Iterable).cast().toList(growable: false) : const [], - stack: json[r'stack'] is List + stack: json.containsKey(r'stack') ? Optional.present(json[r'stack'] is List ? (json[r'stack'] as List).map((e) => - e == null ? null : (e as List).cast() + e == null ? null : (e as List).map((value) => value as String).toList(growable: false) ).toList() - : const [], + : const []) : const Optional.absent(), thumbhash: json[r'thumbhash'] is Iterable ? (json[r'thumbhash'] as Iterable).cast().toList(growable: false) : const [], diff --git a/mobile/openapi/lib/model/time_buckets_response_dto.dart b/mobile/openapi/lib/model/time_buckets_response_dto.dart index 8b8da1d37a..977fe195f2 100644 --- a/mobile/openapi/lib/model/time_buckets_response_dto.dart +++ b/mobile/openapi/lib/model/time_buckets_response_dto.dart @@ -55,6 +55,17 @@ class TimeBucketsResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'count'), 'Required key "TimeBucketsResponseDto[count]" is missing from JSON.'); + assert(json[r'count'] != null, 'Required key "TimeBucketsResponseDto[count]" has a null value in JSON.'); + assert(json.containsKey(r'timeBucket'), 'Required key "TimeBucketsResponseDto[timeBucket]" is missing from JSON.'); + assert(json[r'timeBucket'] != null, 'Required key "TimeBucketsResponseDto[timeBucket]" has a null value in JSON.'); + return true; + }()); + return TimeBucketsResponseDto( count: mapValueOfType(json, r'count')!, timeBucket: mapValueOfType(json, r'timeBucket')!, diff --git a/mobile/openapi/lib/model/trash_response_dto.dart b/mobile/openapi/lib/model/trash_response_dto.dart index 7b43d9ceb7..d51c221acd 100644 --- a/mobile/openapi/lib/model/trash_response_dto.dart +++ b/mobile/openapi/lib/model/trash_response_dto.dart @@ -48,6 +48,15 @@ class TrashResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'count'), 'Required key "TrashResponseDto[count]" is missing from JSON.'); + assert(json[r'count'] != null, 'Required key "TrashResponseDto[count]" has a null value in JSON.'); + return true; + }()); + return TrashResponseDto( count: mapValueOfType(json, r'count')!, ); diff --git a/mobile/openapi/lib/model/update_album_dto.dart b/mobile/openapi/lib/model/update_album_dto.dart index ae4a5c1f87..3e58958d3f 100644 --- a/mobile/openapi/lib/model/update_album_dto.dart +++ b/mobile/openapi/lib/model/update_album_dto.dart @@ -13,11 +13,11 @@ part of openapi.api; class UpdateAlbumDto { /// Returns a new [UpdateAlbumDto] instance. UpdateAlbumDto({ - this.albumName, - this.albumThumbnailAssetId, - this.description, - this.isActivityEnabled, - this.order, + this.albumName = const Optional.absent(), + this.albumThumbnailAssetId = const Optional.absent(), + this.description = const Optional.absent(), + this.isActivityEnabled = const Optional.absent(), + this.order = const Optional.absent(), }); /// Album name @@ -27,7 +27,7 @@ class UpdateAlbumDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? albumName; + Optional albumName; /// Album thumbnail asset ID /// @@ -36,7 +36,7 @@ class UpdateAlbumDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? albumThumbnailAssetId; + Optional albumThumbnailAssetId; /// Album description /// @@ -45,7 +45,7 @@ class UpdateAlbumDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? description; + Optional description; /// Enable activity feed /// @@ -54,7 +54,7 @@ class UpdateAlbumDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isActivityEnabled; + Optional isActivityEnabled; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -62,7 +62,7 @@ class UpdateAlbumDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetOrder? order; + Optional order; @override bool operator ==(Object other) => identical(this, other) || other is UpdateAlbumDto && @@ -86,30 +86,25 @@ class UpdateAlbumDto { Map toJson() { final json = {}; - if (this.albumName != null) { - json[r'albumName'] = this.albumName; - } else { - // json[r'albumName'] = null; + if (this.albumName.isPresent) { + final value = this.albumName.value; + json[r'albumName'] = value; } - if (this.albumThumbnailAssetId != null) { - json[r'albumThumbnailAssetId'] = this.albumThumbnailAssetId; - } else { - // json[r'albumThumbnailAssetId'] = null; + if (this.albumThumbnailAssetId.isPresent) { + final value = this.albumThumbnailAssetId.value; + json[r'albumThumbnailAssetId'] = value; } - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - if (this.isActivityEnabled != null) { - json[r'isActivityEnabled'] = this.isActivityEnabled; - } else { - // json[r'isActivityEnabled'] = null; + if (this.isActivityEnabled.isPresent) { + final value = this.isActivityEnabled.value; + json[r'isActivityEnabled'] = value; } - if (this.order != null) { - json[r'order'] = this.order; - } else { - // json[r'order'] = null; + if (this.order.isPresent) { + final value = this.order.value; + json[r'order'] = value; } return json; } @@ -122,12 +117,19 @@ class UpdateAlbumDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return UpdateAlbumDto( - albumName: mapValueOfType(json, r'albumName'), - albumThumbnailAssetId: mapValueOfType(json, r'albumThumbnailAssetId'), - description: mapValueOfType(json, r'description'), - isActivityEnabled: mapValueOfType(json, r'isActivityEnabled'), - order: AssetOrder.fromJson(json[r'order']), + albumName: json.containsKey(r'albumName') ? Optional.present(mapValueOfType(json, r'albumName')) : const Optional.absent(), + albumThumbnailAssetId: json.containsKey(r'albumThumbnailAssetId') ? Optional.present(mapValueOfType(json, r'albumThumbnailAssetId')) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + isActivityEnabled: json.containsKey(r'isActivityEnabled') ? Optional.present(mapValueOfType(json, r'isActivityEnabled')) : const Optional.absent(), + order: json.containsKey(r'order') ? Optional.present(AssetOrder.fromJson(json[r'order'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/update_album_user_dto.dart b/mobile/openapi/lib/model/update_album_user_dto.dart index 43218cae6e..3d71b8dbc8 100644 --- a/mobile/openapi/lib/model/update_album_user_dto.dart +++ b/mobile/openapi/lib/model/update_album_user_dto.dart @@ -44,6 +44,15 @@ class UpdateAlbumUserDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'role'), 'Required key "UpdateAlbumUserDto[role]" is missing from JSON.'); + assert(json[r'role'] != null, 'Required key "UpdateAlbumUserDto[role]" has a null value in JSON.'); + return true; + }()); + return UpdateAlbumUserDto( role: AlbumUserRole.fromJson(json[r'role'])!, ); diff --git a/mobile/openapi/lib/model/update_asset_dto.dart b/mobile/openapi/lib/model/update_asset_dto.dart index 2c4c3352ea..5d9912a09f 100644 --- a/mobile/openapi/lib/model/update_asset_dto.dart +++ b/mobile/openapi/lib/model/update_asset_dto.dart @@ -13,14 +13,14 @@ part of openapi.api; class UpdateAssetDto { /// Returns a new [UpdateAssetDto] instance. UpdateAssetDto({ - this.dateTimeOriginal, - this.description, - this.isFavorite, - this.latitude, - this.livePhotoVideoId, - this.longitude, - this.rating, - this.visibility, + this.dateTimeOriginal = const Optional.absent(), + this.description = const Optional.absent(), + this.isFavorite = const Optional.absent(), + this.latitude = const Optional.absent(), + this.livePhotoVideoId = const Optional.absent(), + this.longitude = const Optional.absent(), + this.rating = const Optional.absent(), + this.visibility = const Optional.absent(), }); /// Original date and time @@ -30,7 +30,7 @@ class UpdateAssetDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? dateTimeOriginal; + Optional dateTimeOriginal; /// Asset description /// @@ -39,7 +39,7 @@ class UpdateAssetDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? description; + Optional description; /// Mark as favorite /// @@ -48,7 +48,7 @@ class UpdateAssetDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isFavorite; + Optional isFavorite; /// Latitude coordinate /// @@ -60,10 +60,10 @@ class UpdateAssetDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - num? latitude; + Optional latitude; /// Live photo video ID - String? livePhotoVideoId; + Optional livePhotoVideoId; /// Longitude coordinate /// @@ -75,13 +75,13 @@ class UpdateAssetDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - num? longitude; + Optional longitude; /// Rating in range [1-5], or null for unrated /// /// Minimum value: -1 /// Maximum value: 5 - int? rating; + Optional rating; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -89,7 +89,7 @@ class UpdateAssetDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AssetVisibility? visibility; + Optional visibility; @override bool operator ==(Object other) => identical(this, other) || other is UpdateAssetDto && @@ -119,45 +119,37 @@ class UpdateAssetDto { Map toJson() { final json = {}; - if (this.dateTimeOriginal != null) { - json[r'dateTimeOriginal'] = this.dateTimeOriginal; - } else { - // json[r'dateTimeOriginal'] = null; + if (this.dateTimeOriginal.isPresent) { + final value = this.dateTimeOriginal.value; + json[r'dateTimeOriginal'] = value; } - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - if (this.isFavorite != null) { - json[r'isFavorite'] = this.isFavorite; - } else { - // json[r'isFavorite'] = null; + if (this.isFavorite.isPresent) { + final value = this.isFavorite.value; + json[r'isFavorite'] = value; } - if (this.latitude != null) { - json[r'latitude'] = this.latitude; - } else { - // json[r'latitude'] = null; + if (this.latitude.isPresent) { + final value = this.latitude.value; + json[r'latitude'] = value; } - if (this.livePhotoVideoId != null) { - json[r'livePhotoVideoId'] = this.livePhotoVideoId; - } else { - // json[r'livePhotoVideoId'] = null; + if (this.livePhotoVideoId.isPresent) { + final value = this.livePhotoVideoId.value; + json[r'livePhotoVideoId'] = value; } - if (this.longitude != null) { - json[r'longitude'] = this.longitude; - } else { - // json[r'longitude'] = null; + if (this.longitude.isPresent) { + final value = this.longitude.value; + json[r'longitude'] = value; } - if (this.rating != null) { - json[r'rating'] = this.rating; - } else { - // json[r'rating'] = null; + if (this.rating.isPresent) { + final value = this.rating.value; + json[r'rating'] = value; } - if (this.visibility != null) { - json[r'visibility'] = this.visibility; - } else { - // json[r'visibility'] = null; + if (this.visibility.isPresent) { + final value = this.visibility.value; + json[r'visibility'] = value; } return json; } @@ -170,15 +162,22 @@ class UpdateAssetDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return UpdateAssetDto( - dateTimeOriginal: mapValueOfType(json, r'dateTimeOriginal'), - description: mapValueOfType(json, r'description'), - isFavorite: mapValueOfType(json, r'isFavorite'), - latitude: num.parse('${json[r'latitude']}'), - livePhotoVideoId: mapValueOfType(json, r'livePhotoVideoId'), - longitude: num.parse('${json[r'longitude']}'), - rating: mapValueOfType(json, r'rating'), - visibility: AssetVisibility.fromJson(json[r'visibility']), + dateTimeOriginal: json.containsKey(r'dateTimeOriginal') ? Optional.present(mapValueOfType(json, r'dateTimeOriginal')) : const Optional.absent(), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + isFavorite: json.containsKey(r'isFavorite') ? Optional.present(mapValueOfType(json, r'isFavorite')) : const Optional.absent(), + latitude: json.containsKey(r'latitude') ? Optional.present(json[r'latitude'] == null ? null : num.parse('${json[r'latitude']}')) : const Optional.absent(), + livePhotoVideoId: json.containsKey(r'livePhotoVideoId') ? Optional.present(mapValueOfType(json, r'livePhotoVideoId')) : const Optional.absent(), + longitude: json.containsKey(r'longitude') ? Optional.present(json[r'longitude'] == null ? null : num.parse('${json[r'longitude']}')) : const Optional.absent(), + rating: json.containsKey(r'rating') ? Optional.present(json[r'rating'] == null ? null : int.parse('${json[r'rating']}')) : const Optional.absent(), + visibility: json.containsKey(r'visibility') ? Optional.present(AssetVisibility.fromJson(json[r'visibility'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/update_library_dto.dart b/mobile/openapi/lib/model/update_library_dto.dart index 276d43ecd9..7a220c2475 100644 --- a/mobile/openapi/lib/model/update_library_dto.dart +++ b/mobile/openapi/lib/model/update_library_dto.dart @@ -13,16 +13,16 @@ part of openapi.api; class UpdateLibraryDto { /// Returns a new [UpdateLibraryDto] instance. UpdateLibraryDto({ - this.exclusionPatterns = const [], - this.importPaths = const [], - this.name, + this.exclusionPatterns = const Optional.present(const []), + this.importPaths = const Optional.present(const []), + this.name = const Optional.absent(), }); /// Exclusion patterns (max 128) - List exclusionPatterns; + Optional?> exclusionPatterns; /// Import paths (max 128) - List importPaths; + Optional?> importPaths; /// Library name /// @@ -31,7 +31,7 @@ class UpdateLibraryDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? name; + Optional name; @override bool operator ==(Object other) => identical(this, other) || other is UpdateLibraryDto && @@ -51,12 +51,17 @@ class UpdateLibraryDto { Map toJson() { final json = {}; - json[r'exclusionPatterns'] = this.exclusionPatterns; - json[r'importPaths'] = this.importPaths; - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.exclusionPatterns.isPresent) { + final value = this.exclusionPatterns.value; + json[r'exclusionPatterns'] = value; + } + if (this.importPaths.isPresent) { + final value = this.importPaths.value; + json[r'importPaths'] = value; + } + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; } return json; } @@ -69,14 +74,21 @@ class UpdateLibraryDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return UpdateLibraryDto( - exclusionPatterns: json[r'exclusionPatterns'] is Iterable + exclusionPatterns: json.containsKey(r'exclusionPatterns') ? Optional.present(json[r'exclusionPatterns'] is Iterable ? (json[r'exclusionPatterns'] as Iterable).cast().toList(growable: false) - : const [], - importPaths: json[r'importPaths'] is Iterable + : const []) : const Optional.absent(), + importPaths: json.containsKey(r'importPaths') ? Optional.present(json[r'importPaths'] is Iterable ? (json[r'importPaths'] as Iterable).cast().toList(growable: false) - : const [], - name: mapValueOfType(json, r'name'), + : const []) : const Optional.absent(), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/usage_by_user_dto.dart b/mobile/openapi/lib/model/usage_by_user_dto.dart index 462b82c3e0..a740d09fc1 100644 --- a/mobile/openapi/lib/model/usage_by_user_dto.dart +++ b/mobile/openapi/lib/model/usage_by_user_dto.dart @@ -97,7 +97,7 @@ class UsageByUserDto { if (this.quotaSizeInBytes != null) { json[r'quotaSizeInBytes'] = this.quotaSizeInBytes; } else { - // json[r'quotaSizeInBytes'] = null; + json[r'quotaSizeInBytes'] = null; } json[r'usage'] = this.usage; json[r'usagePhotos'] = this.usagePhotos; @@ -116,6 +116,28 @@ class UsageByUserDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'photos'), 'Required key "UsageByUserDto[photos]" is missing from JSON.'); + assert(json[r'photos'] != null, 'Required key "UsageByUserDto[photos]" has a null value in JSON.'); + assert(json.containsKey(r'quotaSizeInBytes'), 'Required key "UsageByUserDto[quotaSizeInBytes]" is missing from JSON.'); + assert(json.containsKey(r'usage'), 'Required key "UsageByUserDto[usage]" is missing from JSON.'); + assert(json[r'usage'] != null, 'Required key "UsageByUserDto[usage]" has a null value in JSON.'); + assert(json.containsKey(r'usagePhotos'), 'Required key "UsageByUserDto[usagePhotos]" is missing from JSON.'); + assert(json[r'usagePhotos'] != null, 'Required key "UsageByUserDto[usagePhotos]" has a null value in JSON.'); + assert(json.containsKey(r'usageVideos'), 'Required key "UsageByUserDto[usageVideos]" is missing from JSON.'); + assert(json[r'usageVideos'] != null, 'Required key "UsageByUserDto[usageVideos]" has a null value in JSON.'); + assert(json.containsKey(r'userId'), 'Required key "UsageByUserDto[userId]" is missing from JSON.'); + assert(json[r'userId'] != null, 'Required key "UsageByUserDto[userId]" has a null value in JSON.'); + assert(json.containsKey(r'userName'), 'Required key "UsageByUserDto[userName]" is missing from JSON.'); + assert(json[r'userName'] != null, 'Required key "UsageByUserDto[userName]" has a null value in JSON.'); + assert(json.containsKey(r'videos'), 'Required key "UsageByUserDto[videos]" is missing from JSON.'); + assert(json[r'videos'] != null, 'Required key "UsageByUserDto[videos]" has a null value in JSON.'); + return true; + }()); + return UsageByUserDto( photos: mapValueOfType(json, r'photos')!, quotaSizeInBytes: mapValueOfType(json, r'quotaSizeInBytes'), diff --git a/mobile/openapi/lib/model/user_admin_create_dto.dart b/mobile/openapi/lib/model/user_admin_create_dto.dart index 54da0b0566..8c63fb6360 100644 --- a/mobile/openapi/lib/model/user_admin_create_dto.dart +++ b/mobile/openapi/lib/model/user_admin_create_dto.dart @@ -13,19 +13,19 @@ part of openapi.api; class UserAdminCreateDto { /// Returns a new [UserAdminCreateDto] instance. UserAdminCreateDto({ - this.avatarColor, + this.avatarColor = const Optional.absent(), required this.email, - this.isAdmin, + this.isAdmin = const Optional.absent(), required this.name, - this.notify, + this.notify = const Optional.absent(), required this.password, - this.pinCode, - this.quotaSizeInBytes, - this.shouldChangePassword, - this.storageLabel, + this.pinCode = const Optional.absent(), + this.quotaSizeInBytes = const Optional.absent(), + this.shouldChangePassword = const Optional.absent(), + this.storageLabel = const Optional.absent(), }); - UserAvatarColor? avatarColor; + Optional avatarColor; /// User email String email; @@ -37,7 +37,7 @@ class UserAdminCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isAdmin; + Optional isAdmin; /// User name String name; @@ -49,19 +49,19 @@ class UserAdminCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? notify; + Optional notify; /// User password String password; /// PIN code - String? pinCode; + Optional pinCode; /// Storage quota in bytes /// /// Minimum value: 0 /// Maximum value: 9007199254740991 - int? quotaSizeInBytes; + Optional quotaSizeInBytes; /// Require password change on next login /// @@ -70,10 +70,10 @@ class UserAdminCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? shouldChangePassword; + Optional shouldChangePassword; /// Storage label - String? storageLabel; + Optional storageLabel; @override bool operator ==(Object other) => identical(this, other) || other is UserAdminCreateDto && @@ -107,43 +107,36 @@ class UserAdminCreateDto { Map toJson() { final json = {}; - if (this.avatarColor != null) { - json[r'avatarColor'] = this.avatarColor; - } else { - // json[r'avatarColor'] = null; + if (this.avatarColor.isPresent) { + final value = this.avatarColor.value; + json[r'avatarColor'] = value; } json[r'email'] = this.email; - if (this.isAdmin != null) { - json[r'isAdmin'] = this.isAdmin; - } else { - // json[r'isAdmin'] = null; + if (this.isAdmin.isPresent) { + final value = this.isAdmin.value; + json[r'isAdmin'] = value; } json[r'name'] = this.name; - if (this.notify != null) { - json[r'notify'] = this.notify; - } else { - // json[r'notify'] = null; + if (this.notify.isPresent) { + final value = this.notify.value; + json[r'notify'] = value; } json[r'password'] = this.password; - if (this.pinCode != null) { - json[r'pinCode'] = this.pinCode; - } else { - // json[r'pinCode'] = null; + if (this.pinCode.isPresent) { + final value = this.pinCode.value; + json[r'pinCode'] = value; } - if (this.quotaSizeInBytes != null) { - json[r'quotaSizeInBytes'] = this.quotaSizeInBytes; - } else { - // json[r'quotaSizeInBytes'] = null; + if (this.quotaSizeInBytes.isPresent) { + final value = this.quotaSizeInBytes.value; + json[r'quotaSizeInBytes'] = value; } - if (this.shouldChangePassword != null) { - json[r'shouldChangePassword'] = this.shouldChangePassword; - } else { - // json[r'shouldChangePassword'] = null; + if (this.shouldChangePassword.isPresent) { + final value = this.shouldChangePassword.value; + json[r'shouldChangePassword'] = value; } - if (this.storageLabel != null) { - json[r'storageLabel'] = this.storageLabel; - } else { - // json[r'storageLabel'] = null; + if (this.storageLabel.isPresent) { + final value = this.storageLabel.value; + json[r'storageLabel'] = value; } return json; } @@ -156,17 +149,30 @@ class UserAdminCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'email'), 'Required key "UserAdminCreateDto[email]" is missing from JSON.'); + assert(json[r'email'] != null, 'Required key "UserAdminCreateDto[email]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "UserAdminCreateDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "UserAdminCreateDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'password'), 'Required key "UserAdminCreateDto[password]" is missing from JSON.'); + assert(json[r'password'] != null, 'Required key "UserAdminCreateDto[password]" has a null value in JSON.'); + return true; + }()); + return UserAdminCreateDto( - avatarColor: UserAvatarColor.fromJson(json[r'avatarColor']), + avatarColor: json.containsKey(r'avatarColor') ? Optional.present(UserAvatarColor.fromJson(json[r'avatarColor'])) : const Optional.absent(), email: mapValueOfType(json, r'email')!, - isAdmin: mapValueOfType(json, r'isAdmin'), + isAdmin: json.containsKey(r'isAdmin') ? Optional.present(mapValueOfType(json, r'isAdmin')) : const Optional.absent(), name: mapValueOfType(json, r'name')!, - notify: mapValueOfType(json, r'notify'), + notify: json.containsKey(r'notify') ? Optional.present(mapValueOfType(json, r'notify')) : const Optional.absent(), password: mapValueOfType(json, r'password')!, - pinCode: mapValueOfType(json, r'pinCode'), - quotaSizeInBytes: mapValueOfType(json, r'quotaSizeInBytes'), - shouldChangePassword: mapValueOfType(json, r'shouldChangePassword'), - storageLabel: mapValueOfType(json, r'storageLabel'), + pinCode: json.containsKey(r'pinCode') ? Optional.present(mapValueOfType(json, r'pinCode')) : const Optional.absent(), + quotaSizeInBytes: json.containsKey(r'quotaSizeInBytes') ? Optional.present(json[r'quotaSizeInBytes'] == null ? null : int.parse('${json[r'quotaSizeInBytes']}')) : const Optional.absent(), + shouldChangePassword: json.containsKey(r'shouldChangePassword') ? Optional.present(mapValueOfType(json, r'shouldChangePassword')) : const Optional.absent(), + storageLabel: json.containsKey(r'storageLabel') ? Optional.present(mapValueOfType(json, r'storageLabel')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/user_admin_delete_dto.dart b/mobile/openapi/lib/model/user_admin_delete_dto.dart index 6be70f37b7..434f8140f6 100644 --- a/mobile/openapi/lib/model/user_admin_delete_dto.dart +++ b/mobile/openapi/lib/model/user_admin_delete_dto.dart @@ -13,7 +13,7 @@ part of openapi.api; class UserAdminDeleteDto { /// Returns a new [UserAdminDeleteDto] instance. UserAdminDeleteDto({ - this.force, + this.force = const Optional.absent(), }); /// Force delete even if user has assets @@ -23,7 +23,7 @@ class UserAdminDeleteDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? force; + Optional force; @override bool operator ==(Object other) => identical(this, other) || other is UserAdminDeleteDto && @@ -39,10 +39,9 @@ class UserAdminDeleteDto { Map toJson() { final json = {}; - if (this.force != null) { - json[r'force'] = this.force; - } else { - // json[r'force'] = null; + if (this.force.isPresent) { + final value = this.force.value; + json[r'force'] = value; } return json; } @@ -55,8 +54,15 @@ class UserAdminDeleteDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return UserAdminDeleteDto( - force: mapValueOfType(json, r'force'), + force: json.containsKey(r'force') ? Optional.present(mapValueOfType(json, r'force')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/user_admin_response_dto.dart b/mobile/openapi/lib/model/user_admin_response_dto.dart index 09f8cedce4..f414856e72 100644 --- a/mobile/openapi/lib/model/user_admin_response_dto.dart +++ b/mobile/openapi/lib/model/user_admin_response_dto.dart @@ -141,7 +141,7 @@ class UserAdminResponseDto { ? this.deletedAt!.millisecondsSinceEpoch : this.deletedAt!.toUtc().toIso8601String(); } else { - // json[r'deletedAt'] = null; + json[r'deletedAt'] = null; } json[r'email'] = this.email; json[r'id'] = this.id; @@ -149,7 +149,7 @@ class UserAdminResponseDto { if (this.license != null) { json[r'license'] = this.license; } else { - // json[r'license'] = null; + json[r'license'] = null; } json[r'name'] = this.name; json[r'oauthId'] = this.oauthId; @@ -158,19 +158,19 @@ class UserAdminResponseDto { if (this.quotaSizeInBytes != null) { json[r'quotaSizeInBytes'] = this.quotaSizeInBytes; } else { - // json[r'quotaSizeInBytes'] = null; + json[r'quotaSizeInBytes'] = null; } if (this.quotaUsageInBytes != null) { json[r'quotaUsageInBytes'] = this.quotaUsageInBytes; } else { - // json[r'quotaUsageInBytes'] = null; + json[r'quotaUsageInBytes'] = null; } json[r'shouldChangePassword'] = this.shouldChangePassword; json[r'status'] = this.status; if (this.storageLabel != null) { json[r'storageLabel'] = this.storageLabel; } else { - // json[r'storageLabel'] = null; + json[r'storageLabel'] = null; } json[r'updatedAt'] = _isEpochMarker(r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/') ? this.updatedAt.millisecondsSinceEpoch @@ -186,6 +186,42 @@ class UserAdminResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'avatarColor'), 'Required key "UserAdminResponseDto[avatarColor]" is missing from JSON.'); + assert(json[r'avatarColor'] != null, 'Required key "UserAdminResponseDto[avatarColor]" has a null value in JSON.'); + assert(json.containsKey(r'createdAt'), 'Required key "UserAdminResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "UserAdminResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'deletedAt'), 'Required key "UserAdminResponseDto[deletedAt]" is missing from JSON.'); + assert(json.containsKey(r'email'), 'Required key "UserAdminResponseDto[email]" is missing from JSON.'); + assert(json[r'email'] != null, 'Required key "UserAdminResponseDto[email]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "UserAdminResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "UserAdminResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'isAdmin'), 'Required key "UserAdminResponseDto[isAdmin]" is missing from JSON.'); + assert(json[r'isAdmin'] != null, 'Required key "UserAdminResponseDto[isAdmin]" has a null value in JSON.'); + assert(json.containsKey(r'license'), 'Required key "UserAdminResponseDto[license]" is missing from JSON.'); + assert(json.containsKey(r'name'), 'Required key "UserAdminResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "UserAdminResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'oauthId'), 'Required key "UserAdminResponseDto[oauthId]" is missing from JSON.'); + assert(json[r'oauthId'] != null, 'Required key "UserAdminResponseDto[oauthId]" has a null value in JSON.'); + assert(json.containsKey(r'profileChangedAt'), 'Required key "UserAdminResponseDto[profileChangedAt]" is missing from JSON.'); + assert(json[r'profileChangedAt'] != null, 'Required key "UserAdminResponseDto[profileChangedAt]" has a null value in JSON.'); + assert(json.containsKey(r'profileImagePath'), 'Required key "UserAdminResponseDto[profileImagePath]" is missing from JSON.'); + assert(json[r'profileImagePath'] != null, 'Required key "UserAdminResponseDto[profileImagePath]" has a null value in JSON.'); + assert(json.containsKey(r'quotaSizeInBytes'), 'Required key "UserAdminResponseDto[quotaSizeInBytes]" is missing from JSON.'); + assert(json.containsKey(r'quotaUsageInBytes'), 'Required key "UserAdminResponseDto[quotaUsageInBytes]" is missing from JSON.'); + assert(json.containsKey(r'shouldChangePassword'), 'Required key "UserAdminResponseDto[shouldChangePassword]" is missing from JSON.'); + assert(json[r'shouldChangePassword'] != null, 'Required key "UserAdminResponseDto[shouldChangePassword]" has a null value in JSON.'); + assert(json.containsKey(r'status'), 'Required key "UserAdminResponseDto[status]" is missing from JSON.'); + assert(json[r'status'] != null, 'Required key "UserAdminResponseDto[status]" has a null value in JSON.'); + assert(json.containsKey(r'storageLabel'), 'Required key "UserAdminResponseDto[storageLabel]" is missing from JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "UserAdminResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "UserAdminResponseDto[updatedAt]" has a null value in JSON.'); + return true; + }()); + return UserAdminResponseDto( avatarColor: UserAvatarColor.fromJson(json[r'avatarColor'])!, createdAt: mapDateTime(json, r'createdAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, diff --git a/mobile/openapi/lib/model/user_admin_update_dto.dart b/mobile/openapi/lib/model/user_admin_update_dto.dart index 0c33a46139..0835942c56 100644 --- a/mobile/openapi/lib/model/user_admin_update_dto.dart +++ b/mobile/openapi/lib/model/user_admin_update_dto.dart @@ -13,18 +13,18 @@ part of openapi.api; class UserAdminUpdateDto { /// Returns a new [UserAdminUpdateDto] instance. UserAdminUpdateDto({ - this.avatarColor, - this.email, - this.isAdmin, - this.name, - this.password, - this.pinCode, - this.quotaSizeInBytes, - this.shouldChangePassword, - this.storageLabel, + this.avatarColor = const Optional.absent(), + this.email = const Optional.absent(), + this.isAdmin = const Optional.absent(), + this.name = const Optional.absent(), + this.password = const Optional.absent(), + this.pinCode = const Optional.absent(), + this.quotaSizeInBytes = const Optional.absent(), + this.shouldChangePassword = const Optional.absent(), + this.storageLabel = const Optional.absent(), }); - UserAvatarColor? avatarColor; + Optional avatarColor; /// User email /// @@ -33,7 +33,7 @@ class UserAdminUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? email; + Optional email; /// Grant admin privileges /// @@ -42,7 +42,7 @@ class UserAdminUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? isAdmin; + Optional isAdmin; /// User name /// @@ -51,7 +51,7 @@ class UserAdminUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? name; + Optional name; /// User password /// @@ -60,16 +60,16 @@ class UserAdminUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? password; + Optional password; /// PIN code - String? pinCode; + Optional pinCode; /// Storage quota in bytes /// /// Minimum value: 0 /// Maximum value: 9007199254740991 - int? quotaSizeInBytes; + Optional quotaSizeInBytes; /// Require password change on next login /// @@ -78,10 +78,10 @@ class UserAdminUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? shouldChangePassword; + Optional shouldChangePassword; /// Storage label - String? storageLabel; + Optional storageLabel; @override bool operator ==(Object other) => identical(this, other) || other is UserAdminUpdateDto && @@ -113,50 +113,41 @@ class UserAdminUpdateDto { Map toJson() { final json = {}; - if (this.avatarColor != null) { - json[r'avatarColor'] = this.avatarColor; - } else { - // json[r'avatarColor'] = null; + if (this.avatarColor.isPresent) { + final value = this.avatarColor.value; + json[r'avatarColor'] = value; } - if (this.email != null) { - json[r'email'] = this.email; - } else { - // json[r'email'] = null; + if (this.email.isPresent) { + final value = this.email.value; + json[r'email'] = value; } - if (this.isAdmin != null) { - json[r'isAdmin'] = this.isAdmin; - } else { - // json[r'isAdmin'] = null; + if (this.isAdmin.isPresent) { + final value = this.isAdmin.value; + json[r'isAdmin'] = value; } - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; } - if (this.password != null) { - json[r'password'] = this.password; - } else { - // json[r'password'] = null; + if (this.password.isPresent) { + final value = this.password.value; + json[r'password'] = value; } - if (this.pinCode != null) { - json[r'pinCode'] = this.pinCode; - } else { - // json[r'pinCode'] = null; + if (this.pinCode.isPresent) { + final value = this.pinCode.value; + json[r'pinCode'] = value; } - if (this.quotaSizeInBytes != null) { - json[r'quotaSizeInBytes'] = this.quotaSizeInBytes; - } else { - // json[r'quotaSizeInBytes'] = null; + if (this.quotaSizeInBytes.isPresent) { + final value = this.quotaSizeInBytes.value; + json[r'quotaSizeInBytes'] = value; } - if (this.shouldChangePassword != null) { - json[r'shouldChangePassword'] = this.shouldChangePassword; - } else { - // json[r'shouldChangePassword'] = null; + if (this.shouldChangePassword.isPresent) { + final value = this.shouldChangePassword.value; + json[r'shouldChangePassword'] = value; } - if (this.storageLabel != null) { - json[r'storageLabel'] = this.storageLabel; - } else { - // json[r'storageLabel'] = null; + if (this.storageLabel.isPresent) { + final value = this.storageLabel.value; + json[r'storageLabel'] = value; } return json; } @@ -169,16 +160,23 @@ class UserAdminUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return UserAdminUpdateDto( - avatarColor: UserAvatarColor.fromJson(json[r'avatarColor']), - email: mapValueOfType(json, r'email'), - isAdmin: mapValueOfType(json, r'isAdmin'), - name: mapValueOfType(json, r'name'), - password: mapValueOfType(json, r'password'), - pinCode: mapValueOfType(json, r'pinCode'), - quotaSizeInBytes: mapValueOfType(json, r'quotaSizeInBytes'), - shouldChangePassword: mapValueOfType(json, r'shouldChangePassword'), - storageLabel: mapValueOfType(json, r'storageLabel'), + avatarColor: json.containsKey(r'avatarColor') ? Optional.present(UserAvatarColor.fromJson(json[r'avatarColor'])) : const Optional.absent(), + email: json.containsKey(r'email') ? Optional.present(mapValueOfType(json, r'email')) : const Optional.absent(), + isAdmin: json.containsKey(r'isAdmin') ? Optional.present(mapValueOfType(json, r'isAdmin')) : const Optional.absent(), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), + password: json.containsKey(r'password') ? Optional.present(mapValueOfType(json, r'password')) : const Optional.absent(), + pinCode: json.containsKey(r'pinCode') ? Optional.present(mapValueOfType(json, r'pinCode')) : const Optional.absent(), + quotaSizeInBytes: json.containsKey(r'quotaSizeInBytes') ? Optional.present(json[r'quotaSizeInBytes'] == null ? null : int.parse('${json[r'quotaSizeInBytes']}')) : const Optional.absent(), + shouldChangePassword: json.containsKey(r'shouldChangePassword') ? Optional.present(mapValueOfType(json, r'shouldChangePassword')) : const Optional.absent(), + storageLabel: json.containsKey(r'storageLabel') ? Optional.present(mapValueOfType(json, r'storageLabel')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/user_license.dart b/mobile/openapi/lib/model/user_license.dart index 8ef46a0bb5..2ab0be2e0a 100644 --- a/mobile/openapi/lib/model/user_license.dart +++ b/mobile/openapi/lib/model/user_license.dart @@ -61,6 +61,19 @@ class UserLicense { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'activatedAt'), 'Required key "UserLicense[activatedAt]" is missing from JSON.'); + assert(json[r'activatedAt'] != null, 'Required key "UserLicense[activatedAt]" has a null value in JSON.'); + assert(json.containsKey(r'activationKey'), 'Required key "UserLicense[activationKey]" is missing from JSON.'); + assert(json[r'activationKey'] != null, 'Required key "UserLicense[activationKey]" has a null value in JSON.'); + assert(json.containsKey(r'licenseKey'), 'Required key "UserLicense[licenseKey]" is missing from JSON.'); + assert(json[r'licenseKey'] != null, 'Required key "UserLicense[licenseKey]" has a null value in JSON.'); + return true; + }()); + return UserLicense( activatedAt: mapDateTime(json, r'activatedAt', r'/^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$/')!, activationKey: mapValueOfType(json, r'activationKey')!, diff --git a/mobile/openapi/lib/model/user_preferences_response_dto.dart b/mobile/openapi/lib/model/user_preferences_response_dto.dart index 7a6e0252af..6b14dad301 100644 --- a/mobile/openapi/lib/model/user_preferences_response_dto.dart +++ b/mobile/openapi/lib/model/user_preferences_response_dto.dart @@ -104,6 +104,35 @@ class UserPreferencesResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'albums'), 'Required key "UserPreferencesResponseDto[albums]" is missing from JSON.'); + assert(json[r'albums'] != null, 'Required key "UserPreferencesResponseDto[albums]" has a null value in JSON.'); + assert(json.containsKey(r'cast'), 'Required key "UserPreferencesResponseDto[cast]" is missing from JSON.'); + assert(json[r'cast'] != null, 'Required key "UserPreferencesResponseDto[cast]" has a null value in JSON.'); + assert(json.containsKey(r'download'), 'Required key "UserPreferencesResponseDto[download]" is missing from JSON.'); + assert(json[r'download'] != null, 'Required key "UserPreferencesResponseDto[download]" has a null value in JSON.'); + assert(json.containsKey(r'emailNotifications'), 'Required key "UserPreferencesResponseDto[emailNotifications]" is missing from JSON.'); + assert(json[r'emailNotifications'] != null, 'Required key "UserPreferencesResponseDto[emailNotifications]" has a null value in JSON.'); + assert(json.containsKey(r'folders'), 'Required key "UserPreferencesResponseDto[folders]" is missing from JSON.'); + assert(json[r'folders'] != null, 'Required key "UserPreferencesResponseDto[folders]" has a null value in JSON.'); + assert(json.containsKey(r'memories'), 'Required key "UserPreferencesResponseDto[memories]" is missing from JSON.'); + assert(json[r'memories'] != null, 'Required key "UserPreferencesResponseDto[memories]" has a null value in JSON.'); + assert(json.containsKey(r'people'), 'Required key "UserPreferencesResponseDto[people]" is missing from JSON.'); + assert(json[r'people'] != null, 'Required key "UserPreferencesResponseDto[people]" has a null value in JSON.'); + assert(json.containsKey(r'purchase'), 'Required key "UserPreferencesResponseDto[purchase]" is missing from JSON.'); + assert(json[r'purchase'] != null, 'Required key "UserPreferencesResponseDto[purchase]" has a null value in JSON.'); + assert(json.containsKey(r'ratings'), 'Required key "UserPreferencesResponseDto[ratings]" is missing from JSON.'); + assert(json[r'ratings'] != null, 'Required key "UserPreferencesResponseDto[ratings]" has a null value in JSON.'); + assert(json.containsKey(r'sharedLinks'), 'Required key "UserPreferencesResponseDto[sharedLinks]" is missing from JSON.'); + assert(json[r'sharedLinks'] != null, 'Required key "UserPreferencesResponseDto[sharedLinks]" has a null value in JSON.'); + assert(json.containsKey(r'tags'), 'Required key "UserPreferencesResponseDto[tags]" is missing from JSON.'); + assert(json[r'tags'] != null, 'Required key "UserPreferencesResponseDto[tags]" has a null value in JSON.'); + return true; + }()); + return UserPreferencesResponseDto( albums: AlbumsResponse.fromJson(json[r'albums'])!, cast: CastResponse.fromJson(json[r'cast'])!, diff --git a/mobile/openapi/lib/model/user_preferences_update_dto.dart b/mobile/openapi/lib/model/user_preferences_update_dto.dart index 3b9b178b55..f7e0b51b38 100644 --- a/mobile/openapi/lib/model/user_preferences_update_dto.dart +++ b/mobile/openapi/lib/model/user_preferences_update_dto.dart @@ -13,18 +13,18 @@ part of openapi.api; class UserPreferencesUpdateDto { /// Returns a new [UserPreferencesUpdateDto] instance. UserPreferencesUpdateDto({ - this.albums, - this.avatar, - this.cast, - this.download, - this.emailNotifications, - this.folders, - this.memories, - this.people, - this.purchase, - this.ratings, - this.sharedLinks, - this.tags, + this.albums = const Optional.absent(), + this.avatar = const Optional.absent(), + this.cast = const Optional.absent(), + this.download = const Optional.absent(), + this.emailNotifications = const Optional.absent(), + this.folders = const Optional.absent(), + this.memories = const Optional.absent(), + this.people = const Optional.absent(), + this.purchase = const Optional.absent(), + this.ratings = const Optional.absent(), + this.sharedLinks = const Optional.absent(), + this.tags = const Optional.absent(), }); /// @@ -33,7 +33,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AlbumsUpdate? albums; + Optional albums; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -41,7 +41,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - AvatarUpdate? avatar; + Optional avatar; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -49,7 +49,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - CastUpdate? cast; + Optional cast; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -57,7 +57,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - DownloadUpdate? download; + Optional download; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -65,7 +65,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - EmailNotificationsUpdate? emailNotifications; + Optional emailNotifications; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -73,7 +73,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - FoldersUpdate? folders; + Optional folders; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -81,7 +81,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - MemoriesUpdate? memories; + Optional memories; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -89,7 +89,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - PeopleUpdate? people; + Optional people; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -97,7 +97,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - PurchaseUpdate? purchase; + Optional purchase; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -105,7 +105,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - RatingsUpdate? ratings; + Optional ratings; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -113,7 +113,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - SharedLinksUpdate? sharedLinks; + Optional sharedLinks; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -121,7 +121,7 @@ class UserPreferencesUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - TagsUpdate? tags; + Optional tags; @override bool operator ==(Object other) => identical(this, other) || other is UserPreferencesUpdateDto && @@ -159,65 +159,53 @@ class UserPreferencesUpdateDto { Map toJson() { final json = {}; - if (this.albums != null) { - json[r'albums'] = this.albums; - } else { - // json[r'albums'] = null; + if (this.albums.isPresent) { + final value = this.albums.value; + json[r'albums'] = value; } - if (this.avatar != null) { - json[r'avatar'] = this.avatar; - } else { - // json[r'avatar'] = null; + if (this.avatar.isPresent) { + final value = this.avatar.value; + json[r'avatar'] = value; } - if (this.cast != null) { - json[r'cast'] = this.cast; - } else { - // json[r'cast'] = null; + if (this.cast.isPresent) { + final value = this.cast.value; + json[r'cast'] = value; } - if (this.download != null) { - json[r'download'] = this.download; - } else { - // json[r'download'] = null; + if (this.download.isPresent) { + final value = this.download.value; + json[r'download'] = value; } - if (this.emailNotifications != null) { - json[r'emailNotifications'] = this.emailNotifications; - } else { - // json[r'emailNotifications'] = null; + if (this.emailNotifications.isPresent) { + final value = this.emailNotifications.value; + json[r'emailNotifications'] = value; } - if (this.folders != null) { - json[r'folders'] = this.folders; - } else { - // json[r'folders'] = null; + if (this.folders.isPresent) { + final value = this.folders.value; + json[r'folders'] = value; } - if (this.memories != null) { - json[r'memories'] = this.memories; - } else { - // json[r'memories'] = null; + if (this.memories.isPresent) { + final value = this.memories.value; + json[r'memories'] = value; } - if (this.people != null) { - json[r'people'] = this.people; - } else { - // json[r'people'] = null; + if (this.people.isPresent) { + final value = this.people.value; + json[r'people'] = value; } - if (this.purchase != null) { - json[r'purchase'] = this.purchase; - } else { - // json[r'purchase'] = null; + if (this.purchase.isPresent) { + final value = this.purchase.value; + json[r'purchase'] = value; } - if (this.ratings != null) { - json[r'ratings'] = this.ratings; - } else { - // json[r'ratings'] = null; + if (this.ratings.isPresent) { + final value = this.ratings.value; + json[r'ratings'] = value; } - if (this.sharedLinks != null) { - json[r'sharedLinks'] = this.sharedLinks; - } else { - // json[r'sharedLinks'] = null; + if (this.sharedLinks.isPresent) { + final value = this.sharedLinks.value; + json[r'sharedLinks'] = value; } - if (this.tags != null) { - json[r'tags'] = this.tags; - } else { - // json[r'tags'] = null; + if (this.tags.isPresent) { + final value = this.tags.value; + json[r'tags'] = value; } return json; } @@ -230,19 +218,26 @@ class UserPreferencesUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return UserPreferencesUpdateDto( - albums: AlbumsUpdate.fromJson(json[r'albums']), - avatar: AvatarUpdate.fromJson(json[r'avatar']), - cast: CastUpdate.fromJson(json[r'cast']), - download: DownloadUpdate.fromJson(json[r'download']), - emailNotifications: EmailNotificationsUpdate.fromJson(json[r'emailNotifications']), - folders: FoldersUpdate.fromJson(json[r'folders']), - memories: MemoriesUpdate.fromJson(json[r'memories']), - people: PeopleUpdate.fromJson(json[r'people']), - purchase: PurchaseUpdate.fromJson(json[r'purchase']), - ratings: RatingsUpdate.fromJson(json[r'ratings']), - sharedLinks: SharedLinksUpdate.fromJson(json[r'sharedLinks']), - tags: TagsUpdate.fromJson(json[r'tags']), + albums: json.containsKey(r'albums') ? Optional.present(AlbumsUpdate.fromJson(json[r'albums'])) : const Optional.absent(), + avatar: json.containsKey(r'avatar') ? Optional.present(AvatarUpdate.fromJson(json[r'avatar'])) : const Optional.absent(), + cast: json.containsKey(r'cast') ? Optional.present(CastUpdate.fromJson(json[r'cast'])) : const Optional.absent(), + download: json.containsKey(r'download') ? Optional.present(DownloadUpdate.fromJson(json[r'download'])) : const Optional.absent(), + emailNotifications: json.containsKey(r'emailNotifications') ? Optional.present(EmailNotificationsUpdate.fromJson(json[r'emailNotifications'])) : const Optional.absent(), + folders: json.containsKey(r'folders') ? Optional.present(FoldersUpdate.fromJson(json[r'folders'])) : const Optional.absent(), + memories: json.containsKey(r'memories') ? Optional.present(MemoriesUpdate.fromJson(json[r'memories'])) : const Optional.absent(), + people: json.containsKey(r'people') ? Optional.present(PeopleUpdate.fromJson(json[r'people'])) : const Optional.absent(), + purchase: json.containsKey(r'purchase') ? Optional.present(PurchaseUpdate.fromJson(json[r'purchase'])) : const Optional.absent(), + ratings: json.containsKey(r'ratings') ? Optional.present(RatingsUpdate.fromJson(json[r'ratings'])) : const Optional.absent(), + sharedLinks: json.containsKey(r'sharedLinks') ? Optional.present(SharedLinksUpdate.fromJson(json[r'sharedLinks'])) : const Optional.absent(), + tags: json.containsKey(r'tags') ? Optional.present(TagsUpdate.fromJson(json[r'tags'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/user_response_dto.dart b/mobile/openapi/lib/model/user_response_dto.dart index f671072c72..a91ea2a839 100644 --- a/mobile/openapi/lib/model/user_response_dto.dart +++ b/mobile/openapi/lib/model/user_response_dto.dart @@ -79,6 +79,25 @@ class UserResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'avatarColor'), 'Required key "UserResponseDto[avatarColor]" is missing from JSON.'); + assert(json[r'avatarColor'] != null, 'Required key "UserResponseDto[avatarColor]" has a null value in JSON.'); + assert(json.containsKey(r'email'), 'Required key "UserResponseDto[email]" is missing from JSON.'); + assert(json[r'email'] != null, 'Required key "UserResponseDto[email]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "UserResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "UserResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "UserResponseDto[name]" is missing from JSON.'); + assert(json[r'name'] != null, 'Required key "UserResponseDto[name]" has a null value in JSON.'); + assert(json.containsKey(r'profileChangedAt'), 'Required key "UserResponseDto[profileChangedAt]" is missing from JSON.'); + assert(json[r'profileChangedAt'] != null, 'Required key "UserResponseDto[profileChangedAt]" has a null value in JSON.'); + assert(json.containsKey(r'profileImagePath'), 'Required key "UserResponseDto[profileImagePath]" is missing from JSON.'); + assert(json[r'profileImagePath'] != null, 'Required key "UserResponseDto[profileImagePath]" has a null value in JSON.'); + return true; + }()); + return UserResponseDto( avatarColor: UserAvatarColor.fromJson(json[r'avatarColor'])!, email: mapValueOfType(json, r'email')!, diff --git a/mobile/openapi/lib/model/user_update_me_dto.dart b/mobile/openapi/lib/model/user_update_me_dto.dart index 0751d4096b..654b2400be 100644 --- a/mobile/openapi/lib/model/user_update_me_dto.dart +++ b/mobile/openapi/lib/model/user_update_me_dto.dart @@ -13,13 +13,13 @@ part of openapi.api; class UserUpdateMeDto { /// Returns a new [UserUpdateMeDto] instance. UserUpdateMeDto({ - this.avatarColor, - this.email, - this.name, - this.password, + this.avatarColor = const Optional.absent(), + this.email = const Optional.absent(), + this.name = const Optional.absent(), + this.password = const Optional.absent(), }); - UserAvatarColor? avatarColor; + Optional avatarColor; /// User email /// @@ -28,7 +28,7 @@ class UserUpdateMeDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? email; + Optional email; /// User name /// @@ -37,7 +37,7 @@ class UserUpdateMeDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? name; + Optional name; /// User password (deprecated, use change password endpoint) /// @@ -46,7 +46,7 @@ class UserUpdateMeDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? password; + Optional password; @override bool operator ==(Object other) => identical(this, other) || other is UserUpdateMeDto && @@ -68,25 +68,21 @@ class UserUpdateMeDto { Map toJson() { final json = {}; - if (this.avatarColor != null) { - json[r'avatarColor'] = this.avatarColor; - } else { - // json[r'avatarColor'] = null; + if (this.avatarColor.isPresent) { + final value = this.avatarColor.value; + json[r'avatarColor'] = value; } - if (this.email != null) { - json[r'email'] = this.email; - } else { - // json[r'email'] = null; + if (this.email.isPresent) { + final value = this.email.value; + json[r'email'] = value; } - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; } - if (this.password != null) { - json[r'password'] = this.password; - } else { - // json[r'password'] = null; + if (this.password.isPresent) { + final value = this.password.value; + json[r'password'] = value; } return json; } @@ -99,11 +95,18 @@ class UserUpdateMeDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return UserUpdateMeDto( - avatarColor: UserAvatarColor.fromJson(json[r'avatarColor']), - email: mapValueOfType(json, r'email'), - name: mapValueOfType(json, r'name'), - password: mapValueOfType(json, r'password'), + avatarColor: json.containsKey(r'avatarColor') ? Optional.present(UserAvatarColor.fromJson(json[r'avatarColor'])) : const Optional.absent(), + email: json.containsKey(r'email') ? Optional.present(mapValueOfType(json, r'email')) : const Optional.absent(), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), + password: json.containsKey(r'password') ? Optional.present(mapValueOfType(json, r'password')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/validate_access_token_response_dto.dart b/mobile/openapi/lib/model/validate_access_token_response_dto.dart index 16b9d0f925..4fecdb3155 100644 --- a/mobile/openapi/lib/model/validate_access_token_response_dto.dart +++ b/mobile/openapi/lib/model/validate_access_token_response_dto.dart @@ -45,6 +45,15 @@ class ValidateAccessTokenResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'authStatus'), 'Required key "ValidateAccessTokenResponseDto[authStatus]" is missing from JSON.'); + assert(json[r'authStatus'] != null, 'Required key "ValidateAccessTokenResponseDto[authStatus]" has a null value in JSON.'); + return true; + }()); + return ValidateAccessTokenResponseDto( authStatus: mapValueOfType(json, r'authStatus')!, ); diff --git a/mobile/openapi/lib/model/validate_library_dto.dart b/mobile/openapi/lib/model/validate_library_dto.dart index 68fb0e9fe2..039a3ea1c2 100644 --- a/mobile/openapi/lib/model/validate_library_dto.dart +++ b/mobile/openapi/lib/model/validate_library_dto.dart @@ -13,15 +13,15 @@ part of openapi.api; class ValidateLibraryDto { /// Returns a new [ValidateLibraryDto] instance. ValidateLibraryDto({ - this.exclusionPatterns = const [], - this.importPaths = const [], + this.exclusionPatterns = const Optional.present(const []), + this.importPaths = const Optional.present(const []), }); /// Exclusion patterns (max 128) - List exclusionPatterns; + Optional?> exclusionPatterns; /// Import paths to validate (max 128) - List importPaths; + Optional?> importPaths; @override bool operator ==(Object other) => identical(this, other) || other is ValidateLibraryDto && @@ -39,8 +39,14 @@ class ValidateLibraryDto { Map toJson() { final json = {}; - json[r'exclusionPatterns'] = this.exclusionPatterns; - json[r'importPaths'] = this.importPaths; + if (this.exclusionPatterns.isPresent) { + final value = this.exclusionPatterns.value; + json[r'exclusionPatterns'] = value; + } + if (this.importPaths.isPresent) { + final value = this.importPaths.value; + json[r'importPaths'] = value; + } return json; } @@ -52,13 +58,20 @@ class ValidateLibraryDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return ValidateLibraryDto( - exclusionPatterns: json[r'exclusionPatterns'] is Iterable + exclusionPatterns: json.containsKey(r'exclusionPatterns') ? Optional.present(json[r'exclusionPatterns'] is Iterable ? (json[r'exclusionPatterns'] as Iterable).cast().toList(growable: false) - : const [], - importPaths: json[r'importPaths'] is Iterable + : const []) : const Optional.absent(), + importPaths: json.containsKey(r'importPaths') ? Optional.present(json[r'importPaths'] is Iterable ? (json[r'importPaths'] as Iterable).cast().toList(growable: false) - : const [], + : const []) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/validate_library_import_path_response_dto.dart b/mobile/openapi/lib/model/validate_library_import_path_response_dto.dart index ebcb881935..09e4db903a 100644 --- a/mobile/openapi/lib/model/validate_library_import_path_response_dto.dart +++ b/mobile/openapi/lib/model/validate_library_import_path_response_dto.dart @@ -15,7 +15,7 @@ class ValidateLibraryImportPathResponseDto { ValidateLibraryImportPathResponseDto({ required this.importPath, required this.isValid, - this.message, + this.message = const Optional.absent(), }); /// Import path @@ -31,7 +31,7 @@ class ValidateLibraryImportPathResponseDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - String? message; + Optional message; @override bool operator ==(Object other) => identical(this, other) || other is ValidateLibraryImportPathResponseDto && @@ -53,10 +53,9 @@ class ValidateLibraryImportPathResponseDto { final json = {}; json[r'importPath'] = this.importPath; json[r'isValid'] = this.isValid; - if (this.message != null) { - json[r'message'] = this.message; - } else { - // json[r'message'] = null; + if (this.message.isPresent) { + final value = this.message.value; + json[r'message'] = value; } return json; } @@ -69,10 +68,21 @@ class ValidateLibraryImportPathResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'importPath'), 'Required key "ValidateLibraryImportPathResponseDto[importPath]" is missing from JSON.'); + assert(json[r'importPath'] != null, 'Required key "ValidateLibraryImportPathResponseDto[importPath]" has a null value in JSON.'); + assert(json.containsKey(r'isValid'), 'Required key "ValidateLibraryImportPathResponseDto[isValid]" is missing from JSON.'); + assert(json[r'isValid'] != null, 'Required key "ValidateLibraryImportPathResponseDto[isValid]" has a null value in JSON.'); + return true; + }()); + return ValidateLibraryImportPathResponseDto( importPath: mapValueOfType(json, r'importPath')!, isValid: mapValueOfType(json, r'isValid')!, - message: mapValueOfType(json, r'message'), + message: json.containsKey(r'message') ? Optional.present(mapValueOfType(json, r'message')) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/validate_library_response_dto.dart b/mobile/openapi/lib/model/validate_library_response_dto.dart index 37f6ad07d1..84bb623cb1 100644 --- a/mobile/openapi/lib/model/validate_library_response_dto.dart +++ b/mobile/openapi/lib/model/validate_library_response_dto.dart @@ -13,11 +13,11 @@ part of openapi.api; class ValidateLibraryResponseDto { /// Returns a new [ValidateLibraryResponseDto] instance. ValidateLibraryResponseDto({ - this.importPaths = const [], + this.importPaths = const Optional.present(const []), }); /// Validation results for import paths - List importPaths; + Optional?> importPaths; @override bool operator ==(Object other) => identical(this, other) || other is ValidateLibraryResponseDto && @@ -33,7 +33,10 @@ class ValidateLibraryResponseDto { Map toJson() { final json = {}; - json[r'importPaths'] = this.importPaths; + if (this.importPaths.isPresent) { + final value = this.importPaths.value; + json[r'importPaths'] = value; + } return json; } @@ -45,8 +48,15 @@ class ValidateLibraryResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return ValidateLibraryResponseDto( - importPaths: ValidateLibraryImportPathResponseDto.listFromJson(json[r'importPaths']), + importPaths: json.containsKey(r'importPaths') ? Optional.present(ValidateLibraryImportPathResponseDto.listFromJson(json[r'importPaths'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/model/version_check_state_response_dto.dart b/mobile/openapi/lib/model/version_check_state_response_dto.dart index 71075a681c..fd1d4c8528 100644 --- a/mobile/openapi/lib/model/version_check_state_response_dto.dart +++ b/mobile/openapi/lib/model/version_check_state_response_dto.dart @@ -42,12 +42,12 @@ class VersionCheckStateResponseDto { if (this.checkedAt != null) { json[r'checkedAt'] = this.checkedAt; } else { - // json[r'checkedAt'] = null; + json[r'checkedAt'] = null; } if (this.releaseVersion != null) { json[r'releaseVersion'] = this.releaseVersion; } else { - // json[r'releaseVersion'] = null; + json[r'releaseVersion'] = null; } return json; } @@ -60,6 +60,15 @@ class VersionCheckStateResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'checkedAt'), 'Required key "VersionCheckStateResponseDto[checkedAt]" is missing from JSON.'); + assert(json.containsKey(r'releaseVersion'), 'Required key "VersionCheckStateResponseDto[releaseVersion]" is missing from JSON.'); + return true; + }()); + return VersionCheckStateResponseDto( checkedAt: mapValueOfType(json, r'checkedAt'), releaseVersion: mapValueOfType(json, r'releaseVersion'), diff --git a/mobile/openapi/lib/model/workflow_create_dto.dart b/mobile/openapi/lib/model/workflow_create_dto.dart index dfd2d51290..f42331acf9 100644 --- a/mobile/openapi/lib/model/workflow_create_dto.dart +++ b/mobile/openapi/lib/model/workflow_create_dto.dart @@ -13,15 +13,15 @@ part of openapi.api; class WorkflowCreateDto { /// Returns a new [WorkflowCreateDto] instance. WorkflowCreateDto({ - this.description, - this.enabled, - this.name, - this.steps = const [], + this.description = const Optional.absent(), + this.enabled = const Optional.absent(), + this.name = const Optional.absent(), + this.steps = const Optional.present(const []), required this.trigger, }); /// Workflow description - String? description; + Optional description; /// Workflow enabled /// @@ -30,12 +30,12 @@ class WorkflowCreateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; /// Workflow name - String? name; + Optional name; - List steps; + Optional?> steps; WorkflowTrigger trigger; @@ -61,22 +61,22 @@ class WorkflowCreateDto { Map toJson() { final json = {}; - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; + } + if (this.steps.isPresent) { + final value = this.steps.value; + json[r'steps'] = value; } - json[r'steps'] = this.steps; json[r'trigger'] = this.trigger; return json; } @@ -89,11 +89,20 @@ class WorkflowCreateDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'trigger'), 'Required key "WorkflowCreateDto[trigger]" is missing from JSON.'); + assert(json[r'trigger'] != null, 'Required key "WorkflowCreateDto[trigger]" has a null value in JSON.'); + return true; + }()); + return WorkflowCreateDto( - description: mapValueOfType(json, r'description'), - enabled: mapValueOfType(json, r'enabled'), - name: mapValueOfType(json, r'name'), - steps: WorkflowStepDto.listFromJson(json[r'steps']), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), + steps: json.containsKey(r'steps') ? Optional.present(WorkflowStepDto.listFromJson(json[r'steps'])) : const Optional.absent(), trigger: WorkflowTrigger.fromJson(json[r'trigger'])!, ); } diff --git a/mobile/openapi/lib/model/workflow_response_dto.dart b/mobile/openapi/lib/model/workflow_response_dto.dart index f44506d69d..07ebf98125 100644 --- a/mobile/openapi/lib/model/workflow_response_dto.dart +++ b/mobile/openapi/lib/model/workflow_response_dto.dart @@ -78,14 +78,14 @@ class WorkflowResponseDto { if (this.description != null) { json[r'description'] = this.description; } else { - // json[r'description'] = null; + json[r'description'] = null; } json[r'enabled'] = this.enabled; json[r'id'] = this.id; if (this.name != null) { json[r'name'] = this.name; } else { - // json[r'name'] = null; + json[r'name'] = null; } json[r'steps'] = this.steps; json[r'trigger'] = this.trigger; @@ -101,6 +101,27 @@ class WorkflowResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'createdAt'), 'Required key "WorkflowResponseDto[createdAt]" is missing from JSON.'); + assert(json[r'createdAt'] != null, 'Required key "WorkflowResponseDto[createdAt]" has a null value in JSON.'); + assert(json.containsKey(r'description'), 'Required key "WorkflowResponseDto[description]" is missing from JSON.'); + assert(json.containsKey(r'enabled'), 'Required key "WorkflowResponseDto[enabled]" is missing from JSON.'); + assert(json[r'enabled'] != null, 'Required key "WorkflowResponseDto[enabled]" has a null value in JSON.'); + assert(json.containsKey(r'id'), 'Required key "WorkflowResponseDto[id]" is missing from JSON.'); + assert(json[r'id'] != null, 'Required key "WorkflowResponseDto[id]" has a null value in JSON.'); + assert(json.containsKey(r'name'), 'Required key "WorkflowResponseDto[name]" is missing from JSON.'); + assert(json.containsKey(r'steps'), 'Required key "WorkflowResponseDto[steps]" is missing from JSON.'); + assert(json[r'steps'] != null, 'Required key "WorkflowResponseDto[steps]" has a null value in JSON.'); + assert(json.containsKey(r'trigger'), 'Required key "WorkflowResponseDto[trigger]" is missing from JSON.'); + assert(json[r'trigger'] != null, 'Required key "WorkflowResponseDto[trigger]" has a null value in JSON.'); + assert(json.containsKey(r'updatedAt'), 'Required key "WorkflowResponseDto[updatedAt]" is missing from JSON.'); + assert(json[r'updatedAt'] != null, 'Required key "WorkflowResponseDto[updatedAt]" has a null value in JSON.'); + return true; + }()); + return WorkflowResponseDto( createdAt: mapValueOfType(json, r'createdAt')!, description: mapValueOfType(json, r'description'), diff --git a/mobile/openapi/lib/model/workflow_share_response_dto.dart b/mobile/openapi/lib/model/workflow_share_response_dto.dart index 336e8503c5..a55e295a50 100644 --- a/mobile/openapi/lib/model/workflow_share_response_dto.dart +++ b/mobile/openapi/lib/model/workflow_share_response_dto.dart @@ -53,12 +53,12 @@ class WorkflowShareResponseDto { if (this.description != null) { json[r'description'] = this.description; } else { - // json[r'description'] = null; + json[r'description'] = null; } if (this.name != null) { json[r'name'] = this.name; } else { - // json[r'name'] = null; + json[r'name'] = null; } json[r'steps'] = this.steps; json[r'trigger'] = this.trigger; @@ -73,6 +73,19 @@ class WorkflowShareResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'description'), 'Required key "WorkflowShareResponseDto[description]" is missing from JSON.'); + assert(json.containsKey(r'name'), 'Required key "WorkflowShareResponseDto[name]" is missing from JSON.'); + assert(json.containsKey(r'steps'), 'Required key "WorkflowShareResponseDto[steps]" is missing from JSON.'); + assert(json[r'steps'] != null, 'Required key "WorkflowShareResponseDto[steps]" has a null value in JSON.'); + assert(json.containsKey(r'trigger'), 'Required key "WorkflowShareResponseDto[trigger]" is missing from JSON.'); + assert(json[r'trigger'] != null, 'Required key "WorkflowShareResponseDto[trigger]" has a null value in JSON.'); + return true; + }()); + return WorkflowShareResponseDto( description: mapValueOfType(json, r'description'), name: mapValueOfType(json, r'name'), diff --git a/mobile/openapi/lib/model/workflow_share_step_dto.dart b/mobile/openapi/lib/model/workflow_share_step_dto.dart index 79c55ef716..c566002d1a 100644 --- a/mobile/openapi/lib/model/workflow_share_step_dto.dart +++ b/mobile/openapi/lib/model/workflow_share_step_dto.dart @@ -14,7 +14,7 @@ class WorkflowShareStepDto { /// Returns a new [WorkflowShareStepDto] instance. WorkflowShareStepDto({ this.config = const {}, - this.enabled, + this.enabled = const Optional.absent(), required this.method, }); @@ -28,7 +28,7 @@ class WorkflowShareStepDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; /// Step plugin method String method; @@ -54,12 +54,11 @@ class WorkflowShareStepDto { if (this.config != null) { json[r'config'] = this.config; } else { - // json[r'config'] = null; + json[r'config'] = null; } - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } json[r'method'] = this.method; return json; @@ -73,9 +72,19 @@ class WorkflowShareStepDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'config'), 'Required key "WorkflowShareStepDto[config]" is missing from JSON.'); + assert(json.containsKey(r'method'), 'Required key "WorkflowShareStepDto[method]" is missing from JSON.'); + assert(json[r'method'] != null, 'Required key "WorkflowShareStepDto[method]" has a null value in JSON.'); + return true; + }()); + return WorkflowShareStepDto( config: mapCastOfType(json, r'config'), - enabled: mapValueOfType(json, r'enabled'), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), method: mapValueOfType(json, r'method')!, ); } diff --git a/mobile/openapi/lib/model/workflow_step_dto.dart b/mobile/openapi/lib/model/workflow_step_dto.dart index e881ad3150..b0cf5ba053 100644 --- a/mobile/openapi/lib/model/workflow_step_dto.dart +++ b/mobile/openapi/lib/model/workflow_step_dto.dart @@ -14,7 +14,7 @@ class WorkflowStepDto { /// Returns a new [WorkflowStepDto] instance. WorkflowStepDto({ this.config = const {}, - this.enabled, + this.enabled = const Optional.absent(), required this.method, }); @@ -28,7 +28,7 @@ class WorkflowStepDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; /// Step plugin method String method; @@ -54,12 +54,11 @@ class WorkflowStepDto { if (this.config != null) { json[r'config'] = this.config; } else { - // json[r'config'] = null; + json[r'config'] = null; } - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } json[r'method'] = this.method; return json; @@ -73,9 +72,19 @@ class WorkflowStepDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'config'), 'Required key "WorkflowStepDto[config]" is missing from JSON.'); + assert(json.containsKey(r'method'), 'Required key "WorkflowStepDto[method]" is missing from JSON.'); + assert(json[r'method'] != null, 'Required key "WorkflowStepDto[method]" has a null value in JSON.'); + return true; + }()); + return WorkflowStepDto( config: mapCastOfType(json, r'config'), - enabled: mapValueOfType(json, r'enabled'), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), method: mapValueOfType(json, r'method')!, ); } diff --git a/mobile/openapi/lib/model/workflow_trigger_response_dto.dart b/mobile/openapi/lib/model/workflow_trigger_response_dto.dart index 6e24e1559a..aa714e259f 100644 --- a/mobile/openapi/lib/model/workflow_trigger_response_dto.dart +++ b/mobile/openapi/lib/model/workflow_trigger_response_dto.dart @@ -51,6 +51,17 @@ class WorkflowTriggerResponseDto { if (value is Map) { final json = value.cast(); + // 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(() { + assert(json.containsKey(r'trigger'), 'Required key "WorkflowTriggerResponseDto[trigger]" is missing from JSON.'); + assert(json[r'trigger'] != null, 'Required key "WorkflowTriggerResponseDto[trigger]" has a null value in JSON.'); + assert(json.containsKey(r'types'), 'Required key "WorkflowTriggerResponseDto[types]" is missing from JSON.'); + assert(json[r'types'] != null, 'Required key "WorkflowTriggerResponseDto[types]" has a null value in JSON.'); + return true; + }()); + return WorkflowTriggerResponseDto( trigger: WorkflowTrigger.fromJson(json[r'trigger'])!, types: WorkflowType.listFromJson(json[r'types']), diff --git a/mobile/openapi/lib/model/workflow_update_dto.dart b/mobile/openapi/lib/model/workflow_update_dto.dart index 0bce75283a..9bc2dec727 100644 --- a/mobile/openapi/lib/model/workflow_update_dto.dart +++ b/mobile/openapi/lib/model/workflow_update_dto.dart @@ -13,15 +13,15 @@ part of openapi.api; class WorkflowUpdateDto { /// Returns a new [WorkflowUpdateDto] instance. WorkflowUpdateDto({ - this.description, - this.enabled, - this.name, - this.steps = const [], - this.trigger, + this.description = const Optional.absent(), + this.enabled = const Optional.absent(), + this.name = const Optional.absent(), + this.steps = const Optional.present(const []), + this.trigger = const Optional.absent(), }); /// Workflow description - String? description; + Optional description; /// Workflow enabled /// @@ -30,12 +30,12 @@ class WorkflowUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - bool? enabled; + Optional enabled; /// Workflow name - String? name; + Optional name; - List steps; + Optional?> steps; /// /// Please note: This property should have been non-nullable! Since the specification file @@ -43,7 +43,7 @@ class WorkflowUpdateDto { /// source code must fall back to having a nullable type. /// Consider adding a "default:" property in the specification file to hide this note. /// - WorkflowTrigger? trigger; + Optional trigger; @override bool operator ==(Object other) => identical(this, other) || other is WorkflowUpdateDto && @@ -67,26 +67,25 @@ class WorkflowUpdateDto { Map toJson() { final json = {}; - if (this.description != null) { - json[r'description'] = this.description; - } else { - // json[r'description'] = null; + if (this.description.isPresent) { + final value = this.description.value; + json[r'description'] = value; } - if (this.enabled != null) { - json[r'enabled'] = this.enabled; - } else { - // json[r'enabled'] = null; + if (this.enabled.isPresent) { + final value = this.enabled.value; + json[r'enabled'] = value; } - if (this.name != null) { - json[r'name'] = this.name; - } else { - // json[r'name'] = null; + if (this.name.isPresent) { + final value = this.name.value; + json[r'name'] = value; } - json[r'steps'] = this.steps; - if (this.trigger != null) { - json[r'trigger'] = this.trigger; - } else { - // json[r'trigger'] = null; + if (this.steps.isPresent) { + final value = this.steps.value; + json[r'steps'] = value; + } + if (this.trigger.isPresent) { + final value = this.trigger.value; + json[r'trigger'] = value; } return json; } @@ -99,12 +98,19 @@ class WorkflowUpdateDto { if (value is Map) { final json = value.cast(); + // 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(() { + return true; + }()); + return WorkflowUpdateDto( - description: mapValueOfType(json, r'description'), - enabled: mapValueOfType(json, r'enabled'), - name: mapValueOfType(json, r'name'), - steps: WorkflowStepDto.listFromJson(json[r'steps']), - trigger: WorkflowTrigger.fromJson(json[r'trigger']), + description: json.containsKey(r'description') ? Optional.present(mapValueOfType(json, r'description')) : const Optional.absent(), + enabled: json.containsKey(r'enabled') ? Optional.present(mapValueOfType(json, r'enabled')) : const Optional.absent(), + name: json.containsKey(r'name') ? Optional.present(mapValueOfType(json, r'name')) : const Optional.absent(), + steps: json.containsKey(r'steps') ? Optional.present(WorkflowStepDto.listFromJson(json[r'steps'])) : const Optional.absent(), + trigger: json.containsKey(r'trigger') ? Optional.present(WorkflowTrigger.fromJson(json[r'trigger'])) : const Optional.absent(), ); } return null; diff --git a/mobile/openapi/lib/optional.dart b/mobile/openapi/lib/optional.dart new file mode 100644 index 0000000000..f260ec4a84 --- /dev/null +++ b/mobile/openapi/lib/optional.dart @@ -0,0 +1,119 @@ +// +// AUTO-GENERATED FILE, DO NOT MODIFY! +// +// @dart=2.18 + +// ignore_for_file: unused_element, unused_import +// ignore_for_file: always_put_required_named_parameters_first +// ignore_for_file: constant_identifier_names +// ignore_for_file: lines_longer_than_80_chars + +part of openapi.api; + +/// Represents an optional value that can be either absent or present. +/// +/// This is used to distinguish between three states in PATCH operations: +/// - Absent: Field is not set (omitted from JSON) +/// - Present with null: Field is explicitly set to null +/// - Present with value: Field has a value +/// +/// Example usage: +/// ```dart +/// // Field absent - not sent in request +/// final patch1 = Model(); +/// +/// // Field explicitly null - sends {"field": null} +/// final patch2 = Model(field: const Optional.present(null)); +/// +/// // Field has value - sends {"field": "value"} +/// final patch3 = Model(field: const Optional.present('value')); +/// ``` +abstract class Optional { + const Optional(); + + /// Creates an Optional with an absent value (not set). + const factory Optional.absent() = Absent; + + /// Creates an Optional with a present value (can be null). + const factory Optional.present(T value) = Present; + + /// Returns true if this Optional has a value (even if that value is null). + bool get isPresent; + + /// Returns true if this Optional does not have a value. + bool get isEmpty => !isPresent; + + /// Returns the value if present, throws if absent. + T get value; + + /// Returns the value if present, otherwise returns [defaultValue]. + T orElse(T defaultValue); + + /// Returns the value if present, otherwise returns the result of calling [defaultValue]. + T orElseGet(T Function() defaultValue); + + /// Maps the value if present using [transform], otherwise returns an absent Optional. + Optional map(R Function(T value) transform); +} + +/// Represents an absent Optional value. +class Absent extends Optional { + const Absent(); + + @override + bool get isPresent => false; + + @override + T get value => throw StateError('No value present'); + + @override + T orElse(T defaultValue) => defaultValue; + + @override + T orElseGet(T Function() defaultValue) => defaultValue(); + + @override + Optional map(R Function(T value) transform) => const Absent(); + + @override + bool operator ==(Object other) => other is Absent; + + @override + int get hashCode => 0; + + @override + String toString() => 'Optional.absent()'; +} + +/// Represents a present Optional value. +class Present extends Optional { + const Present(this._value); + + final T _value; + + @override + bool get isPresent => true; + + @override + T get value => _value; + + @override + T orElse(T defaultValue) => _value; + + @override + T orElseGet(T Function() defaultValue) => _value; + + @override + Optional map(R Function(T value) transform) => Optional.present(transform(_value)); + + @override + bool operator ==(Object other) => + identical(this, other) || + (other is Present && _value == other._value); + + @override + int get hashCode => _value.hashCode; + + @override + String toString() => 'Optional.present($_value)'; +} diff --git a/open-api/templates/mobile/api.mustache b/open-api/templates/mobile/api.mustache index 2cd4c0f04e..8c6d2bb96e 100644 --- a/open-api/templates/mobile/api.mustache +++ b/open-api/templates/mobile/api.mustache @@ -1,5 +1,6 @@ {{>header}} {{>part_of}} + {{#operations}} class {{{classname}}} { diff --git a/open-api/templates/mobile/serialization/native/native_class.mustache b/open-api/templates/mobile/serialization/native/native_class.mustache index 2d6e6d24f3..d13e0d1c9f 100644 --- a/open-api/templates/mobile/serialization/native/native_class.mustache +++ b/open-api/templates/mobile/serialization/native/native_class.mustache @@ -1,5 +1,6 @@ class {{{classname}}} { {{>dart_constructor}} + {{#vars}} {{#description}} /// {{{.}}} @@ -32,7 +33,17 @@ class {{{classname}}} { {{/required}} {{/isNullable}} {{/isEnum}} - {{#isArray}}{{#uniqueItems}}Set{{/uniqueItems}}{{^uniqueItems}}List{{/uniqueItems}}<{{{items.dataType}}}{{#items.isNullable}}?{{/items.isNullable}}>{{/isArray}}{{^isArray}}{{{datatypeWithEnum}}}{{/isArray}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^required}}{{^defaultValue}}?{{/defaultValue}}{{/required}}{{/isNullable}} {{{name}}}; + {{#required}} + {{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}} {{{name}}}; + {{/required}} + {{^required}} + {{#vendorExtensions.x-is-optional}} + {{{datatypeWithEnum}}} {{{name}}}; + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} + {{{datatypeWithEnum}}}{{#isNullable}}?{{/isNullable}}{{^isNullable}}{{^defaultValue}}?{{/defaultValue}}{{/isNullable}} {{{name}}}; + {{/vendorExtensions.x-is-optional}} + {{/required}} {{/vars}} @override @@ -54,6 +65,37 @@ class {{{classname}}} { Map toJson() { final json = {}; {{#vars}} + {{#vendorExtensions.x-is-optional}} + if (this.{{{name}}}.isPresent) { + final value = this.{{{name}}}.value; + {{#isDateTime}} + {{#pattern}} + json[r'{{{baseName}}}'] = value == null ? null : (_isEpochMarker(r'{{{pattern}}}') + ? value.millisecondsSinceEpoch + : value.toUtc().toIso8601String()); + {{/pattern}} + {{^pattern}} + json[r'{{{baseName}}}'] = value == null ? null : value.toUtc().toIso8601String(); + {{/pattern}} + {{/isDateTime}} + {{#isDate}} + {{#pattern}} + json[r'{{{baseName}}}'] = value == null ? null : (_isEpochMarker(r'{{{pattern}}}') + ? value.millisecondsSinceEpoch + : _dateFormatter.format(value.toUtc())); + {{/pattern}} + {{^pattern}} + json[r'{{{baseName}}}'] = value == null ? null : _dateFormatter.format(value.toUtc()); + {{/pattern}} + {{/isDate}} + {{^isDateTime}} + {{^isDate}} + json[r'{{{baseName}}}'] = value{{#isArray}}{{#uniqueItems}} == null ? null : value.toList(growable: false){{/uniqueItems}}{{/isArray}}; + {{/isDate}} + {{/isDateTime}} + } + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{#isNullable}} if (this.{{{name}}} != null) { {{/isNullable}} @@ -91,18 +133,19 @@ class {{{classname}}} { {{/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}} {{/isNullable}} + {{/vendorExtensions.x-is-optional}} {{/vars}} return json; } @@ -115,61 +158,136 @@ class {{{classname}}} { if (value is Map) { final json = value.cast(); + // 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(() { + {{#vars}} + {{#required}} + assert(json.containsKey(r'{{{baseName}}}'), 'Required key "{{{classname}}}[{{{baseName}}}]" is missing from JSON.'); + {{^isNullable}} + assert(json[r'{{{baseName}}}'] != null, 'Required key "{{{classname}}}[{{{baseName}}}]" has a null value in JSON.'); + {{/isNullable}} + {{/required}} + {{/vars}} + return true; + }()); + return {{{classname}}}( {{#vars}} {{#isDateTime}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}')) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, + {{/vendorExtensions.x-is-optional}} {{/isDateTime}} {{#isDate}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}')) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: mapDateTime(json, r'{{{baseName}}}', r'{{{pattern}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, + {{/vendorExtensions.x-is-optional}} {{/isDate}} {{^isDateTime}} {{^isDate}} {{#complexType}} {{#isArray}} {{#items.isArray}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(json[r'{{{baseName}}}'] is List + ? (json[r'{{{baseName}}}'] as List).map((e) => + {{#items.complexType}} + e == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.complexType}}>[]{{/items.isNullable}} : {{items.complexType}}.listFromJson(e){{#uniqueItems}}.toSet(){{/uniqueItems}} + {{/items.complexType}} + {{^items.complexType}} + e == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}>[]{{/items.isNullable}} : (e as List).map((value) => value as {{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}).toList(growable: false) + {{/items.complexType}} + ).toList() + : {{#isNullable}}null{{/isNullable}}{{^isNullable}}const []{{/isNullable}}) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: json[r'{{{baseName}}}'] is List ? (json[r'{{{baseName}}}'] as List).map((e) => {{#items.complexType}} - {{items.complexType}}.listFromJson(json[r'{{{baseName}}}']){{#uniqueItems}}.toSet(){{/uniqueItems}} + e == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.complexType}}>[]{{/items.isNullable}} : {{items.complexType}}.listFromJson(e){{#uniqueItems}}.toSet(){{/uniqueItems}} {{/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}}>() + e == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}>[]{{/items.isNullable}} : (e as List).map((value) => value as {{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}).toList(growable: false) {{/items.complexType}} ).toList() : {{#isNullable}}null{{/isNullable}}{{^isNullable}}const []{{/isNullable}}, + {{/vendorExtensions.x-is-optional}} {{/items.isArray}} {{^items.isArray}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present({{{complexType}}}.listFromJson(json[r'{{{baseName}}}']){{#uniqueItems}}.toSet(){{/uniqueItems}}) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: {{{complexType}}}.listFromJson(json[r'{{{baseName}}}']){{#uniqueItems}}.toSet(){{/uniqueItems}}, + {{/vendorExtensions.x-is-optional}} {{/items.isArray}} {{/isArray}} {{^isArray}} {{#isMap}} {{#items.isArray}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(json[r'{{{baseName}}}'] == null ? null + {{#items.complexType}} + : {{items.complexType}}.mapListFromJson(json[r'{{{baseName}}}'])) : const Optional.absent(), + {{/items.complexType}} + {{^items.complexType}} + : (json[r'{{{baseName}}}'] as Map).map((k, v) => MapEntry(k, v == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}>[]{{/items.isNullable}} : (v as List).map((value) => value as {{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}).toList(growable: false)))) : const Optional.absent(), + {{/items.complexType}} + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: json[r'{{{baseName}}}'] == null ? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} - {{#items.complexType}} + {{#items.complexType}} : {{items.complexType}}.mapListFromJson(json[r'{{{baseName}}}']), - {{/items.complexType}} - {{^items.complexType}} - : mapCastOfType(json, r'{{{baseName}}}'), - {{/items.complexType}} + {{/items.complexType}} + {{^items.complexType}} + : (json[r'{{{baseName}}}'] as Map).map((k, v) => MapEntry(k, v == null ? {{#items.isNullable}}null{{/items.isNullable}}{{^items.isNullable}}const <{{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}>[]{{/items.isNullable}} : (v as List).map((value) => value as {{items.items.dataType}}{{#items.items.isNullable}}?{{/items.items.isNullable}}).toList(growable: false))), + {{/items.complexType}} + {{/vendorExtensions.x-is-optional}} {{/items.isArray}} {{^items.isArray}} {{#items.isMap}} {{#items.complexType}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present({{items.complexType}}.mapFromJson(json[r'{{{baseName}}}'])) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: {{items.complexType}}.mapFromJson(json[r'{{{baseName}}}']), + {{/vendorExtensions.x-is-optional}} {{/items.complexType}} {{^items.complexType}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(mapCastOfType(json, r'{{{baseName}}}')) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: mapCastOfType(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, + {{/vendorExtensions.x-is-optional}} {{/items.complexType}} {{/items.isMap}} {{^items.isMap}} {{#items.complexType}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present({{{items.complexType}}}.mapFromJson(json[r'{{{baseName}}}'])) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: {{{items.complexType}}}.mapFromJson(json[r'{{{baseName}}}']), + {{/vendorExtensions.x-is-optional}} {{/items.complexType}} {{^items.complexType}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(mapCastOfType(json, r'{{{baseName}}}')) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: mapCastOfType(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, + {{/vendorExtensions.x-is-optional}} {{/items.complexType}} {{/items.isMap}} {{/items.isArray}} @@ -179,7 +297,12 @@ class {{{classname}}} { {{{name}}}: null, // No support for decoding binary content from JSON {{/isBinary}} {{^isBinary}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present({{{complexType}}}.fromJson(json[r'{{{baseName}}}'])) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: {{{complexType}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, + {{/vendorExtensions.x-is-optional}} {{/isBinary}} {{/isMap}} {{/isArray}} @@ -187,37 +310,74 @@ class {{{classname}}} { {{^complexType}} {{#isArray}} {{#isEnum}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present({{{items.datatypeWithEnum}}}.listFromJson(json[r'{{{baseName}}}']){{#uniqueItems}}.toSet(){{/uniqueItems}}) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: {{{items.datatypeWithEnum}}}.listFromJson(json[r'{{{baseName}}}']){{#uniqueItems}}.toSet(){{/uniqueItems}}, + {{/vendorExtensions.x-is-optional}} {{/isEnum}} {{^isEnum}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(json[r'{{{baseName}}}'] is Iterable + ? (json[r'{{{baseName}}}'] as Iterable).cast<{{{items.datatype}}}>().{{#uniqueItems}}toSet(){{/uniqueItems}}{{^uniqueItems}}toList(growable: false){{/uniqueItems}} + : {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: json[r'{{{baseName}}}'] is Iterable ? (json[r'{{{baseName}}}'] as Iterable).cast<{{{items.datatype}}}>().{{#uniqueItems}}toSet(){{/uniqueItems}}{{^uniqueItems}}toList(growable: false){{/uniqueItems}} : {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}, + {{/vendorExtensions.x-is-optional}} {{/isEnum}} {{/isArray}} {{^isArray}} {{#isMap}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(mapCastOfType(json, r'{{{baseName}}}')) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: mapCastOfType(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}, + {{/vendorExtensions.x-is-optional}} {{/isMap}} {{^isMap}} {{#isNumber}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(json[r'{{{baseName}}}'] == null ? null : num.parse('${json[r'{{{baseName}}}']}')) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{name}}}: {{#isNullable}}json[r'{{{baseName}}}'] == null ? {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}} : {{/isNullable}}{{{datatypeWithEnum}}}.parse('${json[r'{{{baseName}}}']}'), + {{/vendorExtensions.x-is-optional}} {{/isNumber}} - {{#isDouble}} - {{{name}}}: (mapValueOfType(json, r'{{{baseName}}}'){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? {{{.}}}{{/defaultValue}}{{/required}}){{#isNullable}}?{{/isNullable}}.toDouble(), - {{/isDouble}} - {{^isDouble}} {{^isNumber}} - {{^isEnum}} + {{#vendorExtensions.x-original-is-integer}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(json[r'{{{baseName}}}'] == null ? null : int.parse('${json[r'{{{baseName}}}']}')) : const Optional.absent(), + {{/vendorExtensions.x-original-is-integer}} + {{^vendorExtensions.x-original-is-integer}} + {{#vendorExtensions.x-original-is-number}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(json[r'{{{baseName}}}'] == null ? null : num.parse('${json[r'{{{baseName}}}']}')) : const Optional.absent(), + {{/vendorExtensions.x-original-is-number}} + {{^vendorExtensions.x-original-is-number}} + {{^isEnum}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present(mapValueOfType<{{#vendorExtensions.x-unwrapped-datatype}}{{{vendorExtensions.x-unwrapped-datatype}}}{{/vendorExtensions.x-unwrapped-datatype}}{{^vendorExtensions.x-unwrapped-datatype}}{{{datatypeWithEnum}}}{{/vendorExtensions.x-unwrapped-datatype}}>(json, r'{{{baseName}}}')) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} {{{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}} + {{/vendorExtensions.x-is-optional}} + {{/isEnum}} + {{#isEnum}} + {{#vendorExtensions.x-is-optional}} + {{{name}}}: json.containsKey(r'{{{baseName}}}') ? Optional.present({{{enumName}}}.fromJson(json[r'{{{baseName}}}'])) : const Optional.absent(), + {{/vendorExtensions.x-is-optional}} + {{^vendorExtensions.x-is-optional}} + {{{name}}}: {{{enumName}}}.fromJson(json[r'{{{baseName}}}']){{#required}}{{^isNullable}}!{{/isNullable}}{{/required}}{{^required}}{{#defaultValue}} ?? const {{{enumName}}}._({{{.}}}){{/defaultValue}}{{/required}}, + {{/vendorExtensions.x-is-optional}} + {{/isEnum}} + {{/vendorExtensions.x-original-is-number}} + {{/vendorExtensions.x-original-is-integer}} {{/isNumber}} - {{/isDouble}} {{/isMap}} {{/isArray}} {{/complexType}} @@ -284,11 +444,13 @@ class {{{classname}}} { {{^isContainer}} {{>serialization/native/native_enum_inline}} + {{/isContainer}} {{#isContainer}} {{#mostInnerItems}} {{>serialization/native/native_enum_inline}} + {{/mostInnerItems}} {{/isContainer}} {{/isEnum}}