PMU/lib/data/dtos/words_dto.dart
2024-12-11 12:40:09 +04:00

55 lines
1.4 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
part 'words_dto.g.dart';
@JsonSerializable(createToJson: false)
class WordsDto{
final List<WordDataDto>? data;
final MetaDto? meta;
const WordsDto({this.data, this.meta});
factory WordsDto.fromJson(Map<String, dynamic> json) => _$WordsDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class WordDataDto{
final String? id;
final String? type;
final WordAttributesDataDto? attributes;
const WordDataDto({this.id, this.type, this.attributes});
factory WordDataDto.fromJson(Map<String, dynamic> json) => _$WordDataDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class WordAttributesDataDto{
final String? name;
final String? born;
final String? died;
final String? image;
factory WordAttributesDataDto.fromJson(Map<String, dynamic> json) => _$WordAttributesDataDtoFromJson(json);
WordAttributesDataDto(this.name, this.born, this.died, this.image);
}
@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);
}