2014-10-20 03:04:45 +00:00
|
|
|
|
using MediaBrowser.Model.Connect;
|
2014-10-15 00:05:09 +00:00
|
|
|
|
using MediaBrowser.Model.Dto;
|
2014-10-03 03:48:59 +00:00
|
|
|
|
using MediaBrowser.Model.Events;
|
|
|
|
|
using System;
|
2014-10-20 03:04:45 +00:00
|
|
|
|
using System.Collections.Generic;
|
2014-10-03 03:48:59 +00: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-20 03:04:45 +00: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>
|
|
|
|
|
event EventHandler<EventArgs> LocalUserSignOut;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [connect user sign out].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<EventArgs> ConnectUserSignOut;
|
2014-10-20 20:23:40 +00:00
|
|
|
|
[Obsolete]
|
|
|
|
|
event EventHandler<EventArgs> RemoteLoggedOut;
|
|
|
|
|
|
2014-10-04 03:18:57 +00:00
|
|
|
|
/// <summary>
|
2014-10-20 03:04:45 +00:00
|
|
|
|
/// Gets the connect user.
|
2014-10-04 03:18:57 +00:00
|
|
|
|
/// </summary>
|
2014-10-20 03:04:45 +00:00
|
|
|
|
/// <value>The connect user.</value>
|
|
|
|
|
ConnectUser ConnectUser { get; }
|
|
|
|
|
|
2014-10-03 03:48:59 +00:00
|
|
|
|
/// <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();
|
2014-10-13 20:14:53 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Logins to connect.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task LoginToConnect(string username, string password);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the active api client instance
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Obsolete]
|
|
|
|
|
IApiClient CurrentApiClient { get; }
|
2014-10-15 00:05:09 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates the pin.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>Task<PinCreationResult>.</returns>
|
|
|
|
|
Task<PinCreationResult> CreatePin();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the pin status.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="pin">The pin.</param>
|
|
|
|
|
/// <returns>Task<PinStatusResult>.</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 21:49:55 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the available servers.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
Task<List<ServerInfo>> GetAvailableServers(CancellationToken cancellationToken);
|
2014-10-03 03:48:59 +00:00
|
|
|
|
}
|
|
|
|
|
}
|