garage_sale_rent_entity.g.dart 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/garage_sale_rent_entity.dart';
  3. GarageSaleRentEntity $GarageSaleRentEntityFromJson(Map<String, dynamic> json) {
  4. final GarageSaleRentEntity garageSaleRentEntity = GarageSaleRentEntity();
  5. final int? count = jsonConvert.convert<int>(json['count']);
  6. if (count != null) {
  7. garageSaleRentEntity.count = count;
  8. }
  9. final int? page = jsonConvert.convert<int>(json['page']);
  10. if (page != null) {
  11. garageSaleRentEntity.page = page;
  12. }
  13. final int? limit = jsonConvert.convert<int>(json['limit']);
  14. if (limit != null) {
  15. garageSaleRentEntity.limit = limit;
  16. }
  17. final int? countPage = jsonConvert.convert<int>(json['count_page']);
  18. if (countPage != null) {
  19. garageSaleRentEntity.countPage = countPage;
  20. }
  21. final List<GarageSaleRentList>? list = (json['list'] as List<dynamic>?)?.map(
  22. (e) => jsonConvert.convert<GarageSaleRentList>(e) as GarageSaleRentList).toList();
  23. if (list != null) {
  24. garageSaleRentEntity.list = list;
  25. }
  26. return garageSaleRentEntity;
  27. }
  28. Map<String, dynamic> $GarageSaleRentEntityToJson(GarageSaleRentEntity 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 GarageSaleRentEntityExtension on GarageSaleRentEntity {
  38. GarageSaleRentEntity copyWith({
  39. int? count,
  40. int? page,
  41. int? limit,
  42. int? countPage,
  43. List<GarageSaleRentList>? list,
  44. }) {
  45. return GarageSaleRentEntity()
  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. GarageSaleRentList $GarageSaleRentListFromJson(Map<String, dynamic> json) {
  54. final GarageSaleRentList garageSaleRentList = GarageSaleRentList();
  55. final int? id = jsonConvert.convert<int>(json['id']);
  56. if (id != null) {
  57. garageSaleRentList.id = id;
  58. }
  59. final String? title = jsonConvert.convert<String>(json['title']);
  60. if (title != null) {
  61. garageSaleRentList.title = title;
  62. }
  63. final int? price = jsonConvert.convert<int>(json['price']);
  64. if (price != null) {
  65. garageSaleRentList.price = price;
  66. }
  67. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  68. (e) => jsonConvert.convert<String>(e) as String).toList();
  69. if (resources != null) {
  70. garageSaleRentList.resources = resources;
  71. }
  72. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  73. if (createdAt != null) {
  74. garageSaleRentList.createdAt = createdAt;
  75. }
  76. final bool? liked = jsonConvert.convert<bool>(json['liked']);
  77. if (liked != null) {
  78. garageSaleRentList.liked = liked;
  79. }
  80. final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
  81. if (likesCount != null) {
  82. garageSaleRentList.likesCount = likesCount;
  83. }
  84. final GarageSaleRentListAccount? account = jsonConvert.convert<GarageSaleRentListAccount>(json['account']);
  85. if (account != null) {
  86. garageSaleRentList.account = account;
  87. }
  88. return garageSaleRentList;
  89. }
  90. Map<String, dynamic> $GarageSaleRentListToJson(GarageSaleRentList entity) {
  91. final Map<String, dynamic> data = <String, dynamic>{};
  92. data['id'] = entity.id;
  93. data['title'] = entity.title;
  94. data['price'] = entity.price;
  95. data['resources'] = entity.resources;
  96. data['created_at'] = entity.createdAt;
  97. data['liked'] = entity.liked;
  98. data['likes_count'] = entity.likesCount;
  99. data['account'] = entity.account?.toJson();
  100. return data;
  101. }
  102. extension GarageSaleRentListExtension on GarageSaleRentList {
  103. GarageSaleRentList copyWith({
  104. int? id,
  105. String? title,
  106. int? price,
  107. List<String>? resources,
  108. String? createdAt,
  109. bool? liked,
  110. int? likesCount,
  111. GarageSaleRentListAccount? account,
  112. }) {
  113. return GarageSaleRentList()
  114. ..id = id ?? this.id
  115. ..title = title ?? this.title
  116. ..price = price ?? this.price
  117. ..resources = resources ?? this.resources
  118. ..createdAt = createdAt ?? this.createdAt
  119. ..liked = liked ?? this.liked
  120. ..likesCount = likesCount ?? this.likesCount
  121. ..account = account ?? this.account;
  122. }
  123. }
  124. GarageSaleRentListAccount $GarageSaleRentListAccountFromJson(Map<String, dynamic> json) {
  125. final GarageSaleRentListAccount garageSaleRentListAccount = GarageSaleRentListAccount();
  126. final int? id = jsonConvert.convert<int>(json['id']);
  127. if (id != null) {
  128. garageSaleRentListAccount.id = id;
  129. }
  130. final String? name = jsonConvert.convert<String>(json['name']);
  131. if (name != null) {
  132. garageSaleRentListAccount.name = name;
  133. }
  134. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  135. if (avatar != null) {
  136. garageSaleRentListAccount.avatar = avatar;
  137. }
  138. return garageSaleRentListAccount;
  139. }
  140. Map<String, dynamic> $GarageSaleRentListAccountToJson(GarageSaleRentListAccount entity) {
  141. final Map<String, dynamic> data = <String, dynamic>{};
  142. data['id'] = entity.id;
  143. data['name'] = entity.name;
  144. data['avatar'] = entity.avatar;
  145. return data;
  146. }
  147. extension GarageSaleRentListAccountExtension on GarageSaleRentListAccount {
  148. GarageSaleRentListAccount copyWith({
  149. int? id,
  150. String? name,
  151. String? avatar,
  152. }) {
  153. return GarageSaleRentListAccount()
  154. ..id = id ?? this.id
  155. ..name = name ?? this.name
  156. ..avatar = avatar ?? this.avatar;
  157. }
  158. }