getWatched method

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

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

If type is set to shows and you add extendedNoSeasons, 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.

id - User slug useOAuth - whether to make the request using OAuth header

🔓 OAuth Optional ✨ Extended Info

Implementation

Future<List<WatchedItem>> getWatched(String id, MoviesShowsType type,
    {bool useOAuth = false, 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(",");
  }

  if (useOAuth) {
    return await _manager._authenticatedGetList<WatchedItem>("users/$id/watched/${type.value}",
        queryParamameters: params);
  }
  return await _manager._getList<WatchedItem>("users/$id/watched/${type.value}", queryParamameters: params);
}