addItemsToCustomList method
Add one or more items to a custom list. Items can be movies, shows, seasons, episodes, or people.
id
- User slug
listId
- Trakt ID or Trakt slug
movies
- Movies to add
shows
- Shows to add
seasons
- Seasons to add
episodes
- Episodes to add
people
- Persons to add
🔒 OAuth Required 😁 Emojis
Implementation
Future<AddToCustomListResponse> addItemsToCustomList(int id, String listId,
{List<Movie> movies = const [],
List<Show> shows = const [],
List<Season> seasons = const [],
List<Episode> episodes = const [],
List<Person> people = 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();
}
if (people.isNotEmpty) {
body["people"] = people.map((person) => person.metadata).toList();
}
return await _manager._authenticatedPost<AddToCustomListResponse>("users/$id/lists/$listId/items",
body: jsonEncode(body));
}