123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/newsfeed_foryou_entity.dart';
- NewsfeedForyouEntity $NewsfeedForyouEntityFromJson(Map<String, dynamic> json) {
- final NewsfeedForyouEntity newsfeedForyouEntity = NewsfeedForyouEntity();
- final int? count = jsonConvert.convert<int>(json['count']);
- if (count != null) {
- newsfeedForyouEntity.count = count;
- }
- final int? page = jsonConvert.convert<int>(json['page']);
- if (page != null) {
- newsfeedForyouEntity.page = page;
- }
- final int? limit = jsonConvert.convert<int>(json['limit']);
- if (limit != null) {
- newsfeedForyouEntity.limit = limit;
- }
- final int? countPage = jsonConvert.convert<int>(json['count_page']);
- if (countPage != null) {
- newsfeedForyouEntity.countPage = countPage;
- }
- final List<NewsfeedForyouList>? list = (json['list'] as List<dynamic>?)
- ?.map(
- (e) =>
- jsonConvert.convert<NewsfeedForyouList>(e) as NewsfeedForyouList)
- .toList();
- if (list != null) {
- newsfeedForyouEntity.list = list;
- }
- return newsfeedForyouEntity;
- }
- Map<String, dynamic> $NewsfeedForyouEntityToJson(NewsfeedForyouEntity entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['count'] = entity.count;
- data['page'] = entity.page;
- data['limit'] = entity.limit;
- data['count_page'] = entity.countPage;
- data['list'] = entity.list?.map((v) => v.toJson()).toList();
- return data;
- }
- extension NewsfeedForyouEntityExtension on NewsfeedForyouEntity {
- NewsfeedForyouEntity copyWith({
- int? count,
- int? page,
- int? limit,
- int? countPage,
- List<NewsfeedForyouList>? list,
- }) {
- return NewsfeedForyouEntity()
- ..count = count ?? this.count
- ..page = page ?? this.page
- ..limit = limit ?? this.limit
- ..countPage = countPage ?? this.countPage
- ..list = list ?? this.list;
- }
- }
- NewsfeedForyouList $NewsfeedForyouListFromJson(Map<String, dynamic> json) {
- final NewsfeedForyouList newsfeedForyouList = NewsfeedForyouList();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- newsfeedForyouList.id = id;
- }
- final String? content = jsonConvert.convert<String>(json['content']);
- if (content != null) {
- newsfeedForyouList.content = content;
- }
- final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<String>(e) as String).toList();
- if (resources != null) {
- newsfeedForyouList.resources = resources;
- }
- final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
- if (likesCount != null) {
- newsfeedForyouList.likesCount = likesCount;
- }
- final int? commentsCount = jsonConvert.convert<int>(json['comments_count']);
- if (commentsCount != null) {
- newsfeedForyouList.commentsCount = commentsCount;
- }
- final bool? liked = jsonConvert.convert<bool>(json['liked']);
- if (liked != null) {
- newsfeedForyouList.liked = liked;
- }
- final String? createdAt = jsonConvert.convert<String>(json['created_at']);
- if (createdAt != null) {
- newsfeedForyouList.createdAt = createdAt;
- }
- final NewsfeedForyouListAccount? account = jsonConvert.convert<
- NewsfeedForyouListAccount>(json['account']);
- if (account != null) {
- newsfeedForyouList.account = account;
- }
- return newsfeedForyouList;
- }
- Map<String, dynamic> $NewsfeedForyouListToJson(NewsfeedForyouList entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['content'] = entity.content;
- data['resources'] = entity.resources;
- data['likes_count'] = entity.likesCount;
- data['comments_count'] = entity.commentsCount;
- data['liked'] = entity.liked;
- data['created_at'] = entity.createdAt;
- data['account'] = entity.account?.toJson();
- return data;
- }
- extension NewsfeedForyouListExtension on NewsfeedForyouList {
- NewsfeedForyouList copyWith({
- int? id,
- String? content,
- List<String>? resources,
- int? likesCount,
- int? commentsCount,
- bool? liked,
- String? createdAt,
- NewsfeedForyouListAccount? account,
- }) {
- return NewsfeedForyouList()
- ..id = id ?? this.id
- ..content = content ?? this.content
- ..resources = resources ?? this.resources
- ..likesCount = likesCount ?? this.likesCount
- ..commentsCount = commentsCount ?? this.commentsCount
- ..liked = liked ?? this.liked
- ..createdAt = createdAt ?? this.createdAt
- ..account = account ?? this.account;
- }
- }
- NewsfeedForyouListAccount $NewsfeedForyouListAccountFromJson(
- Map<String, dynamic> json) {
- final NewsfeedForyouListAccount newsfeedForyouListAccount = NewsfeedForyouListAccount();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- newsfeedForyouListAccount.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- newsfeedForyouListAccount.name = name;
- }
- final String? avatar = jsonConvert.convert<String>(json['avatar']);
- if (avatar != null) {
- newsfeedForyouListAccount.avatar = avatar;
- }
- final bool? followed = jsonConvert.convert<bool>(json['followed']);
- if (followed != null) {
- newsfeedForyouListAccount.followed = followed;
- }
- return newsfeedForyouListAccount;
- }
- Map<String, dynamic> $NewsfeedForyouListAccountToJson(
- NewsfeedForyouListAccount entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['avatar'] = entity.avatar;
- data['followed'] = entity.followed;
- return data;
- }
- extension NewsfeedForyouListAccountExtension on NewsfeedForyouListAccount {
- NewsfeedForyouListAccount copyWith({
- int? id,
- String? name,
- String? avatar,
- bool? followed,
- }) {
- return NewsfeedForyouListAccount()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..avatar = avatar ?? this.avatar
- ..followed = followed ?? this.followed;
- }
- }
|