ClientCapabilitiesDto.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.Json.Serialization;
  4. using Jellyfin.Data.Enums;
  5. using Jellyfin.Extensions.Json.Converters;
  6. using MediaBrowser.Model.Dlna;
  7. using MediaBrowser.Model.Session;
  8. namespace Jellyfin.Api.Models.SessionDtos;
  9. /// <summary>
  10. /// Client capabilities dto.
  11. /// </summary>
  12. public class ClientCapabilitiesDto
  13. {
  14. /// <summary>
  15. /// Gets or sets the list of playable media types.
  16. /// </summary>
  17. [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
  18. public IReadOnlyList<MediaType> PlayableMediaTypes { get; set; } = Array.Empty<MediaType>();
  19. /// <summary>
  20. /// Gets or sets the list of supported commands.
  21. /// </summary>
  22. [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
  23. public IReadOnlyList<GeneralCommandType> SupportedCommands { get; set; } = Array.Empty<GeneralCommandType>();
  24. /// <summary>
  25. /// Gets or sets a value indicating whether session supports media control.
  26. /// </summary>
  27. public bool SupportsMediaControl { get; set; }
  28. /// <summary>
  29. /// Gets or sets a value indicating whether session supports a persistent identifier.
  30. /// </summary>
  31. public bool SupportsPersistentIdentifier { get; set; }
  32. /// <summary>
  33. /// Gets or sets the device profile.
  34. /// </summary>
  35. public DeviceProfile? DeviceProfile { get; set; }
  36. /// <summary>
  37. /// Gets or sets the app store url.
  38. /// </summary>
  39. public string? AppStoreUrl { get; set; }
  40. /// <summary>
  41. /// Gets or sets the icon url.
  42. /// </summary>
  43. public string? IconUrl { get; set; }
  44. /// <summary>
  45. /// Convert the dto to the full <see cref="ClientCapabilities"/> model.
  46. /// </summary>
  47. /// <returns>The converted <see cref="ClientCapabilities"/> model.</returns>
  48. public ClientCapabilities ToClientCapabilities()
  49. {
  50. return new ClientCapabilities
  51. {
  52. PlayableMediaTypes = PlayableMediaTypes,
  53. SupportedCommands = SupportedCommands,
  54. SupportsMediaControl = SupportsMediaControl,
  55. SupportsPersistentIdentifier = SupportsPersistentIdentifier,
  56. DeviceProfile = DeviceProfile,
  57. AppStoreUrl = AppStoreUrl,
  58. IconUrl = IconUrl
  59. };
  60. }
  61. }