2024-12-10 12:59:08 +04:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'words_dto.g.dart';
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
2024-12-19 08:53:16 +04:00
|
|
|
class WordsDto {
|
2024-12-10 12:59:08 +04:00
|
|
|
final List<WordDataDto>? data;
|
2024-12-11 12:40:09 +04:00
|
|
|
final MetaDto? meta;
|
2024-12-10 12:59:08 +04:00
|
|
|
|
2024-12-11 12:40:09 +04:00
|
|
|
const WordsDto({this.data, this.meta});
|
2024-12-10 12:59:08 +04:00
|
|
|
|
|
|
|
factory WordsDto.fromJson(Map<String, dynamic> json) => _$WordsDtoFromJson(json);
|
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
2024-12-19 08:53:16 +04:00
|
|
|
class WordDataDto {
|
2024-12-10 12:59:08 +04:00
|
|
|
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)
|
2024-12-19 08:53:16 +04:00
|
|
|
class WordAttributesDataDto {
|
2024-12-21 15:24:04 +04:00
|
|
|
final String? word;
|
|
|
|
final String? translation;
|
2024-12-10 12:59:08 +04:00
|
|
|
final String? image;
|
|
|
|
|
2024-12-19 08:53:16 +04:00
|
|
|
factory WordAttributesDataDto.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$WordAttributesDataDtoFromJson(json);
|
2024-12-10 12:59:08 +04:00
|
|
|
|
2024-12-21 15:24:04 +04:00
|
|
|
WordAttributesDataDto(this.word, this.translation, this.image);
|
2024-12-11 12:40:09 +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);
|
|
|
|
}
|