rewards_index_entity.g.dart 4.2 KB

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