newsfeed_detail_entity.g.dart 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/newsfeed_detail_entity.dart';
  3. NewsfeedDetailEntity $NewsfeedDetailEntityFromJson(Map<String, dynamic> json) {
  4. final NewsfeedDetailEntity newsfeedDetailEntity = NewsfeedDetailEntity();
  5. final int? id = jsonConvert.convert<int>(json['id']);
  6. if (id != null) {
  7. newsfeedDetailEntity.id = id;
  8. }
  9. final String? content = jsonConvert.convert<String>(json['content']);
  10. if (content != null) {
  11. newsfeedDetailEntity.content = content;
  12. }
  13. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  14. (e) => jsonConvert.convert<String>(e) as String).toList();
  15. if (resources != null) {
  16. newsfeedDetailEntity.resources = resources;
  17. }
  18. final int? clicks = jsonConvert.convert<int>(json['clicks']);
  19. if (clicks != null) {
  20. newsfeedDetailEntity.clicks = clicks;
  21. }
  22. final int? share = jsonConvert.convert<int>(json['share']);
  23. if (share != null) {
  24. newsfeedDetailEntity.share = share;
  25. }
  26. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  27. if (createdAt != null) {
  28. newsfeedDetailEntity.createdAt = createdAt;
  29. }
  30. final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
  31. if (likesCount != null) {
  32. newsfeedDetailEntity.likesCount = likesCount;
  33. }
  34. final int? commentsCount = jsonConvert.convert<int>(json['comments_count']);
  35. if (commentsCount != null) {
  36. newsfeedDetailEntity.commentsCount = commentsCount;
  37. }
  38. final bool? liked = jsonConvert.convert<bool>(json['liked']);
  39. if (liked != null) {
  40. newsfeedDetailEntity.liked = liked;
  41. }
  42. final NewsfeedDetailAccount? account = jsonConvert.convert<NewsfeedDetailAccount>(json['account']);
  43. if (account != null) {
  44. newsfeedDetailEntity.account = account;
  45. }
  46. final List<NewsfeedDetailComments>? comments = (json['comments'] as List<dynamic>?)?.map(
  47. (e) => jsonConvert.convert<NewsfeedDetailComments>(e) as NewsfeedDetailComments).toList();
  48. if (comments != null) {
  49. newsfeedDetailEntity.comments = comments;
  50. }
  51. return newsfeedDetailEntity;
  52. }
  53. Map<String, dynamic> $NewsfeedDetailEntityToJson(NewsfeedDetailEntity entity) {
  54. final Map<String, dynamic> data = <String, dynamic>{};
  55. data['id'] = entity.id;
  56. data['content'] = entity.content;
  57. data['resources'] = entity.resources;
  58. data['clicks'] = entity.clicks;
  59. data['share'] = entity.share;
  60. data['created_at'] = entity.createdAt;
  61. data['likes_count'] = entity.likesCount;
  62. data['comments_count'] = entity.commentsCount;
  63. data['liked'] = entity.liked;
  64. data['account'] = entity.account?.toJson();
  65. data['comments'] = entity.comments?.map((v) => v.toJson()).toList();
  66. return data;
  67. }
  68. extension NewsfeedDetailEntityExtension on NewsfeedDetailEntity {
  69. NewsfeedDetailEntity copyWith({
  70. int? id,
  71. String? content,
  72. List<String>? resources,
  73. int? clicks,
  74. int? share,
  75. String? createdAt,
  76. int? likesCount,
  77. int? commentsCount,
  78. bool? liked,
  79. NewsfeedDetailAccount? account,
  80. List<NewsfeedDetailComments>? comments,
  81. }) {
  82. return NewsfeedDetailEntity()
  83. ..id = id ?? this.id
  84. ..content = content ?? this.content
  85. ..resources = resources ?? this.resources
  86. ..clicks = clicks ?? this.clicks
  87. ..share = share ?? this.share
  88. ..createdAt = createdAt ?? this.createdAt
  89. ..likesCount = likesCount ?? this.likesCount
  90. ..commentsCount = commentsCount ?? this.commentsCount
  91. ..liked = liked ?? this.liked
  92. ..account = account ?? this.account
  93. ..comments = comments ?? this.comments;
  94. }
  95. }
  96. NewsfeedDetailAccount $NewsfeedDetailAccountFromJson(Map<String, dynamic> json) {
  97. final NewsfeedDetailAccount newsfeedDetailAccount = NewsfeedDetailAccount();
  98. final int? id = jsonConvert.convert<int>(json['id']);
  99. if (id != null) {
  100. newsfeedDetailAccount.id = id;
  101. }
  102. final String? name = jsonConvert.convert<String>(json['name']);
  103. if (name != null) {
  104. newsfeedDetailAccount.name = name;
  105. }
  106. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  107. if (avatar != null) {
  108. newsfeedDetailAccount.avatar = avatar;
  109. }
  110. final bool? followed = jsonConvert.convert<bool>(json['followed']);
  111. if (followed != null) {
  112. newsfeedDetailAccount.followed = followed;
  113. }
  114. return newsfeedDetailAccount;
  115. }
  116. Map<String, dynamic> $NewsfeedDetailAccountToJson(NewsfeedDetailAccount entity) {
  117. final Map<String, dynamic> data = <String, dynamic>{};
  118. data['id'] = entity.id;
  119. data['name'] = entity.name;
  120. data['avatar'] = entity.avatar;
  121. data['followed'] = entity.followed;
  122. return data;
  123. }
  124. extension NewsfeedDetailAccountExtension on NewsfeedDetailAccount {
  125. NewsfeedDetailAccount copyWith({
  126. int? id,
  127. String? name,
  128. String? avatar,
  129. bool? followed,
  130. }) {
  131. return NewsfeedDetailAccount()
  132. ..id = id ?? this.id
  133. ..name = name ?? this.name
  134. ..avatar = avatar ?? this.avatar
  135. ..followed = followed ?? this.followed;
  136. }
  137. }
  138. NewsfeedDetailComments $NewsfeedDetailCommentsFromJson(Map<String, dynamic> json) {
  139. final NewsfeedDetailComments newsfeedDetailComments = NewsfeedDetailComments();
  140. final int? id = jsonConvert.convert<int>(json['id']);
  141. if (id != null) {
  142. newsfeedDetailComments.id = id;
  143. }
  144. final String? content = jsonConvert.convert<String>(json['content']);
  145. if (content != null) {
  146. newsfeedDetailComments.content = content;
  147. }
  148. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  149. if (createdAt != null) {
  150. newsfeedDetailComments.createdAt = createdAt;
  151. }
  152. final NewsfeedDetailCommentsAccount? account = jsonConvert.convert<NewsfeedDetailCommentsAccount>(json['account']);
  153. if (account != null) {
  154. newsfeedDetailComments.account = account;
  155. }
  156. final NewsfeedDetailCommentsToAccount? toAccount = jsonConvert.convert<NewsfeedDetailCommentsToAccount>(json['to_account']);
  157. if (toAccount != null) {
  158. newsfeedDetailComments.toAccount = toAccount;
  159. }
  160. return newsfeedDetailComments;
  161. }
  162. Map<String, dynamic> $NewsfeedDetailCommentsToJson(NewsfeedDetailComments entity) {
  163. final Map<String, dynamic> data = <String, dynamic>{};
  164. data['id'] = entity.id;
  165. data['content'] = entity.content;
  166. data['created_at'] = entity.createdAt;
  167. data['account'] = entity.account?.toJson();
  168. data['to_account'] = entity.toAccount?.toJson();
  169. return data;
  170. }
  171. extension NewsfeedDetailCommentsExtension on NewsfeedDetailComments {
  172. NewsfeedDetailComments copyWith({
  173. int? id,
  174. String? content,
  175. String? createdAt,
  176. NewsfeedDetailCommentsAccount? account,
  177. NewsfeedDetailCommentsToAccount? toAccount,
  178. }) {
  179. return NewsfeedDetailComments()
  180. ..id = id ?? this.id
  181. ..content = content ?? this.content
  182. ..createdAt = createdAt ?? this.createdAt
  183. ..account = account ?? this.account
  184. ..toAccount = toAccount ?? this.toAccount;
  185. }
  186. }
  187. NewsfeedDetailCommentsAccount $NewsfeedDetailCommentsAccountFromJson(Map<String, dynamic> json) {
  188. final NewsfeedDetailCommentsAccount newsfeedDetailCommentsAccount = NewsfeedDetailCommentsAccount();
  189. final int? id = jsonConvert.convert<int>(json['id']);
  190. if (id != null) {
  191. newsfeedDetailCommentsAccount.id = id;
  192. }
  193. final String? name = jsonConvert.convert<String>(json['name']);
  194. if (name != null) {
  195. newsfeedDetailCommentsAccount.name = name;
  196. }
  197. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  198. if (avatar != null) {
  199. newsfeedDetailCommentsAccount.avatar = avatar;
  200. }
  201. return newsfeedDetailCommentsAccount;
  202. }
  203. Map<String, dynamic> $NewsfeedDetailCommentsAccountToJson(NewsfeedDetailCommentsAccount entity) {
  204. final Map<String, dynamic> data = <String, dynamic>{};
  205. data['id'] = entity.id;
  206. data['name'] = entity.name;
  207. data['avatar'] = entity.avatar;
  208. return data;
  209. }
  210. extension NewsfeedDetailCommentsAccountExtension on NewsfeedDetailCommentsAccount {
  211. NewsfeedDetailCommentsAccount copyWith({
  212. int? id,
  213. String? name,
  214. String? avatar,
  215. }) {
  216. return NewsfeedDetailCommentsAccount()
  217. ..id = id ?? this.id
  218. ..name = name ?? this.name
  219. ..avatar = avatar ?? this.avatar;
  220. }
  221. }
  222. NewsfeedDetailCommentsToAccount $NewsfeedDetailCommentsToAccountFromJson(Map<String, dynamic> json) {
  223. final NewsfeedDetailCommentsToAccount newsfeedDetailCommentsToAccount = NewsfeedDetailCommentsToAccount();
  224. final int? id = jsonConvert.convert<int>(json['id']);
  225. if (id != null) {
  226. newsfeedDetailCommentsToAccount.id = id;
  227. }
  228. final String? name = jsonConvert.convert<String>(json['name']);
  229. if (name != null) {
  230. newsfeedDetailCommentsToAccount.name = name;
  231. }
  232. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  233. if (avatar != null) {
  234. newsfeedDetailCommentsToAccount.avatar = avatar;
  235. }
  236. return newsfeedDetailCommentsToAccount;
  237. }
  238. Map<String, dynamic> $NewsfeedDetailCommentsToAccountToJson(NewsfeedDetailCommentsToAccount entity) {
  239. final Map<String, dynamic> data = <String, dynamic>{};
  240. data['id'] = entity.id;
  241. data['name'] = entity.name;
  242. data['avatar'] = entity.avatar;
  243. return data;
  244. }
  245. extension NewsfeedDetailCommentsToAccountExtension on NewsfeedDetailCommentsToAccount {
  246. NewsfeedDetailCommentsToAccount copyWith({
  247. int? id,
  248. String? name,
  249. String? avatar,
  250. }) {
  251. return NewsfeedDetailCommentsToAccount()
  252. ..id = id ?? this.id
  253. ..name = name ?? this.name
  254. ..avatar = avatar ?? this.avatar;
  255. }
  256. }