exif_entity.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. //
  2. // AUTO-GENERATED FILE, DO NOT MODIFY!
  3. //
  4. // @dart=2.12
  5. // ignore_for_file: unused_element, unused_import
  6. // ignore_for_file: always_put_required_named_parameters_first
  7. // ignore_for_file: constant_identifier_names
  8. // ignore_for_file: lines_longer_than_80_chars
  9. part of openapi.api;
  10. class ExifEntity {
  11. /// Returns a new [ExifEntity] instance.
  12. ExifEntity({
  13. required this.id,
  14. required this.assetId,
  15. required this.description,
  16. required this.exifImageWidth,
  17. required this.exifImageHeight,
  18. required this.fileSizeInByte,
  19. required this.orientation,
  20. required this.dateTimeOriginal,
  21. required this.modifyDate,
  22. required this.latitude,
  23. required this.longitude,
  24. required this.city,
  25. required this.state,
  26. required this.country,
  27. required this.make,
  28. required this.model,
  29. required this.imageName,
  30. required this.lensModel,
  31. required this.fNumber,
  32. required this.focalLength,
  33. required this.iso,
  34. required this.exposureTime,
  35. this.fps,
  36. this.asset,
  37. required this.exifTextSearchableColumn,
  38. });
  39. String id;
  40. String assetId;
  41. /// General info
  42. String description;
  43. num? exifImageWidth;
  44. num? exifImageHeight;
  45. num? fileSizeInByte;
  46. String? orientation;
  47. DateTime? dateTimeOriginal;
  48. DateTime? modifyDate;
  49. num? latitude;
  50. num? longitude;
  51. String? city;
  52. String? state;
  53. String? country;
  54. /// Image info
  55. String? make;
  56. String? model;
  57. String? imageName;
  58. String? lensModel;
  59. num? fNumber;
  60. num? focalLength;
  61. num? iso;
  62. num? exposureTime;
  63. /// Video info
  64. num? fps;
  65. ///
  66. /// Please note: This property should have been non-nullable! Since the specification file
  67. /// does not include a default value (using the "default:" property), however, the generated
  68. /// source code must fall back to having a nullable type.
  69. /// Consider adding a "default:" property in the specification file to hide this note.
  70. ///
  71. AssetEntity? asset;
  72. String exifTextSearchableColumn;
  73. @override
  74. bool operator ==(Object other) => identical(this, other) || other is ExifEntity &&
  75. other.id == id &&
  76. other.assetId == assetId &&
  77. other.description == description &&
  78. other.exifImageWidth == exifImageWidth &&
  79. other.exifImageHeight == exifImageHeight &&
  80. other.fileSizeInByte == fileSizeInByte &&
  81. other.orientation == orientation &&
  82. other.dateTimeOriginal == dateTimeOriginal &&
  83. other.modifyDate == modifyDate &&
  84. other.latitude == latitude &&
  85. other.longitude == longitude &&
  86. other.city == city &&
  87. other.state == state &&
  88. other.country == country &&
  89. other.make == make &&
  90. other.model == model &&
  91. other.imageName == imageName &&
  92. other.lensModel == lensModel &&
  93. other.fNumber == fNumber &&
  94. other.focalLength == focalLength &&
  95. other.iso == iso &&
  96. other.exposureTime == exposureTime &&
  97. other.fps == fps &&
  98. other.asset == asset &&
  99. other.exifTextSearchableColumn == exifTextSearchableColumn;
  100. @override
  101. int get hashCode =>
  102. // ignore: unnecessary_parenthesis
  103. (id.hashCode) +
  104. (assetId.hashCode) +
  105. (description.hashCode) +
  106. (exifImageWidth == null ? 0 : exifImageWidth!.hashCode) +
  107. (exifImageHeight == null ? 0 : exifImageHeight!.hashCode) +
  108. (fileSizeInByte == null ? 0 : fileSizeInByte!.hashCode) +
  109. (orientation == null ? 0 : orientation!.hashCode) +
  110. (dateTimeOriginal == null ? 0 : dateTimeOriginal!.hashCode) +
  111. (modifyDate == null ? 0 : modifyDate!.hashCode) +
  112. (latitude == null ? 0 : latitude!.hashCode) +
  113. (longitude == null ? 0 : longitude!.hashCode) +
  114. (city == null ? 0 : city!.hashCode) +
  115. (state == null ? 0 : state!.hashCode) +
  116. (country == null ? 0 : country!.hashCode) +
  117. (make == null ? 0 : make!.hashCode) +
  118. (model == null ? 0 : model!.hashCode) +
  119. (imageName == null ? 0 : imageName!.hashCode) +
  120. (lensModel == null ? 0 : lensModel!.hashCode) +
  121. (fNumber == null ? 0 : fNumber!.hashCode) +
  122. (focalLength == null ? 0 : focalLength!.hashCode) +
  123. (iso == null ? 0 : iso!.hashCode) +
  124. (exposureTime == null ? 0 : exposureTime!.hashCode) +
  125. (fps == null ? 0 : fps!.hashCode) +
  126. (asset == null ? 0 : asset!.hashCode) +
  127. (exifTextSearchableColumn.hashCode);
  128. @override
  129. String toString() => 'ExifEntity[id=$id, assetId=$assetId, description=$description, exifImageWidth=$exifImageWidth, exifImageHeight=$exifImageHeight, fileSizeInByte=$fileSizeInByte, orientation=$orientation, dateTimeOriginal=$dateTimeOriginal, modifyDate=$modifyDate, latitude=$latitude, longitude=$longitude, city=$city, state=$state, country=$country, make=$make, model=$model, imageName=$imageName, lensModel=$lensModel, fNumber=$fNumber, focalLength=$focalLength, iso=$iso, exposureTime=$exposureTime, fps=$fps, asset=$asset, exifTextSearchableColumn=$exifTextSearchableColumn]';
  130. Map<String, dynamic> toJson() {
  131. final _json = <String, dynamic>{};
  132. _json[r'id'] = id;
  133. _json[r'assetId'] = assetId;
  134. _json[r'description'] = description;
  135. if (exifImageWidth != null) {
  136. _json[r'exifImageWidth'] = exifImageWidth;
  137. } else {
  138. _json[r'exifImageWidth'] = null;
  139. }
  140. if (exifImageHeight != null) {
  141. _json[r'exifImageHeight'] = exifImageHeight;
  142. } else {
  143. _json[r'exifImageHeight'] = null;
  144. }
  145. if (fileSizeInByte != null) {
  146. _json[r'fileSizeInByte'] = fileSizeInByte;
  147. } else {
  148. _json[r'fileSizeInByte'] = null;
  149. }
  150. if (orientation != null) {
  151. _json[r'orientation'] = orientation;
  152. } else {
  153. _json[r'orientation'] = null;
  154. }
  155. if (dateTimeOriginal != null) {
  156. _json[r'dateTimeOriginal'] = dateTimeOriginal!.toUtc().toIso8601String();
  157. } else {
  158. _json[r'dateTimeOriginal'] = null;
  159. }
  160. if (modifyDate != null) {
  161. _json[r'modifyDate'] = modifyDate!.toUtc().toIso8601String();
  162. } else {
  163. _json[r'modifyDate'] = null;
  164. }
  165. if (latitude != null) {
  166. _json[r'latitude'] = latitude;
  167. } else {
  168. _json[r'latitude'] = null;
  169. }
  170. if (longitude != null) {
  171. _json[r'longitude'] = longitude;
  172. } else {
  173. _json[r'longitude'] = null;
  174. }
  175. if (city != null) {
  176. _json[r'city'] = city;
  177. } else {
  178. _json[r'city'] = null;
  179. }
  180. if (state != null) {
  181. _json[r'state'] = state;
  182. } else {
  183. _json[r'state'] = null;
  184. }
  185. if (country != null) {
  186. _json[r'country'] = country;
  187. } else {
  188. _json[r'country'] = null;
  189. }
  190. if (make != null) {
  191. _json[r'make'] = make;
  192. } else {
  193. _json[r'make'] = null;
  194. }
  195. if (model != null) {
  196. _json[r'model'] = model;
  197. } else {
  198. _json[r'model'] = null;
  199. }
  200. if (imageName != null) {
  201. _json[r'imageName'] = imageName;
  202. } else {
  203. _json[r'imageName'] = null;
  204. }
  205. if (lensModel != null) {
  206. _json[r'lensModel'] = lensModel;
  207. } else {
  208. _json[r'lensModel'] = null;
  209. }
  210. if (fNumber != null) {
  211. _json[r'fNumber'] = fNumber;
  212. } else {
  213. _json[r'fNumber'] = null;
  214. }
  215. if (focalLength != null) {
  216. _json[r'focalLength'] = focalLength;
  217. } else {
  218. _json[r'focalLength'] = null;
  219. }
  220. if (iso != null) {
  221. _json[r'iso'] = iso;
  222. } else {
  223. _json[r'iso'] = null;
  224. }
  225. if (exposureTime != null) {
  226. _json[r'exposureTime'] = exposureTime;
  227. } else {
  228. _json[r'exposureTime'] = null;
  229. }
  230. if (fps != null) {
  231. _json[r'fps'] = fps;
  232. } else {
  233. _json[r'fps'] = null;
  234. }
  235. if (asset != null) {
  236. _json[r'asset'] = asset;
  237. } else {
  238. _json[r'asset'] = null;
  239. }
  240. _json[r'exifTextSearchableColumn'] = exifTextSearchableColumn;
  241. return _json;
  242. }
  243. /// Returns a new [ExifEntity] instance and imports its values from
  244. /// [value] if it's a [Map], null otherwise.
  245. // ignore: prefer_constructors_over_static_methods
  246. static ExifEntity? fromJson(dynamic value) {
  247. if (value is Map) {
  248. final json = value.cast<String, dynamic>();
  249. // Ensure that the map contains the required keys.
  250. // Note 1: the values aren't checked for validity beyond being non-null.
  251. // Note 2: this code is stripped in release mode!
  252. assert(() {
  253. requiredKeys.forEach((key) {
  254. assert(json.containsKey(key), 'Required key "ExifEntity[$key]" is missing from JSON.');
  255. assert(json[key] != null, 'Required key "ExifEntity[$key]" has a null value in JSON.');
  256. });
  257. return true;
  258. }());
  259. return ExifEntity(
  260. id: mapValueOfType<String>(json, r'id')!,
  261. assetId: mapValueOfType<String>(json, r'assetId')!,
  262. description: mapValueOfType<String>(json, r'description')!,
  263. exifImageWidth: json[r'exifImageWidth'] == null
  264. ? null
  265. : num.parse(json[r'exifImageWidth'].toString()),
  266. exifImageHeight: json[r'exifImageHeight'] == null
  267. ? null
  268. : num.parse(json[r'exifImageHeight'].toString()),
  269. fileSizeInByte: json[r'fileSizeInByte'] == null
  270. ? null
  271. : num.parse(json[r'fileSizeInByte'].toString()),
  272. orientation: mapValueOfType<String>(json, r'orientation'),
  273. dateTimeOriginal: mapDateTime(json, r'dateTimeOriginal', ''),
  274. modifyDate: mapDateTime(json, r'modifyDate', ''),
  275. latitude: json[r'latitude'] == null
  276. ? null
  277. : num.parse(json[r'latitude'].toString()),
  278. longitude: json[r'longitude'] == null
  279. ? null
  280. : num.parse(json[r'longitude'].toString()),
  281. city: mapValueOfType<String>(json, r'city'),
  282. state: mapValueOfType<String>(json, r'state'),
  283. country: mapValueOfType<String>(json, r'country'),
  284. make: mapValueOfType<String>(json, r'make'),
  285. model: mapValueOfType<String>(json, r'model'),
  286. imageName: mapValueOfType<String>(json, r'imageName'),
  287. lensModel: mapValueOfType<String>(json, r'lensModel'),
  288. fNumber: json[r'fNumber'] == null
  289. ? null
  290. : num.parse(json[r'fNumber'].toString()),
  291. focalLength: json[r'focalLength'] == null
  292. ? null
  293. : num.parse(json[r'focalLength'].toString()),
  294. iso: json[r'iso'] == null
  295. ? null
  296. : num.parse(json[r'iso'].toString()),
  297. exposureTime: json[r'exposureTime'] == null
  298. ? null
  299. : num.parse(json[r'exposureTime'].toString()),
  300. fps: json[r'fps'] == null
  301. ? null
  302. : num.parse(json[r'fps'].toString()),
  303. asset: AssetEntity.fromJson(json[r'asset']),
  304. exifTextSearchableColumn: mapValueOfType<String>(json, r'exifTextSearchableColumn')!,
  305. );
  306. }
  307. return null;
  308. }
  309. static List<ExifEntity>? listFromJson(dynamic json, {bool growable = false,}) {
  310. final result = <ExifEntity>[];
  311. if (json is List && json.isNotEmpty) {
  312. for (final row in json) {
  313. final value = ExifEntity.fromJson(row);
  314. if (value != null) {
  315. result.add(value);
  316. }
  317. }
  318. }
  319. return result.toList(growable: growable);
  320. }
  321. static Map<String, ExifEntity> mapFromJson(dynamic json) {
  322. final map = <String, ExifEntity>{};
  323. if (json is Map && json.isNotEmpty) {
  324. json = json.cast<String, dynamic>(); // ignore: parameter_assignments
  325. for (final entry in json.entries) {
  326. final value = ExifEntity.fromJson(entry.value);
  327. if (value != null) {
  328. map[entry.key] = value;
  329. }
  330. }
  331. }
  332. return map;
  333. }
  334. // maps a json object with a list of ExifEntity-objects as value to a dart map
  335. static Map<String, List<ExifEntity>> mapListFromJson(dynamic json, {bool growable = false,}) {
  336. final map = <String, List<ExifEntity>>{};
  337. if (json is Map && json.isNotEmpty) {
  338. json = json.cast<String, dynamic>(); // ignore: parameter_assignments
  339. for (final entry in json.entries) {
  340. final value = ExifEntity.listFromJson(entry.value, growable: growable,);
  341. if (value != null) {
  342. map[entry.key] = value;
  343. }
  344. }
  345. }
  346. return map;
  347. }
  348. /// The list of required keys that must be present in a JSON.
  349. static const requiredKeys = <String>{
  350. 'id',
  351. 'assetId',
  352. 'description',
  353. 'exifImageWidth',
  354. 'exifImageHeight',
  355. 'fileSizeInByte',
  356. 'orientation',
  357. 'dateTimeOriginal',
  358. 'modifyDate',
  359. 'latitude',
  360. 'longitude',
  361. 'city',
  362. 'state',
  363. 'country',
  364. 'make',
  365. 'model',
  366. 'imageName',
  367. 'lensModel',
  368. 'fNumber',
  369. 'focalLength',
  370. 'iso',
  371. 'exposureTime',
  372. 'exifTextSearchableColumn',
  373. };
  374. }