2024-10-07 17:59:30 +04:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
|
|
|
|
part 'characters_dto.g.dart';
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class CharactersDto {
|
|
|
|
final List<CharacterDataDto>? data;
|
2024-10-16 11:29:51 +04:00
|
|
|
final MetaDto? meta;
|
2024-10-07 17:59:30 +04:00
|
|
|
|
2024-10-16 11:29:51 +04:00
|
|
|
const CharactersDto({
|
|
|
|
this.data,
|
|
|
|
this.meta,
|
|
|
|
});
|
2024-10-07 17:59:30 +04:00
|
|
|
|
|
|
|
factory CharactersDto.fromJson(Map<String, dynamic> json) => _$CharactersDtoFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class CharacterDataDto {
|
2024-10-07 18:19:03 +04:00
|
|
|
final String? id;
|
|
|
|
final String? type;
|
|
|
|
final CharacterAttributesDataDto? attributes;
|
2024-10-07 17:59:30 +04:00
|
|
|
|
2024-10-07 18:19:03 +04:00
|
|
|
const CharacterDataDto({this.id, this.type, this.attributes});
|
2024-10-07 17:59:30 +04:00
|
|
|
|
2024-10-07 18:19:03 +04:00
|
|
|
factory CharacterDataDto.fromJson(Map<String, dynamic> json) => _$CharacterDataDtoFromJson(json);
|
2024-10-07 17:59:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class CharacterAttributesDataDto {
|
2024-10-07 18:19:03 +04:00
|
|
|
final String? name;
|
|
|
|
final String? born;
|
|
|
|
final String? died;
|
|
|
|
final String? image;
|
2024-10-07 17:59:30 +04:00
|
|
|
|
2024-10-07 18:19:03 +04:00
|
|
|
const CharacterAttributesDataDto({this.name, this.born, this.died, this.image});
|
2024-10-07 17:59:30 +04:00
|
|
|
|
2024-10-07 18:19:03 +04:00
|
|
|
factory CharacterAttributesDataDto.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$CharacterAttributesDataDtoFromJson(json);
|
2024-10-16 11:29:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class MetaDto {
|
|
|
|
final PaginationDto? pagination;
|
|
|
|
|
|
|
|
const MetaDto({this.pagination});
|
|
|
|
|
|
|
|
factory MetaDto.fromJson(Map<String, dynamic> json) => _$MetaDtoFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class PaginationDto {
|
|
|
|
final int? current;
|
|
|
|
final int? next;
|
|
|
|
final int? last;
|
|
|
|
|
|
|
|
const PaginationDto({this.current, this.next, this.last});
|
|
|
|
|
|
|
|
factory PaginationDto.fromJson(Map<String, dynamic> json) => _$PaginationDtoFromJson(json);
|
2024-10-07 18:19:03 +04:00
|
|
|
}
|