42 lines
1.3 KiB
Dart
42 lines
1.3 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
part 'api_poetry.freezed.dart';
|
|
part 'api_poetry.g.dart';
|
|
|
|
@freezed
|
|
abstract class ApiPoetry with _$ApiPoetry {
|
|
@JsonSerializable(fieldRename: FieldRename.snake)
|
|
const factory ApiPoetry({
|
|
@Default(0) int id,
|
|
@Default('') String title,
|
|
@Default('') String content,
|
|
@Default(0) int authorId,
|
|
@Default('') String authorName,
|
|
@Default('') String authorAvatar,
|
|
@Default('') String authorBio,
|
|
@Default(0) int dynastyId,
|
|
@Default('') String dynastyName,
|
|
@Default(0) int favorNum,
|
|
@Default(0) int shareNum,
|
|
@Default(0) int commentNum,
|
|
@Default(0) int collectNum,
|
|
@Default(0) int sealNum,
|
|
@Default(0) int honorPoints,
|
|
@Default(0) int version,
|
|
@Default(false) bool deleted,
|
|
@Default(false) bool favored,
|
|
}) = _ApiPoetry;
|
|
|
|
factory ApiPoetry.fromJson(Map<String, Object?> json) =>
|
|
_$ApiPoetryFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
abstract class ApiPoetryData with _$ApiPoetryData {
|
|
@JsonSerializable(fieldRename: FieldRename.snake)
|
|
const factory ApiPoetryData({required ApiPoetry poetry}) = _ApiPoetryData;
|
|
|
|
factory ApiPoetryData.fromJson(Map<String, Object?> json) =>
|
|
_$ApiPoetryDataFromJson(json);
|
|
}
|