60 lines
1.5 KiB
Dart
Raw Normal View History

2024-12-20 15:27:57 +04:00
import 'package:json_annotation/json_annotation.dart';
part 'potions_dto.g.dart';
@JsonSerializable(createToJson: false)
class PotionsDto {
final List<PotionDataDto>? data;
2024-12-20 16:18:09 +04:00
final MetaDto? meta;
2024-12-20 15:27:57 +04:00
2024-12-20 16:18:09 +04:00
const PotionsDto({
this.data,
this.meta,
});
2024-12-20 15:27:57 +04:00
factory PotionsDto.fromJson(Map<String, dynamic> json) => _$PotionsDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class PotionDataDto {
final String? id;
final String? type;
final PotionAttributesDataDto? attributes;
const PotionDataDto({this.id, this.type, this.attributes});
factory PotionDataDto.fromJson(Map<String, dynamic> json) => _$PotionDataDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class PotionAttributesDataDto {
final String? name;
final String? characteristics;
final String? effect;
final String? image;
const PotionAttributesDataDto({this.name, this.characteristics, this.effect, this.image});
factory PotionAttributesDataDto.fromJson(Map<String, dynamic> json) =>
_$PotionAttributesDataDtoFromJson(json);
2024-12-20 16:18: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);
2024-12-20 15:27:57 +04:00
}