2021-05-06 22:39:20 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2021-07-24 17:58:50 +00:00
|
|
|
#pragma warning disable CA1002, CA1707, CS1591
|
2020-08-22 19:56:24 +00:00
|
|
|
|
2019-01-13 20:01:16 +00:00
|
|
|
using System;
|
2019-01-13 19:25:32 +00:00
|
|
|
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>
|
2019-11-17 22:05:39 +00:00
|
|
|
/// 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-08-22 19:56:24 +00:00
|
|
|
|
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
|
|
|
|
2023-11-13 12:51:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Save the provided user data for the given user.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
/// <param name="userDataDto">The reason for updating the user data.</param>
|
|
|
|
/// <param name="reason">The reason.</param>
|
2023-11-15 10:55:14 +00:00
|
|
|
void SaveUserData(User user, BaseItem item, UpdateUserItemDataDto userDataDto, UserDataSaveReason reason);
|
2023-11-13 12:51:06 +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>
|
2021-07-24 17:58:50 +00:00
|
|
|
/// <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>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Get all user data for the given user.
|
2018-12-27 23:27:57 +00:00
|
|
|
/// </summary>
|
2021-06-06 15:16:41 +00:00
|
|
|
/// <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>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// Save the all provided user data for the given user.
|
2018-12-27 23:27:57 +00:00
|
|
|
/// </summary>
|
2021-06-06 15:16:41 +00:00
|
|
|
/// <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>
|
2020-06-15 22:37:52 +00:00
|
|
|
/// 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>
|
2021-07-24 17:58:50 +00:00
|
|
|
/// <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>
|
2021-07-24 17:58:50 +00:00
|
|
|
/// <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
|
|
|
}
|
|
|
|
}
|