Implements library management update library

This commit is contained in:
BinaryAlley committed 2024-11-17 21:02:10 +02:00
1 parent d0d53fd471
commit 291d1fa329
68 files changed
+1003 -110

No files matched your search

@@ -13,5 +13,6 @@ public static partial class ApiRoutes
public const string GET_LIBRARY_BY_ID = "/libraries/{id}";
public const string GET_LIBRARIES = "/libraries";
public const string ADD_LIBRARY = "/libraries";
public const string UPDATE_LIBRARY = "/libraries/{id}";
}
}
@@ -10,7 +10,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Directories.GetDirectories;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetDirectoriesEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetDirectoriesEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetDirectoriesEndpointSummary : Summary<GetDirectoriesEndpoint, GetDirectoriesRequest>
@@ -10,7 +10,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Directories.GetDirectoryTree;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetDirectoryTreeEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetDirectoryTreeEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetDirectoryTreeEndpointSummary : Summary<GetDirectoryTreeEndpoint, GetDirectoryTreeRequest>
@@ -10,7 +10,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Directories.GetTreeDirectories;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetTreeDirectoriesEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetTreeDirectoriesEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetTreeDirectoriesEndpointSummary : Summary<GetTreeDirectoriesEndpoint, GetTreeDirectoriesRequest>
@@ -9,7 +9,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Drives.GetDrives;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetDrivesEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetDrivesEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetDrivesEndpointSummary : Summary<GetDrivesEndpoint>
@@ -8,7 +8,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.FileSystem.GetType;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetTypeEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetTypeEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetTypeEndpointSummary : Summary<GetTypeEndpoint, FileSystemTypeResponse>
@@ -11,7 +11,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Files.GetFiles;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetFilesEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetFilesEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetFilesEndpointSummary : Summary<GetFilesEndpoint, GetFilesRequest>
@@ -10,7 +10,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Files.GetTreeFiles;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetTreeFilesEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetTreeFilesEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetTreeFilesEndpointSummary : Summary<GetTreeFilesEndpoint, GetTreeFilesRequest>
@@ -10,7 +10,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.CheckPathExists;
/// <summary>
/// Class used for providing a textual description for the <see cref="CheckPathExistsEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="CheckPathExistsEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class CheckPathExistsEndpointSummary : Summary<CheckPathExistsEndpoint, CheckPathExistsRequest>
@@ -9,7 +9,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.CombinePath;
/// <summary>
/// Class used for providing a textual description for the <see cref="CombinePathEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="CombinePathEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class CombinePathEndpointSummary : Summary<CombinePathEndpoint, CombinePathRequest>
@@ -9,7 +9,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.GetPathParent;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetPathParentEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetPathParentEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetPathParentEndpointSummary : Summary<GetPathParentEndpoint, GetPathParentRequest>
@@ -9,7 +9,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.GetPathRoot;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetPathRootEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetPathRootEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetPathRootEndpointSummary : Summary<GetPathRootEndpoint, GetPathRootRequest>
@@ -7,7 +7,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.GetPathSeparator;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetPathSeparatorEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetPathSeparatorEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetPathSeparatorEndpointSummary : Summary<GetPathSeparatorEndpoint>
@@ -9,7 +9,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.SplitPath;
/// <summary>
/// Class used for providing a textual description for the <see cref="SplitPathEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="SplitPathEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class SplitPathEndpointSummary : Summary<SplitPathEndpoint, SplitPathRequest>
@@ -9,7 +9,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.ValidatePath;
/// <summary>
/// Class used for providing a textual description for the <see cref="ValidatePathEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="ValidatePathEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class ValidatePathEndpointSummary : Summary<ValidatePathEndpoint, ValidatePathRequest>
@@ -8,7 +8,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Thumbnails.GetThumbnail;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetThumbnailEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetThumbnailEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetThumbnailEndpointSummary : Summary<GetThumbnailEndpoint, GetThumbnailRequest>
@@ -50,6 +50,7 @@ public class AddLibraryEndpoint : BaseEndpoint<AddLibraryRequest, IResult>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(AddLibraryRequest request, CancellationToken cancellationToken)
{
// retrieve the currently authenticated user, and send it with the request
string? user = User.FindFirstValue(ClaimTypes.NameIdentifier);
ErrorOr<LibraryResponse> result = await _sender.Send(request.ToCommand(Guid.Parse(user!)), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Created($"{BaseURL}api/v1{ApiRoutes.Libraries.ADD_LIBRARY}/{result.Value.Id}", result.Value), Problem);
@@ -6,14 +6,12 @@ using Lumina.Domain.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.AddLibrary;
/// <summary>
/// Class used for providing a textual description for the <see cref="AddLibraryEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="AddLibraryEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryRequest>
@@ -28,7 +26,7 @@ public class AddLibraryEndpointSummary : Summary<AddLibraryEndpoint, AddLibraryR
ExampleRequest = new AddLibraryRequest(
Title: "TV Shows",
LibraryType: LibraryType.TvShow,
LibraryType: "TvShow",
ContentLocations: [
"/media/tv shows/drama/",
"/media/tv shows/SCI-FI/",
@@ -0,0 +1,58 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
using Lumina.Contracts.Requests.MediaLibrary.Management;
using Lumina.Contracts.Responses.MediaLibrary.Management;
using Lumina.Presentation.Api.Common.Routes.Library.Management;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Mediator;
using Microsoft.AspNetCore.Http;
using System;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.GetLibrary;
/// <summary>
/// API endpoint for the <c>/libraries/{id}</c> route.
/// </summary>
public class GetLibraryEndpoint : BaseEndpoint<GetLibraryRequest, IResult>
{
private readonly ISender _sender;
/// <summary>
/// Initializes a new instance of the <see cref="GetLibraryEndpoint"/> class.
/// </summary>
/// <param name="sender">Injected service for mediating commands and queries.</param>
public GetLibraryEndpoint(ISender sender)
{
_sender = sender;
}
/// <summary>
/// Configures the API endpoint.
/// </summary>
public override void Configure()
{
Verbs(Http.GET);
Routes(ApiRoutes.Libraries.GET_LIBRARY_BY_ID);
Version(1);
DontCatchExceptions();
}
/// <summary>
/// Gets a library by Id.
/// </summary>
/// <param name="request">The request containing the id of the library to be retrieved.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(GetLibraryRequest request, CancellationToken cancellationToken)
{
// retrieve the currently authenticated user, and send it with the request
string? user = User.FindFirstValue(ClaimTypes.NameIdentifier);
ErrorOr<LibraryResponse> result = await _sender.Send(request.ToQuery(Guid.Parse(user!)), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -0,0 +1,129 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Contracts.Requests.MediaLibrary.Management;
using Lumina.Contracts.Responses.MediaLibrary.Management;
using Lumina.Domain.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.GetLibrary;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetLibraryEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetLibraryEndpointSummary : Summary<GetLibraryEndpoint, GetLibraryRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="GetLibraryEndpointSummary"/> class.
/// </summary>
public GetLibraryEndpointSummary()
{
Summary = "Retrieves a media library by its Id.";
Description = "Retrieves a media library by its Id, if the user making the request is an Admin, or the owner of the library.";
ExampleRequest = new GetLibraryRequest(
Id: Guid.NewGuid()
);
RequestParam(r => r.Id, "The Id of the media library. Required.");
ResponseParam<LibraryResponse>(r => r.Id, "The unique identifier of the entity.");
ResponseParam<LibraryResponse>(r => r.UserId, "The Id of the user owning the media library.");
ResponseParam<LibraryResponse>(r => r.Title, "The title of the media library.");
ResponseParam<LibraryResponse>(r => r.LibraryType, "The type of the media library.");
ResponseParam<LibraryResponse>(r => r.ContentLocations, "The file system paths of the directories where the media library elements are located.");
ResponseParam<LibraryResponse>(r => r.Created, "The date and time when the entity was created.");
ResponseParam<LibraryResponse>(r => r.Updated, "The date and time when the entity was last updated.");
Response(200, "The media library is returned.", example: new LibraryResponse(
Id: Guid.NewGuid(),
UserId: Guid.NewGuid(),
Title: "TV Shows",
LibraryType: LibraryType.TvShow,
ContentLocations: ["/media/tv shows/drama/", "/media/tv shows/SCI-FI/"],
Created: DateTime.UtcNow,
Updated: default
));
Response(401, "Authentication required.", "application/problem+json",
example: new[]
{
new
{
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "You are not authorized",
instance = "/api/v1/libraries/{id}"
},
new
{
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "Invalid token: The token expired at '01/01/2024 01:00:00'",
instance = "/api/v1/libraries/{id}"
},
new
{
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "The token is invalid",
instance = "/api/v1/libraries/{id}"
}
}
);
Response(403, "The request failed because the user making the request is not an Admin, or the owner of the media library.", "application/problem+json",
example: new
{
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
title = "General.Failure",
status = 403,
detail = "NotAuthorized",
instance = "/api/v1/libraries/{id}",
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00"
}
);
Response(404, "The request failed because the requested media library does not exist.", "application/problem+json",
example: new
{
type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
title = "General.NotFound",
status = 404,
detail = "LibraryNotFound",
instance = "/api/v1/libraries/{id}",
traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00"
}
);
Response(422, "The request did not pass validation checks.", "application/problem+json",
example: new
{
type = "https://tools.ietf.org/html/rfc4918#section-11.2",
title = "General.Validation",
status = 422,
detail = "OneOrMoreValidationErrorsOccurred",
instance = "/api/v1/libraries/{id}",
errors = new Dictionary<string, string[]>
{
{
"General.Validation", new[]
{
"UserIdCannotBeEmpty",
"LibraryIdCannotBeEmpty"
}
}
},
traceId = "00-2470be4248a2a5a0c6f70579975a6954-b9c3ba9544a03500-00"
}
);
}
}
@@ -0,0 +1,58 @@
#region ========================================================================= USING =====================================================================================
using ErrorOr;
using FastEndpoints;
using Lumina.Application.Common.Mapping.MediaLibrary.Management;
using Lumina.Contracts.Requests.MediaLibrary.Management;
using Lumina.Contracts.Responses.MediaLibrary.Management;
using Lumina.Presentation.Api.Common.Routes.Library.Management;
using Lumina.Presentation.Api.Core.Endpoints.Common;
using Mediator;
using Microsoft.AspNetCore.Http;
using System;
using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.UpdateLibrary;
/// <summary>
/// API endpoint for the <c>/libraries/{id}</c> route.
/// </summary>
public class UpdateLibraryEndpoint : BaseEndpoint<UpdateLibraryRequest, IResult>
{
private readonly ISender _sender;
/// <summary>
/// Initializes a new instance of the <see cref="UpdateLibraryEndpoint"/> class.
/// </summary>
/// <param name="sender">Injected service for mediating commands and queries.</param>
public UpdateLibraryEndpoint(ISender sender)
{
_sender = sender;
}
/// <summary>
/// Configures the API endpoint.
/// </summary>
public override void Configure()
{
Verbs(Http.PUT);
Routes(ApiRoutes.Libraries.UPDATE_LIBRARY);
Version(1);
DontCatchExceptions();
}
/// <summary>
/// Updates a media library stored in <paramref name="request"/>.
/// </summary>
/// <param name="request">The request containing the media library to be updated.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
public override async Task<IResult> ExecuteAsync(UpdateLibraryRequest request, CancellationToken cancellationToken)
{
// retrieve the currently authenticated user, and send it with the request
string? user = User.FindFirstValue(ClaimTypes.NameIdentifier);
ErrorOr<LibraryResponse> result = await _sender.Send(request.ToCommand(Guid.Parse(user!)), cancellationToken).ConfigureAwait(false);
return result.Match(success => TypedResults.Ok(success), Problem);
}
}
@@ -0,0 +1,148 @@
#region ========================================================================= USING =====================================================================================
using FastEndpoints;
using Lumina.Contracts.Requests.MediaLibrary.Management;
using Lumina.Contracts.Responses.MediaLibrary.Management;
using Lumina.Domain.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Presentation.Api.Core.Endpoints.Library.Management.UpdateLibrary;
/// <summary>
/// Class used for providing a textual description for the <see cref="UpdateLibraryEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class UpdateLibraryEndpointSummary : Summary<UpdateLibraryEndpoint, UpdateLibraryRequest>
{
/// <summary>
/// Initializes a new instance of the <see cref="UpdateLibraryEndpointSummary"/> class.
/// </summary>
public UpdateLibraryEndpointSummary()
{
Summary = "Updates an existing media library.";
Description = "Updates a media library and returns its details, if the user making the request is an Admin, or the owner of the library.";
ExampleRequest = new UpdateLibraryRequest(
Id: Guid.NewGuid(),
UserId: Guid.NewGuid(),
Title: "TV Shows",
LibraryType: "TvShow",
ContentLocations: [
"/media/tv shows/drama/",
"/media/tv shows/SCI-FI/",
]
);
RequestParam(r => r.Id, "The Id of the media library. Required.");
RequestParam(r => r.UserId, "The Id of the user owning the media library. Required.");
RequestParam(r => r.Title, "The title of the media library. Required.");
RequestParam(r => r.LibraryType, "The type of the media library. Required.");
RequestParam(r => r.ContentLocations, ">The file system paths of the directories where the media library elements are located. Required.");
ResponseParam<LibraryResponse>(r => r.Id, "The unique identifier of the entity.");
ResponseParam<LibraryResponse>(r => r.UserId, "The Id of the user owning the media library.");
ResponseParam<LibraryResponse>(r => r.Title, "The title of the media library.");
ResponseParam<LibraryResponse>(r => r.LibraryType, "The type of the media library.");
ResponseParam<LibraryResponse>(r => r.ContentLocations, "The file system paths of the directories where the media library elements are located.");
ResponseParam<LibraryResponse>(r => r.Created, "The date and time when the entity was created.");
ResponseParam<LibraryResponse>(r => r.Updated, "The date and time when the entity was last updated.");
Response(200, "The media library was successfully updated.", example:
new LibraryResponse(
Id: Guid.NewGuid(),
UserId: Guid.NewGuid(),
Title: "TV Shows",
LibraryType: LibraryType.TvShow,
ContentLocations: ["/media/tv shows/drama/", "/media/tv shows/SCI-FI/"],
Created: DateTime.UtcNow,
Updated: default
));
Response(401, "Authentication required.", "application/problem+json",
example: new[]
{
new
{
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "You are not authorized",
instance = "/api/v1/libraries"
},
new
{
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "Invalid token: The token expired at '01/01/2024 01:00:00'",
instance = "/api/v1/libraries"
},
new
{
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
status = 401,
title = "Unauthorized",
detail = "The token is invalid",
instance = "/api/v1/libraries"
}
}
);
Response(403, "The request failed because the user making the request is not an Admin, or the owner of the media library.", "application/problem+json",
example: new
{
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
title = "General.Failure",
status = 403,
detail = "NotAuthorized",
instance = "/api/v1/libraries/{id}",
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-00"
}
);
Response(404, "The request failed because the requested media library does not exist.", "application/problem+json",
example: new
{
type = "https://tools.ietf.org/html/rfc9110#section-15.5.5",
title = "General.NotFound",
status = 404,
detail = "LibraryNotFound",
instance = "/api/v1/libraries/{id}",
traceId = "00-57d15dadd702dbd4aeb5dc9b7cee68ee-9330237dbb2ce0e5-00"
}
);
Response(422, "The request did not pass validation checks.", "application/problem+json",
example: new
{
type = "https://tools.ietf.org/html/rfc4918#section-11.2",
title = "General.Validation",
status = 422,
detail = "OneOrMoreValidationErrorsOccurred",
instance = "/api/v1/libraries",
errors = new Dictionary<string, string[]>
{
{
"General.Validation", new[]
{
"UserIdCannotBeEmpty",
"LibraryTypeCannotBeNull",
"LibraryTypeCannotBeNull",
"UnknownLibraryType",
"PathsListCannotBeNull",
"PathsListCannotBeEmpty",
"PathCannotBeEmpty",
"TitleCannotBeEmpty",
"TitleMustBeMaximum255CharactersLong"
}
}
},
traceId = "00-2470be4248a2a5a0c6f70579975a6954-b9c3ba9544a03500-00"
}
);
}
}
@@ -14,7 +14,7 @@ using System;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.AddBook;
/// <summary>
/// Class used for providing a textual description for the <see cref="AddBookEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="AddBookEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class AddLibraryEndpointSummary : Summary<AddBookEndpoint, AddBookRequest>
@@ -13,7 +13,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.Books.GetBooks;
/// <summary>
/// Class used for providing a textual description for the <see cref="GetBooksEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="GetBooksEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class GetBooksEndpointSummary : Summary<GetBooksEndpoint>
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace Lumina.Presentation.Api.Core.Endpoints.Library.WrittenContentLibrary.BookLibrary.GetBook;
/// <summary>
/// API endpoint for the <c>/books</c> route.
/// API endpoint for the <c>/books/{id}</c> route.
/// </summary>
public class GetBookEndpoint : BaseEndpoint<GetBookRequest, IResult>
{
@@ -7,7 +7,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.Maintenance.ApplicationSetup;
/// <summary>
/// Class used for providing a textual description for the <see cref="CheckInitializationEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="CheckInitializationEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class CheckInitializationEndpointSummary : Summary<CheckInitializationEndpoint>
@@ -10,7 +10,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.Maintenance.ApplicationSetup;
/// <summary>
/// Class used for providing a textual description for the <see cref="SetupApplicationEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="SetupApplicationEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class SetupApplicationEndpointSummary : Summary<SetupApplicationEndpoint, RegistrationRequest>
@@ -9,7 +9,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.ChangePassword;
/// <summary>
/// Class used for providing a textual description for the <see cref="ChangePasswordEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="ChangePasswordEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class ChangePasswordEndpointSummary : Summary<ChangePasswordEndpoint, ChangePasswordRequest>
@@ -10,7 +10,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.Login;
/// <summary>
/// Class used for providing a textual description for the <see cref="LoginEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="LoginEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class LoginEndpointSummary : Summary<LoginEndpoint, LoginRequest>
@@ -9,7 +9,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.RecoverPassword;
/// <summary>
/// Class used for providing a textual description for the <see cref="RecoverPasswordEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="RecoverPasswordEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class RecoverPasswordEndpointSummary : Summary<RecoverPasswordEndpoint, RecoverPasswordRequest>
@@ -13,7 +13,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Lumina.Presentation.Api.Core.Endpoints.UsersManagement.Authentication.Register;
/// <summary>
/// Class used for providing a textual description for the <see cref="RegisterEndpoint"/> API endpoint, for Swagger.
/// Class used for providing a textual description for the <see cref="RegisterEndpoint"/> API endpoint, for OpenAPI.
/// </summary>
[ExcludeFromCodeCoverage]
public class RegisterEndpointSummary : Summary<RegisterEndpoint, RegistrationRequest>