addToRatings method
Rate one or more items. Accepts shows, seasons, episodes and movies.
If only a show is passed, only the show itself will be rated. If seasons are specified, all of those seasons will be rated.Send a rated_at UTC datetime to mark items as rated in the past. This is useful for syncing ratings from a media center.
movies
- Movies to add
shows
- Shows to add
seasons
- Seasons to add
episodes
- Episodes to add
🔒 OAuth Required
Implementation
Future<AddToSyncResponse> addToRatings(
{List<Movie> movies = const [],
List<Show> shows = const [],
List<Season> seasons = const [],
List<Episode> episodes = const []}) async {
Map<String, dynamic> body = {};
if (movies.isNotEmpty) {
body["movies"] = movies.map((movie) => movie.metadata).toList();
}
if (shows.isNotEmpty) {
body["shows"] = shows.map((show) => show.metadata).toList();
}
if (seasons.isNotEmpty) {
body["seasons"] = seasons.map((season) => season.metadata).toList();
}
if (episodes.isNotEmpty) {
body["episodes"] = episodes.map((episode) => episode.metadata).toList();
}
return await _manager._authenticatedPost<AddToSyncResponse>("sync/ratings",
body: jsonEncode(body));
}