aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2023-06-10 07:28:21 -0600
committerGitHub <noreply@github.com>2023-06-10 07:28:21 -0600
commit9a0dfc00f1e36092476f62984ba66886032f4f89 (patch)
tree935482bc811b30913944703fb7b980a78294fc17 /MediaBrowser.Model
parent81cf798430a3d8c5504bc30b2d59af26fe5e2b9f (diff)
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
Diffstat (limited to 'MediaBrowser.Model')
-rw-r--r--MediaBrowser.Model/Net/WebSocketMessage.cs31
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupUpdate.cs54
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupUpdateOfT.cs31
-rw-r--r--MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs4
-rw-r--r--MediaBrowser.Model/SyncPlay/SyncPlayQueueItem.cs (renamed from MediaBrowser.Model/SyncPlay/QueueItem.cs)6
5 files changed, 57 insertions, 69 deletions
diff --git a/MediaBrowser.Model/Net/WebSocketMessage.cs b/MediaBrowser.Model/Net/WebSocketMessage.cs
deleted file mode 100644
index b00158cb3..000000000
--- a/MediaBrowser.Model/Net/WebSocketMessage.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-#nullable disable
-#pragma warning disable CS1591
-
-using System;
-using MediaBrowser.Model.Session;
-
-namespace MediaBrowser.Model.Net
-{
- /// <summary>
- /// Class WebSocketMessage.
- /// </summary>
- /// <typeparam name="T">The type of the data.</typeparam>
- public class WebSocketMessage<T>
- {
- /// <summary>
- /// Gets or sets the type of the message.
- /// </summary>
- /// <value>The type of the message.</value>
- public SessionMessageType MessageType { get; set; }
-
- public Guid MessageId { get; set; }
-
- public string ServerId { get; set; }
-
- /// <summary>
- /// Gets or sets the data.
- /// </summary>
- /// <value>The data.</value>
- public T Data { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/SyncPlay/GroupUpdate.cs b/MediaBrowser.Model/SyncPlay/GroupUpdate.cs
index 6f159d653..ec67d7ea8 100644
--- a/MediaBrowser.Model/SyncPlay/GroupUpdate.cs
+++ b/MediaBrowser.Model/SyncPlay/GroupUpdate.cs
@@ -1,42 +1,30 @@
using System;
-namespace MediaBrowser.Model.SyncPlay
+namespace MediaBrowser.Model.SyncPlay;
+
+/// <summary>
+/// Group update without data.
+/// </summary>
+public abstract class GroupUpdate
{
/// <summary>
- /// Class GroupUpdate.
+ /// Initializes a new instance of the <see cref="GroupUpdate"/> class.
/// </summary>
- /// <typeparam name="T">The type of the data of the message.</typeparam>
- public class GroupUpdate<T>
+ /// <param name="groupId">The group identifier.</param>
+ protected GroupUpdate(Guid groupId)
{
- /// <summary>
- /// Initializes a new instance of the <see cref="GroupUpdate{T}"/> class.
- /// </summary>
- /// <param name="groupId">The group identifier.</param>
- /// <param name="type">The update type.</param>
- /// <param name="data">The update data.</param>
- public GroupUpdate(Guid groupId, GroupUpdateType type, T data)
- {
- GroupId = groupId;
- Type = type;
- Data = data;
- }
-
- /// <summary>
- /// Gets the group identifier.
- /// </summary>
- /// <value>The group identifier.</value>
- public Guid GroupId { get; }
+ GroupId = groupId;
+ }
- /// <summary>
- /// Gets the update type.
- /// </summary>
- /// <value>The update type.</value>
- public GroupUpdateType Type { get; }
+ /// <summary>
+ /// Gets the group identifier.
+ /// </summary>
+ /// <value>The group identifier.</value>
+ public Guid GroupId { get; }
- /// <summary>
- /// Gets the update data.
- /// </summary>
- /// <value>The update data.</value>
- public T Data { get; }
- }
+ /// <summary>
+ /// Gets the update type.
+ /// </summary>
+ /// <value>The update type.</value>
+ public GroupUpdateType Type { get; init; }
}
diff --git a/MediaBrowser.Model/SyncPlay/GroupUpdateOfT.cs b/MediaBrowser.Model/SyncPlay/GroupUpdateOfT.cs
new file mode 100644
index 000000000..25cd44461
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/GroupUpdateOfT.cs
@@ -0,0 +1,31 @@
+#pragma warning disable SA1649
+
+using System;
+
+namespace MediaBrowser.Model.SyncPlay;
+
+/// <summary>
+/// Class GroupUpdate.
+/// </summary>
+/// <typeparam name="T">The type of the data of the message.</typeparam>
+public class GroupUpdate<T> : GroupUpdate
+{
+ /// <summary>
+ /// Initializes a new instance of the <see cref="GroupUpdate{T}"/> class.
+ /// </summary>
+ /// <param name="groupId">The group identifier.</param>
+ /// <param name="type">The update type.</param>
+ /// <param name="data">The update data.</param>
+ public GroupUpdate(Guid groupId, GroupUpdateType type, T data)
+ : base(groupId)
+ {
+ Data = data;
+ Type = type;
+ }
+
+ /// <summary>
+ /// Gets the update data.
+ /// </summary>
+ /// <value>The update data.</value>
+ public T Data { get; }
+}
diff --git a/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs b/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs
index cce99c77d..376d926c9 100644
--- a/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs
+++ b/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs
@@ -19,7 +19,7 @@ namespace MediaBrowser.Model.SyncPlay
/// <param name="isPlaying">The playing item status.</param>
/// <param name="shuffleMode">The shuffle mode.</param>
/// <param name="repeatMode">The repeat mode.</param>
- public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<QueueItem> playlist, int playingItemIndex, long startPositionTicks, bool isPlaying, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode)
+ public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<SyncPlayQueueItem> playlist, int playingItemIndex, long startPositionTicks, bool isPlaying, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode)
{
Reason = reason;
LastUpdate = lastUpdate;
@@ -47,7 +47,7 @@ namespace MediaBrowser.Model.SyncPlay
/// Gets the playlist.
/// </summary>
/// <value>The playlist.</value>
- public IReadOnlyList<QueueItem> Playlist { get; }
+ public IReadOnlyList<SyncPlayQueueItem> Playlist { get; }
/// <summary>
/// Gets the playing item index in the playlist.
diff --git a/MediaBrowser.Model/SyncPlay/QueueItem.cs b/MediaBrowser.Model/SyncPlay/SyncPlayQueueItem.cs
index a6dcc109e..da81fecbd 100644
--- a/MediaBrowser.Model/SyncPlay/QueueItem.cs
+++ b/MediaBrowser.Model/SyncPlay/SyncPlayQueueItem.cs
@@ -5,13 +5,13 @@ namespace MediaBrowser.Model.SyncPlay
/// <summary>
/// Class QueueItem.
/// </summary>
- public class QueueItem
+ public class SyncPlayQueueItem
{
/// <summary>
- /// Initializes a new instance of the <see cref="QueueItem"/> class.
+ /// Initializes a new instance of the <see cref="SyncPlayQueueItem"/> class.
/// </summary>
/// <param name="itemId">The item identifier.</param>
- public QueueItem(Guid itemId)
+ public SyncPlayQueueItem(Guid itemId)
{
ItemId = itemId;
}