createCustomList method
Future<TraktList>
createCustomList(
- String id, {
- required String name,
- String? description,
- CustomListPrivacy privacy = CustomListPrivacy.private,
- bool displayNumbers = false,
- bool allowComments = true,
- CustomListSort sortBy = CustomListSort.rank,
- CustomListSortHow sortHow = CustomListSortHow.asc,
Create a new custom list.
The name is the only required field, but the other info is recommended to ask for.
id
- User slug
name
- Name of the list.
description
- Description for this list.
privacy
- Possible values: private, friends, or public
displayNumbers
- Should each item be numbered?
allowComments
- Are comments allowed?
sortBy
- Possible values: rank, added, title, released, runtime, popularity, percentage, votes, my_rating, random, watched, collected
sortHow
- Possible values: asc, desc
🔒 OAuth Required
Implementation
Future<TraktList> createCustomList(String id,
{required String name,
String? description,
CustomListPrivacy privacy = CustomListPrivacy.private,
bool displayNumbers = false,
bool allowComments = true,
CustomListSort sortBy = CustomListSort.rank,
CustomListSortHow sortHow = CustomListSortHow.asc}) async {
Map<String, dynamic> body = {
"name": name,
"privacy": privacy.value,
"display_numbers": displayNumbers,
"allow_comments": allowComments,
"sort_by": sortBy.value,
"sort_how": sortHow.value
};
if (description != null) {
body["description"] = description;
}
return await _manager._authenticatedPost<TraktList>("users/$id/lists", body: jsonEncode(body));
}