|
|
|
// ignore_for_file: invalid_annotation_target
|
|
|
|
|
|
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
|
|
|
|
part 'page_info.freezed.dart';
|
|
|
|
part 'page_info.g.dart';
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class PageInfo with _$PageInfo {
|
|
|
|
const PageInfo._();
|
|
|
|
|
|
|
|
factory PageInfo({
|
|
|
|
required int pageid,
|
|
|
|
required int ns,
|
|
|
|
required String title,
|
|
|
|
String? subtitle,
|
|
|
|
String? displayTitle,
|
|
|
|
@JsonKey(name: "extract") String? description,
|
|
|
|
String? contentmodel,
|
|
|
|
String? pagelanguage,
|
|
|
|
String? pagelanguagehtmlcode,
|
|
|
|
String? pagelanguagedir,
|
|
|
|
bool? inwatchlist,
|
|
|
|
@JsonKey(name: "touched") DateTime? updatedTime,
|
|
|
|
int? lastrevid,
|
|
|
|
int? length,
|
|
|
|
String? fullurl,
|
|
|
|
String? editurl,
|
|
|
|
String? canonicalurl,
|
|
|
|
}) = _PageInfo;
|
|
|
|
|
|
|
|
String get mainTitle {
|
|
|
|
return displayTitle ?? title;
|
|
|
|
}
|
|
|
|
|
|
|
|
String? get mainCategory {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
factory PageInfo.fromJson(Map<String, dynamic> json) => _$PageInfoFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class PagesResponse with _$PagesResponse {
|
|
|
|
factory PagesResponse({required List<PageInfo> pages}) = _PageResponse;
|
|
|
|
|
|
|
|
factory PagesResponse.fromJson(Map<String, dynamic> json) => _$PagesResponseFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@freezed
|
|
|
|
class PageImageInfo with _$PageImageInfo {
|
|
|
|
factory PageImageInfo({required String source, int? width, int? height}) = _PageImageInfo;
|
|
|
|
|
|
|
|
factory PageImageInfo.fromJson(Map<String, dynamic> json) => _$PageImageInfoFromJson(json);
|
|
|
|
}
|