using System; using System.Collections.Generic; using MediaBrowser.Model.QuickConnect; using MediaBrowser.Model.Services; 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 string to prefix internal access tokens with. /// string TokenNamePrefix { 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. /// /// Friendly device name to display in the request UI. /// A quick connect result with tokens to proceed or throws an exception if not active. QuickConnectResult TryConnect(string friendlyName); /// /// Checks the status of an individual request. /// /// Unique secret identifier of the request. /// Quick connect result. QuickConnectResult CheckRequestStatus(string secret); /// /// Authorizes a quick connect request to connect as the calling user. /// /// HTTP request object. /// Identifying code for the request. /// A boolean indicating if the authorization completed successfully. bool AuthorizeRequest(IRequest request, 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(); } }