522 lines
14 KiB
Dart
522 lines
14 KiB
Dart
class ComPostModel {
|
|
ComPostModel({
|
|
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 ComPostModel.fromJson(Map<String, dynamic> json) {
|
|
return ComPostModel(
|
|
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.iamPrincipalXid,
|
|
required this.postIn,
|
|
required this.caption,
|
|
required this.image,
|
|
required this.manageTagsXids,
|
|
required this.postAs,
|
|
required this.isUploadedByBussinessUser,
|
|
required this.ctaTitle,
|
|
required this.ctaLink,
|
|
required this.isActive,
|
|
required this.createdBy,
|
|
required this.modifiedBy,
|
|
required this.deletedAt,
|
|
required this.createdAt,
|
|
required this.updatedAt,
|
|
required this.likecount,
|
|
required this.isILiked,
|
|
required this.isIFollow,
|
|
required this.isISaved,
|
|
required this.likeIcon,
|
|
required this.totalComment,
|
|
required this.totalSave,
|
|
required this.tagsXid,
|
|
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? iamPrincipalXid;
|
|
final int? postIn;
|
|
final String? caption;
|
|
final String? image;
|
|
final String? manageTagsXids;
|
|
final String? postAs;
|
|
final int? isUploadedByBussinessUser;
|
|
final String? ctaTitle;
|
|
final String? ctaLink;
|
|
final int? isActive;
|
|
final dynamic createdBy;
|
|
final dynamic modifiedBy;
|
|
final dynamic deletedAt;
|
|
final DateTime? createdAt;
|
|
final DateTime? updatedAt;
|
|
final int? likecount;
|
|
final bool? isILiked;
|
|
final bool? isIFollow;
|
|
final bool? isISaved;
|
|
final LikeIcon? likeIcon;
|
|
final int? totalComment;
|
|
final int? totalSave;
|
|
final List<int> tagsXid;
|
|
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"],
|
|
iamPrincipalXid: json["iam_principal_xid"],
|
|
postIn: json["post_in"],
|
|
caption: json["caption"],
|
|
image: json["image"],
|
|
manageTagsXids: json["manage_tags_xids"],
|
|
postAs: json["post_as"],
|
|
isUploadedByBussinessUser: json["is_uploaded_by_bussiness_user"],
|
|
ctaTitle: json["cta_title"],
|
|
ctaLink: json["cta_link"],
|
|
isActive: json["is_active"],
|
|
createdBy: json["created_by"],
|
|
modifiedBy: json["modified_by"],
|
|
deletedAt: json["deleted_at"],
|
|
createdAt: DateTime.tryParse(json["created_at"] ?? ""),
|
|
updatedAt: DateTime.tryParse(json["updated_at"] ?? ""),
|
|
likecount: json["likecount"],
|
|
isILiked: json["is_i_liked"],
|
|
isIFollow: json["is_i_follow"],
|
|
isISaved: json["is_i_saved"],
|
|
// likeIcon: json["likeIcon"],
|
|
likeIcon: json["likeIcon"] == null ? null : LikeIcon.fromJson(json["likeIcon"]),
|
|
totalComment: json["total_comment"],
|
|
totalSave: json["total_save"],
|
|
tagsXid: json["tags_xid"] == null
|
|
? []
|
|
: List<int>.from(json["tags_xid"]!.map((x) => x)),
|
|
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 ManageTag? 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
|
|
: ManageTag.fromJson(json["manage_tag"]),
|
|
);
|
|
}
|
|
}
|
|
|
|
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"],
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
class ManageTag {
|
|
ManageTag({
|
|
required this.id,
|
|
required this.isPinned,
|
|
required this.name,
|
|
});
|
|
|
|
final int? id;
|
|
final bool? isPinned;
|
|
final String? name;
|
|
|
|
factory ManageTag.fromJson(Map<String, dynamic> json) {
|
|
return ManageTag(
|
|
id: json["id"],
|
|
isPinned: json["is_pinned"],
|
|
name: json["name"],
|
|
);
|
|
}
|
|
}
|
|
|
|
class Community {
|
|
Community({
|
|
required this.id,
|
|
required this.communityProfilePhoto,
|
|
required this.communityBannerImage,
|
|
required this.communityName,
|
|
required this.totalGroup,
|
|
required this.totalAnnouncements,
|
|
});
|
|
|
|
final int? id;
|
|
final String? communityProfilePhoto;
|
|
final String? communityBannerImage;
|
|
final String? communityName;
|
|
final int? totalGroup;
|
|
final int? totalAnnouncements;
|
|
|
|
factory Community.fromJson(Map<String, dynamic> json) {
|
|
return Community(
|
|
id: json["id"],
|
|
communityProfilePhoto: json["community_profile_photo"],
|
|
communityBannerImage: json["community_banner_image"],
|
|
communityName: json["community_name"],
|
|
totalGroup: json["total_group"],
|
|
totalAnnouncements: json["total_announcements"],
|
|
);
|
|
}
|
|
}
|
|
|
|
class IamPrincipal {
|
|
IamPrincipal({
|
|
required this.id,
|
|
required this.principalTypeXid,
|
|
required this.userName,
|
|
required this.fullName,
|
|
required this.profilePhoto,
|
|
required this.isUserPinned,
|
|
});
|
|
|
|
final int? id;
|
|
final int? principalTypeXid;
|
|
final String? userName;
|
|
final String? fullName;
|
|
final String? profilePhoto;
|
|
final bool? isUserPinned;
|
|
|
|
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"],
|
|
isUserPinned: json["is_user_pinned"],
|
|
);
|
|
}
|
|
}
|
|
|
|
/*
|
|
{
|
|
"status": "success",
|
|
"status_code": 200,
|
|
"message": "Data Fetched Successfully.",
|
|
"data": [
|
|
{
|
|
"id": 1,
|
|
"iam_principal_xid": 24,
|
|
"post_in": 1,
|
|
"caption": "test",
|
|
"image": "https://regroup.betadelivery.com/storage/app/public/uploads/post_image/66a88f43ac269.png?d=1723806586",
|
|
"manage_tags_xids": "[2,1,3]",
|
|
"post_as": "Individual",
|
|
"is_uploaded_by_bussiness_user": 1,
|
|
"cta_title": "test",
|
|
"cta_link": "test",
|
|
"is_active": 1,
|
|
"created_by": null,
|
|
"modified_by": null,
|
|
"deleted_at": null,
|
|
"created_at": "2024-07-30T06:59:15.000000Z",
|
|
"updated_at": "2024-07-30T06:59:15.000000Z",
|
|
"likecount": 6,
|
|
"is_i_liked": false,
|
|
"is_i_follow": false,
|
|
"is_i_saved": true,
|
|
"likeIcon": null,
|
|
"total_comment": 6,
|
|
"total_save": 2,
|
|
"tags_xid": [
|
|
2,
|
|
1,
|
|
3
|
|
],
|
|
"totalViewCount": 10,
|
|
"totalReactionCount": 6,
|
|
"totalCommentCount": 6,
|
|
"totalImpressionCount": 0,
|
|
"totalPopularScore": 0,
|
|
"totalHoursAgo": 412,
|
|
"iam_principal": {
|
|
"id": 24,
|
|
"principal_type_xid": 1,
|
|
"user_name": "kishansjsj",
|
|
"full_name": "kishan",
|
|
"profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/profile_photos/1720599966.jpg?d=1723806586",
|
|
"is_user_pinned": false
|
|
},
|
|
"community": {
|
|
"id": 1,
|
|
"community_profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/community_profile_photo/66a8c09525d87.jpg?d=1723806586",
|
|
"community_banner_image": "https://regroup.betadelivery.com/storage/app/public/uploads/community_banner_image/66a8c09527b92.jpg?d=1723806586",
|
|
"community_name": "Flutter Community",
|
|
"total_group": 5,
|
|
"total_announcements": 3
|
|
},
|
|
"attach_tags": [
|
|
{
|
|
"manage_post_xid": 1,
|
|
"manage_tag_xid": 2,
|
|
"manage_tag": {
|
|
"id": 2,
|
|
"is_pinned": false,
|
|
"name": "Test 1"
|
|
}
|
|
},
|
|
{
|
|
"manage_post_xid": 1,
|
|
"manage_tag_xid": 1,
|
|
"manage_tag": {
|
|
"id": 1,
|
|
"is_pinned": false,
|
|
"name": "Test 2"
|
|
}
|
|
},
|
|
{
|
|
"manage_post_xid": 1,
|
|
"manage_tag_xid": 3,
|
|
"manage_tag": {
|
|
"id": 3,
|
|
"is_pinned": false,
|
|
"name": "another test 1"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 2,
|
|
"iam_principal_xid": 24,
|
|
"post_in": 1,
|
|
"caption": "test",
|
|
"image": "https://regroup.betadelivery.com/storage/app/public/uploads/post_image/66ab5b2a52291.png?d=1723806586",
|
|
"manage_tags_xids": "[2,1,3]",
|
|
"post_as": "Individual",
|
|
"is_uploaded_by_bussiness_user": 0,
|
|
"cta_title": null,
|
|
"cta_link": null,
|
|
"is_active": 1,
|
|
"created_by": null,
|
|
"modified_by": null,
|
|
"deleted_at": null,
|
|
"created_at": "2024-08-01T09:53:46.000000Z",
|
|
"updated_at": "2024-08-01T09:53:46.000000Z",
|
|
"likecount": 0,
|
|
"is_i_liked": false,
|
|
"is_i_follow": false,
|
|
"is_i_saved": false,
|
|
"likeIcon": null,
|
|
"total_comment": 1,
|
|
"total_save": 0,
|
|
"tags_xid": [
|
|
2,
|
|
1,
|
|
3
|
|
],
|
|
"totalViewCount": 8,
|
|
"totalReactionCount": 0,
|
|
"totalCommentCount": 1,
|
|
"totalImpressionCount": 0,
|
|
"totalPopularScore": 0,
|
|
"totalHoursAgo": 361,
|
|
"iam_principal": {
|
|
"id": 24,
|
|
"principal_type_xid": 1,
|
|
"user_name": "kishansjsj",
|
|
"full_name": "kishan",
|
|
"profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/profile_photos/1720599966.jpg?d=1723806586",
|
|
"is_user_pinned": false
|
|
},
|
|
"community": {
|
|
"id": 1,
|
|
"community_profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/community_profile_photo/66a8c09525d87.jpg?d=1723806586",
|
|
"community_banner_image": "https://regroup.betadelivery.com/storage/app/public/uploads/community_banner_image/66a8c09527b92.jpg?d=1723806586",
|
|
"community_name": "Flutter Community",
|
|
"total_group": 5,
|
|
"total_announcements": 3
|
|
},
|
|
"attach_tags": [
|
|
{
|
|
"manage_post_xid": 2,
|
|
"manage_tag_xid": 2,
|
|
"manage_tag": {
|
|
"id": 2,
|
|
"is_pinned": false,
|
|
"name": "Test 1"
|
|
}
|
|
},
|
|
{
|
|
"manage_post_xid": 2,
|
|
"manage_tag_xid": 1,
|
|
"manage_tag": {
|
|
"id": 1,
|
|
"is_pinned": false,
|
|
"name": "Test 2"
|
|
}
|
|
},
|
|
{
|
|
"manage_post_xid": 2,
|
|
"manage_tag_xid": 3,
|
|
"manage_tag": {
|
|
"id": 3,
|
|
"is_pinned": false,
|
|
"name": "another test 1"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": 3,
|
|
"iam_principal_xid": 10,
|
|
"post_in": 1,
|
|
"caption": "this is individual caption",
|
|
"image": "https://regroup.betadelivery.com/storage/app/public/uploads/post_image/66ab5ceb8ddb5.jpg?d=1723806586",
|
|
"manage_tags_xids": "[5,7]",
|
|
"post_as": "Individual",
|
|
"is_uploaded_by_bussiness_user": 0,
|
|
"cta_title": null,
|
|
"cta_link": null,
|
|
"is_active": 1,
|
|
"created_by": null,
|
|
"modified_by": null,
|
|
"deleted_at": null,
|
|
"created_at": "2024-08-01T10:01:15.000000Z",
|
|
"updated_at": "2024-08-01T10:01:15.000000Z",
|
|
"likecount": 2,
|
|
"is_i_liked": false,
|
|
"is_i_follow": false,
|
|
"is_i_saved": false,
|
|
"likeIcon": null,
|
|
"total_comment": 0,
|
|
"total_save": 0,
|
|
"tags_xid": [
|
|
5,
|
|
7
|
|
],
|
|
"totalViewCount": 1,
|
|
"totalReactionCount": 2,
|
|
"totalCommentCount": 0,
|
|
"totalImpressionCount": 0,
|
|
"totalPopularScore": 0,
|
|
"totalHoursAgo": 361,
|
|
"iam_principal": {
|
|
"id": 10,
|
|
"principal_type_xid": 1,
|
|
"user_name": "shubham shirva",
|
|
"full_name": "Shubham",
|
|
"profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/profile_photos/1720599966.jpg?d=1723806586",
|
|
"is_user_pinned": false
|
|
},
|
|
"community": {
|
|
"id": 1,
|
|
"community_profile_photo": "https://regroup.betadelivery.com/storage/app/public/uploads/community_profile_photo/66a8c09525d87.jpg?d=1723806586",
|
|
"community_banner_image": "https://regroup.betadelivery.com/storage/app/public/uploads/community_banner_image/66a8c09527b92.jpg?d=1723806586",
|
|
"community_name": "Flutter Community",
|
|
"total_group": 5,
|
|
"total_announcements": 3
|
|
},
|
|
"attach_tags": [
|
|
{
|
|
"manage_post_xid": 3,
|
|
"manage_tag_xid": 5,
|
|
"manage_tag": {
|
|
"id": 5,
|
|
"is_pinned": false,
|
|
"name": "Test new"
|
|
}
|
|
},
|
|
{
|
|
"manage_post_xid": 3,
|
|
"manage_tag_xid": 7,
|
|
"manage_tag": {
|
|
"id": 7,
|
|
"is_pinned": false,
|
|
"name": "Test new 2"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}*/ |