Files
jellyfin-ha-src/MediaBrowser.Controller/QuickConnect/IQuickConnect.cs
T
unkin-agent e1ca272d6c
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
fail quick connect closed on an unreachable valkey and restore the idempotent exchange
2026-09-26 14:28:45 +10:00

53 lines
2.2 KiB
C#

using System;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Authentication;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.QuickConnect;
namespace MediaBrowser.Controller.QuickConnect
{
/// <summary>
/// Quick connect standard interface.
/// </summary>
public interface IQuickConnect
{
/// <summary>
/// Gets a value indicating whether quick connect is enabled or not.
/// </summary>
bool IsEnabled { get; }
/// <summary>
/// Initiates a new quick connect request.
/// </summary>
/// <param name="authorizationInfo">The initiator authorization info.</param>
/// <returns>A quick connect result with tokens to proceed or throws an exception if not active.</returns>
Task<QuickConnectResult> TryConnect(AuthorizationInfo authorizationInfo);
/// <summary>
/// Checks the status of an individual request.
/// </summary>
/// <param name="secret">Unique secret identifier of the request.</param>
/// <returns>Quick connect result.</returns>
Task<QuickConnectResult> CheckRequestStatus(string secret);
/// <summary>
/// Authorizes a quick connect request to connect as the calling user. A request can be authorized
/// once: a second attempt, including one following an attempt that failed part way, throws
/// <see cref="ConflictException"/> and the user has to start quick connect again for a new code.
/// </summary>
/// <param name="userId">User id.</param>
/// <param name="code">Identifying code for the request.</param>
/// <returns>A boolean indicating if the authorization completed successfully.</returns>
Task<bool> AuthorizeRequest(Guid userId, string code);
/// <summary>
/// Gets the authorized request for the secret. The read does not consume the authorization, so a
/// client that retries the exchange gets the same access token until the authorization expires.
/// </summary>
/// <param name="secret">The secret.</param>
/// <returns>The authentication result.</returns>
Task<AuthenticationResult> GetAuthorizedRequest(string secret);
}
}