Files
Regression-Testing/SpeckleAutomateDotnetExample/AutomateFunction.cs
T
Claire Kuang cc84d5c4a1 Initial commit
2024-01-28 14:26:24 +00:00

30 lines
818 B
C#

using Objects;
using Objects.Geometry;
using Speckle.Automate.Sdk;
using Speckle.Core.Logging;
using Speckle.Core.Models.Extensions;
static class AutomateFunction
{
public static async Task Run(
AutomationContext automationContext,
FunctionInputs functionInputs
)
{
Console.WriteLine("Starting execution");
_ = typeof(ObjectsKit).Assembly; // INFO: Force objects kit to initialize
Console.WriteLine("Receiving version");
var commitObject = await automationContext.ReceiveVersion();
Console.WriteLine("Received version: " + commitObject);
var count = commitObject
.Flatten()
.Count(b => b.speckle_type == functionInputs.SpeckleTypeToCount);
Console.WriteLine($"Counted {count} objects");
automationContext.MarkRunSuccess($"Counted {count} objects");
}
}