Merge pull request #6377 from elsa-workflows/feature/incidents-main

Exposed incidents in the Elsa.Api.Client
This commit is contained in:
Sipke Schoorstra 2025-02-06 12:04:27 +01:00 committed by GitHub
commit 8a309e64ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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>