rewards_my_entity.g.dart 5.6 KB

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