rewards_search_entity.g.dart 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/rewards_search_entity.dart';
  3. RewardsSearchEntity $RewardsSearchEntityFromJson(Map<String, dynamic> json) {
  4. final RewardsSearchEntity rewardsSearchEntity = RewardsSearchEntity();
  5. final List<String>? recent = (json['recent'] as List<dynamic>?)?.map(
  6. (e) => jsonConvert.convert<String>(e) as String).toList();
  7. if (recent != null) {
  8. rewardsSearchEntity.recent = recent;
  9. }
  10. final List<String>? trending = (json['trending'] as List<dynamic>?)?.map(
  11. (e) => jsonConvert.convert<String>(e) as String).toList();
  12. if (trending != null) {
  13. rewardsSearchEntity.trending = trending;
  14. }
  15. final List<RewardsSearchRewards>? rewards = (json['rewards'] as List<dynamic>?)?.map(
  16. (e) => jsonConvert.convert<RewardsSearchRewards>(e) as RewardsSearchRewards).toList();
  17. if (rewards != null) {
  18. rewardsSearchEntity.rewards = rewards;
  19. }
  20. return rewardsSearchEntity;
  21. }
  22. Map<String, dynamic> $RewardsSearchEntityToJson(RewardsSearchEntity entity) {
  23. final Map<String, dynamic> data = <String, dynamic>{};
  24. data['recent'] = entity.recent;
  25. data['trending'] = entity.trending;
  26. data['rewards'] = entity.rewards.map((v) => v.toJson()).toList();
  27. return data;
  28. }
  29. extension RewardsSearchEntityExtension on RewardsSearchEntity {
  30. RewardsSearchEntity copyWith({
  31. List<String>? recent,
  32. List<String>? trending,
  33. List<RewardsSearchRewards>? rewards,
  34. }) {
  35. return RewardsSearchEntity()
  36. ..recent = recent ?? this.recent
  37. ..trending = trending ?? this.trending
  38. ..rewards = rewards ?? this.rewards;
  39. }
  40. }
  41. RewardsSearchRewards $RewardsSearchRewardsFromJson(Map<String, dynamic> json) {
  42. final RewardsSearchRewards rewardsSearchRewards = RewardsSearchRewards();
  43. final int? id = jsonConvert.convert<int>(json['id']);
  44. if (id != null) {
  45. rewardsSearchRewards.id = id;
  46. }
  47. final String? name = jsonConvert.convert<String>(json['name']);
  48. if (name != null) {
  49. rewardsSearchRewards.name = name;
  50. }
  51. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  52. (e) => jsonConvert.convert<String>(e) as String).toList();
  53. if (resources != null) {
  54. rewardsSearchRewards.resources = resources;
  55. }
  56. final int? originalPoint = jsonConvert.convert<int>(json['original_point']);
  57. if (originalPoint != null) {
  58. rewardsSearchRewards.originalPoint = originalPoint;
  59. }
  60. final int? point = jsonConvert.convert<int>(json['point']);
  61. if (point != null) {
  62. rewardsSearchRewards.point = point;
  63. }
  64. return rewardsSearchRewards;
  65. }
  66. Map<String, dynamic> $RewardsSearchRewardsToJson(RewardsSearchRewards entity) {
  67. final Map<String, dynamic> data = <String, dynamic>{};
  68. data['id'] = entity.id;
  69. data['name'] = entity.name;
  70. data['resources'] = entity.resources;
  71. data['original_point'] = entity.originalPoint;
  72. data['point'] = entity.point;
  73. return data;
  74. }
  75. extension RewardsSearchRewardsExtension on RewardsSearchRewards {
  76. RewardsSearchRewards copyWith({
  77. int? id,
  78. String? name,
  79. List<String>? resources,
  80. int? originalPoint,
  81. int? point,
  82. }) {
  83. return RewardsSearchRewards()
  84. ..id = id ?? this.id
  85. ..name = name ?? this.name
  86. ..resources = resources ?? this.resources
  87. ..originalPoint = originalPoint ?? this.originalPoint
  88. ..point = point ?? this.point;
  89. }
  90. }