60 lines
1.6 KiB
Dart
60 lines
1.6 KiB
Dart
|
import 'package:json_annotation/json_annotation.dart';
|
||
|
|
||
|
part 'character_dto.g.dart';
|
||
|
|
||
|
@JsonSerializable(createToJson: false)
|
||
|
class CharactersDto {
|
||
|
@JsonKey(name: 'characters')
|
||
|
final List<CharacterDataDto>? data;
|
||
|
final MetaDto? meta;
|
||
|
|
||
|
const CharactersDto({
|
||
|
this.data,
|
||
|
this.meta,
|
||
|
});
|
||
|
|
||
|
factory CharactersDto.fromJson(Map<String, dynamic> json) =>
|
||
|
_$CharactersDtoFromJson(json);
|
||
|
}
|
||
|
|
||
|
@JsonSerializable(createToJson: false)
|
||
|
class CharacterDataDto {
|
||
|
final int? id;
|
||
|
final String? name;
|
||
|
final List<String>? images;
|
||
|
@JsonKey(name: 'personal')
|
||
|
final CharacterDataAttributesDto? attributes;
|
||
|
|
||
|
const CharacterDataDto({this.id, this.name, this.images, this.attributes});
|
||
|
|
||
|
factory CharacterDataDto.fromJson(Map<String, dynamic> json) =>
|
||
|
_$CharacterDataDtoFromJson(json);
|
||
|
}
|
||
|
|
||
|
@JsonSerializable(createToJson: false)
|
||
|
class CharacterDataAttributesDto {
|
||
|
final String? birthdate;
|
||
|
final String? sex;
|
||
|
final String? clan;
|
||
|
|
||
|
const CharacterDataAttributesDto({this.birthdate, this.sex, this.clan});
|
||
|
|
||
|
factory CharacterDataAttributesDto.fromJson(Map<String, dynamic> json) =>
|
||
|
_$CharacterDataAttributesDtoFromJson(json);
|
||
|
}
|
||
|
|
||
|
@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);
|
||
|
}
|