create_user_dto.dart 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 CreateUserDto {
  11. /// Returns a new [CreateUserDto] instance.
  12. CreateUserDto({
  13. required this.email,
  14. this.externalPath,
  15. required this.firstName,
  16. required this.lastName,
  17. required this.password,
  18. this.storageLabel,
  19. });
  20. String email;
  21. String? externalPath;
  22. String firstName;
  23. String lastName;
  24. String password;
  25. String? storageLabel;
  26. @override
  27. bool operator ==(Object other) => identical(this, other) || other is CreateUserDto &&
  28. other.email == email &&
  29. other.externalPath == externalPath &&
  30. other.firstName == firstName &&
  31. other.lastName == lastName &&
  32. other.password == password &&
  33. other.storageLabel == storageLabel;
  34. @override
  35. int get hashCode =>
  36. // ignore: unnecessary_parenthesis
  37. (email.hashCode) +
  38. (externalPath == null ? 0 : externalPath!.hashCode) +
  39. (firstName.hashCode) +
  40. (lastName.hashCode) +
  41. (password.hashCode) +
  42. (storageLabel == null ? 0 : storageLabel!.hashCode);
  43. @override
  44. String toString() => 'CreateUserDto[email=$email, externalPath=$externalPath, firstName=$firstName, lastName=$lastName, password=$password, storageLabel=$storageLabel]';
  45. Map<String, dynamic> toJson() {
  46. final json = <String, dynamic>{};
  47. json[r'email'] = this.email;
  48. if (this.externalPath != null) {
  49. json[r'externalPath'] = this.externalPath;
  50. } else {
  51. // json[r'externalPath'] = null;
  52. }
  53. json[r'firstName'] = this.firstName;
  54. json[r'lastName'] = this.lastName;
  55. json[r'password'] = this.password;
  56. if (this.storageLabel != null) {
  57. json[r'storageLabel'] = this.storageLabel;
  58. } else {
  59. // json[r'storageLabel'] = null;
  60. }
  61. return json;
  62. }
  63. /// Returns a new [CreateUserDto] instance and imports its values from
  64. /// [value] if it's a [Map], null otherwise.
  65. // ignore: prefer_constructors_over_static_methods
  66. static CreateUserDto? fromJson(dynamic value) {
  67. if (value is Map) {
  68. final json = value.cast<String, dynamic>();
  69. return CreateUserDto(
  70. email: mapValueOfType<String>(json, r'email')!,
  71. externalPath: mapValueOfType<String>(json, r'externalPath'),
  72. firstName: mapValueOfType<String>(json, r'firstName')!,
  73. lastName: mapValueOfType<String>(json, r'lastName')!,
  74. password: mapValueOfType<String>(json, r'password')!,
  75. storageLabel: mapValueOfType<String>(json, r'storageLabel'),
  76. );
  77. }
  78. return null;
  79. }
  80. static List<CreateUserDto> listFromJson(dynamic json, {bool growable = false,}) {
  81. final result = <CreateUserDto>[];
  82. if (json is List && json.isNotEmpty) {
  83. for (final row in json) {
  84. final value = CreateUserDto.fromJson(row);
  85. if (value != null) {
  86. result.add(value);
  87. }
  88. }
  89. }
  90. return result.toList(growable: growable);
  91. }
  92. static Map<String, CreateUserDto> mapFromJson(dynamic json) {
  93. final map = <String, CreateUserDto>{};
  94. if (json is Map && json.isNotEmpty) {
  95. json = json.cast<String, dynamic>(); // ignore: parameter_assignments
  96. for (final entry in json.entries) {
  97. final value = CreateUserDto.fromJson(entry.value);
  98. if (value != null) {
  99. map[entry.key] = value;
  100. }
  101. }
  102. }
  103. return map;
  104. }
  105. // maps a json object with a list of CreateUserDto-objects as value to a dart map
  106. static Map<String, List<CreateUserDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
  107. final map = <String, List<CreateUserDto>>{};
  108. if (json is Map && json.isNotEmpty) {
  109. // ignore: parameter_assignments
  110. json = json.cast<String, dynamic>();
  111. for (final entry in json.entries) {
  112. map[entry.key] = CreateUserDto.listFromJson(entry.value, growable: growable,);
  113. }
  114. }
  115. return map;
  116. }
  117. /// The list of required keys that must be present in a JSON.
  118. static const requiredKeys = <String>{
  119. 'email',
  120. 'firstName',
  121. 'lastName',
  122. 'password',
  123. };
  124. }