Skip to content

Commit

Permalink
feat: add movie list
Browse files Browse the repository at this point in the history
  • Loading branch information
sozonome committed Oct 21, 2022
1 parent 9979c19 commit a91a269
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 0 deletions.
79 changes: 79 additions & 0 deletions lib/models/tmdb/movie/movie_list.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import 'package:json_annotation/json_annotation.dart';

part 'movie_list.g.dart';

@JsonSerializable()
class MovieListParams {
MovieListParams({
this.language,
this.page,
this.query,
this.withGenres,
});

factory MovieListParams.fromJson(Map<String, dynamic> json) =>
_$MovieListParamsFromJson(json);

String? language;
int? page;
String? query;
@JsonKey(name: 'with_genres')
List<String>? withGenres;

Map<String, dynamic> toJson() => _$MovieListParamsToJson(this);
}

@JsonSerializable()
class MovieListItemType {
const MovieListItemType({
required this.releaseDate,
required this.id,
required this.popularity,
this.posterPath,
this.adult = false,
this.overview = '',
this.genreIDs = const <int>[],
this.originalTitle = '',
this.originalLanguage = '',
this.title = '',
this.backdropPath,
this.voteCount = 0,
this.video = false,
this.voteAverage = 0,
});

factory MovieListItemType.fromJson(Map<String, dynamic> json) =>
_$MovieListItemTypeFromJson(json);

@JsonKey(name: 'poster_path')
final String? posterPath;
final bool adult;
final String overview;

@JsonKey(name: 'release_date')
final String releaseDate;

@JsonKey(name: 'genre_ids')
final List<int> genreIDs;
final int id;

@JsonKey(name: 'original_title')
final String originalTitle;

@JsonKey(name: 'original_language')
final String originalLanguage;
final String title;

@JsonKey(name: 'backdrop_path')
final String? backdropPath;
final int popularity;

@JsonKey(name: 'vote_count')
final int voteCount;
final bool video;

@JsonKey(name: 'vote_average')
final int voteAverage;

Map<String, dynamic> toJson() => _$MovieListItemTypeToJson(this);
}
64 changes: 64 additions & 0 deletions lib/models/tmdb/movie/movie_list.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a91a269

Please sign in to comment.