2021-05-06 22:39:20 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2020-08-22 19:56:24 +00:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-13 20:01:16 +00:00
|
|
|
using System;
|
2021-04-10 20:17:36 +00:00
|
|
|
using System.Threading.Tasks;
|
2020-05-13 02:10:35 +00:00
|
|
|
using Jellyfin.Data.Entities;
|
2021-04-10 20:17:36 +00:00
|
|
|
using Jellyfin.Data.Entities.Security;
|
2020-08-14 00:48:28 +00:00
|
|
|
using Jellyfin.Data.Events;
|
2021-05-21 03:56:59 +00:00
|
|
|
using Jellyfin.Data.Queries;
|
2019-01-13 19:25:32 +00:00
|
|
|
using MediaBrowser.Model.Devices;
|
|
|
|
using MediaBrowser.Model.Querying;
|
|
|
|
using MediaBrowser.Model.Session;
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Devices
|
|
|
|
{
|
|
|
|
public interface IDeviceManager
|
|
|
|
{
|
2020-08-22 19:56:24 +00:00
|
|
|
event EventHandler<GenericEventArgs<Tuple<string, DeviceOptions>>> DeviceOptionsUpdated;
|
|
|
|
|
2021-05-21 03:56:59 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new device.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="device">The device to create.</param>
|
|
|
|
/// <returns>A <see cref="Task{Device}"/> representing the creation of the device.</returns>
|
|
|
|
Task<Device> CreateDevice(Device device);
|
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Saves the capabilities.
|
|
|
|
/// </summary>
|
2021-04-10 21:11:59 +00:00
|
|
|
/// <param name="deviceId">The device id.</param>
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <param name="capabilities">The capabilities.</param>
|
2021-04-10 21:11:59 +00:00
|
|
|
void SaveCapabilities(string deviceId, ClientCapabilities capabilities);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the capabilities.
|
|
|
|
/// </summary>
|
2021-04-10 21:11:59 +00:00
|
|
|
/// <param name="deviceId">The device id.</param>
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <returns>ClientCapabilities.</returns>
|
2021-04-10 21:11:59 +00:00
|
|
|
ClientCapabilities GetCapabilities(string deviceId);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the device information.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="id">The identifier.</param>
|
|
|
|
/// <returns>DeviceInfo.</returns>
|
2021-04-10 20:17:36 +00:00
|
|
|
Task<DeviceInfo> GetDevice(string id);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
2021-05-21 03:56:59 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets devices based on the provided query.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="query">The device query.</param>
|
|
|
|
/// <returns>A <see cref="Task{QueryResult}"/> representing the retrieval of the devices.</returns>
|
|
|
|
Task<QueryResult<Device>> GetDevices(DeviceQuery query);
|
|
|
|
|
|
|
|
Task<QueryResult<DeviceInfo>> GetDeviceInfos(DeviceQuery query);
|
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the devices.
|
|
|
|
/// </summary>
|
2021-05-21 00:39:22 +00:00
|
|
|
/// <param name="userId">The user's id, or <c>null</c>.</param>
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <returns>IEnumerable<DeviceInfo>.</returns>
|
2024-01-06 20:33:48 +00:00
|
|
|
Task<QueryResult<DeviceInfo>> GetDevicesForUser(Guid? userId);
|
2018-12-27 23:27:57 +00:00
|
|
|
|
2021-05-21 03:56:59 +00:00
|
|
|
Task DeleteDevice(Device device);
|
|
|
|
|
2018-12-27 23:27:57 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Determines whether this instance [can access device] the specified user identifier.
|
|
|
|
/// </summary>
|
2021-09-03 00:22:08 +00:00
|
|
|
/// <param name="user">The user to test.</param>
|
|
|
|
/// <param name="deviceId">The device id to test.</param>
|
|
|
|
/// <returns>Whether the user can access the device.</returns>
|
2018-12-27 23:27:57 +00:00
|
|
|
bool CanAccessDevice(User user, string deviceId);
|
|
|
|
|
2021-07-13 23:30:11 +00:00
|
|
|
Task UpdateDeviceOptions(string deviceId, string deviceName);
|
2020-08-22 19:56:24 +00:00
|
|
|
|
2021-04-10 20:57:25 +00:00
|
|
|
Task<DeviceOptions> GetDeviceOptions(string deviceId);
|
2018-12-27 23:27:57 +00:00
|
|
|
}
|
|
|
|
}
|