125 lines
3.2 KiB
Dart
125 lines
3.2 KiB
Dart
import 'dart:convert';
|
|
|
|
ParentCommentResponseModel parentCommentResponseModelFromJson(String str) =>
|
|
ParentCommentResponseModel.fromJson(json.decode(str));
|
|
|
|
String parentCommentResponseModelToJson(ParentCommentResponseModel data) =>
|
|
json.encode(data.toJson());
|
|
|
|
class ParentCommentResponseModel {
|
|
bool? isSuccess;
|
|
int? statusCode;
|
|
String? message;
|
|
CommentData? data;
|
|
dynamic errors;
|
|
|
|
ParentCommentResponseModel({
|
|
this.isSuccess,
|
|
this.statusCode,
|
|
this.message,
|
|
this.data,
|
|
this.errors,
|
|
});
|
|
|
|
factory ParentCommentResponseModel.fromJson(Map<String, dynamic> json) =>
|
|
ParentCommentResponseModel(
|
|
isSuccess: json["isSuccess"],
|
|
statusCode: json["statusCode"],
|
|
message: json["message"],
|
|
data: json["data"] == null ? null : CommentData.fromJson(json["data"]),
|
|
errors: json["errors"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"isSuccess": isSuccess,
|
|
"statusCode": statusCode,
|
|
"message": message,
|
|
"data": data?.toJson(),
|
|
"errors": errors,
|
|
};
|
|
}
|
|
|
|
class CommentData {
|
|
int? totalCount;
|
|
List<CommentItem>? items;
|
|
|
|
CommentData({this.totalCount, this.items});
|
|
|
|
factory CommentData.fromJson(Map<String, dynamic> json) => CommentData(
|
|
totalCount: json["totalCount"],
|
|
items:
|
|
json["items"] == null
|
|
? []
|
|
: List<CommentItem>.from(
|
|
json["items"]!.map((x) => CommentItem.fromJson(x)),
|
|
),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"totalCount": totalCount,
|
|
"items":
|
|
items == null ? [] : List<dynamic>.from(items!.map((x) => x.toJson())),
|
|
};
|
|
}
|
|
|
|
class CommentItem {
|
|
List<CommentItem>? subComments;
|
|
int? totalSubCommentCount;
|
|
String? firstName;
|
|
String? lastName;
|
|
String? fullName;
|
|
String? profilePicture;
|
|
int? commentId;
|
|
int? postId;
|
|
String? commentText;
|
|
DateTime? createdAt;
|
|
|
|
CommentItem({
|
|
this.subComments,
|
|
this.totalSubCommentCount,
|
|
this.firstName,
|
|
this.lastName,
|
|
this.fullName,
|
|
this.profilePicture,
|
|
this.commentId,
|
|
this.postId,
|
|
this.commentText,
|
|
this.createdAt,
|
|
});
|
|
|
|
factory CommentItem.fromJson(Map<String, dynamic> json) => CommentItem(
|
|
subComments:
|
|
json["subComments"] == null
|
|
? []
|
|
: List<CommentItem>.from(
|
|
json["subComments"]!.map((x) => CommentItem.fromJson(x)),
|
|
),
|
|
totalSubCommentCount: json["totalSubCommentCount"],
|
|
firstName: json["firstName"],
|
|
lastName: json["lastName"],
|
|
fullName: json["fullName"],
|
|
profilePicture: json["profilePicture"],
|
|
commentId: json["commentID"],
|
|
postId: json["postID"],
|
|
commentText: json["commentText"],
|
|
createdAt:
|
|
json["createdAt"] == null ? null : DateTime.parse(json["createdAt"]),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"subComments":
|
|
subComments == null
|
|
? []
|
|
: List<dynamic>.from(subComments!.map((x) => x.toJson())),
|
|
"totalSubCommentCount": totalSubCommentCount,
|
|
"firstName": firstName,
|
|
"lastName": lastName,
|
|
"fullName": fullName,
|
|
"profilePicture": profilePicture,
|
|
"commentID": commentId,
|
|
"postID": postId,
|
|
"commentText": commentText,
|
|
"createdAt": createdAt?.toIso8601String(),
|
|
};
|
|
}
|