mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Improves OpenApi documentation
This commit is contained in:
1 parent
f2703b86c5
commit
77f95708b9
101 files changed
+2336
-294
No files matched your search
-1
@@ -40,7 +40,6 @@ public class GetDirectoriesEndpoint : BaseEndpoint<GetDirectoriesRequest, IResul
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Directories.GET_DIRECTORIES);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+80
-4
@@ -2,6 +2,7 @@
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
@@ -22,10 +23,85 @@ public class GetDirectoriesEndpointSummary : Summary<GetDirectoriesEndpoint, Get
|
||||
Summary = "Retrieves the list of directories for a specified file system path.";
|
||||
Description = "Returns the directories within the specified path, with an option to include hidden file system elements.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the directories.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not.");
|
||||
ExampleRequest = new GetDirectoriesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: true
|
||||
);
|
||||
RequestExamples.Add(new RequestExample(new GetDirectoriesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: false
|
||||
)));
|
||||
|
||||
Response<IEnumerable<DirectoryResponse>>(200, "The list of directories for the specified path is returned.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
RequestParam(r => r.Path, "The file system path for which to get the directories. Required.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
|
||||
Response(200, "The list of directories for the specified path is returned.",
|
||||
example: new DirectoryResponse[] {
|
||||
new(Path: "/media/movies/The Matrix (1999)/", Name: "The Matrix", DateCreated: DateTime.UtcNow, DateModified: DateTime.UtcNow.AddMinutes(-10), Items: []),
|
||||
new(Path: "/media/movies/The Lord of the Rings - The Fellowship of the Ring (2001)/", Name: "The Lord of the Rings - The Fellowship of the Ring (2001)", DateCreated: DateTime.UtcNow, DateModified: DateTime.UtcNow.AddMinutes(-10), Items: [])
|
||||
});
|
||||
|
||||
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/directories/get-directories"
|
||||
},
|
||||
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/directories/get-directories"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/directories/get-directories"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Response(403, "The request failed because the provided path does not exist, or the current user doesn't have permission to access it.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
|
||||
title = "General.Failure",
|
||||
status = 403,
|
||||
detail = "UnauthorizedAccess",
|
||||
instance = "/api/v1/directories/get-directories",
|
||||
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-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/directories/get-directories",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -40,7 +40,6 @@ public class GetDirectoryTreeEndpoint : BaseEndpoint<GetDirectoryTreeRequest, IR
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Directories.GET_DIRECTORY_TREE);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+162
-5
@@ -2,6 +2,7 @@
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Common.Enums.FileSystem;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
@@ -22,11 +23,167 @@ public class GetDirectoryTreeEndpointSummary : Summary<GetDirectoryTreeEndpoint,
|
||||
Summary = "Retrieves the directory tree structure for a specified file system path.";
|
||||
Description = "Returns a hierarchical view of the directory tree, with options to include files and hidden elements.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the directory tree.");
|
||||
RequestParam(r => r.IncludeFiles, "Whether to include files along the directories or not.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not.");
|
||||
ExampleRequest = new GetDirectoryTreeRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeFiles: true,
|
||||
IncludeHiddenElements: true
|
||||
);
|
||||
RequestExamples.Add(new RequestExample(new GetDirectoryTreeRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeFiles: false,
|
||||
IncludeHiddenElements: false
|
||||
)));
|
||||
RequestExamples.Add(new RequestExample(new GetDirectoryTreeRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeFiles: true,
|
||||
IncludeHiddenElements: false
|
||||
)));
|
||||
RequestExamples.Add(new RequestExample(new GetDirectoryTreeRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeFiles: false,
|
||||
IncludeHiddenElements: true
|
||||
)));
|
||||
|
||||
Response<IEnumerable<FileSystemTreeNodeResponse>>(200, "The directory tree structure for the specified path.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
RequestParam(r => r.Path, "The file system path for which to get the directory tree. Required.");
|
||||
RequestParam(r => r.IncludeFiles, "Whether to include files along the directories or not. Optional.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
|
||||
Response(200, "The directory tree structure for the specified path.",
|
||||
example: new FileSystemTreeNodeResponse[] {
|
||||
new()
|
||||
{
|
||||
Path = "/",
|
||||
Name = "The Lord of the Rings - The Fellowship of the Ring (2001)",
|
||||
ItemType = FileSystemItemType.Root,
|
||||
IsExpanded = true,
|
||||
ChildrenLoaded = true,
|
||||
Children =
|
||||
[
|
||||
new()
|
||||
{
|
||||
Path = "/media/",
|
||||
Name = "media",
|
||||
ItemType = FileSystemItemType.Directory,
|
||||
IsExpanded = true,
|
||||
ChildrenLoaded = true,
|
||||
Children =
|
||||
[
|
||||
new()
|
||||
{
|
||||
Path = "/media/movies/",
|
||||
Name = "movies",
|
||||
ItemType = FileSystemItemType.Directory,
|
||||
IsExpanded = true,
|
||||
ChildrenLoaded = true,
|
||||
Children =
|
||||
[
|
||||
new()
|
||||
{
|
||||
Path = "/media/movies/The Lord of the Rings - The Fellowship of the Ring (2001)/",
|
||||
Name = "The Lord of the Rings - The Fellowship of the Ring (2001)",
|
||||
ItemType = FileSystemItemType.Directory,
|
||||
IsExpanded = true,
|
||||
ChildrenLoaded = true,
|
||||
Children =
|
||||
[
|
||||
new()
|
||||
{
|
||||
Path = "/media/movies/The Lord of the Rings - The Fellowship of the Ring (2001)/Extras/",
|
||||
Name = "Extras",
|
||||
ItemType = FileSystemItemType.Directory,
|
||||
IsExpanded = false,
|
||||
ChildrenLoaded = false,
|
||||
Children = []
|
||||
},
|
||||
new()
|
||||
{
|
||||
Path = "/media/movies/The Matrix (1999)/The Matrix.mkv",
|
||||
Name = "The Matrix.mkv",
|
||||
ItemType = FileSystemItemType.File,
|
||||
IsExpanded = false,
|
||||
ChildrenLoaded = false,
|
||||
Children = []
|
||||
},
|
||||
new()
|
||||
{
|
||||
Path = "/media/movies/The Matrix (1999)/The Matrix.en.srt",
|
||||
Name = "The Matrix.en.srt",
|
||||
ItemType = FileSystemItemType.File,
|
||||
IsExpanded = false,
|
||||
ChildrenLoaded = false,
|
||||
Children = []
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
},
|
||||
});
|
||||
|
||||
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/directories/get-directory-tree"
|
||||
},
|
||||
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/directories/get-directory-tree"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/directories/get-directory-tree"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Response(403, "The request failed because the provided path does not exist, or the current user doesn't have permission to access it.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
|
||||
title = "General.Failure",
|
||||
status = 403,
|
||||
detail = "UnauthorizedAccess",
|
||||
instance = "/api/v1/directories/get-directory-tree",
|
||||
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-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/directories/get-directory-tree",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -39,7 +39,6 @@ public class GetTreeDirectoriesEndpoint : BaseEndpoint<GetTreeDirectoriesRequest
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Directories.GET_TREE_DIRECTORIES);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+80
-4
@@ -2,6 +2,7 @@
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Common.Enums.FileSystem;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
@@ -22,10 +23,85 @@ public class GetTreeDirectoriesEndpointSummary : Summary<GetTreeDirectoriesEndpo
|
||||
Summary = "Retrieves the directory tree structure for the specified file system path.";
|
||||
Description = "Returns the directory tree structure, with an option to include hidden file system elements.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the directory tree.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not.");
|
||||
ExampleRequest = new GetTreeDirectoriesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: true
|
||||
);
|
||||
RequestExamples.Add(new RequestExample(new GetTreeDirectoriesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: false
|
||||
)));
|
||||
|
||||
Response<IEnumerable<FileSystemTreeNodeResponse>>(200, "The directory tree structure is returned.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
RequestParam(r => r.Path, "The file system path for which to get the directory tree. Required.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
|
||||
Response(200, "The directory tree structure is returned.",
|
||||
example: new FileSystemTreeNodeResponse[] {
|
||||
new() { Path = "/media/movies/The Matrix (1999)/", Name = "The Matrix (1999)", ItemType = FileSystemItemType.Directory, IsExpanded = false, ChildrenLoaded = false, Children = [] },
|
||||
new() { Path = "/media/movies/The Lord of the Rings - The Fellowship of the Ring (2001)/", Name = "The Lord of the Rings - The Fellowship of the Ring (2001)", ItemType = FileSystemItemType.Directory, IsExpanded = false, ChildrenLoaded = false, Children = [] },
|
||||
});
|
||||
|
||||
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/directories/get-tree-directories"
|
||||
},
|
||||
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/directories/get-tree-directories"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/directories/get-tree-directories"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Response(403, "The request failed because the provided path does not exist, or the current user doesn't have permission to access it.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
|
||||
title = "General.Failure",
|
||||
status = 403,
|
||||
detail = "UnauthorizedAccess",
|
||||
instance = "/api/v1/directories/get-tree-directories",
|
||||
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-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/directories/get-tree-directories",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -38,7 +38,6 @@ public class GetDrivesEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Drives.GET_DRIVES);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+37
-1
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Common.Enums.FileSystem;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
@@ -21,6 +22,41 @@ public class GetDrivesEndpointSummary : Summary<GetDrivesEndpoint>
|
||||
Summary = "Retrieves the list of file system drives.";
|
||||
Description = "Returns all available drives in the file system, on Windows, or the root path, on UNIX.";
|
||||
|
||||
Response<IEnumerable<FileSystemTreeNodeResponse>>(200, "The list of file system drives is returned.");
|
||||
|
||||
Response(200, "The list of file system drives is returned.",
|
||||
example: new FileSystemTreeNodeResponse[] {
|
||||
new() { Path = "C:\\", Name = "C:\\", ItemType = FileSystemItemType.Root, IsExpanded = false, ChildrenLoaded = false, Children = [] },
|
||||
new() { Path = "D:\\", Name = "D:\\", ItemType = FileSystemItemType.Root, IsExpanded = false, ChildrenLoaded = false, Children = [] }
|
||||
});
|
||||
|
||||
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/drives/get-drives"
|
||||
},
|
||||
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/drives/get-drives"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/drives/get-drives"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -40,7 +40,6 @@ public class GetTypeEndpoint : BaseEndpoint<EmptyRequest, IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.FileSystem.GET_TYPES);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+36
-2
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.FileSystem;
|
||||
using Lumina.Domain.Common.Enums.FileSystem;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
@@ -10,7 +11,7 @@ namespace Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.FileSystem
|
||||
/// Class used for providing a textual description for the <see cref="GetTypeEndpoint"/> API endpoint, for Swagger.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class GetTypeEndpointSummary : Summary<GetTypeEndpoint>
|
||||
public class GetTypeEndpointSummary : Summary<GetTypeEndpoint, FileSystemTypeResponse>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GetTypeEndpointSummary"/> class.
|
||||
@@ -20,6 +21,39 @@ public class GetTypeEndpointSummary : Summary<GetTypeEndpoint>
|
||||
Summary = "Gets the type of the file system.";
|
||||
Description = "Returns the type of the file system.";
|
||||
|
||||
Response<FileSystemTypeResponse>(200, "The file system type is returned.");
|
||||
Response(200, "The file system type is returned.",
|
||||
example: new FileSystemTypeResponse(
|
||||
PlatformType: PlatformType.Unix
|
||||
));
|
||||
|
||||
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/file-system/get-type"
|
||||
},
|
||||
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/file-system/get-type"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/file-system/get-type"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -39,7 +39,6 @@ public class GetFilesEndpoint : BaseEndpoint<GetFilesRequest, IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Files.GET_FILES);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+81
-4
@@ -2,6 +2,8 @@
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Files;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
@@ -22,10 +24,85 @@ public class GetFilesEndpointSummary : Summary<GetFilesEndpoint, GetFilesRequest
|
||||
Summary = "Retrieves the list of files for a specified file system path.";
|
||||
Description = "Returns the files within the specified path, with an option to include hidden file system elements.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the files.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not.");
|
||||
ExampleRequest = new GetFilesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: true
|
||||
);
|
||||
RequestExamples.Add(new RequestExample(new GetFilesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: false
|
||||
)));
|
||||
|
||||
Response<IEnumerable<FileSystemTreeNodeResponse>>(200, "The list of files is returned.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
RequestParam(r => r.Path, "The file system path for which to get the files. Required.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
|
||||
Response(200, "The list of files is returned.",
|
||||
example: new FileResponse[] {
|
||||
new(Path: "/media/movies/The Matrix (1999)/The Matrix.mkv", Name: "The Matrix.mkv", DateCreated: DateTime.UtcNow, DateModified: DateTime.UtcNow.AddMinutes(-10), Size: 754045401),
|
||||
new(Path: "/media/movies/The Matrix (1999)/The Matrix.en.srt", Name: "The Matrix.en.srt", DateCreated: DateTime.UtcNow, DateModified: DateTime.UtcNow.AddMinutes(-10), Size: 6897)
|
||||
});
|
||||
|
||||
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/files/get-files"
|
||||
},
|
||||
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/files/get-files"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/files/get-files"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Response(403, "The request failed because the provided path does not exist, or the current user doesn't have permission to access it.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
|
||||
title = "General.Failure",
|
||||
status = 403,
|
||||
detail = "UnauthorizedAccess",
|
||||
instance = "/api/v1/files/get-files",
|
||||
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-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/files/get-files",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -39,7 +39,6 @@ public class GetTreeFilesEndpoint : BaseEndpoint<GetTreeFilesRequest, IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Files.GET_TREE_FILES);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+81
-4
@@ -2,6 +2,7 @@
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.Common.Enums.FileSystem;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
@@ -22,10 +23,86 @@ public class GetTreeFilesEndpointSummary : Summary<GetTreeFilesEndpoint, GetTree
|
||||
Summary = "Retrieves the tree structure of files for a specified file system path.";
|
||||
Description = "Returns the files within the specified path in a hierarchical tree structure, with an option to include hidden file system elements.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the tree files.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not.");
|
||||
ExampleRequest = new GetTreeFilesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: true
|
||||
);
|
||||
RequestExamples.Add(new RequestExample(new GetTreeFilesRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: false
|
||||
)));
|
||||
|
||||
Response<IEnumerable<FileSystemTreeNodeResponse>>(200, "The tree structure of files is returned.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
RequestParam(r => r.Path, "The file system path for which to get the tree files. Required.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden file system elements or not. Optional.");
|
||||
|
||||
Response(200, "The tree structure of files is returned.",
|
||||
example: new FileSystemTreeNodeResponse[] {
|
||||
new() { Path = "/media/movies/The Matrix (1999)/The Matrix.mkv", Name = "The Matrix.mkv", ItemType = FileSystemItemType.File, IsExpanded = false, ChildrenLoaded = false, Children = [] },
|
||||
new() { Path = "/media/movies/The Matrix (1999)/The Matrix.en.srt", Name = "The Matrix.en.srt", ItemType = FileSystemItemType.File, IsExpanded = false, ChildrenLoaded = false, Children = [] },
|
||||
new() { Path = "/media/movies/The Matrix (1999)/poster.jpg", Name = "poster.jpg", ItemType = FileSystemItemType.File, IsExpanded = false, ChildrenLoaded = false, Children = [] },
|
||||
});
|
||||
|
||||
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/files/get-tree-files"
|
||||
},
|
||||
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/files/get-tree-files"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/files/get-tree-files"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Response(403, "The request failed because the provided path does not exist, or the current user doesn't have permission to access it.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
|
||||
title = "General.Failure",
|
||||
status = 403,
|
||||
detail = "UnauthorizedAccess",
|
||||
instance = "/api/v1/files/get-tree-files",
|
||||
traceId = "00-a712bbf99ca8ab485f86a762ae5ae74d-b3a2eb78813b0a5d-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/files/get-tree-files",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using Lumina.Application.Common.Mapping.FileSystemManagement.Paths;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
@@ -37,7 +38,6 @@ public class CheckPathExistsEndpoint : BaseEndpoint<CheckPathExistsRequest, IRes
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.CHECK_PATH_EXISTS);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CheckPathExistsEndpoint : BaseEndpoint<CheckPathExistsRequest, IRes
|
||||
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
|
||||
public override async Task<IResult> ExecuteAsync(CheckPathExistsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
PathExistsResponse result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return TypedResults.Ok(result);
|
||||
ErrorOr<PathExistsResponse> result = await _sender.Send(request.ToQuery(), cancellationToken).ConfigureAwait(false);
|
||||
return result.Match(success => TypedResults.Ok(success), Problem);
|
||||
}
|
||||
}
|
||||
+67
-4
@@ -3,6 +3,7 @@ using FastEndpoints;
|
||||
using FastEndpoints.Swagger;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
@@ -22,10 +23,72 @@ public class CheckPathExistsEndpointSummary : Summary<CheckPathExistsEndpoint, C
|
||||
Summary = "Checks the existence of a file system path.";
|
||||
Description = "Verifies if the specified file system path exists, with an option to include hidden elements in the search.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path to check the exitence of.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden elements in the search results, or not.");
|
||||
ExampleRequest = new CheckPathExistsRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: true
|
||||
);
|
||||
RequestExamples.Add(new RequestExample(new CheckPathExistsRequest(
|
||||
Path: "/media/movies/",
|
||||
IncludeHiddenElements: false
|
||||
)));
|
||||
|
||||
Response<PathSegmentResponse>(200, "Indicates whether the file system path exists.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
RequestParam(r => r.Path, "The file system path to check the exitence of. Required.");
|
||||
RequestParam(r => r.IncludeHiddenElements, "Whether to include hidden elements in the search results, or not. Optional.");
|
||||
|
||||
Response(200, "Indicates whether the file system path exists.",
|
||||
example: new PathExistsResponse(
|
||||
Exists: true
|
||||
));
|
||||
|
||||
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/path/check-path-exists"
|
||||
},
|
||||
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/path/check-path-exists"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/path/check-path-exists"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
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/path/check-path-exists",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -38,7 +38,6 @@ public class CombinePathEndpoint : BaseEndpoint<CombinePathRequest, IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.COMBINE);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+63
-4
@@ -2,6 +2,7 @@
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
@@ -21,10 +22,68 @@ public class CombinePathEndpointSummary : Summary<CombinePathEndpoint, CombinePa
|
||||
Summary = "Combines two file system paths.";
|
||||
Description = "Combines the specified original path with a new path to form a single file system path.";
|
||||
|
||||
RequestParam(r => r.OriginalPath, "The file system path to combine to.");
|
||||
RequestParam(r => r.NewPath, "The file system path to combine with.");
|
||||
ExampleRequest = new CombinePathRequest(
|
||||
OriginalPath: "/media",
|
||||
NewPath: "movies"
|
||||
);
|
||||
|
||||
Response<PathSegmentResponse>(200, "Successfully combined the paths.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
RequestParam(r => r.OriginalPath, "The file system path to combine to. Required.");
|
||||
RequestParam(r => r.NewPath, "The file system path to combine with. Required.");
|
||||
|
||||
Response(200, "The combined paths are returned.",
|
||||
example: new PathSegmentResponse(
|
||||
Path: "/media/movies/"
|
||||
));
|
||||
|
||||
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/path/combine"
|
||||
},
|
||||
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/path/combine"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/path/combine"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
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/path/combine",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -39,7 +39,6 @@ public class GetPathParentEndpoint : BaseEndpoint<GetPathParentRequest, IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.GET_PATH_PARENT);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+73
-3
@@ -22,9 +22,79 @@ public class GetPathParentEndpointSummary : Summary<GetPathParentEndpoint, GetPa
|
||||
Summary = "Retrieves the parent directory of the requested file system path.";
|
||||
Description = "Fetches the parent directory of a specified file system path, if available.";
|
||||
|
||||
RequestParam(r => r.Path, "The path for which to get the parent directory.");
|
||||
ExampleRequest = new GetPathParentRequest(
|
||||
Path: "/media/movies/"
|
||||
);
|
||||
|
||||
Response<IEnumerable<PathSegmentResponse>>(200, "The parent directory of the requested path is returned.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
RequestParam(r => r.Path, "The path for which to get the parent directory. Required.");
|
||||
|
||||
Response(200, "The parent directory of the requested path is returned.",
|
||||
example: new PathSegmentResponse[] {
|
||||
new("/"),
|
||||
new("media")
|
||||
});
|
||||
|
||||
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/path/get-path-parent"
|
||||
},
|
||||
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/path/get-path-parent"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/path/get-path-parent"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Response(403, "The request failed because the provided path has no parent.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
|
||||
title = "General.Failure",
|
||||
status = 403,
|
||||
detail = "CannotNavigateUp",
|
||||
instance = "/api/v1/path/get-path-parent",
|
||||
traceId = "00-612a168d318340949b326a8598161059-310ff12684509b92-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/path/get-path-parent",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -38,7 +38,6 @@ public class GetPathRootEndpoint : BaseEndpoint<GetPathRootRequest, IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.GET_PATH_ROOT);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+63
-5
@@ -2,6 +2,7 @@
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
@@ -20,10 +21,67 @@ public class GetPathRootEndpointSummary : Summary<GetPathRootEndpoint, GetPathRo
|
||||
{
|
||||
Summary = "Retrieves a file system path root segment.";
|
||||
Description = "Fetches the root segment of a specified file system path, using the provided path parameter.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the root.");
|
||||
|
||||
Response<PathSegmentResponse>(200, "The root of the requested path is returned.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
|
||||
ExampleRequest = new GetPathRootRequest(
|
||||
Path: "/media/movies/"
|
||||
);
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the root. Required.");
|
||||
|
||||
Response(200, "The root of the requested path is returned.",
|
||||
example: new PathSegmentResponse(
|
||||
Path: "/"
|
||||
));
|
||||
|
||||
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/path/get-path-root"
|
||||
},
|
||||
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/path/get-path-root"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/path/get-path-root"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
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/path/get-path-root",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -35,7 +35,6 @@ public class GetPathSeparatorEndpoint : EndpointWithoutRequest<IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.GET_PATH_SEPARATOR);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+34
-1
@@ -20,6 +20,39 @@ public class GetPathSeparatorEndpointSummary : Summary<GetPathSeparatorEndpoint>
|
||||
Summary = "Retrieves the file system path separator character.";
|
||||
Description = "Fetches the path separator character for the current file system that the API is running on.";
|
||||
|
||||
Response<PathSeparatorResponse>(200, "The path separator character is returned.");
|
||||
Response(200, "The path separator character is returned.",
|
||||
example: new PathSeparatorResponse(
|
||||
Separator: "/"
|
||||
));
|
||||
|
||||
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/path/get-path-separator"
|
||||
},
|
||||
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/path/get-path-separator"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/path/get-path-separator"
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -39,7 +39,6 @@ public class SplitPathEndpoint : BaseEndpoint<SplitPathRequest, IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.SPLIT);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+62
-3
@@ -22,9 +22,68 @@ public class SplitPathEndpointSummary : Summary<SplitPathEndpoint, SplitPathRequ
|
||||
Summary = "Splits a file system path.";
|
||||
Description = "Splits a file system path into its constituent segments.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path for which to get the path segments.");
|
||||
ExampleRequest = new SplitPathRequest(
|
||||
Path: "/media/movies/"
|
||||
);
|
||||
|
||||
Response<IEnumerable<PathSegmentResponse>>(200, "Successfully split the path into segments.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
RequestParam(r => r.Path, "The file system path for which to get the path segments. Required.");
|
||||
|
||||
Response(200, "Successfully split the path into segments.",
|
||||
example: new PathSegmentResponse[2] {
|
||||
new(Path: "media"),
|
||||
new(Path: "movies")
|
||||
});
|
||||
|
||||
|
||||
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/path/split"
|
||||
},
|
||||
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/path/split"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/path/split"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
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/path/split",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -37,7 +37,6 @@ public class ValidatePathEndpoint : BaseEndpoint<ValidatePathRequest, IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Path.VALIDATE);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+61
-3
@@ -2,6 +2,7 @@
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
@@ -21,9 +22,66 @@ public class ValidatePathEndpointSummary : Summary<ValidatePathEndpoint, Validat
|
||||
Summary = "Validates a file system path.";
|
||||
Description = "Checks if the specified file system path is valid according to predefined criteria.";
|
||||
|
||||
RequestParam(r => r.Path, "The file system path to validate.");
|
||||
ExampleRequest = new ValidatePathRequest(
|
||||
Path: "/media/movies/"
|
||||
);
|
||||
|
||||
Response<PathValidResponse>(200, "The requested path is validated.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
RequestParam(r => r.Path, "The file system path to validate. Required.");
|
||||
|
||||
Response(200, "The requested path is validated.",
|
||||
example: new PathValidResponse(
|
||||
IsValid: true
|
||||
));
|
||||
|
||||
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/path/validate"
|
||||
},
|
||||
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/path/validate"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/path/validate"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
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/path/validate",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -40,7 +40,6 @@ public class GetThumbnailEndpoint : BaseEndpoint<GetThumbnailRequest, IResult>
|
||||
Verbs(Http.GET);
|
||||
Routes(ApiRoutes.Thumbnails.GET_THUMBNAIL);
|
||||
Version(1);
|
||||
AllowAnonymous();
|
||||
DontCatchExceptions();
|
||||
}
|
||||
|
||||
|
||||
+73
-3
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Thumbnails;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
@@ -20,10 +21,79 @@ public class GetThumbnailEndpointSummary : Summary<GetThumbnailEndpoint, GetThum
|
||||
Summary = "Retrieves a thumbnail for a specified file.";
|
||||
Description = "Returns a thumbnail image for the specified file, with the option to specify the quality.";
|
||||
|
||||
RequestParam(r => r.Path, "The path of the file for which to get the thumbnail.");
|
||||
ExampleRequest = new GetThumbnailRequest(
|
||||
Path: "/media/contributors/s/patrick_stewart.jpg",
|
||||
Quality: 75
|
||||
);
|
||||
|
||||
RequestParam(r => r.Path, "The path of the file for which to get the thumbnail. Required.");
|
||||
RequestParam(r => r.Quality, "The quality to use for the thumbnail.");
|
||||
|
||||
Response(200, "The thumbnail image for the specified file is returned.");
|
||||
Response<ProblemDetails>(422, "The request did not pass validation checks.", "application/problem+json");
|
||||
Response(200, "The thumbnail image for the specified file is returned.", contentType: "image/*",
|
||||
example: "Binary file content");
|
||||
|
||||
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/thumbnails/get-thumbnail"
|
||||
},
|
||||
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/thumbnails/get-thumbnail"
|
||||
},
|
||||
new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc7235#section-3.1",
|
||||
status = 401,
|
||||
title = "Unauthorized",
|
||||
detail = "The token is invalid",
|
||||
instance = "/api/v1/thumbnails/get-thumbnail"
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Response(403, "The request failed because the provided path does not exist, or the current user doesn't have permission to access it.", "application/problem+json",
|
||||
example: new
|
||||
{
|
||||
type = "https://tools.ietf.org/html/rfc9110#section-15.5.4",
|
||||
title = "General.Failure",
|
||||
status = 403,
|
||||
detail = "UnauthorizedAccess",
|
||||
instance = "/api/v1/thumbnails/get-thumbnail",
|
||||
traceId = "00-9945ec5ab76ade665761d3493dfbafba-7e8bb1005b4ddc50-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/thumbnails/get-thumbnail",
|
||||
errors = new Dictionary<string, string[]>
|
||||
{
|
||||
{
|
||||
"General.Validation", new[]
|
||||
{
|
||||
"PathCannotBeEmpty",
|
||||
"ImageQaulityMustBeBetweenZeroAndOneHundred"
|
||||
}
|
||||
}
|
||||
},
|
||||
traceId = "00-839f81e411d7eb91ed5aa91e56b00bbb-7c8bd5dfabdaf2dc-00"
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user