import 'package:json_annotation/json_annotation.dart'; part 'page_info.g.dart'; @JsonSerializable() class PageInfo { int pageid; int ns; String title; String? displayTitle; String? subtitle; int? lastrevid; String? contentmodel; String? pagelanguage; String? pagelanguagehtmlcode; String? pagelanguagedir; bool? inwatchlist; int? length; String? fullurl; String? editurl; String? canonicalurl; PageImageInfo? thumbnail; @JsonKey(name: "extract") String? description; @JsonKey(name: "touched") DateTime? updatedTime; PageInfo({ required this.pageid, required this.ns, required this.title, this.subtitle, this.displayTitle, this.description, this.contentmodel, this.pagelanguage, this.pagelanguagehtmlcode, this.pagelanguagedir, this.inwatchlist, this.updatedTime, this.lastrevid, this.length, this.fullurl, this.editurl, this.canonicalurl, }); String get mainTitle { return displayTitle ?? title; } String? get mainCategory { return null; } factory PageInfo.fromJson(Map json) => _$PageInfoFromJson(json); Map toJson() => _$PageInfoToJson(this); } @JsonSerializable() class PagesResponse { List pages; PagesResponse({required this.pages}); factory PagesResponse.fromJson(Map json) => _$PagesResponseFromJson(json); Map toJson() => _$PagesResponseToJson(this); } @JsonSerializable() class PageImageInfo { String source; int? width; int? height; PageImageInfo({required this.source, this.width, this.height}); factory PageImageInfo.fromJson(Map json) => _$PageImageInfoFromJson(json); Map toJson() => _$PageImageInfoToJson(this); }