newsfeed_following_entity.g.dart 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/newsfeed_following_entity.dart';
  3. NewsfeedFollowingEntity $NewsfeedFollowingEntityFromJson(Map<String, dynamic> json) {
  4. final NewsfeedFollowingEntity newsfeedFollowingEntity = NewsfeedFollowingEntity();
  5. final int? count = jsonConvert.convert<int>(json['count']);
  6. if (count != null) {
  7. newsfeedFollowingEntity.count = count;
  8. }
  9. final int? page = jsonConvert.convert<int>(json['page']);
  10. if (page != null) {
  11. newsfeedFollowingEntity.page = page;
  12. }
  13. final int? limit = jsonConvert.convert<int>(json['limit']);
  14. if (limit != null) {
  15. newsfeedFollowingEntity.limit = limit;
  16. }
  17. final int? countPage = jsonConvert.convert<int>(json['count_page']);
  18. if (countPage != null) {
  19. newsfeedFollowingEntity.countPage = countPage;
  20. }
  21. final List<NewsfeedFollowingList>? list = (json['list'] as List<dynamic>?)?.map(
  22. (e) => jsonConvert.convert<NewsfeedFollowingList>(e) as NewsfeedFollowingList).toList();
  23. if (list != null) {
  24. newsfeedFollowingEntity.list = list;
  25. }
  26. return newsfeedFollowingEntity;
  27. }
  28. Map<String, dynamic> $NewsfeedFollowingEntityToJson(NewsfeedFollowingEntity 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 NewsfeedFollowingEntityExtension on NewsfeedFollowingEntity {
  38. NewsfeedFollowingEntity copyWith({
  39. int? count,
  40. int? page,
  41. int? limit,
  42. int? countPage,
  43. List<NewsfeedFollowingList>? list,
  44. }) {
  45. return NewsfeedFollowingEntity()
  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. NewsfeedFollowingList $NewsfeedFollowingListFromJson(Map<String, dynamic> json) {
  54. final NewsfeedFollowingList newsfeedFollowingList = NewsfeedFollowingList();
  55. final int? id = jsonConvert.convert<int>(json['id']);
  56. if (id != null) {
  57. newsfeedFollowingList.id = id;
  58. }
  59. final String? content = jsonConvert.convert<String>(json['content']);
  60. if (content != null) {
  61. newsfeedFollowingList.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. newsfeedFollowingList.resources = resources;
  67. }
  68. final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
  69. if (likesCount != null) {
  70. newsfeedFollowingList.likesCount = likesCount;
  71. }
  72. final int? commentsCount = jsonConvert.convert<int>(json['comments_count']);
  73. if (commentsCount != null) {
  74. newsfeedFollowingList.commentsCount = commentsCount;
  75. }
  76. final bool? liked = jsonConvert.convert<bool>(json['liked']);
  77. if (liked != null) {
  78. newsfeedFollowingList.liked = liked;
  79. }
  80. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  81. if (createdAt != null) {
  82. newsfeedFollowingList.createdAt = createdAt;
  83. }
  84. final NewsfeedFollowingListAccount? account = jsonConvert.convert<NewsfeedFollowingListAccount>(json['account']);
  85. if (account != null) {
  86. newsfeedFollowingList.account = account;
  87. }
  88. return newsfeedFollowingList;
  89. }
  90. Map<String, dynamic> $NewsfeedFollowingListToJson(NewsfeedFollowingList 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 NewsfeedFollowingListExtension on NewsfeedFollowingList {
  103. NewsfeedFollowingList copyWith({
  104. int? id,
  105. String? content,
  106. List<String>? resources,
  107. int? likesCount,
  108. int? commentsCount,
  109. bool? liked,
  110. String? createdAt,
  111. NewsfeedFollowingListAccount? account,
  112. }) {
  113. return NewsfeedFollowingList()
  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. NewsfeedFollowingListAccount $NewsfeedFollowingListAccountFromJson(Map<String, dynamic> json) {
  125. final NewsfeedFollowingListAccount newsfeedFollowingListAccount = NewsfeedFollowingListAccount();
  126. final int? id = jsonConvert.convert<int>(json['id']);
  127. if (id != null) {
  128. newsfeedFollowingListAccount.id = id;
  129. }
  130. final String? name = jsonConvert.convert<String>(json['name']);
  131. if (name != null) {
  132. newsfeedFollowingListAccount.name = name;
  133. }
  134. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  135. if (avatar != null) {
  136. newsfeedFollowingListAccount.avatar = avatar;
  137. }
  138. final bool? followed = jsonConvert.convert<bool>(json['followed']);
  139. if (followed != null) {
  140. newsfeedFollowingListAccount.followed = followed;
  141. }
  142. return newsfeedFollowingListAccount;
  143. }
  144. Map<String, dynamic> $NewsfeedFollowingListAccountToJson(NewsfeedFollowingListAccount 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 NewsfeedFollowingListAccountExtension on NewsfeedFollowingListAccount {
  153. NewsfeedFollowingListAccount copyWith({
  154. int? id,
  155. String? name,
  156. String? avatar,
  157. bool? followed,
  158. }) {
  159. return NewsfeedFollowingListAccount()
  160. ..id = id ?? this.id
  161. ..name = name ?? this.name
  162. ..avatar = avatar ?? this.avatar
  163. ..followed = followed ?? this.followed;
  164. }
  165. }