import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/newsfeed_news_entity.dart'; NewsfeedNewsEntity $NewsfeedNewsEntityFromJson(Map json) { final NewsfeedNewsEntity newsfeedNewsEntity = NewsfeedNewsEntity(); final int? count = jsonConvert.convert(json['count']); if (count != null) { newsfeedNewsEntity.count = count; } final int? page = jsonConvert.convert(json['page']); if (page != null) { newsfeedNewsEntity.page = page; } final int? limit = jsonConvert.convert(json['limit']); if (limit != null) { newsfeedNewsEntity.limit = limit; } final int? countPage = jsonConvert.convert(json['count_page']); if (countPage != null) { newsfeedNewsEntity.countPage = countPage; } final List? list = (json['list'] as List?)?.map( (e) => jsonConvert.convert(e) as NewsfeedNewsList).toList(); if (list != null) { newsfeedNewsEntity.list = list; } return newsfeedNewsEntity; } Map $NewsfeedNewsEntityToJson(NewsfeedNewsEntity 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 NewsfeedNewsEntityExtension on NewsfeedNewsEntity { NewsfeedNewsEntity copyWith({ int? count, int? page, int? limit, int? countPage, List? list, }) { return NewsfeedNewsEntity() ..count = count ?? this.count ..page = page ?? this.page ..limit = limit ?? this.limit ..countPage = countPage ?? this.countPage ..list = list ?? this.list; } } NewsfeedNewsList $NewsfeedNewsListFromJson(Map json) { final NewsfeedNewsList newsfeedNewsList = NewsfeedNewsList(); final int? id = jsonConvert.convert(json['id']); if (id != null) { newsfeedNewsList.id = id; } final String? content = jsonConvert.convert(json['content']); if (content != null) { newsfeedNewsList.content = content; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { newsfeedNewsList.resources = resources; } final int? likesCount = jsonConvert.convert(json['likes_count']); if (likesCount != null) { newsfeedNewsList.likesCount = likesCount; } final int? commentsCount = jsonConvert.convert(json['comments_count']); if (commentsCount != null) { newsfeedNewsList.commentsCount = commentsCount; } final bool? liked = jsonConvert.convert(json['liked']); if (liked != null) { newsfeedNewsList.liked = liked; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { newsfeedNewsList.createdAt = createdAt; } final NewsfeedNewsListAccount? account = jsonConvert.convert(json['account']); if (account != null) { newsfeedNewsList.account = account; } return newsfeedNewsList; } Map $NewsfeedNewsListToJson(NewsfeedNewsList 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 NewsfeedNewsListExtension on NewsfeedNewsList { NewsfeedNewsList copyWith({ int? id, String? content, List? resources, int? likesCount, int? commentsCount, bool? liked, String? createdAt, NewsfeedNewsListAccount? account, }) { return NewsfeedNewsList() ..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; } } NewsfeedNewsListAccount $NewsfeedNewsListAccountFromJson(Map json) { final NewsfeedNewsListAccount newsfeedNewsListAccount = NewsfeedNewsListAccount(); final int? id = jsonConvert.convert(json['id']); if (id != null) { newsfeedNewsListAccount.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { newsfeedNewsListAccount.name = name; } final String? avatar = jsonConvert.convert(json['avatar']); if (avatar != null) { newsfeedNewsListAccount.avatar = avatar; } final bool? followed = jsonConvert.convert(json['followed']); if (followed != null) { newsfeedNewsListAccount.followed = followed; } return newsfeedNewsListAccount; } Map $NewsfeedNewsListAccountToJson(NewsfeedNewsListAccount entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['avatar'] = entity.avatar; data['followed'] = entity.followed; return data; } extension NewsfeedNewsListAccountExtension on NewsfeedNewsListAccount { NewsfeedNewsListAccount copyWith({ int? id, String? name, String? avatar, bool? followed, }) { return NewsfeedNewsListAccount() ..id = id ?? this.id ..name = name ?? this.name ..avatar = avatar ?? this.avatar ..followed = followed ?? this.followed; } }