gen client

This commit is contained in:
timonrieger
2026-05-04 17:22:50 +02:00
parent 17af4324eb
commit 49b30ea2f2
315 changed files with 4724 additions and 930 deletions
+45 -12
View File
@@ -151,31 +151,31 @@ class SyncAssetV1 {
? 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;
@@ -183,38 +183,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;
}
@@ -223,10 +223,43 @@ class SyncAssetV1 {
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static SyncAssetV1? fromJson(dynamic value) {
upgradeDto(value, "SyncAssetV1");
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
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'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<String>(json, r'checksum')!,
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))$/'),