import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/newsfeed_following_entity.dart'; NewsfeedFollowingEntity $NewsfeedFollowingEntityFromJson(Map json) { final NewsfeedFollowingEntity newsfeedFollowingEntity = NewsfeedFollowingEntity(); final int? count = jsonConvert.convert(json['count']); if (count != null) { newsfeedFollowingEntity.count = count; } final int? page = jsonConvert.convert(json['page']); if (page != null) { newsfeedFollowingEntity.page = page; } final int? limit = jsonConvert.convert(json['limit']); if (limit != null) { newsfeedFollowingEntity.limit = limit; } final int? countPage = jsonConvert.convert(json['count_page']); if (countPage != null) { newsfeedFollowingEntity.countPage = countPage; } final List? list = (json['list'] as List?)?.map( (e) => jsonConvert.convert(e) as NewsfeedFollowingList).toList(); if (list != null) { newsfeedFollowingEntity.list = list; } return newsfeedFollowingEntity; } Map $NewsfeedFollowingEntityToJson(NewsfeedFollowingEntity entity) { final Map data = {}; 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 NewsfeedFollowingEntityExtension on NewsfeedFollowingEntity { NewsfeedFollowingEntity copyWith({ int? count, int? page, int? limit, int? countPage, List? list, }) { return NewsfeedFollowingEntity() ..count = count ?? this.count ..page = page ?? this.page ..limit = limit ?? this.limit ..countPage = countPage ?? this.countPage ..list = list ?? this.list; } } NewsfeedFollowingList $NewsfeedFollowingListFromJson(Map json) { final NewsfeedFollowingList newsfeedFollowingList = NewsfeedFollowingList(); final int? id = jsonConvert.convert(json['id']); if (id != null) { newsfeedFollowingList.id = id; } final String? content = jsonConvert.convert(json['content']); if (content != null) { newsfeedFollowingList.content = content; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { newsfeedFollowingList.resources = resources; } final int? likesCount = jsonConvert.convert(json['likes_count']); if (likesCount != null) { newsfeedFollowingList.likesCount = likesCount; } final int? commentsCount = jsonConvert.convert(json['comments_count']); if (commentsCount != null) { newsfeedFollowingList.commentsCount = commentsCount; } final bool? liked = jsonConvert.convert(json['liked']); if (liked != null) { newsfeedFollowingList.liked = liked; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { newsfeedFollowingList.createdAt = createdAt; } final NewsfeedFollowingListAccount? account = jsonConvert.convert(json['account']); if (account != null) { newsfeedFollowingList.account = account; } return newsfeedFollowingList; } Map $NewsfeedFollowingListToJson(NewsfeedFollowingList entity) { final Map data = {}; 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 NewsfeedFollowingListExtension on NewsfeedFollowingList { NewsfeedFollowingList copyWith({ int? id, String? content, List? resources, int? likesCount, int? commentsCount, bool? liked, String? createdAt, NewsfeedFollowingListAccount? account, }) { return NewsfeedFollowingList() ..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; } } NewsfeedFollowingListAccount $NewsfeedFollowingListAccountFromJson(Map json) { final NewsfeedFollowingListAccount newsfeedFollowingListAccount = NewsfeedFollowingListAccount(); final int? id = jsonConvert.convert(json['id']); if (id != null) { newsfeedFollowingListAccount.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { newsfeedFollowingListAccount.name = name; } final String? avatar = jsonConvert.convert(json['avatar']); if (avatar != null) { newsfeedFollowingListAccount.avatar = avatar; } final bool? followed = jsonConvert.convert(json['followed']); if (followed != null) { newsfeedFollowingListAccount.followed = followed; } return newsfeedFollowingListAccount; } Map $NewsfeedFollowingListAccountToJson(NewsfeedFollowingListAccount entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['avatar'] = entity.avatar; data['followed'] = entity.followed; return data; } extension NewsfeedFollowingListAccountExtension on NewsfeedFollowingListAccount { NewsfeedFollowingListAccount copyWith({ int? id, String? name, String? avatar, bool? followed, }) { return NewsfeedFollowingListAccount() ..id = id ?? this.id ..name = name ?? this.name ..avatar = avatar ?? this.avatar ..followed = followed ?? this.followed; } }