myposts_newsfeed_entity.g.dart 6.1 KB

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