Exposed incidents in the Elsa.Api.Client

This commit is contained in:
Marius Vasile Vușcan 2025-02-06 12:19:26 +02:00
parent 771b21b0c1
commit 0832fda8ab
No known key found for this signature in database
GPG key ID: E0EC75631D902E06
2 changed files with 56 additions and 0 deletions

View file

@ -0,0 +1,51 @@
using System.Text.Json.Serialization;
namespace Elsa.Api.Client.Resources.WorkflowInstances.Models;
/// <summary>
/// Holds information about an activity incident.
/// </summary>
public class ActivityIncident
{
/// <summary>
/// Initializes a new instance of the <see cref="ActivityIncident"/> class.
/// </summary>
[JsonConstructor]
public ActivityIncident()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ActivityIncident"/> class.
/// </summary>
/// <param name="activityId">The ID of the activity that caused the incident.</param>
/// <param name="activityType">The type of the activity that caused the incident.</param>
/// <param name="message">The message of the incident.</param>
/// <param name="exception">The exception that caused the incident.</param>
/// <param name="timestamp">The timestamp of the incident.</param>
public ActivityIncident(string activityId, string activityType, string message, ExceptionState? exception, DateTimeOffset timestamp)
{
ActivityId = activityId;
ActivityType = activityType;
Message = message;
Exception = exception;
Timestamp = timestamp;
}
/// <summary>The ID of the activity that caused the incident.</summary>
public string ActivityId { get; init; } = default!;
/// <summary>The type of the activity that caused the incident.</summary>
public string ActivityType { get; init; } = default!;
/// <summary>The message of the incident.</summary>
public string Message { get; init; } = default!;
/// <summary>The exception that caused the incident.</summary>
public ExceptionState? Exception { get; init; }
/// <summary>
/// The timestamp of the incident.
/// </summary>
public DateTimeOffset Timestamp { get; init; }
}

View file

@ -38,6 +38,11 @@ public class WorkflowState : Entity
/// </summary>
public ICollection<Bookmark> Bookmarks { get; set; } = new List<Bookmark>();
/// <summary>
/// A collection of incidents that may have occurred during execution.
/// </summary>
public ICollection<ActivityIncident> Incidents { get; set; } = new List<ActivityIncident>();
/// <summary>
/// The serialized workflow state, if any.
/// </summary>