243 lines
6.9 KiB
Dart
243 lines
6.9 KiB
Dart
class PopularpostModel {
|
|
PopularpostModel({
|
|
required this.status,
|
|
required this.statusCode,
|
|
required this.message,
|
|
required this.data,
|
|
});
|
|
|
|
final String? status;
|
|
final int? statusCode;
|
|
final String? message;
|
|
final List<Datum> data;
|
|
|
|
factory PopularpostModel.fromJson(Map<String, dynamic> json){
|
|
return PopularpostModel(
|
|
status: json["status"],
|
|
statusCode: json["status_code"],
|
|
message: json["message"],
|
|
data: json["data"] == null ? [] : List<Datum>.from(json["data"]!.map((x) => Datum.fromJson(x))),
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
class Datum {
|
|
Datum({
|
|
required this.id,
|
|
required this.likecount,
|
|
required this.isISaved,
|
|
required this.tagsXid,
|
|
required this.isILiked,
|
|
required this.totalComment,
|
|
required this.totalSave,
|
|
required this.iamPrincipalXid,
|
|
required this.postIn,
|
|
required this.caption,
|
|
required this.image,
|
|
required this.manageTagsXids,
|
|
required this.postAs,
|
|
required this.ctaTitle,
|
|
required this.ctaLink,
|
|
required this.createdAt,
|
|
required this.likeIcon,
|
|
required this.totalViewCount,
|
|
required this.totalReactionCount,
|
|
required this.totalCommentCount,
|
|
required this.totalImpressionCount,
|
|
required this.totalPopularScore,
|
|
required this.totalHoursAgo,
|
|
required this.iamPrincipal,
|
|
required this.community,
|
|
required this.attachTags,
|
|
});
|
|
|
|
final int? id;
|
|
final int? likecount;
|
|
final bool? isISaved;
|
|
final List<int> tagsXid;
|
|
final bool? isILiked;
|
|
final int? totalComment;
|
|
final int? totalSave;
|
|
final int? iamPrincipalXid;
|
|
final int? postIn;
|
|
final String? caption;
|
|
final String? image;
|
|
final String? manageTagsXids;
|
|
final String? postAs;
|
|
final String? ctaTitle;
|
|
final String? ctaLink;
|
|
final DateTime? createdAt;
|
|
final LikeIcon? likeIcon;
|
|
final int? totalViewCount;
|
|
final int? totalReactionCount;
|
|
final int? totalCommentCount;
|
|
final int? totalImpressionCount;
|
|
final int? totalPopularScore;
|
|
final int? totalHoursAgo;
|
|
final IamPrincipal? iamPrincipal;
|
|
final Community? community;
|
|
final List<AttachTag> attachTags;
|
|
|
|
factory Datum.fromJson(Map<String, dynamic> json){
|
|
return Datum(
|
|
id: json["id"],
|
|
likecount: json["likecount"],
|
|
isISaved: json["is_i_saved"],
|
|
tagsXid: json["tags_xid"] == null ? [] : List<int>.from(json["tags_xid"]!.map((x) => x)),
|
|
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: DateTime.tryParse(json["created_at"] ?? ""),
|
|
likeIcon: json["likeIcon"] == null ? null : LikeIcon.fromJson(json["likeIcon"]),
|
|
totalViewCount: json["totalViewCount"],
|
|
totalReactionCount: json["totalReactionCount"],
|
|
totalCommentCount: json["totalCommentCount"],
|
|
totalImpressionCount: json["totalImpressionCount"],
|
|
totalPopularScore: json["totalPopularScore"],
|
|
totalHoursAgo: json["totalHoursAgo"],
|
|
iamPrincipal: json["iam_principal"] == null ? null : IamPrincipal.fromJson(json["iam_principal"]),
|
|
community: json["community"] == null ? null : Community.fromJson(json["community"]),
|
|
attachTags: json["attach_tags"] == null ? [] : List<AttachTag>.from(json["attach_tags"]!.map((x) => AttachTag.fromJson(x))),
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
class AttachTag {
|
|
AttachTag({
|
|
required this.managePostXid,
|
|
required this.manageTagXid,
|
|
required this.manageTag,
|
|
});
|
|
|
|
final int? managePostXid;
|
|
final int? manageTagXid;
|
|
final ManageTagPopular? manageTag;
|
|
|
|
factory AttachTag.fromJson(Map<String, dynamic> json){
|
|
return AttachTag(
|
|
managePostXid: json["manage_post_xid"],
|
|
manageTagXid: json["manage_tag_xid"],
|
|
manageTag: json["manage_tag"] == null ? null : ManageTagPopular.fromJson(json["manage_tag"]),
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
class ManageTagPopular {
|
|
ManageTagPopular({
|
|
required this.id,
|
|
required this.isPinned,
|
|
required this.name,
|
|
});
|
|
|
|
final int? id;
|
|
final bool? isPinned;
|
|
final String? name;
|
|
|
|
factory ManageTagPopular.fromJson(Map<String, dynamic> json){
|
|
return ManageTagPopular(
|
|
id: json["id"],
|
|
isPinned: json["is_pinned"],
|
|
name: json["name"],
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
class Community {
|
|
Community({
|
|
required this.id,
|
|
required this.communityProfilePhoto,
|
|
required this.communityName,
|
|
});
|
|
|
|
final int? id;
|
|
final String? communityProfilePhoto;
|
|
final String? communityName;
|
|
|
|
factory Community.fromJson(Map<String, dynamic> json){
|
|
return Community(
|
|
id: json["id"],
|
|
communityProfilePhoto: json["community_profile_photo"],
|
|
communityName: json["community_name"],
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
class IamPrincipal {
|
|
IamPrincipal({
|
|
required this.id,
|
|
required this.isUserPinned,
|
|
required this.principalTypeXid,
|
|
required this.userName,
|
|
required this.fullName,
|
|
required this.profilePhoto,
|
|
});
|
|
|
|
final int? id;
|
|
final bool? isUserPinned;
|
|
final int? principalTypeXid;
|
|
final String? userName;
|
|
final String? fullName;
|
|
final String? profilePhoto;
|
|
|
|
factory IamPrincipal.fromJson(Map<String, dynamic> json){
|
|
return IamPrincipal(
|
|
id: json["id"],
|
|
isUserPinned: json["is_user_pinned"],
|
|
principalTypeXid: json["principal_type_xid"],
|
|
userName: json["user_name"],
|
|
fullName: json["full_name"],
|
|
profilePhoto: json["profile_photo"],
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
class LikeIcon {
|
|
LikeIcon({
|
|
required this.likeIconsXid,
|
|
required this.likeIcon,
|
|
});
|
|
|
|
final int? likeIconsXid;
|
|
final LikeIconClass? likeIcon;
|
|
|
|
factory LikeIcon.fromJson(Map<String, dynamic> json){
|
|
return LikeIcon(
|
|
likeIconsXid: json["like_icons_xid"],
|
|
likeIcon: json["like_icon"] == null ? null : LikeIconClass.fromJson(json["like_icon"]),
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
class LikeIconClass {
|
|
LikeIconClass({
|
|
required this.id,
|
|
required this.image,
|
|
});
|
|
|
|
final int? id;
|
|
final String? image;
|
|
|
|
factory LikeIconClass.fromJson(Map<String, dynamic> json){
|
|
return LikeIconClass(
|
|
id: json["id"],
|
|
image: json["image"],
|
|
);
|
|
}
|
|
|
|
}
|