aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/QuickConnect/QuickConnectResultDto.cs
blob: 19acc7cd8878e5dd4d624744dae6e07ea8682045 (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
using System;

namespace MediaBrowser.Model.QuickConnect
{
    /// <summary>
    /// Stores the non-sensitive results of an incoming quick connect request.
    /// </summary>
    public class QuickConnectResultDto
    {
        /// <summary>
        /// Gets a value indicating whether this request is authorized.
        /// </summary>
        public bool Authenticated { get; private set; }

        /// <summary>
        /// Gets the user facing code used so the user can quickly differentiate this request from others.
        /// </summary>
        public string? Code { get; private set; }

        /// <summary>
        /// Gets the public value used to uniquely identify this request. Can only be used to authorize the request.
        /// </summary>
        public string? Lookup { get; private set; }

        /// <summary>
        /// Gets the device friendly name.
        /// </summary>
        public string? FriendlyName { get; private set; }

        /// <summary>
        /// Gets the DateTime that this request was created.
        /// </summary>
        public DateTime? DateAdded { get; private set; }

        /// <summary>
        /// Cast an internal quick connect result to a DTO by removing all sensitive properties.
        /// </summary>
        /// <param name="result">QuickConnectResult object to cast</param>
        public static implicit operator QuickConnectResultDto(QuickConnectResult result)
        {
            QuickConnectResultDto resultDto = new QuickConnectResultDto
            {
                Authenticated = result.Authenticated,
                Code = result.Code,
                FriendlyName = result.FriendlyName,
                DateAdded = result.DateAdded,
                Lookup = result.Lookup
            };

            return resultDto;
        }
    }
}