diff --git a/Automate/Speckle.Automate.Sdk/AutomationContext.cs b/Automate/Speckle.Automate.Sdk/AutomationContext.cs index 2d99d5823a..6d64d4a812 100644 --- a/Automate/Speckle.Automate.Sdk/AutomationContext.cs +++ b/Automate/Speckle.Automate.Sdk/AutomationContext.cs @@ -369,6 +369,20 @@ public void AttachInfoToObjects( Dictionary? visualOverrides = null ) => AttachResultToObjects(ObjectResultLevel.Info, category, objectIds, message, metadata, visualOverrides); + /// + /// Add a new success case to the run results. + /// If the success cause has already created a success case, + /// the case will be extended with a new case referring to the causing objects. + /// + /// + public void AttachSuccessToObjects( + string category, + IEnumerable objectIds, + string? message = null, + Dictionary? metadata = null, + Dictionary? visualOverrides = null + ) => AttachResultToObjects(ObjectResultLevel.Success, category, objectIds, message, metadata, visualOverrides); + /// /// Add a new case to the run results. /// If the cause has already created an case with equal level, diff --git a/Automate/Speckle.Automate.Sdk/Schema/ObjectResultLevel.cs b/Automate/Speckle.Automate.Sdk/Schema/ObjectResultLevel.cs index b868f67880..4eaf7b2c6e 100644 --- a/Automate/Speckle.Automate.Sdk/Schema/ObjectResultLevel.cs +++ b/Automate/Speckle.Automate.Sdk/Schema/ObjectResultLevel.cs @@ -2,6 +2,7 @@ namespace Speckle.Automate.Sdk.Schema; public enum ObjectResultLevel { + Success, Info, Warning, Error diff --git a/Automate/Speckle.Automate.Sdk/Schema/ObjectResultLevelMapping.cs b/Automate/Speckle.Automate.Sdk/Schema/ObjectResultLevelMapping.cs index 9a35718173..24b3d8d03d 100644 --- a/Automate/Speckle.Automate.Sdk/Schema/ObjectResultLevelMapping.cs +++ b/Automate/Speckle.Automate.Sdk/Schema/ObjectResultLevelMapping.cs @@ -2,6 +2,7 @@ namespace Speckle.Automate.Sdk.Schema; public abstract class ObjectResultLevelMapping { + private const string SUCCESS = "SUCCESS"; private const string INFO = "INFO"; private const string WARNING = "WARNING"; private const string ERROR = "ERROR"; @@ -12,6 +13,7 @@ public static string Get(ObjectResultLevel level) => ObjectResultLevel.Error => ERROR, ObjectResultLevel.Warning => WARNING, ObjectResultLevel.Info => INFO, + ObjectResultLevel.Success => SUCCESS, _ => throw new ArgumentOutOfRangeException($"Not valid value for enum {level}") }; }