jellyfin/MediaBrowser.Controller/Devices/IDeviceManager.cs

81 lines
2.9 KiB
C#
Raw Normal View History

#nullable disable
#pragma warning disable CS1591
using System;
2021-04-10 13:17:36 -07:00
using System.Threading.Tasks;
2020-05-12 19:10:35 -07:00
using Jellyfin.Data.Entities;
2021-04-10 13:17:36 -07:00
using Jellyfin.Data.Entities.Security;
using Jellyfin.Data.Events;
2021-05-20 20:56:59 -07:00
using Jellyfin.Data.Queries;
using MediaBrowser.Model.Devices;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Session;
2018-12-27 16:27:57 -07:00
namespace MediaBrowser.Controller.Devices
{
public interface IDeviceManager
{
event EventHandler<GenericEventArgs<Tuple<string, DeviceOptions>>> DeviceOptionsUpdated;
2021-05-20 20:56:59 -07: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 16:27:57 -07:00
/// <summary>
/// Saves the capabilities.
/// </summary>
2021-04-10 14:11:59 -07:00
/// <param name="deviceId">The device id.</param>
2018-12-27 16:27:57 -07:00
/// <param name="capabilities">The capabilities.</param>
2021-04-10 14:11:59 -07:00
void SaveCapabilities(string deviceId, ClientCapabilities capabilities);
2018-12-27 16:27:57 -07:00
/// <summary>
/// Gets the capabilities.
/// </summary>
2021-04-10 14:11:59 -07:00
/// <param name="deviceId">The device id.</param>
2018-12-27 16:27:57 -07:00
/// <returns>ClientCapabilities.</returns>
2021-04-10 14:11:59 -07:00
ClientCapabilities GetCapabilities(string deviceId);
2018-12-27 16:27:57 -07:00
/// <summary>
/// Gets the device information.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>DeviceInfo.</returns>
2021-04-10 13:17:36 -07:00
Task<DeviceInfo> GetDevice(string id);
2018-12-27 16:27:57 -07:00
2021-05-20 20:56:59 -07: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 16:27:57 -07:00
/// <summary>
/// Gets the devices.
/// </summary>
2021-05-20 17:39:22 -07:00
/// <param name="userId">The user's id, or <c>null</c>.</param>
/// <param name="supportsSync">A value indicating whether the device supports sync, or <c>null</c>.</param>
2018-12-27 16:27:57 -07:00
/// <returns>IEnumerable&lt;DeviceInfo&gt;.</returns>
2021-05-20 17:39:22 -07:00
Task<QueryResult<DeviceInfo>> GetDevicesForUser(Guid? userId, bool? supportsSync);
2018-12-27 16:27:57 -07:00
2021-05-20 20:56:59 -07:00
Task DeleteDevice(Device device);
2018-12-27 16:27:57 -07:00
/// <summary>
/// Determines whether this instance [can access device] the specified user identifier.
/// </summary>
2021-09-02 17:22:08 -07: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 16:27:57 -07:00
bool CanAccessDevice(User user, string deviceId);
2021-07-13 16:30:11 -07:00
Task UpdateDeviceOptions(string deviceId, string deviceName);
2021-04-10 13:57:25 -07:00
Task<DeviceOptions> GetDeviceOptions(string deviceId);
2018-12-27 16:27:57 -07:00
}
}