From 269508be9f78901b3a3b2bea88392aeef88359e4 Mon Sep 17 00:00:00 2001 From: Niels van Velzen Date: Sat, 19 Apr 2025 21:08:15 +0200 Subject: Fix SyncPlay WebSocket OpenAPI schemas (#13946) --- MediaBrowser.Model/SyncPlay/GroupUpdate.cs | 17 +++++++++--- MediaBrowser.Model/SyncPlay/GroupUpdateOfT.cs | 31 ---------------------- MediaBrowser.Model/SyncPlay/GroupUpdateType.cs | 10 ------- .../SyncPlay/SyncPlayGroupDoesNotExistUpdate.cs | 21 +++++++++++++++ .../SyncPlay/SyncPlayGroupJoinedUpdate.cs | 21 +++++++++++++++ .../SyncPlay/SyncPlayGroupLeftUpdate.cs | 21 +++++++++++++++ .../SyncPlay/SyncPlayLibraryAccessDeniedUpdate.cs | 21 +++++++++++++++ .../SyncPlay/SyncPlayNotInGroupUpdate.cs | 21 +++++++++++++++ .../SyncPlay/SyncPlayPlayQueueUpdate.cs | 21 +++++++++++++++ MediaBrowser.Model/SyncPlay/SyncPlayStateUpdate.cs | 21 +++++++++++++++ .../SyncPlay/SyncPlayUserJoinedUpdate.cs | 21 +++++++++++++++ .../SyncPlay/SyncPlayUserLeftUpdate.cs | 21 +++++++++++++++ 12 files changed, 202 insertions(+), 45 deletions(-) delete mode 100644 MediaBrowser.Model/SyncPlay/GroupUpdateOfT.cs create mode 100644 MediaBrowser.Model/SyncPlay/SyncPlayGroupDoesNotExistUpdate.cs create mode 100644 MediaBrowser.Model/SyncPlay/SyncPlayGroupJoinedUpdate.cs create mode 100644 MediaBrowser.Model/SyncPlay/SyncPlayGroupLeftUpdate.cs create mode 100644 MediaBrowser.Model/SyncPlay/SyncPlayLibraryAccessDeniedUpdate.cs create mode 100644 MediaBrowser.Model/SyncPlay/SyncPlayNotInGroupUpdate.cs create mode 100644 MediaBrowser.Model/SyncPlay/SyncPlayPlayQueueUpdate.cs create mode 100644 MediaBrowser.Model/SyncPlay/SyncPlayStateUpdate.cs create mode 100644 MediaBrowser.Model/SyncPlay/SyncPlayUserJoinedUpdate.cs create mode 100644 MediaBrowser.Model/SyncPlay/SyncPlayUserLeftUpdate.cs (limited to 'MediaBrowser.Model') diff --git a/MediaBrowser.Model/SyncPlay/GroupUpdate.cs b/MediaBrowser.Model/SyncPlay/GroupUpdate.cs index ec67d7ea8..794443499 100644 --- a/MediaBrowser.Model/SyncPlay/GroupUpdate.cs +++ b/MediaBrowser.Model/SyncPlay/GroupUpdate.cs @@ -5,15 +5,18 @@ namespace MediaBrowser.Model.SyncPlay; /// /// Group update without data. /// -public abstract class GroupUpdate +/// The type of the update data. +public abstract class GroupUpdate { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The group identifier. - protected GroupUpdate(Guid groupId) + /// The update data. + protected GroupUpdate(Guid groupId, T data) { GroupId = groupId; + Data = data; } /// @@ -22,9 +25,15 @@ public abstract class GroupUpdate /// The group identifier. public Guid GroupId { get; } + /// + /// Gets the update data. + /// + /// The update data. + public T Data { get; } + /// /// Gets the update type. /// /// The update type. - public GroupUpdateType Type { get; init; } + public abstract GroupUpdateType Type { get; } } diff --git a/MediaBrowser.Model/SyncPlay/GroupUpdateOfT.cs b/MediaBrowser.Model/SyncPlay/GroupUpdateOfT.cs deleted file mode 100644 index 25cd44461..000000000 --- a/MediaBrowser.Model/SyncPlay/GroupUpdateOfT.cs +++ /dev/null @@ -1,31 +0,0 @@ -#pragma warning disable SA1649 - -using System; - -namespace MediaBrowser.Model.SyncPlay; - -/// -/// Class GroupUpdate. -/// -/// The type of the data of the message. -public class GroupUpdate : GroupUpdate -{ - /// - /// Initializes a new instance of the class. - /// - /// The group identifier. - /// The update type. - /// The update data. - public GroupUpdate(Guid groupId, GroupUpdateType type, T data) - : base(groupId) - { - Data = data; - Type = type; - } - - /// - /// Gets the update data. - /// - /// The update data. - public T Data { get; } -} diff --git a/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs b/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs index 907d1defe..e792229a4 100644 --- a/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs +++ b/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs @@ -45,16 +45,6 @@ namespace MediaBrowser.Model.SyncPlay /// GroupDoesNotExist, - /// - /// The create-group-denied error. Sent when a user tries to create a group without required permissions. - /// - CreateGroupDenied, - - /// - /// The join-group-denied error. Sent when a user tries to join a group without required permissions. - /// - JoinGroupDenied, - /// /// The library-access-denied error. Sent when a user tries to join a group without required access to the library. /// diff --git a/MediaBrowser.Model/SyncPlay/SyncPlayGroupDoesNotExistUpdate.cs b/MediaBrowser.Model/SyncPlay/SyncPlayGroupDoesNotExistUpdate.cs new file mode 100644 index 000000000..7e2d10c8b --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/SyncPlayGroupDoesNotExistUpdate.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel; + +namespace MediaBrowser.Model.SyncPlay; + +/// +public class SyncPlayGroupDoesNotExistUpdate : GroupUpdate +{ + /// + /// Initializes a new instance of the class. + /// + /// The groupId. + /// The data. + public SyncPlayGroupDoesNotExistUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// + [DefaultValue(GroupUpdateType.GroupDoesNotExist)] + public override GroupUpdateType Type => GroupUpdateType.GroupDoesNotExist; +} diff --git a/MediaBrowser.Model/SyncPlay/SyncPlayGroupJoinedUpdate.cs b/MediaBrowser.Model/SyncPlay/SyncPlayGroupJoinedUpdate.cs new file mode 100644 index 000000000..bfb49152a --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/SyncPlayGroupJoinedUpdate.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel; + +namespace MediaBrowser.Model.SyncPlay; + +/// +public class SyncPlayGroupJoinedUpdate : GroupUpdate +{ + /// + /// Initializes a new instance of the class. + /// + /// The groupId. + /// The data. + public SyncPlayGroupJoinedUpdate(Guid groupId, GroupInfoDto data) : base(groupId, data) + { + } + + /// + [DefaultValue(GroupUpdateType.GroupJoined)] + public override GroupUpdateType Type => GroupUpdateType.GroupJoined; +} diff --git a/MediaBrowser.Model/SyncPlay/SyncPlayGroupLeftUpdate.cs b/MediaBrowser.Model/SyncPlay/SyncPlayGroupLeftUpdate.cs new file mode 100644 index 000000000..5ff60c5c2 --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/SyncPlayGroupLeftUpdate.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel; + +namespace MediaBrowser.Model.SyncPlay; + +/// +public class SyncPlayGroupLeftUpdate : GroupUpdate +{ + /// + /// Initializes a new instance of the class. + /// + /// The groupId. + /// The data. + public SyncPlayGroupLeftUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// + [DefaultValue(GroupUpdateType.GroupLeft)] + public override GroupUpdateType Type => GroupUpdateType.GroupLeft; +} diff --git a/MediaBrowser.Model/SyncPlay/SyncPlayLibraryAccessDeniedUpdate.cs b/MediaBrowser.Model/SyncPlay/SyncPlayLibraryAccessDeniedUpdate.cs new file mode 100644 index 000000000..0d9a722f7 --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/SyncPlayLibraryAccessDeniedUpdate.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel; + +namespace MediaBrowser.Model.SyncPlay; + +/// +public class SyncPlayLibraryAccessDeniedUpdate : GroupUpdate +{ + /// + /// Initializes a new instance of the class. + /// + /// The groupId. + /// The data. + public SyncPlayLibraryAccessDeniedUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// + [DefaultValue(GroupUpdateType.LibraryAccessDenied)] + public override GroupUpdateType Type => GroupUpdateType.LibraryAccessDenied; +} diff --git a/MediaBrowser.Model/SyncPlay/SyncPlayNotInGroupUpdate.cs b/MediaBrowser.Model/SyncPlay/SyncPlayNotInGroupUpdate.cs new file mode 100644 index 000000000..a3b610f61 --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/SyncPlayNotInGroupUpdate.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel; + +namespace MediaBrowser.Model.SyncPlay; + +/// +public class SyncPlayNotInGroupUpdate : GroupUpdate +{ + /// + /// Initializes a new instance of the class. + /// + /// The groupId. + /// The data. + public SyncPlayNotInGroupUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// + [DefaultValue(GroupUpdateType.NotInGroup)] + public override GroupUpdateType Type => GroupUpdateType.NotInGroup; +} diff --git a/MediaBrowser.Model/SyncPlay/SyncPlayPlayQueueUpdate.cs b/MediaBrowser.Model/SyncPlay/SyncPlayPlayQueueUpdate.cs new file mode 100644 index 000000000..83d9bd40b --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/SyncPlayPlayQueueUpdate.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel; + +namespace MediaBrowser.Model.SyncPlay; + +/// +public class SyncPlayPlayQueueUpdate : GroupUpdate +{ + /// + /// Initializes a new instance of the class. + /// + /// The groupId. + /// The data. + public SyncPlayPlayQueueUpdate(Guid groupId, PlayQueueUpdate data) : base(groupId, data) + { + } + + /// + [DefaultValue(GroupUpdateType.PlayQueue)] + public override GroupUpdateType Type => GroupUpdateType.PlayQueue; +} diff --git a/MediaBrowser.Model/SyncPlay/SyncPlayStateUpdate.cs b/MediaBrowser.Model/SyncPlay/SyncPlayStateUpdate.cs new file mode 100644 index 000000000..744ca46a0 --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/SyncPlayStateUpdate.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel; + +namespace MediaBrowser.Model.SyncPlay; + +/// +public class SyncPlayStateUpdate : GroupUpdate +{ + /// + /// Initializes a new instance of the class. + /// + /// The groupId. + /// The data. + public SyncPlayStateUpdate(Guid groupId, GroupStateUpdate data) : base(groupId, data) + { + } + + /// + [DefaultValue(GroupUpdateType.StateUpdate)] + public override GroupUpdateType Type => GroupUpdateType.StateUpdate; +} diff --git a/MediaBrowser.Model/SyncPlay/SyncPlayUserJoinedUpdate.cs b/MediaBrowser.Model/SyncPlay/SyncPlayUserJoinedUpdate.cs new file mode 100644 index 000000000..e8c6b4df4 --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/SyncPlayUserJoinedUpdate.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel; + +namespace MediaBrowser.Model.SyncPlay; + +/// +public class SyncPlayUserJoinedUpdate : GroupUpdate +{ + /// + /// Initializes a new instance of the class. + /// + /// The groupId. + /// The data. + public SyncPlayUserJoinedUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// + [DefaultValue(GroupUpdateType.UserJoined)] + public override GroupUpdateType Type => GroupUpdateType.UserJoined; +} diff --git a/MediaBrowser.Model/SyncPlay/SyncPlayUserLeftUpdate.cs b/MediaBrowser.Model/SyncPlay/SyncPlayUserLeftUpdate.cs new file mode 100644 index 000000000..97be8e63a --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/SyncPlayUserLeftUpdate.cs @@ -0,0 +1,21 @@ +using System; +using System.ComponentModel; + +namespace MediaBrowser.Model.SyncPlay; + +/// +public class SyncPlayUserLeftUpdate : GroupUpdate +{ + /// + /// Initializes a new instance of the class. + /// + /// The groupId. + /// The data. + public SyncPlayUserLeftUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// + [DefaultValue(GroupUpdateType.UserLeft)] + public override GroupUpdateType Type => GroupUpdateType.UserLeft; +} -- cgit v1.2.3