Implemented post patch and put call body to be able to parse from model
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
This commit is contained in:
@@ -76,7 +76,8 @@ namespace Nodify.Calculator.NodeHandlers
|
||||
{
|
||||
Title = info.Title,
|
||||
OperationType = (info.OPType ?? "GET").ToUpper(),
|
||||
ResponseModelClassName = info.ResponseModelClassName ?? string.Empty
|
||||
ResponseModelClassName = info.ResponseModelClassName ?? string.Empty,
|
||||
RequestBodyModelClassName = info.RequestBodyModelClassName ?? string.Empty
|
||||
};
|
||||
|
||||
// Flow connectors
|
||||
@@ -109,7 +110,35 @@ namespace Nodify.Calculator.NodeHandlers
|
||||
});
|
||||
}
|
||||
|
||||
// Data inputs
|
||||
// Request body input (for POST/PUT/PATCH)
|
||||
var httpMethod = (info.OPType ?? "").ToUpper();
|
||||
if (httpMethod == "POST" || httpMethod == "PUT" || httpMethod == "PATCH")
|
||||
{
|
||||
if (!string.IsNullOrEmpty(info.RequestBodyModelClassName))
|
||||
{
|
||||
var bc = info.RequestBodyModelClassName;
|
||||
bool isList = bc.StartsWith("List<") && bc.EndsWith(">");
|
||||
op.Input.Add(new ConnectorViewModel
|
||||
{
|
||||
Title = $"Body ({bc})",
|
||||
Shape = isList ? ConnectorShape.Grid : ConnectorShape.Square,
|
||||
ConnectorColor = isList ? Color.MediumSpringGreen : Color.MediumPurple,
|
||||
DataType = bc
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
op.Input.Add(new ConnectorViewModel
|
||||
{
|
||||
Title = "Body",
|
||||
Shape = ConnectorShape.Circle,
|
||||
ConnectorColor = Color.LimeGreen,
|
||||
DataType = "object"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Other data inputs (query/path params)
|
||||
foreach (var label in info.Input)
|
||||
{
|
||||
op.Input.Add(new ConnectorViewModel { Title = label, ConnectorColor = Color.LimeGreen });
|
||||
@@ -124,12 +153,16 @@ namespace Nodify.Calculator.NodeHandlers
|
||||
Title = data.Title,
|
||||
OPType = data.OPType?.ToLower() ?? "get",
|
||||
Type = OperationType.API,
|
||||
ResponseModelClassName = data.ResponseModelClassName ?? string.Empty
|
||||
ResponseModelClassName = data.ResponseModelClassName ?? string.Empty,
|
||||
RequestBodyModelClassName = data.RequestBodyModelClassName ?? string.Empty
|
||||
};
|
||||
// Restore only query/path param inputs (skip flow triangles and body connectors)
|
||||
foreach (var ic in data.InputConnectors)
|
||||
{
|
||||
if (ic.Shape != "Triangle")
|
||||
info.Input.Add(ic.Title);
|
||||
if (ic.Shape == "Triangle") continue;
|
||||
if (ic.Shape == "Square" || ic.Shape == "Grid") continue; // body model connector
|
||||
if ((ic.Title ?? "").StartsWith("Body")) continue;
|
||||
info.Input.Add(ic.Title);
|
||||
}
|
||||
return Create(info);
|
||||
}
|
||||
@@ -141,6 +174,7 @@ namespace Nodify.Calculator.NodeHandlers
|
||||
{
|
||||
data.OPType = api.OperationType;
|
||||
data.ResponseModelClassName = api.ResponseModelClassName;
|
||||
data.RequestBodyModelClassName = api.RequestBodyModelClassName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user