myposts_sale_rent_entity.g.dart 3.9 KB

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