PIbd-32_Stroev_V_M_PMD/lib/data/dtos/characters_dto.dart

38 lines
1.1 KiB
Dart
Raw Normal View History

2024-10-22 08:55:54 +04:00
import 'package:json_annotation/json_annotation.dart';
import 'package:labs/CourseStatus.dart';
part 'characters_dto.g.dart';
@JsonSerializable(createToJson: false)
class CharactersDto{
final List<CharacterDataDto>? data;
const CharactersDto({this.data});
factory CharactersDto.fromJson(Map<String, dynamic> json) => _$CharactersDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class CharacterDataDto {
final String? id;
final String? type;
final CharacterAttributesDataDto? attributes;
const CharacterDataDto({this.id, this.type, this.attributes});
factory CharacterDataDto.fromJson(Map<String, dynamic> json) => _$CharacterDataDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class CharacterAttributesDataDto{
final String? name;
final String? age;
final List<String>? courses;
@JsonKey(name: 'image')
final String? image;
const CharacterAttributesDataDto({this.name, this.age, this.courses, this.image});
factory CharacterAttributesDataDto.fromJson(Map<String, dynamic> json) =>
_$CharacterAttributesDataDtoFromJson(json);
}