getHistory method
Future<List<HistoryItem> >
getHistory({
- WatchedItemType? type,
- String? itemId,
- String? startAt,
- String? endAt,
- bool extendedFull = false,
- RequestPagination? pagination,
Returns movies and episodes that a user has watched, sorted by most recent.
You can optionally limit the type to movies or episodes. The id (64-bit integer) in each history item uniquely identifies the event and can be used to remove individual events by using the /sync/history/remove method. The action will be set to scrobble, checkin, or watch.
Specify a type and trakt id to limit the history for just that item. If the id is valid, but there is no history, an empty array will be returned.
type
- Possible values: movies , shows , seasons , episodes
itemId
- Trakt ID for a specific item
startAt
- Starting date
endAt
- Ending data
🔓 OAuth Optional 📄 Pagination ✨ Extended Info
Implementation
Future<List<HistoryItem>> getHistory(
{WatchedItemType? type,
String? itemId,
String? startAt,
String? endAt,
bool extendedFull = false,
RequestPagination? pagination}) async {
var request = "sync/history";
if (type != null && itemId != null) {
request += "/${type.value}/$itemId";
}
Map<String, dynamic>? params;
if (startAt != null) {
params = {};
params["start_at"] = startAt;
}
if (endAt != null) {
params = params ?? {};
params["end_at"] = endAt;
}
return await _manager._authenticatedGetList<HistoryItem>(request,
extendedFull: extendedFull,
pagination: pagination,
queryParamameters: params);
}