getWatched method

Future<List<WatchedItem>> getWatched(
  1. MoviesShowsType type, {
  2. bool extendedFull = false,
  3. bool? extendedNoSeasons,
})

Returns all movies or shows a user has watched sorted by most plays.

If type is set to shows and you add ?extended=noseasons to the URL, it won't return season or episode info.

Each movie and show object contains last_watched_at and last_updated_at timestamps. Since users can set custom dates when they watched movies and episodes, it is possible for last_watched_at to be in the past. We also include last_updated_at to help sync Trakt data with your app. Cache this timestamp locally and only re-process the movies and shows if you see a newer timestamp.Each show object contains a reset_at timestamp. If not null, this is when the user started re-watching the show. Your app can adjust the progress by ignoring episodes with a last_watched_at prior to the reset_at.

type - Possible values: movies , shows .

🔒 OAuth Required ✨ Extended Info

Implementation

Future<List<WatchedItem>> getWatched(MoviesShowsType type,
    {bool extendedFull = false, bool? extendedNoSeasons}) async {
  Map<String, dynamic>? params;
  List<String> extended = [];
  if (extendedFull) {
    extended.add("full");
  }
  if ((extendedNoSeasons ?? false) && type == MoviesShowsType.shows) {
    extended.add("noseasons");
  }
  if (extended.isNotEmpty) {
    params = {};
    params["extended"] = extended.join(",");
  }

  return await _manager._authenticatedGetList<WatchedItem>(
      "sync/watched/${type.value}",
      queryParamameters: params);
}