PMU/lib/data/dtos/recipes_dto.dart
2024-12-19 22:49:26 +04:00

59 lines
1.4 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
part 'recipes_dto.g.dart';
@JsonSerializable(createToJson: false)
class RecipesDto {
final List<RecipeDataDto>? data;
final MetaDto? meta;
const RecipesDto({
this.data,
this.meta,
});
factory RecipesDto.fromJson(Map<String, dynamic> json) => _$RecipesDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class RecipeDataDto {
final String? id;
final String? type;
final RecipeAttributesDataDto? attributes;
const RecipeDataDto({this.id, this.type, this.attributes});
factory RecipeDataDto.fromJson(Map<String, dynamic> json) => _$RecipeDataDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class RecipeAttributesDataDto {
final String? name;
final String? calories;
final String? died;
final String? image;
const RecipeAttributesDataDto({this.name, this.calories, this.died, this.image});
factory RecipeAttributesDataDto.fromJson(Map<String, dynamic> json) =>
_$RecipeAttributesDataDtoFromJson(json);
}
@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);
}