diff --git a/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IListenTogetherSyncProvidable.cs b/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IListenTogetherSyncProvidable.cs new file mode 100644 index 0000000..746fe5f --- /dev/null +++ b/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IListenTogetherSyncProvidable.cs @@ -0,0 +1,17 @@ +using HyPlayer.PlayCore.Abstraction.Models; +using HyPlayer.PlayCore.Abstraction.Models.SingleItems; + +namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider; + +public interface IListenTogetherSyncProvidable : IListenTogetherProvidable +{ + public Task JoinListenTogetherRoomAsync(string roomId, string inviterId, CancellationToken ctk = new()); + + public Task SendListenTogetherHeartbeatAsync(string roomId, ProviderListenTogetherHeartbeat heartbeat, CancellationToken ctk = new()); + + public Task GetListenTogetherRoomStateAsync(string roomId, CancellationToken ctk = new()); + + public Task> GetListenTogetherQueueSongsAsync(IReadOnlyList itemIds, CancellationToken ctk = new()); + + public Task EndListenTogetherRoomAsync(string roomId, CancellationToken ctk = new()); +} diff --git a/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IMultiListenTogetherProvidable.cs b/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IMultiListenTogetherProvidable.cs new file mode 100644 index 0000000..7df8756 --- /dev/null +++ b/HyPlayer.PlayCore.Abstraction/Interfaces/Provider/IMultiListenTogetherProvidable.cs @@ -0,0 +1,22 @@ +using HyPlayer.PlayCore.Abstraction.Models; + +namespace HyPlayer.PlayCore.Abstraction.Interfaces.Provider; + +public interface IMultiListenTogetherProvidable : IProvider +{ + public Task CreateMultiListenTogetherRoomAsync(string seedItemId, CancellationToken ctk = new()); + + public Task JoinMultiListenTogetherRoomAsync(string roomId, string inviterId, CancellationToken ctk = new()); + + public Task GetMultiListenTogetherRoomAsync(CancellationToken ctk = new()); + + public Task SendMultiListenTogetherHeartbeatAsync(string roomId, CancellationToken ctk = new()); + + public Task> GetMultiListenTogetherQueueAsync(string roomId, CancellationToken ctk = new()); + + public Task RecommendMultiListenTogetherItemAsync(string roomId, string itemId, CancellationToken ctk = new()); + + public Task RequestMultiListenTogetherSkipAsync(string roomId, string itemId, string entryId, CancellationToken ctk = new()); + + public Task LeaveMultiListenTogetherRoomAsync(string roomId, CancellationToken ctk = new()); +} diff --git a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherHeartbeat.cs b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherHeartbeat.cs new file mode 100644 index 0000000..5a2c8be --- /dev/null +++ b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherHeartbeat.cs @@ -0,0 +1,14 @@ +namespace HyPlayer.PlayCore.Abstraction.Models; + +public sealed class ProviderListenTogetherHeartbeat +{ + public required string ItemId { get; init; } + + public bool IsPlaying { get; init; } + + public TimeSpan Position { get; init; } + + public string? UserId { get; init; } + + public long PlaylistVersion { get; init; } +} diff --git a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherQueueReport.cs b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherQueueReport.cs index fc5f601..bb77bbf 100644 --- a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherQueueReport.cs +++ b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherQueueReport.cs @@ -5,6 +5,8 @@ namespace HyPlayer.PlayCore.Abstraction.Models; public sealed class ProviderListenTogetherQueueReport { public required List Queue { get; init; } + + public List? RandomQueue { get; init; } public string? UserId { get; init; } public string PlayModeId { get; init; } = "seq"; public int ClientSeq { get; init; } diff --git a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherRoomState.cs b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherRoomState.cs new file mode 100644 index 0000000..76c3010 --- /dev/null +++ b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherRoomState.cs @@ -0,0 +1,40 @@ +namespace HyPlayer.PlayCore.Abstraction.Models; + +public sealed class ProviderListenTogetherRoomState +{ + public List DisplayItemIds { get; init; } = []; + + public List RandomItemIds { get; init; } = []; + + public string? PlayModeId { get; init; } + + public List Versions { get; init; } = []; + + public ProviderListenTogetherRemoteCommand? LastCommand { get; init; } +} + +public sealed class ProviderListenTogetherQueueVersion +{ + public required string UserId { get; init; } + + public long Version { get; init; } +} + +public sealed class ProviderListenTogetherRemoteCommand +{ + public required string CommandId { get; init; } + + public string? UserId { get; init; } + + public string? FormerItemId { get; init; } + + public string? TargetItemId { get; init; } + + public TimeSpan Position { get; init; } + + public bool IsPlaying { get; init; } + + public long ClientSeq { get; init; } + + public long ServerSeq { get; init; } +} diff --git a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherStatus.cs b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherStatus.cs index 091a2be..c0bbfaf 100644 --- a/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherStatus.cs +++ b/HyPlayer.PlayCore.Abstraction/Models/ProviderListenTogetherStatus.cs @@ -4,6 +4,9 @@ public sealed class ProviderListenTogetherStatus { public bool IsInRoom { get; init; } public string? RoomId { get; init; } + + public string? CreatorId { get; init; } + public bool IsMultiRoom { get; init; } public List Users { get; init; } = []; } diff --git a/HyPlayer.PlayCore.Abstraction/Models/ProviderMultiListenTogetherRoom.cs b/HyPlayer.PlayCore.Abstraction/Models/ProviderMultiListenTogetherRoom.cs new file mode 100644 index 0000000..132392d --- /dev/null +++ b/HyPlayer.PlayCore.Abstraction/Models/ProviderMultiListenTogetherRoom.cs @@ -0,0 +1,49 @@ +namespace HyPlayer.PlayCore.Abstraction.Models; + +public sealed class ProviderMultiListenTogetherRoom +{ + public required string RoomId { get; init; } + public string? CreatorId { get; init; } + public List Users { get; init; } = []; + public ProviderMultiListenTogetherPlayback? Playback { get; init; } + public bool CanRecommend { get; init; } = true; + public bool CanRequestSkip { get; init; } = true; +} + +public sealed class ProviderMultiListenTogetherPlayback +{ + public required string ItemId { get; init; } + public required string EntryId { get; init; } + public string? RecommenderId { get; init; } + public TimeSpan Position { get; init; } + public TimeSpan Duration { get; init; } + public long Version { get; init; } + public List NextItemIds { get; init; } = []; +} + +public sealed class ProviderMultiListenTogetherHeartbeat +{ + public ProviderMultiListenTogetherPlayback? Playback { get; init; } + public TimeSpan? Interval { get; init; } + public bool IsClosed { get; init; } +} + +public sealed class ProviderMultiListenTogetherQueueItem +{ + public required string ItemId { get; init; } + public required string EntryId { get; init; } + public required string Title { get; init; } + public string Artists { get; init; } = string.Empty; + public string? CoverUrl { get; init; } + public string? RecommenderId { get; init; } + public string RecommenderName { get; init; } = string.Empty; + public bool IsSystemRecommendation { get; init; } + public bool IsPlaying { get; init; } +} + +public sealed class ProviderMultiListenTogetherOperation +{ + public bool Succeeded { get; init; } + public string Message { get; init; } = string.Empty; + public ProviderMultiListenTogetherPlayback? Playback { get; init; } +}