removeFromHistory method

Future<RemoveFromSyncResponse> removeFromHistory({
  1. List<Movie> movies = const [],
  2. List<Show> shows = const [],
  3. List<Season> seasons = const [],
  4. List<Episode> episodes = const [],
})

Remove items from a user's watch history including all watches, scrobbles, and checkins.

Accepts shows, seasons, episodes and movies. If only a show is passed, all episodes for the show will be removed. If seasons are specified, only episodes in those seasons will be removed.

You can also send a list of raw history ids (64-bit integers) to delete single plays from the watched history. The /sync/history method will return an individual id (64-bit integer) for each history item.

🔒 OAuth Required

Implementation

Future<RemoveFromSyncResponse> removeFromHistory(
    {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<RemoveFromSyncResponse>(
      "sync/history/remove",
      body: jsonEncode(body));
}