jellyfin-server/MediaBrowser.Controller/Library/IUserDataManager.cs

77 lines
2.9 KiB
C#
Raw Normal View History

#nullable disable
#pragma warning disable CA1002, CA1707, CS1591
using System;
using System.Collections.Generic;
using System.Threading;
2020-05-20 17:07:53 +00:00
using Jellyfin.Data.Entities;
2018-12-27 23:27:57 +00:00
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Library
{
/// <summary>
/// Interface IUserDataManager.
2018-12-27 23:27:57 +00:00
/// </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);
2020-05-20 17:07:53 +00:00
void SaveUserData(User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken);
2018-12-27 23:27:57 +00:00
2020-05-20 17:07:53 +00:00
UserItemData GetUserData(User user, BaseItem item);
2018-12-27 23:27:57 +00:00
UserItemData GetUserData(Guid userId, BaseItem item);
/// <summary>
/// Gets the user data dto.
/// </summary>
/// <param name="item">Item to use.</param>
/// <param name="user">User to use.</param>
/// <returns>User data dto.</returns>
2020-05-20 17:07:53 +00:00
UserItemDataDto GetUserDataDto(BaseItem item, User user);
2018-12-27 23:27:57 +00:00
2021-09-03 16:46:34 +00:00
UserItemDataDto GetUserDataDto(BaseItem item, BaseItemDto itemDto, User user, DtoOptions options);
2018-12-27 23:27:57 +00:00
/// <summary>
/// Get all user data for the given user.
2018-12-27 23:27:57 +00:00
/// </summary>
/// <param name="userId">The user id.</param>
/// <returns>The user item data.</returns>
2018-12-27 23:27:57 +00:00
List<UserItemData> GetAllUserData(Guid userId);
/// <summary>
/// Save the all provided user data for the given user.
2018-12-27 23:27:57 +00:00
/// </summary>
/// <param name="userId">The user id.</param>
/// <param name="userData">The array of user data.</param>
/// <param name="cancellationToken">The cancellation token.</param>
2018-12-27 23:27:57 +00:00
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.
2018-12-27 23:27:57 +00:00
/// </summary>
/// <param name="item">Item to update.</param>
/// <param name="data">Data to update.</param>
2021-09-03 16:46:34 +00:00
/// <param name="reportedPositionTicks">New playstate.</param>
/// <returns>True if playstate was updated.</returns>
2021-09-03 16:46:34 +00:00
bool UpdatePlayState(BaseItem item, UserItemData data, long? reportedPositionTicks);
2018-12-27 23:27:57 +00:00
}
}