garage_sale_rent_entity.g.dart 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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>?)
  22. ?.map(
  23. (e) =>
  24. jsonConvert.convert<GarageSaleRentList>(e) as GarageSaleRentList)
  25. .toList();
  26. if (list != null) {
  27. garageSaleRentEntity.list = list;
  28. }
  29. return garageSaleRentEntity;
  30. }
  31. Map<String, dynamic> $GarageSaleRentEntityToJson(GarageSaleRentEntity entity) {
  32. final Map<String, dynamic> data = <String, dynamic>{};
  33. data['count'] = entity.count;
  34. data['page'] = entity.page;
  35. data['limit'] = entity.limit;
  36. data['count_page'] = entity.countPage;
  37. data['list'] = entity.list?.map((v) => v.toJson()).toList();
  38. return data;
  39. }
  40. extension GarageSaleRentEntityExtension on GarageSaleRentEntity {
  41. GarageSaleRentEntity copyWith({
  42. int? count,
  43. int? page,
  44. int? limit,
  45. int? countPage,
  46. List<GarageSaleRentList>? list,
  47. }) {
  48. return GarageSaleRentEntity()
  49. ..count = count ?? this.count
  50. ..page = page ?? this.page
  51. ..limit = limit ?? this.limit
  52. ..countPage = countPage ?? this.countPage
  53. ..list = list ?? this.list;
  54. }
  55. }
  56. GarageSaleRentList $GarageSaleRentListFromJson(Map<String, dynamic> json) {
  57. final GarageSaleRentList garageSaleRentList = GarageSaleRentList();
  58. final int? id = jsonConvert.convert<int>(json['id']);
  59. if (id != null) {
  60. garageSaleRentList.id = id;
  61. }
  62. final String? title = jsonConvert.convert<String>(json['title']);
  63. if (title != null) {
  64. garageSaleRentList.title = title;
  65. }
  66. final int? price = jsonConvert.convert<int>(json['price']);
  67. if (price != null) {
  68. garageSaleRentList.price = price;
  69. }
  70. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  71. (e) => jsonConvert.convert<String>(e) as String).toList();
  72. if (resources != null) {
  73. garageSaleRentList.resources = resources;
  74. }
  75. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  76. if (createdAt != null) {
  77. garageSaleRentList.createdAt = createdAt;
  78. }
  79. final bool? liked = jsonConvert.convert<bool>(json['liked']);
  80. if (liked != null) {
  81. garageSaleRentList.liked = liked;
  82. }
  83. final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
  84. if (likesCount != null) {
  85. garageSaleRentList.likesCount = likesCount;
  86. }
  87. final GarageSaleRentListAccount? account = jsonConvert.convert<
  88. GarageSaleRentListAccount>(json['account']);
  89. if (account != null) {
  90. garageSaleRentList.account = account;
  91. }
  92. return garageSaleRentList;
  93. }
  94. Map<String, dynamic> $GarageSaleRentListToJson(GarageSaleRentList entity) {
  95. final Map<String, dynamic> data = <String, dynamic>{};
  96. data['id'] = entity.id;
  97. data['title'] = entity.title;
  98. data['price'] = entity.price;
  99. data['resources'] = entity.resources;
  100. data['created_at'] = entity.createdAt;
  101. data['liked'] = entity.liked;
  102. data['likes_count'] = entity.likesCount;
  103. data['account'] = entity.account?.toJson();
  104. return data;
  105. }
  106. extension GarageSaleRentListExtension on GarageSaleRentList {
  107. GarageSaleRentList copyWith({
  108. int? id,
  109. String? title,
  110. int? price,
  111. List<String>? resources,
  112. String? createdAt,
  113. bool? liked,
  114. int? likesCount,
  115. GarageSaleRentListAccount? account,
  116. }) {
  117. return GarageSaleRentList()
  118. ..id = id ?? this.id
  119. ..title = title ?? this.title
  120. ..price = price ?? this.price
  121. ..resources = resources ?? this.resources
  122. ..createdAt = createdAt ?? this.createdAt
  123. ..liked = liked ?? this.liked
  124. ..likesCount = likesCount ?? this.likesCount
  125. ..account = account ?? this.account;
  126. }
  127. }
  128. GarageSaleRentListAccount $GarageSaleRentListAccountFromJson(
  129. Map<String, dynamic> json) {
  130. final GarageSaleRentListAccount garageSaleRentListAccount = GarageSaleRentListAccount();
  131. final int? id = jsonConvert.convert<int>(json['id']);
  132. if (id != null) {
  133. garageSaleRentListAccount.id = id;
  134. }
  135. final String? name = jsonConvert.convert<String>(json['name']);
  136. if (name != null) {
  137. garageSaleRentListAccount.name = name;
  138. }
  139. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  140. if (avatar != null) {
  141. garageSaleRentListAccount.avatar = avatar;
  142. }
  143. return garageSaleRentListAccount;
  144. }
  145. Map<String, dynamic> $GarageSaleRentListAccountToJson(
  146. GarageSaleRentListAccount entity) {
  147. final Map<String, dynamic> data = <String, dynamic>{};
  148. data['id'] = entity.id;
  149. data['name'] = entity.name;
  150. data['avatar'] = entity.avatar;
  151. return data;
  152. }
  153. extension GarageSaleRentListAccountExtension on GarageSaleRentListAccount {
  154. GarageSaleRentListAccount copyWith({
  155. int? id,
  156. String? name,
  157. String? avatar,
  158. }) {
  159. return GarageSaleRentListAccount()
  160. ..id = id ?? this.id
  161. ..name = name ?? this.name
  162. ..avatar = avatar ?? this.avatar;
  163. }
  164. }