ClientCapabilitiesDto.cs 2.8 KB

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