myposts_sale_rent_entity.g.dart 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/myposts_sale_rent_entity.dart';
  3. MypostsSaleRentEntity $MypostsSaleRentEntityFromJson(
  4. Map<String, dynamic> json) {
  5. final MypostsSaleRentEntity mypostsSaleRentEntity = MypostsSaleRentEntity();
  6. final int? count = jsonConvert.convert<int>(json['count']);
  7. if (count != null) {
  8. mypostsSaleRentEntity.count = count;
  9. }
  10. final int? page = jsonConvert.convert<int>(json['page']);
  11. if (page != null) {
  12. mypostsSaleRentEntity.page = page;
  13. }
  14. final int? limit = jsonConvert.convert<int>(json['limit']);
  15. if (limit != null) {
  16. mypostsSaleRentEntity.limit = limit;
  17. }
  18. final int? countPage = jsonConvert.convert<int>(json['count_page']);
  19. if (countPage != null) {
  20. mypostsSaleRentEntity.countPage = countPage;
  21. }
  22. final List<MypostsSaleRentList>? list = (json['list'] as List<dynamic>?)
  23. ?.map(
  24. (e) =>
  25. jsonConvert.convert<MypostsSaleRentList>(e) as MypostsSaleRentList)
  26. .toList();
  27. if (list != null) {
  28. mypostsSaleRentEntity.list = list;
  29. }
  30. return mypostsSaleRentEntity;
  31. }
  32. Map<String, dynamic> $MypostsSaleRentEntityToJson(
  33. MypostsSaleRentEntity entity) {
  34. final Map<String, dynamic> data = <String, dynamic>{};
  35. data['count'] = entity.count;
  36. data['page'] = entity.page;
  37. data['limit'] = entity.limit;
  38. data['count_page'] = entity.countPage;
  39. data['list'] = entity.list?.map((v) => v.toJson()).toList();
  40. return data;
  41. }
  42. extension MypostsSaleRentEntityExtension on MypostsSaleRentEntity {
  43. MypostsSaleRentEntity copyWith({
  44. int? count,
  45. int? page,
  46. int? limit,
  47. int? countPage,
  48. List<MypostsSaleRentList>? list,
  49. }) {
  50. return MypostsSaleRentEntity()
  51. ..count = count ?? this.count
  52. ..page = page ?? this.page
  53. ..limit = limit ?? this.limit
  54. ..countPage = countPage ?? this.countPage
  55. ..list = list ?? this.list;
  56. }
  57. }
  58. MypostsSaleRentList $MypostsSaleRentListFromJson(Map<String, dynamic> json) {
  59. final MypostsSaleRentList mypostsSaleRentList = MypostsSaleRentList();
  60. final int? id = jsonConvert.convert<int>(json['id']);
  61. if (id != null) {
  62. mypostsSaleRentList.id = id;
  63. }
  64. final String? title = jsonConvert.convert<String>(json['title']);
  65. if (title != null) {
  66. mypostsSaleRentList.title = title;
  67. }
  68. final int? price = jsonConvert.convert<int>(json['price']);
  69. if (price != null) {
  70. mypostsSaleRentList.price = price;
  71. }
  72. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  73. (e) => jsonConvert.convert<String>(e) as String).toList();
  74. if (resources != null) {
  75. mypostsSaleRentList.resources = resources;
  76. }
  77. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  78. if (createdAt != null) {
  79. mypostsSaleRentList.createdAt = createdAt;
  80. }
  81. final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
  82. if (likesCount != null) {
  83. mypostsSaleRentList.likesCount = likesCount;
  84. }
  85. return mypostsSaleRentList;
  86. }
  87. Map<String, dynamic> $MypostsSaleRentListToJson(MypostsSaleRentList entity) {
  88. final Map<String, dynamic> data = <String, dynamic>{};
  89. data['id'] = entity.id;
  90. data['title'] = entity.title;
  91. data['price'] = entity.price;
  92. data['resources'] = entity.resources;
  93. data['created_at'] = entity.createdAt;
  94. data['likes_count'] = entity.likesCount;
  95. return data;
  96. }
  97. extension MypostsSaleRentListExtension on MypostsSaleRentList {
  98. MypostsSaleRentList copyWith({
  99. int? id,
  100. String? title,
  101. int? price,
  102. List<String>? resources,
  103. String? createdAt,
  104. int? likesCount,
  105. }) {
  106. return MypostsSaleRentList()
  107. ..id = id ?? this.id
  108. ..title = title ?? this.title
  109. ..price = price ?? this.price
  110. ..resources = resources ?? this.resources
  111. ..createdAt = createdAt ?? this.createdAt
  112. ..likesCount = likesCount ?? this.likesCount;
  113. }
  114. }