rewards_search_entity.g.dart 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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<
  16. dynamic>?)
  17. ?.map(
  18. (e) =>
  19. jsonConvert.convert<RewardsSearchRewards>(e) as RewardsSearchRewards)
  20. .toList();
  21. if (rewards != null) {
  22. rewardsSearchEntity.rewards = rewards;
  23. }
  24. return rewardsSearchEntity;
  25. }
  26. Map<String, dynamic> $RewardsSearchEntityToJson(RewardsSearchEntity entity) {
  27. final Map<String, dynamic> data = <String, dynamic>{};
  28. data['recent'] = entity.recent;
  29. data['trending'] = entity.trending;
  30. data['rewards'] = entity.rewards.map((v) => v.toJson()).toList();
  31. return data;
  32. }
  33. extension RewardsSearchEntityExtension on RewardsSearchEntity {
  34. RewardsSearchEntity copyWith({
  35. List<String>? recent,
  36. List<String>? trending,
  37. List<RewardsSearchRewards>? rewards,
  38. }) {
  39. return RewardsSearchEntity()
  40. ..recent = recent ?? this.recent
  41. ..trending = trending ?? this.trending
  42. ..rewards = rewards ?? this.rewards;
  43. }
  44. }
  45. RewardsSearchRewards $RewardsSearchRewardsFromJson(Map<String, dynamic> json) {
  46. final RewardsSearchRewards rewardsSearchRewards = RewardsSearchRewards();
  47. final int? id = jsonConvert.convert<int>(json['id']);
  48. if (id != null) {
  49. rewardsSearchRewards.id = id;
  50. }
  51. final String? name = jsonConvert.convert<String>(json['name']);
  52. if (name != null) {
  53. rewardsSearchRewards.name = name;
  54. }
  55. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  56. (e) => jsonConvert.convert<String>(e) as String).toList();
  57. if (resources != null) {
  58. rewardsSearchRewards.resources = resources;
  59. }
  60. final int? originalPoint = jsonConvert.convert<int>(json['original_point']);
  61. if (originalPoint != null) {
  62. rewardsSearchRewards.originalPoint = originalPoint;
  63. }
  64. final int? point = jsonConvert.convert<int>(json['point']);
  65. if (point != null) {
  66. rewardsSearchRewards.point = point;
  67. }
  68. return rewardsSearchRewards;
  69. }
  70. Map<String, dynamic> $RewardsSearchRewardsToJson(RewardsSearchRewards entity) {
  71. final Map<String, dynamic> data = <String, dynamic>{};
  72. data['id'] = entity.id;
  73. data['name'] = entity.name;
  74. data['resources'] = entity.resources;
  75. data['original_point'] = entity.originalPoint;
  76. data['point'] = entity.point;
  77. return data;
  78. }
  79. extension RewardsSearchRewardsExtension on RewardsSearchRewards {
  80. RewardsSearchRewards copyWith({
  81. int? id,
  82. String? name,
  83. List<String>? resources,
  84. int? originalPoint,
  85. int? point,
  86. }) {
  87. return RewardsSearchRewards()
  88. ..id = id ?? this.id
  89. ..name = name ?? this.name
  90. ..resources = resources ?? this.resources
  91. ..originalPoint = originalPoint ?? this.originalPoint
  92. ..point = point ?? this.point;
  93. }
  94. }