getSync method

Future<List<UserCollectionItem>> getSync(
  1. MoviesShowsType type, {
  2. bool extendedFull = false,
  3. bool? extendedMetadata,
})

Get all collected items in a user's collection.

A collected item indicates availability to watch digitally or on physical media.

Each movie object contains collected_at and updated_at timestamps. Since users can set custom dates when they collected movies, it is possible for collected_at to be in the past. We also include updated_at to help sync Trakt data with your app. Cache this timestamp locally and only re-process the movie if you see a newer timestamp.

Each show object contains last_collected_at and last_updated_at timestamps. Since users can set custom dates when they collected episodes, it is possible for last_collected_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 show if you see a newer timestamp.

If you add ?extended=metadata to the URL, it will return the additional media_type, resolution, hdr, audio, audio_channels and '3d' metadata. It will use null if the metadata isn't set for an item.

type - Possible values: movies , shows .

🔒 OAuth Required ✨ Extended Info

Implementation

Future<List<UserCollectionItem>> getSync(MoviesShowsType type,
    {bool extendedFull = false, bool? extendedMetadata}) async {
  Map<String, dynamic>? params;
  List<String> extended = [];
  if (extendedFull) {
    extended.add("full");
  }
  if (extendedMetadata ?? false) {
    extended.add("metadata");
  }
  if (extended.isNotEmpty) {
    params = {};
    params["extended"] = extended.join(",");
  }
  return await _manager._authenticatedGetList<UserCollectionItem>(
      "sync/collection/${type.value}",
      queryParamameters: params);
}