forked from eatvio/eatvio_app
32 lines
1.1 KiB
Dart
32 lines
1.1 KiB
Dart
import 'package:eatvio_app/core/models/pagination_model.dart';
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'comment_model.freezed.dart';
|
|
part 'comment_model.g.dart';
|
|
|
|
@freezed
|
|
abstract class CommentModel with _$CommentModel {
|
|
const factory CommentModel({
|
|
@JsonKey(name: "data") required List<Comment> data,
|
|
@JsonKey(name: "links") required Links links,
|
|
@JsonKey(name: "meta") required Meta meta,
|
|
}) = _CommentModel;
|
|
|
|
factory CommentModel.fromJson(Map<String, Object?> json) => _$CommentModelFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
abstract class Comment with _$Comment {
|
|
const factory Comment({
|
|
@JsonKey(name: "id") required int id,
|
|
@JsonKey(name: "author_name") required String authorName,
|
|
@JsonKey(name: "author_slug") required String authorSlug,
|
|
@JsonKey(name: "author_profile_icon") required String authorProfileIcon,
|
|
@JsonKey(name: "body") required String body,
|
|
@JsonKey(name: "children_comments") required List<Comment> childrenComments,
|
|
@JsonKey(name: "created_at") required DateTime createdAt,
|
|
}) = _Comment;
|
|
|
|
factory Comment.fromJson(Map<String, Object?> json) => _$CommentFromJson(json);
|
|
}
|