IDeviceManager.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #nullable disable
  2. #pragma warning disable CS1591
  3. using System;
  4. using System.Threading.Tasks;
  5. using Jellyfin.Data.Entities;
  6. using Jellyfin.Data.Entities.Security;
  7. using Jellyfin.Data.Events;
  8. using Jellyfin.Data.Queries;
  9. using MediaBrowser.Model.Devices;
  10. using MediaBrowser.Model.Querying;
  11. using MediaBrowser.Model.Session;
  12. namespace MediaBrowser.Controller.Devices
  13. {
  14. public interface IDeviceManager
  15. {
  16. event EventHandler<GenericEventArgs<Tuple<string, DeviceOptions>>> DeviceOptionsUpdated;
  17. /// <summary>
  18. /// Creates a new device.
  19. /// </summary>
  20. /// <param name="device">The device to create.</param>
  21. /// <returns>A <see cref="Task{Device}"/> representing the creation of the device.</returns>
  22. Task<Device> CreateDevice(Device device);
  23. /// <summary>
  24. /// Saves the capabilities.
  25. /// </summary>
  26. /// <param name="deviceId">The device id.</param>
  27. /// <param name="capabilities">The capabilities.</param>
  28. void SaveCapabilities(string deviceId, ClientCapabilities capabilities);
  29. /// <summary>
  30. /// Gets the capabilities.
  31. /// </summary>
  32. /// <param name="deviceId">The device id.</param>
  33. /// <returns>ClientCapabilities.</returns>
  34. ClientCapabilities GetCapabilities(string deviceId);
  35. /// <summary>
  36. /// Gets the device information.
  37. /// </summary>
  38. /// <param name="id">The identifier.</param>
  39. /// <returns>DeviceInfo.</returns>
  40. Task<DeviceInfo> GetDevice(string id);
  41. /// <summary>
  42. /// Gets devices based on the provided query.
  43. /// </summary>
  44. /// <param name="query">The device query.</param>
  45. /// <returns>A <see cref="Task{QueryResult}"/> representing the retrieval of the devices.</returns>
  46. Task<QueryResult<Device>> GetDevices(DeviceQuery query);
  47. Task<QueryResult<DeviceInfo>> GetDeviceInfos(DeviceQuery query);
  48. /// <summary>
  49. /// Gets the devices.
  50. /// </summary>
  51. /// <param name="userId">The user's id, or <c>null</c>.</param>
  52. /// <returns>IEnumerable&lt;DeviceInfo&gt;.</returns>
  53. Task<QueryResult<DeviceInfo>> GetDevicesForUser(Guid? userId);
  54. Task DeleteDevice(Device device);
  55. /// <summary>
  56. /// Determines whether this instance [can access device] the specified user identifier.
  57. /// </summary>
  58. /// <param name="user">The user to test.</param>
  59. /// <param name="deviceId">The device id to test.</param>
  60. /// <returns>Whether the user can access the device.</returns>
  61. bool CanAccessDevice(User user, string deviceId);
  62. Task UpdateDeviceOptions(string deviceId, string deviceName);
  63. Task<DeviceOptions> GetDeviceOptions(string deviceId);
  64. }
  65. }