jellyfin/MediaBrowser.Model/ApiClient/IConnectionManager.cs

193 lines
7.2 KiB
C#
Raw Normal View History

2014-10-19 20:04:45 -07:00
using MediaBrowser.Model.Connect;
using MediaBrowser.Model.Dto;
2014-10-02 20:48:59 -07:00
using MediaBrowser.Model.Events;
2015-03-14 10:28:32 -07:00
using MediaBrowser.Model.Session;
2014-10-02 20:48:59 -07:00
using System;
2014-10-19 20:04:45 -07:00
using System.Collections.Generic;
2014-10-02 20:48:59 -07:00
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Model.ApiClient
{
public interface IConnectionManager
{
/// <summary>
/// Occurs when [connected].
/// </summary>
event EventHandler<GenericEventArgs<ConnectionResult>> Connected;
2014-10-19 20:04:45 -07:00
/// <summary>
/// Occurs when [local user sign in].
/// </summary>
event EventHandler<GenericEventArgs<UserDto>> LocalUserSignIn;
/// <summary>
/// Occurs when [connect user sign in].
/// </summary>
event EventHandler<GenericEventArgs<ConnectUser>> ConnectUserSignIn;
/// <summary>
/// Occurs when [local user sign out].
/// </summary>
2014-11-21 07:28:30 -07:00
event EventHandler<GenericEventArgs<IApiClient>> LocalUserSignOut;
2014-10-19 20:04:45 -07:00
/// <summary>
/// Occurs when [connect user sign out].
/// </summary>
event EventHandler<EventArgs> ConnectUserSignOut;
2014-10-28 17:13:12 -07:00
/// <summary>
/// Occurs when [remote logged out].
/// </summary>
2014-10-20 13:23:40 -07:00
event EventHandler<EventArgs> RemoteLoggedOut;
2015-03-23 13:06:06 -07:00
/// <summary>
/// Gets the device.
/// </summary>
/// <value>The device.</value>
IDevice Device { get; }
2014-10-03 20:18:57 -07:00
/// <summary>
2014-10-19 20:04:45 -07:00
/// Gets the connect user.
2014-10-03 20:18:57 -07:00
/// </summary>
2014-10-19 20:04:45 -07:00
/// <value>The connect user.</value>
ConnectUser ConnectUser { get; }
2014-10-26 20:06:01 -07:00
/// <summary>
/// Gets or sets a value indicating whether [save local credentials].
/// </summary>
/// <value><c>true</c> if [save local credentials]; otherwise, <c>false</c>.</value>
bool SaveLocalCredentials { get; set; }
2015-03-14 10:28:32 -07:00
/// <summary>
/// Gets the client capabilities.
/// </summary>
/// <value>The client capabilities.</value>
ClientCapabilities ClientCapabilities { get; }
2014-10-02 20:48:59 -07:00
/// <summary>
/// Gets the API client.
/// </summary>
/// <param name="item">The item.</param>
2014-10-23 21:54:35 -07:00
/// <returns>IApiClient.</returns>
IApiClient GetApiClient(IHasServerId item);
2014-10-02 20:48:59 -07:00
2015-02-17 22:01:13 -07:00
/// <summary>
/// Gets the API client.
/// </summary>
/// <param name="serverId">The server identifier.</param>
/// <returns>IApiClient.</returns>
IApiClient GetApiClient(string serverId);
2014-10-02 20:48:59 -07:00
/// <summary>
/// Connects the specified cancellation token.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;ConnectionResult&gt;.</returns>
Task<ConnectionResult> Connect(CancellationToken cancellationToken = default(CancellationToken));
2014-11-10 20:41:55 -07:00
/// <summary>
/// Connects the specified API client.
/// </summary>
/// <param name="apiClient">The API client.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;ConnectionResult&gt;.</returns>
Task<ConnectionResult> Connect(IApiClient apiClient, CancellationToken cancellationToken = default(CancellationToken));
2014-10-02 20:48:59 -07:00
/// <summary>
/// Connects the specified server.
/// </summary>
/// <param name="server">The server.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;ConnectionResult&gt;.</returns>
Task<ConnectionResult> Connect(ServerInfo server, CancellationToken cancellationToken = default(CancellationToken));
2014-10-02 20:48:59 -07:00
2014-12-15 22:01:57 -07:00
/// <summary>
/// Connects the specified server.
/// </summary>
/// <param name="server">The server.</param>
/// <param name="options">The options.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;ConnectionResult&gt;.</returns>
Task<ConnectionResult> Connect(ServerInfo server, ConnectionOptions options, CancellationToken cancellationToken = default(CancellationToken));
2014-12-15 22:01:57 -07:00
2014-10-02 20:48:59 -07:00
/// <summary>
/// Connects the specified server.
/// </summary>
/// <param name="address">The address.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;ConnectionResult&gt;.</returns>
Task<ConnectionResult> Connect(string address, CancellationToken cancellationToken = default(CancellationToken));
2014-10-02 20:48:59 -07:00
/// <summary>
/// Logouts this instance.
/// </summary>
/// <returns>Task&lt;ConnectionResult&gt;.</returns>
2014-11-02 20:38:43 -07:00
Task Logout();
2014-10-13 13:14:53 -07:00
/// <summary>
/// Logins to connect.
/// </summary>
/// <returns>Task.</returns>
Task LoginToConnect(string username, string password);
/// <summary>
/// Gets the active api client instance
/// </summary>
IApiClient CurrentApiClient { get; }
/// <summary>
/// Creates the pin.
/// </summary>
/// <returns>Task&lt;PinCreationResult&gt;.</returns>
Task<PinCreationResult> CreatePin();
/// <summary>
/// Gets the pin status.
/// </summary>
/// <param name="pin">The pin.</param>
/// <returns>Task&lt;PinStatusResult&gt;.</returns>
Task<PinStatusResult> GetPinStatus(PinCreationResult pin);
/// <summary>
/// Exchanges the pin.
/// </summary>
/// <param name="pin">The pin.</param>
/// <returns>Task.</returns>
Task ExchangePin(PinCreationResult pin);
2014-10-17 14:49:55 -07:00
2015-03-16 11:48:52 -07:00
/// <summary>
/// Gets the server information.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>Task&lt;ServerInfo&gt;.</returns>
Task<ServerInfo> GetServerInfo(string id);
2014-10-17 14:49:55 -07:00
/// <summary>
/// Gets the available servers.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
Task<List<ServerInfo>> GetAvailableServers(CancellationToken cancellationToken = default(CancellationToken));
2015-01-29 22:18:32 -07:00
/// <summary>
/// Authenticates an offline user with their password
/// </summary>
/// <param name="user">The user.</param>
/// <param name="password">The password.</param>
/// <param name="rememberCredentials">if set to <c>true</c> [remember credentials].</param>
/// <returns>Task.</returns>
Task AuthenticateOffline(UserDto user, string password, bool rememberCredentials);
2015-03-29 09:45:16 -07:00
/// <summary>
/// Gets the offline users.
/// </summary>
/// <returns>Task&lt;List&lt;UserDto&gt;&gt;.</returns>
Task<List<UserDto>> GetOfflineUsers();
2015-06-10 06:37:07 -07:00
/// <summary>
/// Signups for connect.
/// </summary>
/// <param name="email">The email.</param>
/// <param name="username">The username.</param>
/// <param name="password">The password.</param>
/// <param name="cancellationToken">The cancellation token.</param>
2015-06-10 06:37:07 -07:00
/// <returns>Task.</returns>
Task<ConnectSignupResponse> SignupForConnect(string email, string username, string password, CancellationToken cancellationToken = default(CancellationToken));
2014-10-02 20:48:59 -07:00
}
}