mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-30 11:22:53 +01:00
update connect
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Model.ApiClient
|
||||
{
|
||||
public class ConnectionResult
|
||||
{
|
||||
public ConnectionState State { get; set; }
|
||||
public ServerInfo ServerInfo { get; set; }
|
||||
public List<ServerInfo> Servers { get; set; }
|
||||
public IApiClient ApiClient { get; set; }
|
||||
|
||||
public ConnectionResult()
|
||||
{
|
||||
State = ConnectionState.Unavailable;
|
||||
Servers = new List<ServerInfo>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace MediaBrowser.Model.ApiClient
|
||||
{
|
||||
Unavailable = 1,
|
||||
ServerSignIn = 2,
|
||||
SignedIn = 3
|
||||
SignedIn = 3,
|
||||
ServerSelection = 4
|
||||
}
|
||||
}
|
||||
@@ -1350,5 +1350,12 @@ namespace MediaBrowser.Model.ApiClient
|
||||
/// </summary>
|
||||
/// <returns>Task<DevicesOptions>.</returns>
|
||||
Task<DevicesOptions> GetDevicesOptions();
|
||||
|
||||
/// <summary>
|
||||
/// Opens the web socket.
|
||||
/// </summary>
|
||||
/// <param name="webSocketFactory">The web socket factory.</param>
|
||||
/// <param name="keepAliveTimerMs">The keep alive timer ms.</param>
|
||||
void OpenWebSocket(Func<IClientWebSocket> webSocketFactory, int keepAliveTimerMs = 60000);
|
||||
}
|
||||
}
|
||||
54
MediaBrowser.Model/ApiClient/IClientWebSocket.cs
Normal file
54
MediaBrowser.Model/ApiClient/IClientWebSocket.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Model.ApiClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IClientWebSocket
|
||||
/// </summary>
|
||||
public interface IClientWebSocket : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Occurs when [closed].
|
||||
/// </summary>
|
||||
event EventHandler Closed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the state.
|
||||
/// </summary>
|
||||
/// <value>The state.</value>
|
||||
WebSocketState State { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Connects the async.
|
||||
/// </summary>
|
||||
/// <param name="url">The URL.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task ConnectAsync(string url, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the receive action.
|
||||
/// </summary>
|
||||
/// <value>The receive action.</value>
|
||||
Action<byte[]> OnReceiveBytes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the on receive.
|
||||
/// </summary>
|
||||
/// <value>The on receive.</value>
|
||||
Action<string> OnReceive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sends the async.
|
||||
/// </summary>
|
||||
/// <param name="bytes">The bytes.</param>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="endOfMessage">if set to <c>true</c> [end of message].</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task SendAsync(byte[] bytes, WebSocketMessageType type, bool endOfMessage, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -53,5 +53,17 @@ namespace MediaBrowser.Model.ApiClient
|
||||
/// </summary>
|
||||
/// <returns>Task<ConnectionResult>.</returns>
|
||||
Task<ConnectionResult> Logout();
|
||||
|
||||
/// <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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace MediaBrowser.Model.ApiClient
|
||||
public String UserId { get; set; }
|
||||
public String AccessToken { get; set; }
|
||||
public List<WakeOnLanInfo> WakeOnLanInfos { get; set; }
|
||||
public DateTime DateLastAccessed { get; set; }
|
||||
|
||||
public ServerInfo()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user