jellyfin/MediaBrowser.Controller/Library/IUserDataManager.cs
2020-05-12 22:10:35 -04:00

65 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Library
{
/// <summary>
/// Interface IUserDataManager.
/// </summary>
public interface IUserDataManager
{
/// <summary>
/// Occurs when [user data saved].
/// </summary>
event EventHandler<UserDataSaveEventArgs> UserDataSaved;
/// <summary>
/// Saves the user data.
/// </summary>
/// <param name="userId">The user id.</param>
/// <param name="item">The item.</param>
/// <param name="userData">The user data.</param>
/// <param name="reason">The reason.</param>
/// <param name="cancellationToken">The cancellation token.</param>
void SaveUserData(Guid userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
void SaveUserData(Jellyfin.Data.Entities.User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
UserItemData GetUserData(Jellyfin.Data.Entities.User user, BaseItem item);
UserItemData GetUserData(Guid userId, BaseItem item);
/// <summary>
/// Gets the user data dto.
/// </summary>
UserItemDataDto GetUserDataDto(BaseItem item, Jellyfin.Data.Entities.User user);
UserItemDataDto GetUserDataDto(BaseItem item, BaseItemDto itemDto, Jellyfin.Data.Entities.User user, DtoOptions dto_options);
/// <summary>
/// Get all user data for the given user
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
List<UserItemData> GetAllUserData(Guid userId);
/// <summary>
/// Save the all provided user data for the given user
/// </summary>
/// <param name="userId"></param>
/// <param name="userData"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken);
/// <summary>
/// Updates playstate for an item and returns true or false indicating if it was played to completion
/// </summary>
bool UpdatePlayState(BaseItem item, UserItemData data, long? positionTicks);
}
}