2014-10-02 20:48:59 -07:00
|
|
|
|
using MediaBrowser.Model.Dto;
|
|
|
|
|
using MediaBrowser.Model.Events;
|
2014-10-03 18:42:38 -07:00
|
|
|
|
using MediaBrowser.Model.Users;
|
2014-10-02 20:48:59 -07:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Model.ApiClient
|
|
|
|
|
{
|
|
|
|
|
public interface IConnectionManager
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [connected].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<GenericEventArgs<ConnectionResult>> Connected;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the API client.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <returns>MediaBrowser.Model.ApiClient.IApiClient.</returns>
|
|
|
|
|
IApiClient GetApiClient(BaseItemDto item);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Connects the specified cancellation token.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task<ConnectionResult>.</returns>
|
|
|
|
|
Task<ConnectionResult> Connect(CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Connects the specified server.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="server">The server.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task<ConnectionResult>.</returns>
|
|
|
|
|
Task<ConnectionResult> Connect(ServerInfo server, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Connects the specified server.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="address">The address.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task<ConnectionResult>.</returns>
|
|
|
|
|
Task<ConnectionResult> Connect(string address, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Logouts this instance.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>Task<ConnectionResult>.</returns>
|
|
|
|
|
Task<ConnectionResult> Logout();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2014-10-03 18:42:38 -07:00
|
|
|
|
/// Authenticates with a specific server
|
2014-10-02 20:48:59 -07:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="server">The server.</param>
|
|
|
|
|
/// <param name="username">The username.</param>
|
|
|
|
|
/// <param name="hash">The hash.</param>
|
|
|
|
|
/// <param name="rememberLogin">if set to <c>true</c> [remember login].</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2014-10-03 18:42:38 -07:00
|
|
|
|
Task<AuthenticationResult> Authenticate(ServerInfo server, string username, byte[] hash, bool rememberLogin);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Authenticates with a specific server
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="apiClient">The API client.</param>
|
|
|
|
|
/// <param name="username">The username.</param>
|
|
|
|
|
/// <param name="hash">The hash.</param>
|
|
|
|
|
/// <param name="rememberLogin">if set to <c>true</c> [remember login].</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task<AuthenticationResult> Authenticate(IApiClient apiClient, string username, byte[] hash, bool rememberLogin);
|
2014-10-02 20:48:59 -07:00
|
|
|
|
}
|
|
|
|
|
}
|