edit_shared_link_dto.dart 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 EditSharedLinkDto {
  11. /// Returns a new [EditSharedLinkDto] instance.
  12. EditSharedLinkDto({
  13. this.description,
  14. this.expiresAt,
  15. this.allowUpload,
  16. this.allowDownload,
  17. this.showExif,
  18. });
  19. ///
  20. /// Please note: This property should have been non-nullable! Since the specification file
  21. /// does not include a default value (using the "default:" property), however, the generated
  22. /// source code must fall back to having a nullable type.
  23. /// Consider adding a "default:" property in the specification file to hide this note.
  24. ///
  25. String? description;
  26. DateTime? expiresAt;
  27. ///
  28. /// Please note: This property should have been non-nullable! Since the specification file
  29. /// does not include a default value (using the "default:" property), however, the generated
  30. /// source code must fall back to having a nullable type.
  31. /// Consider adding a "default:" property in the specification file to hide this note.
  32. ///
  33. bool? allowUpload;
  34. ///
  35. /// Please note: This property should have been non-nullable! Since the specification file
  36. /// does not include a default value (using the "default:" property), however, the generated
  37. /// source code must fall back to having a nullable type.
  38. /// Consider adding a "default:" property in the specification file to hide this note.
  39. ///
  40. bool? allowDownload;
  41. ///
  42. /// Please note: This property should have been non-nullable! Since the specification file
  43. /// does not include a default value (using the "default:" property), however, the generated
  44. /// source code must fall back to having a nullable type.
  45. /// Consider adding a "default:" property in the specification file to hide this note.
  46. ///
  47. bool? showExif;
  48. @override
  49. bool operator ==(Object other) => identical(this, other) || other is EditSharedLinkDto &&
  50. other.description == description &&
  51. other.expiresAt == expiresAt &&
  52. other.allowUpload == allowUpload &&
  53. other.allowDownload == allowDownload &&
  54. other.showExif == showExif;
  55. @override
  56. int get hashCode =>
  57. // ignore: unnecessary_parenthesis
  58. (description == null ? 0 : description!.hashCode) +
  59. (expiresAt == null ? 0 : expiresAt!.hashCode) +
  60. (allowUpload == null ? 0 : allowUpload!.hashCode) +
  61. (allowDownload == null ? 0 : allowDownload!.hashCode) +
  62. (showExif == null ? 0 : showExif!.hashCode);
  63. @override
  64. String toString() => 'EditSharedLinkDto[description=$description, expiresAt=$expiresAt, allowUpload=$allowUpload, allowDownload=$allowDownload, showExif=$showExif]';
  65. Map<String, dynamic> toJson() {
  66. final json = <String, dynamic>{};
  67. if (this.description != null) {
  68. json[r'description'] = this.description;
  69. } else {
  70. // json[r'description'] = null;
  71. }
  72. if (this.expiresAt != null) {
  73. json[r'expiresAt'] = this.expiresAt!.toUtc().toIso8601String();
  74. } else {
  75. // json[r'expiresAt'] = null;
  76. }
  77. if (this.allowUpload != null) {
  78. json[r'allowUpload'] = this.allowUpload;
  79. } else {
  80. // json[r'allowUpload'] = null;
  81. }
  82. if (this.allowDownload != null) {
  83. json[r'allowDownload'] = this.allowDownload;
  84. } else {
  85. // json[r'allowDownload'] = null;
  86. }
  87. if (this.showExif != null) {
  88. json[r'showExif'] = this.showExif;
  89. } else {
  90. // json[r'showExif'] = null;
  91. }
  92. return json;
  93. }
  94. /// Returns a new [EditSharedLinkDto] instance and imports its values from
  95. /// [value] if it's a [Map], null otherwise.
  96. // ignore: prefer_constructors_over_static_methods
  97. static EditSharedLinkDto? fromJson(dynamic value) {
  98. if (value is Map) {
  99. final json = value.cast<String, dynamic>();
  100. // Ensure that the map contains the required keys.
  101. // Note 1: the values aren't checked for validity beyond being non-null.
  102. // Note 2: this code is stripped in release mode!
  103. assert(() {
  104. requiredKeys.forEach((key) {
  105. assert(json.containsKey(key), 'Required key "EditSharedLinkDto[$key]" is missing from JSON.');
  106. assert(json[key] != null, 'Required key "EditSharedLinkDto[$key]" has a null value in JSON.');
  107. });
  108. return true;
  109. }());
  110. return EditSharedLinkDto(
  111. description: mapValueOfType<String>(json, r'description'),
  112. expiresAt: mapDateTime(json, r'expiresAt', ''),
  113. allowUpload: mapValueOfType<bool>(json, r'allowUpload'),
  114. allowDownload: mapValueOfType<bool>(json, r'allowDownload'),
  115. showExif: mapValueOfType<bool>(json, r'showExif'),
  116. );
  117. }
  118. return null;
  119. }
  120. static List<EditSharedLinkDto> listFromJson(dynamic json, {bool growable = false,}) {
  121. final result = <EditSharedLinkDto>[];
  122. if (json is List && json.isNotEmpty) {
  123. for (final row in json) {
  124. final value = EditSharedLinkDto.fromJson(row);
  125. if (value != null) {
  126. result.add(value);
  127. }
  128. }
  129. }
  130. return result.toList(growable: growable);
  131. }
  132. static Map<String, EditSharedLinkDto> mapFromJson(dynamic json) {
  133. final map = <String, EditSharedLinkDto>{};
  134. if (json is Map && json.isNotEmpty) {
  135. json = json.cast<String, dynamic>(); // ignore: parameter_assignments
  136. for (final entry in json.entries) {
  137. final value = EditSharedLinkDto.fromJson(entry.value);
  138. if (value != null) {
  139. map[entry.key] = value;
  140. }
  141. }
  142. }
  143. return map;
  144. }
  145. // maps a json object with a list of EditSharedLinkDto-objects as value to a dart map
  146. static Map<String, List<EditSharedLinkDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
  147. final map = <String, List<EditSharedLinkDto>>{};
  148. if (json is Map && json.isNotEmpty) {
  149. // ignore: parameter_assignments
  150. json = json.cast<String, dynamic>();
  151. for (final entry in json.entries) {
  152. map[entry.key] = EditSharedLinkDto.listFromJson(entry.value, growable: growable,);
  153. }
  154. }
  155. return map;
  156. }
  157. /// The list of required keys that must be present in a JSON.
  158. static const requiredKeys = <String>{
  159. };
  160. }