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 { /// /// Quick connect standard interface. /// public interface IQuickConnect { /// /// Gets a value indicating whether quick connect is enabled or not. /// bool IsEnabled { get; } /// /// Initiates a new quick connect request. /// /// The initiator authorization info. /// A quick connect result with tokens to proceed or throws an exception if not active. Task TryConnect(AuthorizationInfo authorizationInfo); /// /// Checks the status of an individual request. /// /// Unique secret identifier of the request. /// Quick connect result. Task CheckRequestStatus(string secret); /// /// 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 /// and the user has to start quick connect again for a new code. /// /// User id. /// Identifying code for the request. /// A boolean indicating if the authorization completed successfully. Task AuthorizeRequest(Guid userId, string code); /// /// 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. /// /// The secret. /// The authentication result. Task GetAuthorizedRequest(string secret); } }