mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-06-06 05:49:03 +08:00
56 lines
1.4 KiB
Dart
56 lines
1.4 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'file.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class EhFileBasic {
|
|
const EhFileBasic({
|
|
required this.id,
|
|
required this.width,
|
|
required this.height,
|
|
required this.isOriginal,
|
|
});
|
|
final int id;
|
|
final int width;
|
|
final int height;
|
|
@JsonKey(name: 'is_original')
|
|
final bool isOriginal;
|
|
factory EhFileBasic.fromJson(Map<String, dynamic> json) =>
|
|
_$EhFileBasicFromJson(json);
|
|
Map<String, dynamic> toJson() => _$EhFileBasicToJson(this);
|
|
}
|
|
|
|
@JsonSerializable()
|
|
class EhFileExtend {
|
|
const EhFileExtend({
|
|
required this.id,
|
|
required this.width,
|
|
required this.height,
|
|
required this.isOriginal,
|
|
required this.token,
|
|
});
|
|
final int id;
|
|
final int width;
|
|
final int height;
|
|
@JsonKey(name: 'is_original')
|
|
final bool isOriginal;
|
|
final String token;
|
|
factory EhFileExtend.fromJson(Map<String, dynamic> json) =>
|
|
_$EhFileExtendFromJson(json);
|
|
Map<String, dynamic> toJson() => _$EhFileExtendToJson(this);
|
|
}
|
|
|
|
class EhFiles {
|
|
const EhFiles({required this.files});
|
|
final Map<String, List<EhFileBasic>> files;
|
|
factory EhFiles.fromJson(Map<String, dynamic> json) => EhFiles(
|
|
files: (json).map(
|
|
(k, e) => MapEntry(
|
|
k,
|
|
(e as List<dynamic>)
|
|
.map((e) => EhFileBasic.fromJson(e as Map<String, dynamic>))
|
|
.toList()),
|
|
),
|
|
);
|
|
}
|