newsfeed_detail_entity.g.dart 9.6 KB

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