Files
Regroup/lib/Feed Module/Main_Screens/Community/Modal/LatestPost.dart
2024-08-01 13:33:57 +05:30

184 lines
4.6 KiB
Dart

class Latestpost {
String? status;
int? statusCode;
String? message;
List<Data>? data;
Latestpost({this.status, this.statusCode, this.message, this.data});
Latestpost.fromJson(Map<String, dynamic> json) {
status = json['status'];
statusCode = json['status_code'];
message = json['message'];
if (json['data'] != null) {
data = <Data>[];
json['data'].forEach((v) {
data!.add(Data.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['status'] = status;
data['status_code'] = statusCode;
data['message'] = message;
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Data {
int? id;
int? likecount;
List<int>? tagsXid;
bool? isILiked;
int? totalComment;
int? totalSave;
int? iamPrincipalXid;
int? postIn;
String? caption;
String? image;
String? manageTagsXids;
String? postAs;
String? ctaTitle;
String? ctaLink;
String? createdAt;
List<String>? tagNames;
String? likeIcon;
IamPrincipal? iamPrincipal;
Community? community;
Data(
{this.id,
this.likecount,
this.tagsXid,
this.isILiked,
this.totalComment,
this.totalSave,
this.iamPrincipalXid,
this.postIn,
this.caption,
this.image,
this.manageTagsXids,
this.postAs,
this.ctaTitle,
this.ctaLink,
this.createdAt,
this.tagNames,
this.likeIcon,
this.iamPrincipal,
this.community});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
likecount = json['likecount'];
tagsXid = json['tags_xid'].cast<int>();
isILiked = json['is_i_liked'];
totalComment = json['total_comment'];
totalSave = json['total_save'];
iamPrincipalXid = json['iam_principal_xid'];
postIn = json['post_in'];
caption = json['caption'];
image = json['image'];
manageTagsXids = json['manage_tags_xids'];
postAs = json['post_as'];
ctaTitle = json['cta_title'];
ctaLink = json['cta_link'];
createdAt = json['created_at'];
tagNames = json['tag_names'].cast<String>();
likeIcon = json['likeIcon'];
iamPrincipal = json['iam_principal'] != null
? IamPrincipal.fromJson(json['iam_principal'])
: null;
community = json['community'] != null
? Community.fromJson(json['community'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['likecount'] = likecount;
data['tags_xid'] = tagsXid;
data['is_i_liked'] = isILiked;
data['total_comment'] = totalComment;
data['total_save'] = totalSave;
data['iam_principal_xid'] = iamPrincipalXid;
data['post_in'] = postIn;
data['caption'] = caption;
data['image'] = image;
data['manage_tags_xids'] = manageTagsXids;
data['post_as'] = postAs;
data['cta_title'] = ctaTitle;
data['cta_link'] = ctaLink;
data['created_at'] = createdAt;
data['tag_names'] = tagNames;
data['likeIcon'] = likeIcon;
if (iamPrincipal != null) {
data['iam_principal'] = iamPrincipal!.toJson();
}
if (community != null) {
data['community'] = community!.toJson();
}
return data;
}
}
class IamPrincipal {
int? id;
int? principalTypeXid;
String? userName;
String? fullName;
String? profilePhoto;
IamPrincipal(
{this.id,
this.principalTypeXid,
this.userName,
this.fullName,
this.profilePhoto});
IamPrincipal.fromJson(Map<String, dynamic> json) {
id = json['id'];
principalTypeXid = json['principal_type_xid'];
userName = json['user_name'];
fullName = json['full_name'];
profilePhoto = json['profile_photo'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['principal_type_xid'] = principalTypeXid;
data['user_name'] = userName;
data['full_name'] = fullName;
data['profile_photo'] = profilePhoto;
return data;
}
}
class Community {
int? id;
String? communityProfilePhoto;
String? communityName;
Community({this.id, this.communityProfilePhoto, this.communityName});
Community.fromJson(Map<String, dynamic> json) {
id = json['id'];
communityProfilePhoto = json['community_profile_photo'];
communityName = json['community_name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['community_profile_photo'] = communityProfilePhoto;
data['community_name'] = communityName;
return data;
}
}