api_key_create_dto.dart 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 APIKeyCreateDto {
  11. /// Returns a new [APIKeyCreateDto] instance.
  12. APIKeyCreateDto({
  13. this.name,
  14. });
  15. ///
  16. /// Please note: This property should have been non-nullable! Since the specification file
  17. /// does not include a default value (using the "default:" property), however, the generated
  18. /// source code must fall back to having a nullable type.
  19. /// Consider adding a "default:" property in the specification file to hide this note.
  20. ///
  21. String? name;
  22. @override
  23. bool operator ==(Object other) => identical(this, other) || other is APIKeyCreateDto &&
  24. other.name == name;
  25. @override
  26. int get hashCode =>
  27. // ignore: unnecessary_parenthesis
  28. (name == null ? 0 : name!.hashCode);
  29. @override
  30. String toString() => 'APIKeyCreateDto[name=$name]';
  31. Map<String, dynamic> toJson() {
  32. final json = <String, dynamic>{};
  33. if (this.name != null) {
  34. json[r'name'] = this.name;
  35. } else {
  36. // json[r'name'] = null;
  37. }
  38. return json;
  39. }
  40. /// Returns a new [APIKeyCreateDto] instance and imports its values from
  41. /// [value] if it's a [Map], null otherwise.
  42. // ignore: prefer_constructors_over_static_methods
  43. static APIKeyCreateDto? fromJson(dynamic value) {
  44. if (value is Map) {
  45. final json = value.cast<String, dynamic>();
  46. // Ensure that the map contains the required keys.
  47. // Note 1: the values aren't checked for validity beyond being non-null.
  48. // Note 2: this code is stripped in release mode!
  49. assert(() {
  50. requiredKeys.forEach((key) {
  51. assert(json.containsKey(key), 'Required key "APIKeyCreateDto[$key]" is missing from JSON.');
  52. assert(json[key] != null, 'Required key "APIKeyCreateDto[$key]" has a null value in JSON.');
  53. });
  54. return true;
  55. }());
  56. return APIKeyCreateDto(
  57. name: mapValueOfType<String>(json, r'name'),
  58. );
  59. }
  60. return null;
  61. }
  62. static List<APIKeyCreateDto> listFromJson(dynamic json, {bool growable = false,}) {
  63. final result = <APIKeyCreateDto>[];
  64. if (json is List && json.isNotEmpty) {
  65. for (final row in json) {
  66. final value = APIKeyCreateDto.fromJson(row);
  67. if (value != null) {
  68. result.add(value);
  69. }
  70. }
  71. }
  72. return result.toList(growable: growable);
  73. }
  74. static Map<String, APIKeyCreateDto> mapFromJson(dynamic json) {
  75. final map = <String, APIKeyCreateDto>{};
  76. if (json is Map && json.isNotEmpty) {
  77. json = json.cast<String, dynamic>(); // ignore: parameter_assignments
  78. for (final entry in json.entries) {
  79. final value = APIKeyCreateDto.fromJson(entry.value);
  80. if (value != null) {
  81. map[entry.key] = value;
  82. }
  83. }
  84. }
  85. return map;
  86. }
  87. // maps a json object with a list of APIKeyCreateDto-objects as value to a dart map
  88. static Map<String, List<APIKeyCreateDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
  89. final map = <String, List<APIKeyCreateDto>>{};
  90. if (json is Map && json.isNotEmpty) {
  91. // ignore: parameter_assignments
  92. json = json.cast<String, dynamic>();
  93. for (final entry in json.entries) {
  94. map[entry.key] = APIKeyCreateDto.listFromJson(entry.value, growable: growable,);
  95. }
  96. }
  97. return map;
  98. }
  99. /// The list of required keys that must be present in a JSON.
  100. static const requiredKeys = <String>{
  101. };
  102. }