aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/QuickConnect/IQuickConnect.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-09-11 15:53:04 -0600
committercrobibero <cody@robibe.ro>2020-09-11 15:53:04 -0600
commitf13b87afa3e81e7fa2710caec58a7d6cb20f7635 (patch)
tree0f269ac5baa27b334c5377d9dec4010aedf25183 /MediaBrowser.Controller/QuickConnect/IQuickConnect.cs
parent2363ad544979adf32207fa927f106fadb784f1fb (diff)
parent6bf0acb854683377bebad3ca27de17706519c420 (diff)
Merge remote-tracking branch 'upstream/master' into api-upload-subtitle
Diffstat (limited to 'MediaBrowser.Controller/QuickConnect/IQuickConnect.cs')
-rw-r--r--MediaBrowser.Controller/QuickConnect/IQuickConnect.cs87
1 files changed, 87 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/QuickConnect/IQuickConnect.cs b/MediaBrowser.Controller/QuickConnect/IQuickConnect.cs
new file mode 100644
index 000000000..959a2d771
--- /dev/null
+++ b/MediaBrowser.Controller/QuickConnect/IQuickConnect.cs
@@ -0,0 +1,87 @@
+using System;
+using MediaBrowser.Model.QuickConnect;
+
+namespace MediaBrowser.Controller.QuickConnect
+{
+ /// <summary>
+ /// Quick connect standard interface.
+ /// </summary>
+ public interface IQuickConnect
+ {
+ /// <summary>
+ /// Gets or sets the length of user facing codes.
+ /// </summary>
+ int CodeLength { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name of internal access tokens.
+ /// </summary>
+ string TokenName { get; set; }
+
+ /// <summary>
+ /// Gets the current state of quick connect.
+ /// </summary>
+ QuickConnectState State { get; }
+
+ /// <summary>
+ /// Gets or sets the time (in minutes) before quick connect will automatically deactivate.
+ /// </summary>
+ int Timeout { get; set; }
+
+ /// <summary>
+ /// Assert that quick connect is currently active and throws an exception if it is not.
+ /// </summary>
+ void AssertActive();
+
+ /// <summary>
+ /// Temporarily activates quick connect for a short amount of time.
+ /// </summary>
+ void Activate();
+
+ /// <summary>
+ /// Changes the state of quick connect.
+ /// </summary>
+ /// <param name="newState">New state to change to.</param>
+ void SetState(QuickConnectState newState);
+
+ /// <summary>
+ /// Initiates a new quick connect request.
+ /// </summary>
+ /// <returns>A quick connect result with tokens to proceed or throws an exception if not active.</returns>
+ QuickConnectResult TryConnect();
+
+ /// <summary>
+ /// Checks the status of an individual request.
+ /// </summary>
+ /// <param name="secret">Unique secret identifier of the request.</param>
+ /// <returns>Quick connect result.</returns>
+ QuickConnectResult CheckRequestStatus(string secret);
+
+ /// <summary>
+ /// Authorizes a quick connect request to connect as the calling user.
+ /// </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>
+ bool AuthorizeRequest(Guid userId, string code);
+
+ /// <summary>
+ /// Expire quick connect requests that are over the time limit. If <paramref name="expireAll"/> is true, all requests are unconditionally expired.
+ /// </summary>
+ /// <param name="expireAll">If true, all requests will be expired.</param>
+ void ExpireRequests(bool expireAll = false);
+
+ /// <summary>
+ /// Deletes all quick connect access tokens for the provided user.
+ /// </summary>
+ /// <param name="user">Guid of the user to delete tokens for.</param>
+ /// <returns>A count of the deleted tokens.</returns>
+ int DeleteAllDevices(Guid user);
+
+ /// <summary>
+ /// Generates a short code to display to the user to uniquely identify this request.
+ /// </summary>
+ /// <returns>A short, unique alphanumeric string.</returns>
+ string GenerateCode();
+ }
+}