2024-12-18 17:20:52 +04:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
|
2024-12-19 11:41:08 +04:00
|
|
|
part 'recipes_dto.g.dart';
|
2024-12-18 17:20:52 +04:00
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class RecipesDto {
|
2024-12-19 22:49:26 +04:00
|
|
|
final List<RecipeDataDto>? data;
|
|
|
|
final MetaDto? meta;
|
2024-12-18 17:20:52 +04:00
|
|
|
|
2024-12-19 22:49:26 +04:00
|
|
|
const RecipesDto({
|
|
|
|
this.data,
|
|
|
|
this.meta,
|
|
|
|
});
|
2024-12-18 17:20:52 +04:00
|
|
|
|
2024-12-19 22:49:26 +04:00
|
|
|
factory RecipesDto.fromJson(Map<String, dynamic> json) => _$RecipesDtoFromJson(json);
|
2024-12-18 17:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class RecipeDataDto {
|
2024-12-19 22:49:26 +04:00
|
|
|
final String? id;
|
|
|
|
final String? type;
|
|
|
|
final RecipeAttributesDataDto? attributes;
|
2024-12-18 17:20:52 +04:00
|
|
|
|
2024-12-19 22:49:26 +04:00
|
|
|
const RecipeDataDto({this.id, this.type, this.attributes});
|
2024-12-18 17:20:52 +04:00
|
|
|
|
2024-12-19 22:49:26 +04:00
|
|
|
factory RecipeDataDto.fromJson(Map<String, dynamic> json) => _$RecipeDataDtoFromJson(json);
|
2024-12-18 17:20:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
|
|
class RecipeAttributesDataDto {
|
2024-12-19 22:49:26 +04:00
|
|
|
final String? name;
|
|
|
|
final String? calories;
|
|
|
|
final String? died;
|
2024-12-18 17:20:52 +04:00
|
|
|
final String? image;
|
|
|
|
|
2024-12-19 22:49:26 +04:00
|
|
|
const RecipeAttributesDataDto({this.name, this.calories, this.died, this.image});
|
2024-12-18 17:20:52 +04:00
|
|
|
|
|
|
|
factory RecipeAttributesDataDto.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$RecipeAttributesDataDtoFromJson(json);
|
|
|
|
}
|
2024-12-19 22:49:26 +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? next;
|
|
|
|
|
|
|
|
const PaginationDto({ this.next});
|
|
|
|
|
|
|
|
factory PaginationDto.fromJson(Map<String, dynamic> json) => _$PaginationDtoFromJson(json);
|
|
|
|
}
|