diff options
| author | Niels van Velzen <nielsvanvelzen@users.noreply.github.com> | 2025-04-19 21:08:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-19 13:08:15 -0600 |
| commit | 269508be9f78901b3a3b2bea88392aeef88359e4 (patch) | |
| tree | 8885ff1537b6acb2217a372837e9714a9ada048f /MediaBrowser.Model | |
| parent | 1c190f79522268fb6b3c870749e2ab9a4b8b22fb (diff) | |
Fix SyncPlay WebSocket OpenAPI schemas (#13946)
Diffstat (limited to 'MediaBrowser.Model')
12 files changed, 202 insertions, 45 deletions
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; /// <summary> /// Group update without data. /// </summary> -public abstract class GroupUpdate +/// <typeparam name="T">The type of the update data.</typeparam> +public abstract class GroupUpdate<T> { /// <summary> - /// Initializes a new instance of the <see cref="GroupUpdate"/> class. + /// Initializes a new instance of the <see cref="GroupUpdate{T}"/> class. /// </summary> /// <param name="groupId">The group identifier.</param> - protected GroupUpdate(Guid groupId) + /// <param name="data">The update data.</param> + protected GroupUpdate(Guid groupId, T data) { GroupId = groupId; + Data = data; } /// <summary> @@ -23,8 +26,14 @@ public abstract class GroupUpdate 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; } + 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; - -/// <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/GroupUpdateType.cs b/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs index 907d1defe..e792229a4 100644 --- a/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs +++ b/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs @@ -46,16 +46,6 @@ namespace MediaBrowser.Model.SyncPlay GroupDoesNotExist, /// <summary> - /// The create-group-denied error. Sent when a user tries to create a group without required permissions. - /// </summary> - CreateGroupDenied, - - /// <summary> - /// The join-group-denied error. Sent when a user tries to join a group without required permissions. - /// </summary> - JoinGroupDenied, - - /// <summary> /// The library-access-denied error. Sent when a user tries to join a group without required access to the library. /// </summary> LibraryAccessDenied 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; + +/// <inheritdoc /> +public class SyncPlayGroupDoesNotExistUpdate : GroupUpdate<string> +{ + /// <summary> + /// Initializes a new instance of the <see cref="SyncPlayGroupDoesNotExistUpdate"/> class. + /// </summary> + /// <param name="groupId">The groupId.</param> + /// <param name="data">The data.</param> + public SyncPlayGroupDoesNotExistUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// <inheritdoc /> + [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; + +/// <inheritdoc /> +public class SyncPlayGroupJoinedUpdate : GroupUpdate<GroupInfoDto> +{ + /// <summary> + /// Initializes a new instance of the <see cref="SyncPlayGroupJoinedUpdate"/> class. + /// </summary> + /// <param name="groupId">The groupId.</param> + /// <param name="data">The data.</param> + public SyncPlayGroupJoinedUpdate(Guid groupId, GroupInfoDto data) : base(groupId, data) + { + } + + /// <inheritdoc /> + [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; + +/// <inheritdoc /> +public class SyncPlayGroupLeftUpdate : GroupUpdate<string> +{ + /// <summary> + /// Initializes a new instance of the <see cref="SyncPlayGroupLeftUpdate"/> class. + /// </summary> + /// <param name="groupId">The groupId.</param> + /// <param name="data">The data.</param> + public SyncPlayGroupLeftUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// <inheritdoc /> + [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; + +/// <inheritdoc /> +public class SyncPlayLibraryAccessDeniedUpdate : GroupUpdate<string> +{ + /// <summary> + /// Initializes a new instance of the <see cref="SyncPlayLibraryAccessDeniedUpdate"/> class. + /// </summary> + /// <param name="groupId">The groupId.</param> + /// <param name="data">The data.</param> + public SyncPlayLibraryAccessDeniedUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// <inheritdoc /> + [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; + +/// <inheritdoc /> +public class SyncPlayNotInGroupUpdate : GroupUpdate<string> +{ + /// <summary> + /// Initializes a new instance of the <see cref="SyncPlayNotInGroupUpdate"/> class. + /// </summary> + /// <param name="groupId">The groupId.</param> + /// <param name="data">The data.</param> + public SyncPlayNotInGroupUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// <inheritdoc /> + [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; + +/// <inheritdoc /> +public class SyncPlayPlayQueueUpdate : GroupUpdate<PlayQueueUpdate> +{ + /// <summary> + /// Initializes a new instance of the <see cref="SyncPlayPlayQueueUpdate"/> class. + /// </summary> + /// <param name="groupId">The groupId.</param> + /// <param name="data">The data.</param> + public SyncPlayPlayQueueUpdate(Guid groupId, PlayQueueUpdate data) : base(groupId, data) + { + } + + /// <inheritdoc /> + [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; + +/// <inheritdoc /> +public class SyncPlayStateUpdate : GroupUpdate<GroupStateUpdate> +{ + /// <summary> + /// Initializes a new instance of the <see cref="SyncPlayStateUpdate"/> class. + /// </summary> + /// <param name="groupId">The groupId.</param> + /// <param name="data">The data.</param> + public SyncPlayStateUpdate(Guid groupId, GroupStateUpdate data) : base(groupId, data) + { + } + + /// <inheritdoc /> + [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; + +/// <inheritdoc /> +public class SyncPlayUserJoinedUpdate : GroupUpdate<string> +{ + /// <summary> + /// Initializes a new instance of the <see cref="SyncPlayUserJoinedUpdate"/> class. + /// </summary> + /// <param name="groupId">The groupId.</param> + /// <param name="data">The data.</param> + public SyncPlayUserJoinedUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// <inheritdoc /> + [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; + +/// <inheritdoc /> +public class SyncPlayUserLeftUpdate : GroupUpdate<string> +{ + /// <summary> + /// Initializes a new instance of the <see cref="SyncPlayUserLeftUpdate"/> class. + /// </summary> + /// <param name="groupId">The groupId.</param> + /// <param name="data">The data.</param> + public SyncPlayUserLeftUpdate(Guid groupId, string data) : base(groupId, data) + { + } + + /// <inheritdoc /> + [DefaultValue(GroupUpdateType.UserLeft)] + public override GroupUpdateType Type => GroupUpdateType.UserLeft; +} |
