pmu_kursach/lib/data/dtos/artists_dto.dart
2024-12-16 19:00:34 +04:00

47 lines
1.2 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
part 'artists_dto.g.dart';
// dart run build_runner build --delete-conflicting-outputs
@JsonSerializable(createToJson: false)
class ArtistsDto {
final List<ArtistDataDto>? data;
final MetaDto? meta;
const ArtistsDto({this.data, this.meta});
factory ArtistsDto.fromJson(Map<String, dynamic> json) => _$ArtistsDtoFromJson(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.last, this.next});
factory PaginationDto.fromJson(Map<String, dynamic> json) => _$PaginationDtoFromJson(json);
}
@JsonSerializable(createToJson: false)
class ArtistDataDto {
final String? id;
final String? name;
final String image;
final int year_streams;
const ArtistDataDto(this.id, this.name, this.image, this.year_streams);
factory ArtistDataDto.fromJson(Map<String, dynamic> json) => _$ArtistDataDtoFromJson(json);
}