PIbd-31-Makarov-DV-MobilePr.../lib/data/dtos/animes_dto.dart

60 lines
1.5 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
part "animes_dto.g.dart";
@JsonSerializable(createToJson: false)
class AnimesDto {
final List<AnimeDto>? data;
final PaginationDto? pagination;
const AnimesDto({this.data, this.pagination});
factory AnimesDto.fromJson(Map<String, dynamic> json) => _$AnimesDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class PaginationDto {
@JsonKey(name: 'last_visible_page')
final int? lastPage;
@JsonKey(name: 'has_next_page')
final bool? hasNextPage;
@JsonKey(name: 'current_page')
final int? currentPage;
const PaginationDto({this.currentPage, this.hasNextPage, this.lastPage});
factory PaginationDto.fromJson(Map<String, dynamic> json) => _$PaginationDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class AnimeDto {
final String? title;
final int? year;
final String? type;
final String? synopsis;
final String? rating;
final ImagesDto? images;
const AnimeDto({this.title, this.rating, this.synopsis, this.type, this.year, this.images});
factory AnimeDto.fromJson(Map<String, dynamic> json) => _$AnimeDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class ImagesDto {
final ImageDto? jpg;
const ImagesDto({this.jpg});
factory ImagesDto.fromJson(Map<String, dynamic> json) => _$ImagesDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class ImageDto {
@JsonKey(name: "image_url")
final String? imageUrl;
const ImageDto({this.imageUrl});
factory ImageDto.fromJson(Map<String, dynamic> json) => _$ImageDtoFromJson(json);
}