From 9a0dfc00f1e36092476f62984ba66886032f4f89 Mon Sep 17 00:00:00 2001 From: Cody Robibero Date: Sat, 10 Jun 2023 07:28:21 -0600 Subject: Add all websocket messages to generated openapi spec (#9682) * Add all websocket messages to generated openapi spec * Use oneOf * JsonIgnore ServerId * Oops * Add discriminators * Add WebSocketMessage container for Inbound and Outbound messages --- .../Inbound/ActivityLogEntryStartMessage.cs | 25 ++++++++++++++++++++++ .../Inbound/ActivityLogEntryStopMessage.cs | 25 ++++++++++++++++++++++ .../Inbound/ScheduledTasksInfoStartMessage.cs | 25 ++++++++++++++++++++++ .../Inbound/ScheduledTasksInfoStopMessage.cs | 25 ++++++++++++++++++++++ .../Inbound/SessionsStartMessage.cs | 24 +++++++++++++++++++++ .../Inbound/SessionsStopMessage.cs | 24 +++++++++++++++++++++ 6 files changed, 148 insertions(+) create mode 100644 MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ActivityLogEntryStartMessage.cs create mode 100644 MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ActivityLogEntryStopMessage.cs create mode 100644 MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ScheduledTasksInfoStartMessage.cs create mode 100644 MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ScheduledTasksInfoStopMessage.cs create mode 100644 MediaBrowser.Controller/Net/WebSocketMessages/Inbound/SessionsStartMessage.cs create mode 100644 MediaBrowser.Controller/Net/WebSocketMessages/Inbound/SessionsStopMessage.cs (limited to 'MediaBrowser.Controller/Net/WebSocketMessages/Inbound') diff --git a/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ActivityLogEntryStartMessage.cs b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ActivityLogEntryStartMessage.cs new file mode 100644 index 000000000..b9f71b922 --- /dev/null +++ b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ActivityLogEntryStartMessage.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.ComponentModel; +using MediaBrowser.Model.Activity; +using MediaBrowser.Model.Session; + +namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound; + +/// +/// Activity log entry start message. +/// +public class ActivityLogEntryStartMessage : WebSocketMessage>, IInboundWebSocketMessage +{ + /// + /// Initializes a new instance of the class. + /// + /// Collection of activity log entries. + public ActivityLogEntryStartMessage(IReadOnlyCollection data) + : base(data) + { + } + + /// + [DefaultValue(SessionMessageType.ActivityLogEntryStart)] + public override SessionMessageType MessageType => SessionMessageType.ActivityLogEntryStart; +} diff --git a/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ActivityLogEntryStopMessage.cs b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ActivityLogEntryStopMessage.cs new file mode 100644 index 000000000..eac129b20 --- /dev/null +++ b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ActivityLogEntryStopMessage.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.ComponentModel; +using MediaBrowser.Model.Activity; +using MediaBrowser.Model.Session; + +namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound; + +/// +/// Activity log entry stop message. +/// +public class ActivityLogEntryStopMessage : WebSocketMessage>, IInboundWebSocketMessage +{ + /// + /// Initializes a new instance of the class. + /// + /// Collection of activity log entries. + public ActivityLogEntryStopMessage(IReadOnlyCollection data) + : base(data) + { + } + + /// + [DefaultValue(SessionMessageType.ActivityLogEntryStop)] + public override SessionMessageType MessageType => SessionMessageType.ActivityLogEntryStop; +} diff --git a/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ScheduledTasksInfoStartMessage.cs b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ScheduledTasksInfoStartMessage.cs new file mode 100644 index 000000000..dd2a7145e --- /dev/null +++ b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ScheduledTasksInfoStartMessage.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.ComponentModel; +using MediaBrowser.Model.Session; +using MediaBrowser.Model.Tasks; + +namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound; + +/// +/// Scheduled tasks info start message. +/// +public class ScheduledTasksInfoStartMessage : WebSocketMessage>, IInboundWebSocketMessage +{ + /// + /// Initializes a new instance of the class. + /// + /// Collection of task info. + public ScheduledTasksInfoStartMessage(IReadOnlyCollection data) + : base(data) + { + } + + /// + [DefaultValue(SessionMessageType.ScheduledTasksInfoStart)] + public override SessionMessageType MessageType => SessionMessageType.ScheduledTasksInfoStart; +} diff --git a/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ScheduledTasksInfoStopMessage.cs b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ScheduledTasksInfoStopMessage.cs new file mode 100644 index 000000000..84e1f0166 --- /dev/null +++ b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/ScheduledTasksInfoStopMessage.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.ComponentModel; +using MediaBrowser.Model.Session; +using MediaBrowser.Model.Tasks; + +namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound; + +/// +/// Scheduled tasks info stop message. +/// +public class ScheduledTasksInfoStopMessage : WebSocketMessage>, IInboundWebSocketMessage +{ + /// + /// Initializes a new instance of the class. + /// + /// Collection of task info. + public ScheduledTasksInfoStopMessage(IReadOnlyCollection data) + : base(data) + { + } + + /// + [DefaultValue(SessionMessageType.ScheduledTasksInfoStop)] + public override SessionMessageType MessageType => SessionMessageType.ScheduledTasksInfoStop; +} diff --git a/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/SessionsStartMessage.cs b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/SessionsStartMessage.cs new file mode 100644 index 000000000..e35a5dc3a --- /dev/null +++ b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/SessionsStartMessage.cs @@ -0,0 +1,24 @@ +using System.ComponentModel; +using MediaBrowser.Controller.Session; +using MediaBrowser.Model.Session; + +namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound; + +/// +/// Sessions start message. +/// +public class SessionsStartMessage : WebSocketMessage, IInboundWebSocketMessage +{ + /// + /// Initializes a new instance of the class. + /// + /// Session info. + public SessionsStartMessage(SessionInfo data) + : base(data) + { + } + + /// + [DefaultValue(SessionMessageType.SessionsStart)] + public override SessionMessageType MessageType => SessionMessageType.SessionsStart; +} diff --git a/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/SessionsStopMessage.cs b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/SessionsStopMessage.cs new file mode 100644 index 000000000..7e3582d64 --- /dev/null +++ b/MediaBrowser.Controller/Net/WebSocketMessages/Inbound/SessionsStopMessage.cs @@ -0,0 +1,24 @@ +using System.ComponentModel; +using MediaBrowser.Controller.Session; +using MediaBrowser.Model.Session; + +namespace MediaBrowser.Controller.Net.WebSocketMessages.Inbound; + +/// +/// Sessions stop message. +/// +public class SessionsStopMessage : WebSocketMessage, IInboundWebSocketMessage +{ + /// + /// Initializes a new instance of the class. + /// + /// Session info. + public SessionsStopMessage(SessionInfo data) + : base(data) + { + } + + /// + [DefaultValue(SessionMessageType.SessionsStop)] + public override SessionMessageType MessageType => SessionMessageType.SessionsStop; +} -- cgit v1.2.3