mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 10:04:44 +01:00
Add quick connect
This commit is contained in:
50
MediaBrowser.Model/QuickConnect/QuickConnectResult.cs
Normal file
50
MediaBrowser.Model/QuickConnect/QuickConnectResult.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.QuickConnect
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores the result of an incoming quick connect request.
|
||||
/// </summary>
|
||||
public class QuickConnectResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this request is authorized.
|
||||
/// </summary>
|
||||
public bool Authenticated => !string.IsNullOrEmpty(Authentication);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the secret value used to uniquely identify this request. Can be used to retrieve authentication information.
|
||||
/// </summary>
|
||||
public string Secret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the public value used to uniquely identify this request. Can only be used to authorize the request.
|
||||
/// </summary>
|
||||
public string Lookup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user facing code used so the user can quickly differentiate this request from others.
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the device friendly name.
|
||||
/// </summary>
|
||||
public string FriendlyName { get; set; }
|
||||
|
||||
/// <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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DateTime that this request was created.
|
||||
/// </summary>
|
||||
public DateTime DateAdded { get; set; }
|
||||
}
|
||||
}
|
||||
53
MediaBrowser.Model/QuickConnect/QuickConnectResultDto.cs
Normal file
53
MediaBrowser.Model/QuickConnect/QuickConnectResultDto.cs
Normal file
@@ -0,0 +1,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
MediaBrowser.Model/QuickConnect/QuickConnectState.cs
Normal file
23
MediaBrowser.Model/QuickConnect/QuickConnectState.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
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,
|
||||
|
||||
/// <summary>
|
||||
/// The feature is enabled for use on the server but is not currently accepting connection requests.
|
||||
/// </summary>
|
||||
Available,
|
||||
|
||||
/// <summary>
|
||||
/// The feature is actively accepting connection requests.
|
||||
/// </summary>
|
||||
Active
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user