aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Dto/ClientCapabilitiesDto.cs
blob: d481593cd50424ae1a8efb3a5620bcc3ad01c20d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System.Collections.Generic;
using System.Text.Json.Serialization;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions.Json.Converters;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Session;

namespace MediaBrowser.Model.Dto;

/// <summary>
/// Client capabilities dto.
/// </summary>
public class ClientCapabilitiesDto
{
    /// <summary>
    /// Gets or sets the list of playable media types.
    /// </summary>
    [JsonConverter(typeof(JsonCommaDelimitedCollectionConverterFactory))]
    public IReadOnlyList<MediaType> PlayableMediaTypes { get; set; } = [];

    /// <summary>
    /// Gets or sets the list of supported commands.
    /// </summary>
    [JsonConverter(typeof(JsonCommaDelimitedCollectionConverterFactory))]
    public IReadOnlyList<GeneralCommandType> SupportedCommands { get; set; } = [];

    /// <summary>
    /// Gets or sets a value indicating whether session supports media control.
    /// </summary>
    public bool SupportsMediaControl { get; set; }

    /// <summary>
    /// Gets or sets a value indicating whether session supports a persistent identifier.
    /// </summary>
    public bool SupportsPersistentIdentifier { get; set; }

    /// <summary>
    /// Gets or sets the device profile.
    /// </summary>
    public DeviceProfile? DeviceProfile { get; set; }

    /// <summary>
    /// Gets or sets the app store url.
    /// </summary>
    public string? AppStoreUrl { get; set; }

    /// <summary>
    /// Gets or sets the icon url.
    /// </summary>
    public string? IconUrl { get; set; }

    /// <summary>
    /// Convert the dto to the full <see cref="ClientCapabilities"/> model.
    /// </summary>
    /// <returns>The converted <see cref="ClientCapabilities"/> model.</returns>
    public ClientCapabilities ToClientCapabilities()
    {
        return new ClientCapabilities
        {
            PlayableMediaTypes = PlayableMediaTypes,
            SupportedCommands = SupportedCommands,
            SupportsMediaControl = SupportsMediaControl,
            SupportsPersistentIdentifier = SupportsPersistentIdentifier,
            DeviceProfile = DeviceProfile,
            AppStoreUrl = AppStoreUrl,
            IconUrl = IconUrl
        };
    }
}