You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.4 KiB
Dart

// ignore_for_file: invalid_annotation_target
2 years ago
import 'package:freezed_annotation/freezed_annotation.dart';
2 years ago
part 'page_info.freezed.dart';
part 'page_info.g.dart';
2 years ago
@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;
2 years ago
String get mainTitle {
return displayTitle ?? title;
}
String? get mainCategory {
return null;
}
factory PageInfo.fromJson(Map<String, dynamic> json) => _$PageInfoFromJson(json);
2 years ago
}
@freezed
class PagesResponse with _$PagesResponse {
factory PagesResponse({required List<PageInfo> pages}) = _PageResponse;
2 years ago
factory PagesResponse.fromJson(Map<String, dynamic> json) => _$PagesResponseFromJson(json);
2 years ago
}
@freezed
class PageImageInfo with _$PageImageInfo {
factory PageImageInfo({required String source, int? width, int? height}) = _PageImageInfo;
2 years ago
factory PageImageInfo.fromJson(Map<String, dynamic> json) => _$PageImageInfoFromJson(json);
2 years ago
}