forked from immich-app/immich
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimport_asset_dto.dart
229 lines (202 loc) · 7.7 KB
/
import_asset_dto.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class ImportAssetDto {
/// Returns a new [ImportAssetDto] instance.
ImportAssetDto({
required this.assetType,
this.isReadOnly = true,
required this.assetPath,
this.sidecarPath,
required this.deviceAssetId,
required this.deviceId,
required this.fileCreatedAt,
required this.fileModifiedAt,
required this.isFavorite,
required this.isPanorama,
this.isArchived,
this.isVisible,
this.duration,
});
AssetTypeEnum assetType;
bool isReadOnly;
String assetPath;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? sidecarPath;
String deviceAssetId;
String deviceId;
DateTime fileCreatedAt;
DateTime fileModifiedAt;
bool isFavorite;
bool isPanorama;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? isArchived;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? isVisible;
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? duration;
@override
bool operator ==(Object other) => identical(this, other) || other is ImportAssetDto &&
other.assetType == assetType &&
other.isReadOnly == isReadOnly &&
other.assetPath == assetPath &&
other.sidecarPath == sidecarPath &&
other.deviceAssetId == deviceAssetId &&
other.deviceId == deviceId &&
other.fileCreatedAt == fileCreatedAt &&
other.fileModifiedAt == fileModifiedAt &&
other.isFavorite == isFavorite &&
other.isPanorama == isPanorama &&
other.isArchived == isArchived &&
other.isVisible == isVisible &&
other.duration == duration;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(assetType.hashCode) +
(isReadOnly.hashCode) +
(assetPath.hashCode) +
(sidecarPath == null ? 0 : sidecarPath!.hashCode) +
(deviceAssetId.hashCode) +
(deviceId.hashCode) +
(fileCreatedAt.hashCode) +
(fileModifiedAt.hashCode) +
(isFavorite.hashCode) +
(isPanorama.hashCode) +
(isArchived == null ? 0 : isArchived!.hashCode) +
(isVisible == null ? 0 : isVisible!.hashCode) +
(duration == null ? 0 : duration!.hashCode);
@override
String toString() => 'ImportAssetDto[assetType=$assetType, isReadOnly=$isReadOnly, assetPath=$assetPath, sidecarPath=$sidecarPath, deviceAssetId=$deviceAssetId, deviceId=$deviceId, fileCreatedAt=$fileCreatedAt, fileModifiedAt=$fileModifiedAt, isFavorite=$isFavorite, isPanorama=$isPanorama, isArchived=$isArchived, isVisible=$isVisible, duration=$duration]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'assetType'] = this.assetType;
json[r'isReadOnly'] = this.isReadOnly;
json[r'assetPath'] = this.assetPath;
if (this.sidecarPath != null) {
json[r'sidecarPath'] = this.sidecarPath;
} else {
// json[r'sidecarPath'] = null;
}
json[r'deviceAssetId'] = this.deviceAssetId;
json[r'deviceId'] = this.deviceId;
json[r'fileCreatedAt'] = this.fileCreatedAt.toUtc().toIso8601String();
json[r'fileModifiedAt'] = this.fileModifiedAt.toUtc().toIso8601String();
json[r'isFavorite'] = this.isFavorite;
json[r'isPanorama'] = this.isPanorama;
if (this.isArchived != null) {
json[r'isArchived'] = this.isArchived;
} else {
// json[r'isArchived'] = null;
}
if (this.isVisible != null) {
json[r'isVisible'] = this.isVisible;
} else {
// json[r'isVisible'] = null;
}
if (this.duration != null) {
json[r'duration'] = this.duration;
} else {
// json[r'duration'] = null;
}
return json;
}
/// Returns a new [ImportAssetDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static ImportAssetDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return ImportAssetDto(
assetType: AssetTypeEnum.fromJson(json[r'assetType'])!,
isReadOnly: mapValueOfType<bool>(json, r'isReadOnly') ?? true,
assetPath: mapValueOfType<String>(json, r'assetPath')!,
sidecarPath: mapValueOfType<String>(json, r'sidecarPath'),
deviceAssetId: mapValueOfType<String>(json, r'deviceAssetId')!,
deviceId: mapValueOfType<String>(json, r'deviceId')!,
fileCreatedAt: mapDateTime(json, r'fileCreatedAt', r'')!,
fileModifiedAt: mapDateTime(json, r'fileModifiedAt', r'')!,
isFavorite: mapValueOfType<bool>(json, r'isFavorite')!,
isPanorama: mapValueOfType<bool>(json, r'isPanorama')!,
isArchived: mapValueOfType<bool>(json, r'isArchived'),
isVisible: mapValueOfType<bool>(json, r'isVisible'),
duration: mapValueOfType<String>(json, r'duration'),
);
}
return null;
}
static List<ImportAssetDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <ImportAssetDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = ImportAssetDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, ImportAssetDto> mapFromJson(dynamic json) {
final map = <String, ImportAssetDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = ImportAssetDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of ImportAssetDto-objects as value to a dart map
static Map<String, List<ImportAssetDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<ImportAssetDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = ImportAssetDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'assetType',
'assetPath',
'deviceAssetId',
'deviceId',
'fileCreatedAt',
'fileModifiedAt',
'isFavorite',
'isPanorama',
};
}