jellyfin/MediaBrowser.Controller/Library/IUserDataManager.cs

67 lines
2.4 KiB
C#
Raw Normal View History

2014-09-20 22:14:16 +00:00
using System.Collections.Generic;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto;
2013-10-02 17:23:10 +00:00
using MediaBrowser.Model.Entities;
2013-10-02 16:08:58 +00:00
using System;
using System.Threading;
using System.Threading.Tasks;
2016-12-13 07:36:30 +00:00
using MediaBrowser.Model.Querying;
2013-10-02 16:08:58 +00:00
namespace MediaBrowser.Controller.Library
{
2013-10-02 17:23:10 +00:00
/// <summary>
/// Interface IUserDataManager
/// </summary>
2013-10-02 16:08:58 +00:00
public interface IUserDataManager
{
2013-10-02 19:08:58 +00:00
/// <summary>
/// Occurs when [user data saved].
/// </summary>
event EventHandler<UserDataSaveEventArgs> UserDataSaved;
2013-10-02 16:08:58 +00:00
/// <summary>
/// Saves the user data.
/// </summary>
/// <param name="userId">The user id.</param>
2013-10-23 16:03:12 +00:00
/// <param name="item">The item.</param>
2013-10-02 16:08:58 +00:00
/// <param name="userData">The user data.</param>
2013-10-02 17:23:10 +00:00
/// <param name="reason">The reason.</param>
2013-10-02 16:08:58 +00:00
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
2013-12-19 21:51:32 +00:00
Task SaveUserData(Guid userId, IHasUserData item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
2013-10-02 16:08:58 +00:00
2016-04-30 22:05:13 +00:00
UserItemData GetUserData(IHasUserData user, IHasUserData item);
UserItemData GetUserData(string userId, IHasUserData item);
UserItemData GetUserData(Guid userId, IHasUserData item);
/// <summary>
/// Gets the user data dto.
/// </summary>
2016-06-19 06:18:29 +00:00
Task<UserItemDataDto> GetUserDataDto(IHasUserData item, User user);
2016-12-13 07:36:30 +00:00
Task<UserItemDataDto> GetUserDataDto(IHasUserData item, BaseItemDto itemDto, User user, List<ItemFields> fields);
2014-09-20 22:14:16 +00:00
/// <summary>
/// Get all user data for the given user
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
IEnumerable<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>
Task SaveAllUserData(Guid userId, IEnumerable<UserItemData> userData, CancellationToken cancellationToken);
2014-12-26 17:45:06 +00:00
/// <summary>
/// Updates playstate for an item and returns true or false indicating if it was played to completion
/// </summary>
2015-02-17 18:42:46 +00:00
bool UpdatePlayState(BaseItem item, UserItemData data, long? positionTicks);
2013-10-02 16:08:58 +00:00
}
}