feat(api): discovery endpoints for node types + connection providers
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
using VolcanicCore.Api.Registries;
|
||||
|
||||
namespace VolcanicCore.Api.Endpoints;
|
||||
|
||||
public static class ConnectionProvidersEndpoints
|
||||
{
|
||||
public static void MapConnectionProvidersEndpoints(this IEndpointRouteBuilder app)
|
||||
{
|
||||
app.MapGet("/api/connection-providers", (ConnectionProviderRegistry reg) =>
|
||||
Results.Ok(reg.All.Select(p => new
|
||||
{
|
||||
id = p.Id,
|
||||
displayName = p.DisplayName,
|
||||
configSchema = p.ConfigSchema.Root,
|
||||
})))
|
||||
.RequireAuthorization();
|
||||
}
|
||||
}
|
||||
22
src/VolcanicCore.Api/Endpoints/NodeTypesEndpoints.cs
Normal file
22
src/VolcanicCore.Api/Endpoints/NodeTypesEndpoints.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using VolcanicCore.Api.Registries;
|
||||
|
||||
namespace VolcanicCore.Api.Endpoints;
|
||||
|
||||
public static class NodeTypesEndpoints
|
||||
{
|
||||
public static void MapNodeTypesEndpoints(this IEndpointRouteBuilder app)
|
||||
{
|
||||
app.MapGet("/api/node-types", (NodeRegistry reg) =>
|
||||
Results.Ok(reg.All.Select(n => new
|
||||
{
|
||||
id = n.Id,
|
||||
displayName = n.DisplayName,
|
||||
category = n.Category.ToString(),
|
||||
inputCount = n.InputCount,
|
||||
outputCount = n.OutputCount,
|
||||
connectionProviderId = n.ConnectionProviderId,
|
||||
configSchema = n.ConfigSchema.Root,
|
||||
})))
|
||||
.RequireAuthorization();
|
||||
}
|
||||
}
|
||||
@@ -91,6 +91,8 @@ using (var scope = app.Services.CreateScope())
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.MapSessionEndpoints();
|
||||
app.MapNodeTypesEndpoints();
|
||||
app.MapConnectionProvidersEndpoints();
|
||||
|
||||
app.MapGet("/api/health", () => Results.Ok(new { ok = true }));
|
||||
app.Run();
|
||||
|
||||
Reference in New Issue
Block a user