Skip to content

Commit

Permalink
Merge pull request #6377 from elsa-workflows/feature/incidents-main
Browse files Browse the repository at this point in the history
Exposed incidents in the Elsa.Api.Client
  • Loading branch information
sfmskywalker authored Feb 6, 2025
2 parents bce31b6 + 59849bc commit 8a309e6
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 8a309e6

Please sign in to comment.