Converts the web client request objects from classes to records.

This commit is contained in:
BinaryAlley committed 2026-10-12 19:21:52 +03:00
1 parent 5a27c22109
commit defbd9176f
26 files changed
+247 -383

No files matched your search

@@ -9,48 +9,26 @@ namespace Lumina.Presentation.Web.Common.Requests.Libraries;
/// <summary>
/// Represents a request to get the lightweight details of the books of a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose books are retrieved. Required.</param>
/// <param name="CurrentPage">The page of results to retrieve. Optional.</param>
/// <param name="PerPage">The maximum number of books to retrieve per page. Optional.</param>
/// <param name="SearchTerm">The search term used to filter results. Optional.</param>
/// <param name="FilterAlphaKey">
/// The alpha key used to filter the results by the first character of their title, for the alpha picker. Optional.
/// Can be <see langword="null"/> to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter,
/// "#" to filter by titles whose first character is a digit, or "*" to filter by titles whose first character is neither a letter nor a digit.
/// </param>
/// <param name="ShouldIgnoreThePrefixForAlphaPicker">Whether the leading "The " prefix of a title is ignored when computing the alpha key, or not. Optional.</param>
/// <param name="SortBy">The name of the field by which to sort the results. Optional.</param>
/// <param name="SortOrder">The direction in which to sort the results. Optional.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public class GetBooksLiteRequest
{
/// <summary>
/// Gets or sets the Id of the media library whose books are retrieved.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the page of results to retrieve.
/// </summary>
public int? CurrentPage { get; set; }
/// <summary>
/// Gets or sets the maximum number of books to retrieve per page.
/// </summary>
public int? PerPage { get; set; }
/// <summary>
/// Gets or sets the search term used to filter results.
/// </summary>
public string? SearchTerm { get; set; }
/// <summary>
/// Gets or sets the alpha key used to filter the results by the first character of their title, for the alpha picker.
/// Can be <see langword="null"/> to disable alpha filtering, a single ASCII letter (case-insensitive) to filter by that letter,
/// "#" to filter by titles whose first character is a digit, or "*" to filter by titles whose first character is neither a letter nor a digit.
/// </summary>
public string? FilterAlphaKey { get; set; }
/// <summary>
/// Gets or sets whether the leading "The " prefix of a title is ignored when computing the alpha key, or not.
/// </summary>
public bool ShouldIgnoreThePrefixForAlphaPicker { get; set; }
/// <summary>
/// Gets or sets the name of the field by which to sort the results.
/// </summary>
public string? SortBy { get; set; }
/// <summary>
/// Gets or sets the direction in which to sort the results.
/// </summary>
public SortOrder? SortOrder { get; set; }
}
public record GetBooksLiteRequest(
Guid LibraryId,
int? CurrentPage,
int? PerPage,
string? SearchTerm,
string? FilterAlphaKey,
bool ShouldIgnoreThePrefixForAlphaPicker,
string? SortBy,
SortOrder? SortOrder
);
@@ -13,101 +13,44 @@ namespace Lumina.Presentation.Web.Common.Requests.Library.WrittenContentLibrary.
/// <summary>
/// Represents a request to update an existing book.
/// </summary>
/// <param name="BookId">The Id of the book to update, taken from the route. Required.</param>
/// <param name="LibraryId">The Id of the media library the book belongs to. Required.</param>
/// <param name="Metadata">The written content metadata of the book. Required.</param>
/// <param name="Format">The format of the book (e.g., Hardcover, Paperback). Optional.</param>
/// <param name="Edition">The edition of the book. Optional.</param>
/// <param name="VolumeNumber">The volume or book number in the series. Optional.</param>
/// <param name="Series">The series the book is part of. Optional.</param>
/// <param name="ASIN">The ASIN (Amazon Standard Identification Number) of the book. Optional.</param>
/// <param name="GoodreadsId">The Goodreads Id of the book. Optional.</param>
/// <param name="LCCN">The Library of Congress Control Number (LCCN) of the book. Optional.</param>
/// <param name="OCLCNumber">The OCLC Number (WorldCat identifier) of the book. Optional.</param>
/// <param name="OpenLibraryId">The Open Library Id of the book. Optional.</param>
/// <param name="LibraryThingId">The LibraryThing Id of the book. Optional.</param>
/// <param name="GoogleBooksId">The Google Books Id of the book. Optional.</param>
/// <param name="BarnesAndNobleId">The Barnes &amp; Noble Id of the book. Optional.</param>
/// <param name="AppleBooksId">The Apple Books Id of the book. Optional.</param>
/// <param name="ISBNs">The list of ISBN (International Standard Book Number) of the book. Required.</param>
/// <param name="Contributors">The list of media contributors of the book. Required.</param>
/// <param name="Ratings">The list of ratings of the book. Required.</param>
[DebuggerDisplay("Title: {Metadata?.Title}")]
public class UpdateBookRequest
{
/// <summary>
/// Gets or sets the Id of the book to update, taken from the route.
/// </summary>
public string? BookId { get; set; }
/// <summary>
/// Gets or sets the Id of the media library the book belongs to.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the written content metadata of the book.
/// </summary>
public WrittenContentMetadataDto? Metadata { get; set; }
/// <summary>
/// Gets or sets the format of the book (e.g., Hardcover, Paperback), if applicable.
/// </summary>
public BookFormat? Format { get; set; }
/// <summary>
/// Gets or sets the edition of the book, if applicable.
/// </summary>
public string? Edition { get; set; }
/// <summary>
/// Gets or sets the volume or book number in the series, if applicable.
/// </summary>
public float? VolumeNumber { get; set; }
/// <summary>
/// Gets or sets the series name, if the book is part of a series.
/// </summary>
public BookSeriesDto? Series { get; set; }
/// <summary>
/// Gets or sets the ASIN (Amazon Standard Identification Number) of the book, if applicable.
/// </summary>
public string? ASIN { get; set; }
/// <summary>
/// Gets or sets the Goodreads Id of the book, if applicable.
/// </summary>
public string? GoodreadsId { get; set; }
/// <summary>
/// Gets or sets the Library of Congress Control Number (LCCN) of the book, if applicable.
/// </summary>
public string? LCCN { get; set; }
/// <summary>
/// Gets or sets the OCLC Number (WorldCat identifier) of the book, if applicable.
/// </summary>
public string? OCLCNumber { get; set; }
/// <summary>
/// Gets or sets the Open Library Id of the book, if applicable.
/// </summary>
public string? OpenLibraryId { get; set; }
/// <summary>
/// Gets or sets the LibraryThing Id of the book, if applicable.
/// </summary>
public string? LibraryThingId { get; set; }
/// <summary>
/// Gets or sets the Google Books Id of the book, if applicable.
/// </summary>
public string? GoogleBooksId { get; set; }
/// <summary>
/// Gets or sets the Barnes &amp; Noble Id of the book, if applicable.
/// </summary>
public string? BarnesAndNobleId { get; set; }
/// <summary>
/// Gets or sets the Apple Books Id of the book, if applicable.
/// </summary>
public string? AppleBooksId { get; set; }
/// <summary>
/// Gets or sets the list of ISBN (International Standard Book Number) of the book.
/// </summary>
public List<IsbnDto>? ISBNs { get; set; }
/// <summary>
/// Gets or sets the list of media contributors of the book. Required.
/// </summary>
public List<MediaContributorDto>? Contributors { get; set; }
/// <summary>
/// Gets or sets the list of ratings of the book.
/// </summary>
public List<BookRatingDto>? Ratings { get; set; }
}
public record UpdateBookRequest(
string? BookId,
Guid LibraryId,
WrittenContentMetadataDto? Metadata,
BookFormat? Format,
string? Edition,
float? VolumeNumber,
BookSeriesDto? Series,
string? ASIN,
string? GoodreadsId,
string? LCCN,
string? OCLCNumber,
string? OpenLibraryId,
string? LibraryThingId,
string? GoogleBooksId,
string? BarnesAndNobleId,
string? AppleBooksId,
List<IsbnDto>? ISBNs,
List<MediaContributorDto>? Contributors,
List<BookRatingDto>? Ratings
);
@@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
/// <summary>
/// Represents a request to reorder the artwork providers of a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose artwork providers are reordered. Required.</param>
/// <param name="PluginIds">The plugin Ids in the new order, from highest to lowest rank. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public class ReorderLibraryArtworkProvidersRequest
{
/// <summary>
/// Gets or sets the Id of the media library whose artwork providers are reordered.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the plugin Ids in the new order, from highest to lowest rank.
/// </summary>
public List<Guid> PluginIds { get; set; } = [];
}
public record ReorderLibraryArtworkProvidersRequest(
Guid LibraryId,
List<Guid> PluginIds
);
@@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
/// <summary>
/// Represents a request to reorder the metadata providers of a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose metadata providers are reordered. Required.</param>
/// <param name="PluginIds">The plugin Ids in the new order, from highest to lowest rank. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}")]
public class ReorderLibraryMetadataProvidersRequest
{
/// <summary>
/// Gets or sets the Id of the media library whose metadata providers are reordered.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the plugin Ids in the new order, from highest to lowest rank.
/// </summary>
public List<Guid> PluginIds { get; set; } = [];
}
public record ReorderLibraryMetadataProvidersRequest(
Guid LibraryId,
List<Guid> PluginIds
);
@@ -8,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
/// <summary>
/// Represents a request to enable or disable a book reader for a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose book reader is enabled or disabled. Required.</param>
/// <param name="PluginId">The unique identifier of the plugin providing the book reader. Required.</param>
/// <param name="IsEnabled">Whether the book reader should be enabled for the media library. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
public class SetBookReaderEnabledRequest
{
/// <summary>
/// Gets or sets the Id of the media library whose book reader is enabled or disabled. Required.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the plugin providing the book reader. Required.
/// </summary>
public Guid PluginId { get; set; }
/// <summary>
/// Gets or sets whether the book reader should be enabled for the media library. Required.
/// </summary>
public bool IsEnabled { get; set; }
}
public record SetBookReaderEnabledRequest(
Guid LibraryId,
Guid PluginId,
bool IsEnabled
);
@@ -8,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
/// <summary>
/// Represents a request to enable or disable an artwork provider for a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose artwork provider is enabled or disabled. Required.</param>
/// <param name="PluginId">The unique identifier of the plugin providing the artwork. Required.</param>
/// <param name="IsEnabled">Whether the artwork provider should be enabled for the media library. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
public class SetLibraryArtworkProviderEnabledRequest
{
/// <summary>
/// Gets or sets the Id of the media library whose artwork provider is enabled or disabled.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the plugin providing the artwork.
/// </summary>
public Guid PluginId { get; set; }
/// <summary>
/// Gets or sets whether the artwork provider should be enabled for the media library.
/// </summary>
public bool IsEnabled { get; set; }
}
public record SetLibraryArtworkProviderEnabledRequest(
Guid LibraryId,
Guid PluginId,
bool IsEnabled
);
@@ -1,6 +1,5 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
@@ -9,21 +8,12 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
/// <summary>
/// Represents a request to enable or disable a metadata provider for a media library.
/// </summary>
/// <param name="LibraryId">The Id of the media library whose metadata provider is enabled or disabled. Required.</param>
/// <param name="PluginId">The unique identifier of the plugin providing the metadata. Required.</param>
/// <param name="IsEnabled">Whether the metadata provider should be enabled for the media library. Required.</param>
[DebuggerDisplay("LibraryId: {LibraryId}, PluginId: {PluginId}")]
public class SetLibraryMetadataProviderEnabledRequest
{
/// <summary>
/// Gets or sets the Id of the media library whose metadata provider is enabled or disabled.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the plugin providing the metadata.
/// </summary>
public Guid PluginId { get; set; }
/// <summary>
/// Gets or sets whether the metadata provider should be enabled for the media library.
/// </summary>
public bool IsEnabled { get; set; }
}
public record SetLibraryMetadataProviderEnabledRequest(
Guid LibraryId,
Guid PluginId,
bool IsEnabled
);
@@ -9,16 +9,10 @@ namespace Lumina.Presentation.Web.Common.Requests.Plugins;
/// <summary>
/// Represents a request to update the settings of a plugin.
/// </summary>
/// <param name="PluginId">The unique identifier of the plugin. Required.</param>
/// <param name="Settings">The settings of the plugin. Optional.</param>
[DebuggerDisplay("PluginId: {PluginId}")]
public class UpdatePluginSettingsRequest
{
/// <summary>
/// Gets or sets the unique identifier of the plugin.
/// </summary>
public Guid PluginId { get; set; }
/// <summary>
/// Gets or sets the settings of the plugin.
/// </summary>
public Dictionary<string, string>? Settings { get; set; }
}
public record UpdatePluginSettingsRequest(
Guid PluginId,
Dictionary<string, string>? Settings
);