177 lines
4.9 KiB
Dart
177 lines
4.9 KiB
Dart
class LatestpostModel {
|
|
LatestpostModel({
|
|
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 LatestpostModel.fromJson(Map<String, dynamic> json){
|
|
return LatestpostModel(
|
|
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.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.tagNames,
|
|
required this.likeIcon,
|
|
required this.iamPrincipal,
|
|
required this.community,
|
|
});
|
|
|
|
final int? id;
|
|
final int? likecount;
|
|
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 List<String> tagNames;
|
|
final LikeIcon? likeIcon;
|
|
final IamPrincipal? iamPrincipal;
|
|
final Community? community;
|
|
|
|
factory Datum.fromJson(Map<String, dynamic> json){
|
|
return Datum(
|
|
id: json["id"],
|
|
likecount: json["likecount"],
|
|
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"] ?? ""),
|
|
tagNames: json["tag_names"] == null ? [] : List<String>.from(json["tag_names"]!.map((x) => x)),
|
|
likeIcon: json["likeIcon"] == null ? null : LikeIcon.fromJson(json["likeIcon"]),
|
|
iamPrincipal: json["iam_principal"] == null ? null : IamPrincipal.fromJson(json["iam_principal"]),
|
|
community: json["community"] == null ? null : Community.fromJson(json["community"]),
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
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.principalTypeXid,
|
|
required this.userName,
|
|
required this.fullName,
|
|
required this.profilePhoto,
|
|
});
|
|
|
|
final int? id;
|
|
final int? principalTypeXid;
|
|
final String? userName;
|
|
final dynamic fullName;
|
|
final String? profilePhoto;
|
|
|
|
factory IamPrincipal.fromJson(Map<String, dynamic> json){
|
|
return IamPrincipal(
|
|
id: json["id"],
|
|
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"],
|
|
);
|
|
}
|
|
|
|
}
|