Fix Websocket OpenApi (#9935)

* Further split inbound and outbound messages

* Fix datatype for inbound start messages

* fixes from review
This commit is contained in:
Cody Robibero
2023-06-29 05:44:36 -06:00
committed by GitHub
parent 76939bbd9b
commit b5bbb98175
50 changed files with 165 additions and 126 deletions

View File

@@ -1,20 +1,20 @@
using System.Collections.Generic;
using System.ComponentModel;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound;
/// <summary>
/// Activity log entry start message.
/// Data is the timing data encoded as "$initialDelay,$interval" in ms.
/// </summary>
public class ActivityLogEntryStartMessage : WebSocketMessage<IReadOnlyCollection<ActivityLogEntry>>, IInboundWebSocketMessage
public class ActivityLogEntryStartMessage : InboundWebSocketMessage<string>
{
/// <summary>
/// Initializes a new instance of the <see cref="ActivityLogEntryStartMessage"/> class.
/// Data is the timing data encoded as "$initialDelay,$interval" in ms.
/// </summary>
/// <param name="data">Collection of activity log entries.</param>
public ActivityLogEntryStartMessage(IReadOnlyCollection<ActivityLogEntry> data)
/// <param name="data">The timing data encoded as "$initialDelay,$interval".</param>
public ActivityLogEntryStartMessage(string data)
: base(data)
{
}

View File

@@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.ComponentModel;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound;
@@ -8,17 +6,8 @@ namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound;
/// <summary>
/// Activity log entry stop message.
/// </summary>
public class ActivityLogEntryStopMessage : WebSocketMessage<IReadOnlyCollection<ActivityLogEntry>>, IInboundWebSocketMessage
public class ActivityLogEntryStopMessage : InboundWebSocketMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="ActivityLogEntryStopMessage"/> class.
/// </summary>
/// <param name="data">Collection of activity log entries.</param>
public ActivityLogEntryStopMessage(IReadOnlyCollection<ActivityLogEntry> data)
: base(data)
{
}
/// <inheritdoc />
[DefaultValue(SessionMessageType.ActivityLogEntryStop)]
public override SessionMessageType MessageType => SessionMessageType.ActivityLogEntryStop;

View File

@@ -0,0 +1,14 @@
using System.ComponentModel;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound;
/// <summary>
/// Keep alive websocket messages.
/// </summary>
public class InboundKeepAliveMessage : InboundWebSocketMessage
{
/// <inheritdoc />
[DefaultValue(SessionMessageType.KeepAlive)]
public override SessionMessageType MessageType => SessionMessageType.KeepAlive;
}

View File

@@ -1,20 +1,19 @@
using System.Collections.Generic;
using System.ComponentModel;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound;
/// <summary>
/// Scheduled tasks info start message.
/// Data is the timing data encoded as "$initialDelay,$interval" in ms.
/// </summary>
public class ScheduledTasksInfoStartMessage : WebSocketMessage<IReadOnlyCollection<TaskInfo>>, IInboundWebSocketMessage
public class ScheduledTasksInfoStartMessage : InboundWebSocketMessage<string>
{
/// <summary>
/// Initializes a new instance of the <see cref="ScheduledTasksInfoStartMessage"/> class.
/// </summary>
/// <param name="data">Collection of task info.</param>
public ScheduledTasksInfoStartMessage(IReadOnlyCollection<TaskInfo> data)
/// <param name="data">The timing data encoded as $initialDelay,$interval.</param>
public ScheduledTasksInfoStartMessage(string data)
: base(data)
{
}

View File

@@ -1,24 +1,13 @@
using System.Collections.Generic;
using System.ComponentModel;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound;
/// <summary>
/// Scheduled tasks info stop message.
/// </summary>
public class ScheduledTasksInfoStopMessage : WebSocketMessage<IReadOnlyCollection<TaskInfo>>, IInboundWebSocketMessage
public class ScheduledTasksInfoStopMessage : InboundWebSocketMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="ScheduledTasksInfoStopMessage"/> class.
/// </summary>
/// <param name="data">Collection of task info.</param>
public ScheduledTasksInfoStopMessage(IReadOnlyCollection<TaskInfo> data)
: base(data)
{
}
/// <inheritdoc />
[DefaultValue(SessionMessageType.ScheduledTasksInfoStop)]
public override SessionMessageType MessageType => SessionMessageType.ScheduledTasksInfoStop;

View File

@@ -1,19 +1,19 @@
using System.ComponentModel;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound;
/// <summary>
/// Sessions start message.
/// Data is the timing data encoded as "$initialDelay,$interval" in ms.
/// </summary>
public class SessionsStartMessage : WebSocketMessage<SessionInfo>, IInboundWebSocketMessage
public class SessionsStartMessage : InboundWebSocketMessage<string>
{
/// <summary>
/// Initializes a new instance of the <see cref="SessionsStartMessage"/> class.
/// </summary>
/// <param name="data">Session info.</param>
public SessionsStartMessage(SessionInfo data)
/// <param name="data">The timing data encoded as $initialDelay,$interval.</param>
public SessionsStartMessage(string data)
: base(data)
{
}

View File

@@ -1,5 +1,4 @@
using System.ComponentModel;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound;
@@ -7,17 +6,8 @@ namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound;
/// <summary>
/// Sessions stop message.
/// </summary>
public class SessionsStopMessage : WebSocketMessage<SessionInfo>, IInboundWebSocketMessage
public class SessionsStopMessage : InboundWebSocketMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="SessionsStopMessage"/> class.
/// </summary>
/// <param name="data">Session info.</param>
public SessionsStopMessage(SessionInfo data)
: base(data)
{
}
/// <inheritdoc />
[DefaultValue(SessionMessageType.SessionsStop)]
public override SessionMessageType MessageType => SessionMessageType.SessionsStop;