user_response_dto.dart 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 UserResponseDto {
  11. /// Returns a new [UserResponseDto] instance.
  12. UserResponseDto({
  13. required this.avatarColor,
  14. required this.createdAt,
  15. required this.deletedAt,
  16. required this.email,
  17. required this.externalPath,
  18. required this.id,
  19. required this.isAdmin,
  20. this.memoriesEnabled,
  21. required this.name,
  22. required this.oauthId,
  23. required this.profileImagePath,
  24. required this.shouldChangePassword,
  25. required this.storageLabel,
  26. required this.updatedAt,
  27. });
  28. UserAvatarColor avatarColor;
  29. DateTime createdAt;
  30. DateTime? deletedAt;
  31. String email;
  32. String? externalPath;
  33. String id;
  34. bool isAdmin;
  35. ///
  36. /// Please note: This property should have been non-nullable! Since the specification file
  37. /// does not include a default value (using the "default:" property), however, the generated
  38. /// source code must fall back to having a nullable type.
  39. /// Consider adding a "default:" property in the specification file to hide this note.
  40. ///
  41. bool? memoriesEnabled;
  42. String name;
  43. String oauthId;
  44. String profileImagePath;
  45. bool shouldChangePassword;
  46. String? storageLabel;
  47. DateTime updatedAt;
  48. @override
  49. bool operator ==(Object other) => identical(this, other) || other is UserResponseDto &&
  50. other.avatarColor == avatarColor &&
  51. other.createdAt == createdAt &&
  52. other.deletedAt == deletedAt &&
  53. other.email == email &&
  54. other.externalPath == externalPath &&
  55. other.id == id &&
  56. other.isAdmin == isAdmin &&
  57. other.memoriesEnabled == memoriesEnabled &&
  58. other.name == name &&
  59. other.oauthId == oauthId &&
  60. other.profileImagePath == profileImagePath &&
  61. other.shouldChangePassword == shouldChangePassword &&
  62. other.storageLabel == storageLabel &&
  63. other.updatedAt == updatedAt;
  64. @override
  65. int get hashCode =>
  66. // ignore: unnecessary_parenthesis
  67. (avatarColor.hashCode) +
  68. (createdAt.hashCode) +
  69. (deletedAt == null ? 0 : deletedAt!.hashCode) +
  70. (email.hashCode) +
  71. (externalPath == null ? 0 : externalPath!.hashCode) +
  72. (id.hashCode) +
  73. (isAdmin.hashCode) +
  74. (memoriesEnabled == null ? 0 : memoriesEnabled!.hashCode) +
  75. (name.hashCode) +
  76. (oauthId.hashCode) +
  77. (profileImagePath.hashCode) +
  78. (shouldChangePassword.hashCode) +
  79. (storageLabel == null ? 0 : storageLabel!.hashCode) +
  80. (updatedAt.hashCode);
  81. @override
  82. String toString() => 'UserResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, externalPath=$externalPath, id=$id, isAdmin=$isAdmin, memoriesEnabled=$memoriesEnabled, name=$name, oauthId=$oauthId, profileImagePath=$profileImagePath, shouldChangePassword=$shouldChangePassword, storageLabel=$storageLabel, updatedAt=$updatedAt]';
  83. Map<String, dynamic> toJson() {
  84. final json = <String, dynamic>{};
  85. json[r'avatarColor'] = this.avatarColor;
  86. json[r'createdAt'] = this.createdAt.toUtc().toIso8601String();
  87. if (this.deletedAt != null) {
  88. json[r'deletedAt'] = this.deletedAt!.toUtc().toIso8601String();
  89. } else {
  90. // json[r'deletedAt'] = null;
  91. }
  92. json[r'email'] = this.email;
  93. if (this.externalPath != null) {
  94. json[r'externalPath'] = this.externalPath;
  95. } else {
  96. // json[r'externalPath'] = null;
  97. }
  98. json[r'id'] = this.id;
  99. json[r'isAdmin'] = this.isAdmin;
  100. if (this.memoriesEnabled != null) {
  101. json[r'memoriesEnabled'] = this.memoriesEnabled;
  102. } else {
  103. // json[r'memoriesEnabled'] = null;
  104. }
  105. json[r'name'] = this.name;
  106. json[r'oauthId'] = this.oauthId;
  107. json[r'profileImagePath'] = this.profileImagePath;
  108. json[r'shouldChangePassword'] = this.shouldChangePassword;
  109. if (this.storageLabel != null) {
  110. json[r'storageLabel'] = this.storageLabel;
  111. } else {
  112. // json[r'storageLabel'] = null;
  113. }
  114. json[r'updatedAt'] = this.updatedAt.toUtc().toIso8601String();
  115. return json;
  116. }
  117. /// Returns a new [UserResponseDto] instance and imports its values from
  118. /// [value] if it's a [Map], null otherwise.
  119. // ignore: prefer_constructors_over_static_methods
  120. static UserResponseDto? fromJson(dynamic value) {
  121. if (value is Map) {
  122. final json = value.cast<String, dynamic>();
  123. return UserResponseDto(
  124. avatarColor: UserAvatarColor.fromJson(json[r'avatarColor'])!,
  125. createdAt: mapDateTime(json, r'createdAt', '')!,
  126. deletedAt: mapDateTime(json, r'deletedAt', ''),
  127. email: mapValueOfType<String>(json, r'email')!,
  128. externalPath: mapValueOfType<String>(json, r'externalPath'),
  129. id: mapValueOfType<String>(json, r'id')!,
  130. isAdmin: mapValueOfType<bool>(json, r'isAdmin')!,
  131. memoriesEnabled: mapValueOfType<bool>(json, r'memoriesEnabled'),
  132. name: mapValueOfType<String>(json, r'name')!,
  133. oauthId: mapValueOfType<String>(json, r'oauthId')!,
  134. profileImagePath: mapValueOfType<String>(json, r'profileImagePath')!,
  135. shouldChangePassword: mapValueOfType<bool>(json, r'shouldChangePassword')!,
  136. storageLabel: mapValueOfType<String>(json, r'storageLabel'),
  137. updatedAt: mapDateTime(json, r'updatedAt', '')!,
  138. );
  139. }
  140. return null;
  141. }
  142. static List<UserResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
  143. final result = <UserResponseDto>[];
  144. if (json is List && json.isNotEmpty) {
  145. for (final row in json) {
  146. final value = UserResponseDto.fromJson(row);
  147. if (value != null) {
  148. result.add(value);
  149. }
  150. }
  151. }
  152. return result.toList(growable: growable);
  153. }
  154. static Map<String, UserResponseDto> mapFromJson(dynamic json) {
  155. final map = <String, UserResponseDto>{};
  156. if (json is Map && json.isNotEmpty) {
  157. json = json.cast<String, dynamic>(); // ignore: parameter_assignments
  158. for (final entry in json.entries) {
  159. final value = UserResponseDto.fromJson(entry.value);
  160. if (value != null) {
  161. map[entry.key] = value;
  162. }
  163. }
  164. }
  165. return map;
  166. }
  167. // maps a json object with a list of UserResponseDto-objects as value to a dart map
  168. static Map<String, List<UserResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
  169. final map = <String, List<UserResponseDto>>{};
  170. if (json is Map && json.isNotEmpty) {
  171. // ignore: parameter_assignments
  172. json = json.cast<String, dynamic>();
  173. for (final entry in json.entries) {
  174. map[entry.key] = UserResponseDto.listFromJson(entry.value, growable: growable,);
  175. }
  176. }
  177. return map;
  178. }
  179. /// The list of required keys that must be present in a JSON.
  180. static const requiredKeys = <String>{
  181. 'avatarColor',
  182. 'createdAt',
  183. 'deletedAt',
  184. 'email',
  185. 'externalPath',
  186. 'id',
  187. 'isAdmin',
  188. 'name',
  189. 'oauthId',
  190. 'profileImagePath',
  191. 'shouldChangePassword',
  192. 'storageLabel',
  193. 'updatedAt',
  194. };
  195. }