rewards_index_entity.g.dart 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/rewards_index_entity.dart';
  3. RewardsIndexEntity $RewardsIndexEntityFromJson(Map<String, dynamic> json) {
  4. final RewardsIndexEntity rewardsIndexEntity = RewardsIndexEntity();
  5. final int? points = jsonConvert.convert<int>(json['points']);
  6. if (points != null) {
  7. rewardsIndexEntity.points = points;
  8. }
  9. final RewardsIndexContinuous? continuous = jsonConvert.convert<RewardsIndexContinuous>(json['continuous']);
  10. if (continuous != null) {
  11. rewardsIndexEntity.continuous = continuous;
  12. }
  13. final RewardsIndexTasks? tasks = jsonConvert.convert<RewardsIndexTasks>(json['tasks']);
  14. if (tasks != null) {
  15. rewardsIndexEntity.tasks = tasks;
  16. }
  17. final List<dynamic>? latest = (json['latest'] as List<dynamic>?)?.map(
  18. (e) => e).toList();
  19. if (latest != null) {
  20. rewardsIndexEntity.latest = latest;
  21. }
  22. return rewardsIndexEntity;
  23. }
  24. Map<String, dynamic> $RewardsIndexEntityToJson(RewardsIndexEntity entity) {
  25. final Map<String, dynamic> data = <String, dynamic>{};
  26. data['points'] = entity.points;
  27. data['continuous'] = entity.continuous.toJson();
  28. data['tasks'] = entity.tasks.toJson();
  29. data['latest'] = entity.latest;
  30. return data;
  31. }
  32. extension RewardsIndexEntityExtension on RewardsIndexEntity {
  33. RewardsIndexEntity copyWith({
  34. int? points,
  35. RewardsIndexContinuous? continuous,
  36. RewardsIndexTasks? tasks,
  37. List<dynamic>? latest,
  38. }) {
  39. return RewardsIndexEntity()
  40. ..points = points ?? this.points
  41. ..continuous = continuous ?? this.continuous
  42. ..tasks = tasks ?? this.tasks
  43. ..latest = latest ?? this.latest;
  44. }
  45. }
  46. RewardsIndexContinuous $RewardsIndexContinuousFromJson(Map<String, dynamic> json) {
  47. final RewardsIndexContinuous rewardsIndexContinuous = RewardsIndexContinuous();
  48. final int? count = jsonConvert.convert<int>(json['count']);
  49. if (count != null) {
  50. rewardsIndexContinuous.count = count;
  51. }
  52. final List<dynamic>? currentWeekCheckin = (json['current_week_checkin'] as List<dynamic>?)?.map(
  53. (e) => e).toList();
  54. if (currentWeekCheckin != null) {
  55. rewardsIndexContinuous.currentWeekCheckin = currentWeekCheckin;
  56. }
  57. return rewardsIndexContinuous;
  58. }
  59. Map<String, dynamic> $RewardsIndexContinuousToJson(RewardsIndexContinuous entity) {
  60. final Map<String, dynamic> data = <String, dynamic>{};
  61. data['count'] = entity.count;
  62. data['current_week_checkin'] = entity.currentWeekCheckin;
  63. return data;
  64. }
  65. extension RewardsIndexContinuousExtension on RewardsIndexContinuous {
  66. RewardsIndexContinuous copyWith({
  67. int? count,
  68. List<dynamic>? currentWeekCheckin,
  69. }) {
  70. return RewardsIndexContinuous()
  71. ..count = count ?? this.count
  72. ..currentWeekCheckin = currentWeekCheckin ?? this.currentWeekCheckin;
  73. }
  74. }
  75. RewardsIndexTasks $RewardsIndexTasksFromJson(Map<String, dynamic> json) {
  76. final RewardsIndexTasks rewardsIndexTasks = RewardsIndexTasks();
  77. final bool? dailyCheckin = jsonConvert.convert<bool>(json['daily_checkin']);
  78. if (dailyCheckin != null) {
  79. rewardsIndexTasks.dailyCheckin = dailyCheckin;
  80. }
  81. final bool? newsFeedPost = jsonConvert.convert<bool>(json['news_feed_post']);
  82. if (newsFeedPost != null) {
  83. rewardsIndexTasks.newsFeedPost = newsFeedPost;
  84. }
  85. final int? give10Likes = jsonConvert.convert<int>(json['give_10_likes']);
  86. if (give10Likes != null) {
  87. rewardsIndexTasks.give10Likes = give10Likes;
  88. }
  89. return rewardsIndexTasks;
  90. }
  91. Map<String, dynamic> $RewardsIndexTasksToJson(RewardsIndexTasks entity) {
  92. final Map<String, dynamic> data = <String, dynamic>{};
  93. data['daily_checkin'] = entity.dailyCheckin;
  94. data['news_feed_post'] = entity.newsFeedPost;
  95. data['give_10_likes'] = entity.give10Likes;
  96. return data;
  97. }
  98. extension RewardsIndexTasksExtension on RewardsIndexTasks {
  99. RewardsIndexTasks copyWith({
  100. bool? dailyCheckin,
  101. bool? newsFeedPost,
  102. int? give10Likes,
  103. }) {
  104. return RewardsIndexTasks()
  105. ..dailyCheckin = dailyCheckin ?? this.dailyCheckin
  106. ..newsFeedPost = newsFeedPost ?? this.newsFeedPost
  107. ..give10Likes = give10Likes ?? this.give10Likes;
  108. }
  109. }