myposts_newsfeed_entity.g.dart 6.0 KB

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