Adds playlist management and playback

This commit is contained in:
BinaryAlley committed 2026-10-21 16:30:58 +03:00
1 parent 009a0c8156
commit 9889c86c76
296 files changed
+18830 -367

No files matched your search

@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Playlists;
/// <summary>
/// Represents a request for adding several tracks to a playlist of the current user, in order.
/// </summary>
/// <param name="TrackIds">The Ids of the tracks to add, in the order they must take. Required.</param>
[DebuggerDisplay("TrackCount: {TrackIds.Count}")]
public record AddPlaylistEntriesRequest(
List<Guid>? TrackIds
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Playlists;
/// <summary>
/// Represents a request for adding a track to a playlist of the current user.
/// </summary>
/// <param name="TrackId">The Id of the track to add. Required.</param>
[DebuggerDisplay("TrackId: {TrackId}")]
public record AddPlaylistEntryRequest(
Guid? TrackId
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Playlists;
/// <summary>
/// Represents a request to add every track of a music library, an artist or an album to a playlist, resolved on the server.
/// </summary>
/// <param name="LibraryId">The Id of the music library the scope belongs to. Required.</param>
/// <param name="ArtistId">The Id of the artist the scope is limited to. Optional.</param>
/// <param name="AlbumId">The Id of the album the scope is limited to. Optional.</param>
[DebuggerDisplay("LibraryId: {LibraryId}; ArtistId: {ArtistId}; AlbumId: {AlbumId}")]
public record AddPlaylistScopeEntriesRequest(
Guid LibraryId,
Guid? ArtistId = null,
Guid? AlbumId = null
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.SharedKernel.Common.Enums.Playlists;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Playlists;
/// <summary>
/// Represents a request for creating a playlist of the current user.
/// </summary>
/// <param name="Name">The name of the playlist. Required.</param>
/// <param name="Description">The description of the playlist. Optional.</param>
/// <param name="Type">The kind of media the playlist holds. Required.</param>
[DebuggerDisplay("Name: {Name}")]
public record CreatePlaylistRequest(
string? Name,
string? Description,
PlaylistType? Type
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Playlists;
/// <summary>
/// Represents a request for getting a window of the entries of a playlist of the current user.
/// </summary>
/// <param name="Offset">The zero based position of the first entry to return. Optional; defaults to 0.</param>
/// <param name="Limit">The maximum number of entries to return, from 1 to 1000. Optional; defaults to 200.</param>
[DebuggerDisplay("Offset: {Offset}; Limit: {Limit}")]
public record GetPlaylistRequest(
int? Offset,
int? Limit
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Playlists;
/// <summary>
/// Represents a request for moving one entry of a playlist of the current user to a new position.
/// </summary>
/// <param name="TargetPosition">The new zero based position of the entry. Required.</param>
[DebuggerDisplay("TargetPosition: {TargetPosition}")]
public record MovePlaylistEntryRequest(
int? TargetPosition
);
@@ -0,0 +1,16 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Requests.Playlists;
/// <summary>
/// Represents a request for updating the details of a playlist of the current user.
/// </summary>
/// <param name="Name">The name of the playlist. Required.</param>
/// <param name="Description">The description of the playlist. Optional.</param>
[DebuggerDisplay("Name: {Name}")]
public record UpdatePlaylistRequest(
string? Name,
string? Description
);
@@ -0,0 +1,24 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.SharedKernel.Common.Enums.Playlists;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.Playlists;
/// <summary>
/// Represents a response for the editable scalars of a playlist after a details update.
/// </summary>
/// <param name="Id">The Id of the playlist.</param>
/// <param name="Name">The name of the playlist.</param>
/// <param name="Description">The description of the playlist, if applicable.</param>
/// <param name="Type">The kind of media the playlist holds.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("Id: {Id}; Name: {Name}")]
public sealed record PlaylistDetailsResponse(
Guid Id,
string Name,
string? Description,
PlaylistType Type,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.Playlists;
/// <summary>
/// Represents a response for the result of appending several tracks to a playlist, without returning the whole playlist.
/// </summary>
/// <param name="PlaylistId">The Id of the playlist the entries were added to.</param>
/// <param name="AddedCount">The number of entries that were appended, including repeated tracks.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("PlaylistId: {PlaylistId}; AddedCount: {AddedCount}")]
public sealed record PlaylistEntriesAddedResponse(
Guid PlaylistId,
int AddedCount,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.Playlists;
/// <summary>
/// Represents a response for the entry that was appended to a playlist, together with its playlist and the new activity time of the playlist.
/// </summary>
/// <param name="PlaylistId">The Id of the playlist the entry was added to.</param>
/// <param name="Entry">The added entry, with the display details of the media item it references.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("PlaylistId: {PlaylistId}; Entry: {Entry.Id}")]
public sealed record PlaylistEntryAddedResponse(
Guid PlaylistId,
PlaylistEntryResponse Entry,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,21 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.Playlists;
/// <summary>
/// Represents a response for the result of moving one entry of a playlist to a new position.
/// </summary>
/// <param name="PlaylistId">The Id of the playlist whose entry was moved.</param>
/// <param name="EntryId">The Id of the moved entry.</param>
/// <param name="Position">The new zero based position of the entry.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("PlaylistId: {PlaylistId}; EntryId: {EntryId}; Position: {Position}")]
public sealed record PlaylistEntryMovedResponse(
Guid PlaylistId,
Guid EntryId,
int Position,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,21 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.Playlists;
/// <summary>
/// Represents a response for the result of removing an entry from a playlist.
/// </summary>
/// <param name="PlaylistId">The Id of the playlist the entry was removed from.</param>
/// <param name="RemovedEntryId">The Id of the removed entry.</param>
/// <param name="RepositionedCount">Always zero, because sparse order keys need no remaining entries to be repositioned.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("PlaylistId: {PlaylistId}; RemovedEntryId: {RemovedEntryId}; RepositionedCount: {RepositionedCount}")]
public sealed record PlaylistEntryRemovedResponse(
Guid PlaylistId,
Guid RemovedEntryId,
int RepositionedCount,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,38 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.SharedKernel.Common.Enums.Playlists;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.Playlists;
/// <summary>
/// Represents a response for an ordered entry of a playlist.
/// </summary>
/// <param name="Id">The Id of the entry.</param>
/// <param name="MediaItemId">The Id of the media item referenced by the entry.</param>
/// <param name="MediaItemType">The kind of media item referenced by the entry.</param>
/// <param name="Position">The zero based position of the entry in the playlist.</param>
/// <param name="LibraryId">The Id of the media library that contains the media item, or an empty Guid when the item no longer exists.</param>
/// <param name="CollectionId">The Id of the collection that contains the media item, or an empty Guid when the item no longer exists.</param>
/// <param name="CreatorId">The Id of the creator of the media item, or an empty Guid when the item no longer exists.</param>
/// <param name="MediaItemTitle">The title of the media item, or an empty string when the item no longer exists.</param>
/// <param name="CollectionTitle">The title of the collection that contains the media item, or an empty string when the item no longer exists.</param>
/// <param name="CreatorName">The name of the creator of the media item, or an empty string when the item no longer exists.</param>
/// <param name="DurationInSeconds">The duration of the media item in seconds, or zero when the item no longer exists.</param>
/// <param name="CoverPath">The path of the cover art of the collection, if available.</param>
[DebuggerDisplay("MediaItemId: {MediaItemId}; MediaItemType: {MediaItemType}; Position: {Position}")]
public sealed record PlaylistEntryResponse(
Guid Id,
Guid MediaItemId,
PlaylistMediaItemType MediaItemType,
int Position,
Guid LibraryId,
Guid CollectionId,
Guid CreatorId,
string MediaItemTitle,
string CollectionTitle,
string CreatorName,
int DurationInSeconds,
string? CoverPath
);
@@ -0,0 +1,31 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.SharedKernel.Common.Enums.Playlists;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.Playlists;
/// <summary>
/// Represents a response for a playlist together with its ordered entries.
/// </summary>
/// <param name="Id">The Id of the playlist.</param>
/// <param name="Name">The name of the playlist.</param>
/// <param name="Description">The description of the playlist, if applicable.</param>
/// <param name="Type">The kind of media the playlist holds.</param>
/// <param name="Entries">The ordered entries of the requested window of the playlist.</param>
/// <param name="EntryCount">The number of entries the playlist holds, even when only a window of them is returned.</param>
/// <param name="CreatedOnUtc">The date and time when the playlist was created.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("Id: {Id}; Name: {Name}; EntryCount: {EntryCount}; Window: {Entries.Count}")]
public sealed record PlaylistResponse(
Guid Id,
string Name,
string? Description,
PlaylistType Type,
IReadOnlyList<PlaylistEntryResponse> Entries,
int EntryCount,
DateTime CreatedOnUtc,
DateTime? UpdatedOnUtc
);
@@ -0,0 +1,28 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.SharedKernel.Common.Enums.Playlists;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Contracts.Responses.Playlists;
/// <summary>
/// Represents a response for a playlist in a list, without its entries.
/// </summary>
/// <param name="Id">The Id of the playlist.</param>
/// <param name="Name">The name of the playlist.</param>
/// <param name="Description">The description of the playlist, if applicable.</param>
/// <param name="Type">The kind of media the playlist holds.</param>
/// <param name="EntryCount">The number of entries of the playlist.</param>
/// <param name="CreatedOnUtc">The date and time when the playlist was created.</param>
/// <param name="UpdatedOnUtc">The date and time when the playlist was last updated, if applicable.</param>
[DebuggerDisplay("Id: {Id}; Name: {Name}; EntryCount: {EntryCount}")]
public sealed record PlaylistSummaryResponse(
Guid Id,
string Name,
string? Description,
PlaylistType Type,
int EntryCount,
DateTime CreatedOnUtc,
DateTime? UpdatedOnUtc
);