61 lines
1.5 KiB
Dart
61 lines
1.5 KiB
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'films_dto.g.dart';
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class FilmsDto {
|
|
final List<FilmDataDto>? data;
|
|
final MetaDto? meta;
|
|
|
|
const FilmsDto({
|
|
this.data,
|
|
this.meta,
|
|
});
|
|
|
|
factory FilmsDto.fromJson(Map<String, dynamic> json) => _$FilmsDtoFromJson(json);
|
|
}
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class FilmDataDto {
|
|
final String? id;
|
|
final String? type;
|
|
final FilmAttributesDataDto? attributes;
|
|
|
|
const FilmDataDto({this.id, this.type, this.attributes});
|
|
|
|
factory FilmDataDto.fromJson(Map<String, dynamic> json) => _$FilmDataDtoFromJson(json);
|
|
}
|
|
|
|
@JsonSerializable(createToJson: false)
|
|
class FilmAttributesDataDto {
|
|
final String? title;
|
|
final DateTime? release_date;
|
|
final String? budget;
|
|
final String? poster;
|
|
|
|
const FilmAttributesDataDto({this.title, this.release_date, this.budget, this.poster});
|
|
|
|
factory FilmAttributesDataDto.fromJson(Map<String, dynamic> json) =>
|
|
_$FilmAttributesDataDtoFromJson(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? current;
|
|
final int? next;
|
|
final int? last;
|
|
|
|
const PaginationDto({this.current, this.next, this.last});
|
|
|
|
factory PaginationDto.fromJson(Map<String, dynamic> json) => _$PaginationDtoFromJson(json);
|
|
}
|