#nullable disable using System; using MediaBrowser.Controller.Session; using MediaBrowser.Model.QuickConnect; namespace MediaBrowser.Controller.QuickConnect { /// /// Quick connect standard interface. /// public interface IQuickConnect { /// /// Gets or sets the length of user facing codes. /// int CodeLength { get; set; } /// /// Gets or sets the name of internal access tokens. /// string TokenName { get; set; } /// /// Gets the current state of quick connect. /// QuickConnectState State { get; } /// /// Gets or sets the time (in minutes) before quick connect will automatically deactivate. /// int Timeout { get; set; } /// /// Assert that quick connect is currently active and throws an exception if it is not. /// void AssertActive(); /// /// Temporarily activates quick connect for a short amount of time. /// void Activate(); /// /// Changes the state of quick connect. /// /// New state to change to. void SetState(QuickConnectState newState); /// /// Initiates a new quick connect request. /// /// A quick connect result with tokens to proceed or throws an exception if not active. QuickConnectResult TryConnect(); /// /// Checks the status of an individual request. /// /// Unique secret identifier of the request. /// Quick connect result. QuickConnectResult CheckRequestStatus(string secret); /// /// Authenticates a QuickConnect request. /// /// The request. /// The token. void AuthenticateRequest(AuthenticationRequest request, string token); /// /// Authorizes a quick connect request to connect as the calling user. /// /// User id. /// Identifying code for the request. /// A boolean indicating if the authorization completed successfully. bool AuthorizeRequest(Guid userId, string code); /// /// Expire quick connect requests that are over the time limit. If is true, all requests are unconditionally expired. /// /// If true, all requests will be expired. void ExpireRequests(bool expireAll = false); /// /// Deletes all quick connect access tokens for the provided user. /// /// Guid of the user to delete tokens for. /// A count of the deleted tokens. int DeleteAllDevices(Guid user); /// /// Generates a short code to display to the user to uniquely identify this request. /// /// A short, unique alphanumeric string. string GenerateCode(); } }