ClientCapabilitiesDto.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. {
  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<string> PlayableMediaTypes { get; set; } = Array.Empty<string>();
  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 content uploading.
  30. /// </summary>
  31. public bool SupportsContentUploading { get; set; }
  32. /// <summary>
  33. /// Gets or sets the message callback url.
  34. /// </summary>
  35. public string? MessageCallbackUrl { get; set; }
  36. /// <summary>
  37. /// Gets or sets a value indicating whether session supports a persistent identifier.
  38. /// </summary>
  39. public bool SupportsPersistentIdentifier { get; set; }
  40. /// <summary>
  41. /// Gets or sets a value indicating whether session supports sync.
  42. /// </summary>
  43. public bool SupportsSync { get; set; }
  44. /// <summary>
  45. /// Gets or sets the device profile.
  46. /// </summary>
  47. public DeviceProfile? DeviceProfile { get; set; }
  48. /// <summary>
  49. /// Gets or sets the app store url.
  50. /// </summary>
  51. public string? AppStoreUrl { get; set; }
  52. /// <summary>
  53. /// Gets or sets the icon url.
  54. /// </summary>
  55. public string? IconUrl { get; set; }
  56. /// <summary>
  57. /// Convert the dto to the full <see cref="ClientCapabilities"/> model.
  58. /// </summary>
  59. /// <returns>The converted <see cref="ClientCapabilities"/> model.</returns>
  60. public ClientCapabilities ToClientCapabilities()
  61. {
  62. return new ClientCapabilities
  63. {
  64. PlayableMediaTypes = PlayableMediaTypes,
  65. SupportedCommands = SupportedCommands,
  66. SupportsMediaControl = SupportsMediaControl,
  67. SupportsContentUploading = SupportsContentUploading,
  68. MessageCallbackUrl = MessageCallbackUrl,
  69. SupportsPersistentIdentifier = SupportsPersistentIdentifier,
  70. SupportsSync = SupportsSync,
  71. DeviceProfile = DeviceProfile,
  72. AppStoreUrl = AppStoreUrl,
  73. IconUrl = IconUrl
  74. };
  75. }
  76. }
  77. }