rewards_my_entity.g.dart 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/rewards_my_entity.dart';
  3. RewardsMyEntity $RewardsMyEntityFromJson(Map<String, dynamic> json) {
  4. final RewardsMyEntity rewardsMyEntity = RewardsMyEntity();
  5. final int? count = jsonConvert.convert<int>(json['count']);
  6. if (count != null) {
  7. rewardsMyEntity.count = count;
  8. }
  9. final int? page = jsonConvert.convert<int>(json['page']);
  10. if (page != null) {
  11. rewardsMyEntity.page = page;
  12. }
  13. final int? limit = jsonConvert.convert<int>(json['limit']);
  14. if (limit != null) {
  15. rewardsMyEntity.limit = limit;
  16. }
  17. final int? countPage = jsonConvert.convert<int>(json['count_page']);
  18. if (countPage != null) {
  19. rewardsMyEntity.countPage = countPage;
  20. }
  21. final List<RewardsMyList>? list = (json['list'] as List<dynamic>?)?.map(
  22. (e) => jsonConvert.convert<RewardsMyList>(e) as RewardsMyList).toList();
  23. if (list != null) {
  24. rewardsMyEntity.list = list;
  25. }
  26. return rewardsMyEntity;
  27. }
  28. Map<String, dynamic> $RewardsMyEntityToJson(RewardsMyEntity entity) {
  29. final Map<String, dynamic> data = <String, dynamic>{};
  30. data['count'] = entity.count;
  31. data['page'] = entity.page;
  32. data['limit'] = entity.limit;
  33. data['count_page'] = entity.countPage;
  34. data['list'] = entity.list.map((v) => v.toJson()).toList();
  35. return data;
  36. }
  37. extension RewardsMyEntityExtension on RewardsMyEntity {
  38. RewardsMyEntity copyWith({
  39. int? count,
  40. int? page,
  41. int? limit,
  42. int? countPage,
  43. List<RewardsMyList>? list,
  44. }) {
  45. return RewardsMyEntity()
  46. ..count = count ?? this.count
  47. ..page = page ?? this.page
  48. ..limit = limit ?? this.limit
  49. ..countPage = countPage ?? this.countPage
  50. ..list = list ?? this.list;
  51. }
  52. }
  53. RewardsMyList $RewardsMyListFromJson(Map<String, dynamic> json) {
  54. final RewardsMyList rewardsMyList = RewardsMyList();
  55. final int? id = jsonConvert.convert<int>(json['id']);
  56. if (id != null) {
  57. rewardsMyList.id = id;
  58. }
  59. final int? redemptionCode = jsonConvert.convert<int>(json['redemption_code']);
  60. if (redemptionCode != null) {
  61. rewardsMyList.redemptionCode = redemptionCode;
  62. }
  63. final String? usedAt = jsonConvert.convert<String>(json['used_at']);
  64. if (usedAt != null) {
  65. rewardsMyList.usedAt = usedAt;
  66. }
  67. final RewardsMyListReward? reward = jsonConvert.convert<RewardsMyListReward>(json['reward']);
  68. if (reward != null) {
  69. rewardsMyList.reward = reward;
  70. }
  71. return rewardsMyList;
  72. }
  73. Map<String, dynamic> $RewardsMyListToJson(RewardsMyList entity) {
  74. final Map<String, dynamic> data = <String, dynamic>{};
  75. data['id'] = entity.id;
  76. data['redemption_code'] = entity.redemptionCode;
  77. data['used_at'] = entity.usedAt;
  78. data['reward'] = entity.reward.toJson();
  79. return data;
  80. }
  81. extension RewardsMyListExtension on RewardsMyList {
  82. RewardsMyList copyWith({
  83. int? id,
  84. int? redemptionCode,
  85. String? usedAt,
  86. RewardsMyListReward? reward,
  87. }) {
  88. return RewardsMyList()
  89. ..id = id ?? this.id
  90. ..redemptionCode = redemptionCode ?? this.redemptionCode
  91. ..usedAt = usedAt ?? this.usedAt
  92. ..reward = reward ?? this.reward;
  93. }
  94. }
  95. RewardsMyListReward $RewardsMyListRewardFromJson(Map<String, dynamic> json) {
  96. final RewardsMyListReward rewardsMyListReward = RewardsMyListReward();
  97. final int? id = jsonConvert.convert<int>(json['id']);
  98. if (id != null) {
  99. rewardsMyListReward.id = id;
  100. }
  101. final String? title = jsonConvert.convert<String>(json['title']);
  102. if (title != null) {
  103. rewardsMyListReward.title = title;
  104. }
  105. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  106. (e) => jsonConvert.convert<String>(e) as String).toList();
  107. if (resources != null) {
  108. rewardsMyListReward.resources = resources;
  109. }
  110. final int? originalPoint = jsonConvert.convert<int>(json['original_point']);
  111. if (originalPoint != null) {
  112. rewardsMyListReward.originalPoint = originalPoint;
  113. }
  114. final int? point = jsonConvert.convert<int>(json['point']);
  115. if (point != null) {
  116. rewardsMyListReward.point = point;
  117. }
  118. final String? redeemedStart = jsonConvert.convert<String>(json['redeemed_start']);
  119. if (redeemedStart != null) {
  120. rewardsMyListReward.redeemedStart = redeemedStart;
  121. }
  122. final String? redeemedEnd = jsonConvert.convert<String>(json['redeemed_end']);
  123. if (redeemedEnd != null) {
  124. rewardsMyListReward.redeemedEnd = redeemedEnd;
  125. }
  126. return rewardsMyListReward;
  127. }
  128. Map<String, dynamic> $RewardsMyListRewardToJson(RewardsMyListReward entity) {
  129. final Map<String, dynamic> data = <String, dynamic>{};
  130. data['id'] = entity.id;
  131. data['title'] = entity.title;
  132. data['resources'] = entity.resources;
  133. data['original_point'] = entity.originalPoint;
  134. data['point'] = entity.point;
  135. data['redeemed_start'] = entity.redeemedStart;
  136. data['redeemed_end'] = entity.redeemedEnd;
  137. return data;
  138. }
  139. extension RewardsMyListRewardExtension on RewardsMyListReward {
  140. RewardsMyListReward copyWith({
  141. int? id,
  142. String? title,
  143. List<String>? resources,
  144. int? originalPoint,
  145. int? point,
  146. String? redeemedStart,
  147. String? redeemedEnd,
  148. }) {
  149. return RewardsMyListReward()
  150. ..id = id ?? this.id
  151. ..title = title ?? this.title
  152. ..resources = resources ?? this.resources
  153. ..originalPoint = originalPoint ?? this.originalPoint
  154. ..point = point ?? this.point
  155. ..redeemedStart = redeemedStart ?? this.redeemedStart
  156. ..redeemedEnd = redeemedEnd ?? this.redeemedEnd;
  157. }
  158. }