Merge pull request #6200 from nielsvanvelzen/fix-quickconnect

Refactor Quick Connect
This commit is contained in:
Claus Vium
2021-06-22 09:43:14 +02:00
committed by GitHub
5 changed files with 95 additions and 259 deletions

View File

@@ -3,38 +3,46 @@ using System;
namespace MediaBrowser.Model.QuickConnect
{
/// <summary>
/// Stores the result of an incoming quick connect request.
/// Stores the state of an quick connect request.
/// </summary>
public class QuickConnectResult
{
/// <summary>
/// Initializes a new instance of the <see cref="QuickConnectResult"/> class.
/// </summary>
/// <param name="secret">The secret used to query the request state.</param>
/// <param name="code">The code used to allow the request.</param>
/// <param name="dateAdded">The time when the request was created.</param>
public QuickConnectResult(string secret, string code, DateTime dateAdded)
{
Secret = secret;
Code = code;
DateAdded = dateAdded;
}
/// <summary>
/// Gets a value indicating whether this request is authorized.
/// </summary>
public bool Authenticated => !string.IsNullOrEmpty(Authentication);
public bool Authenticated => Authentication != null;
/// <summary>
/// Gets or sets the secret value used to uniquely identify this request. Can be used to retrieve authentication information.
/// Gets the secret value used to uniquely identify this request. Can be used to retrieve authentication information.
/// </summary>
public string? Secret { get; set; }
public string Secret { get; }
/// <summary>
/// Gets or sets the user facing code used so the user can quickly differentiate this request from others.
/// Gets the user facing code used so the user can quickly differentiate this request from others.
/// </summary>
public string? Code { get; set; }
public string Code { get; }
/// <summary>
/// Gets or sets the private access token.
/// </summary>
public string? Authentication { get; set; }
/// <summary>
/// Gets or sets an error message.
/// </summary>
public string? Error { get; set; }
public Guid? Authentication { get; set; }
/// <summary>
/// Gets or sets the DateTime that this request was created.
/// </summary>
public DateTime? DateAdded { get; set; }
public DateTime DateAdded { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
namespace MediaBrowser.Model.QuickConnect
{
/// <summary>
/// Quick connect state.
/// </summary>
public enum QuickConnectState
{
/// <summary>
/// This feature has not been opted into and is unavailable until the server administrator chooses to opt-in.
/// </summary>
Unavailable = 0,
/// <summary>
/// The feature is enabled for use on the server but is not currently accepting connection requests.
/// </summary>
Available = 1,
/// <summary>
/// The feature is actively accepting connection requests.
/// </summary>
Active = 2
}
}