From 771b21b0c152b954b3c7fa5ad2d59d7d7e1c516a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Vasile=20Vu=C8=99can?= Date: Thu, 6 Feb 2025 12:17:58 +0200 Subject: [PATCH 1/3] Exposed HttpClientTimeout setting in ElsaClientBuilderOptions --- .../Elsa.Api.Client/Options/ElsaClientBuilderOptions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/clients/Elsa.Api.Client/Options/ElsaClientBuilderOptions.cs b/src/clients/Elsa.Api.Client/Options/ElsaClientBuilderOptions.cs index 52b0b1b77..debd1c303 100644 --- a/src/clients/Elsa.Api.Client/Options/ElsaClientBuilderOptions.cs +++ b/src/clients/Elsa.Api.Client/Options/ElsaClientBuilderOptions.cs @@ -19,6 +19,11 @@ public class ElsaClientBuilderOptions /// Gets or sets the API key function to use when authenticating with the Elsa server. /// public string? ApiKey { get; set; } + + /// + /// Gets or sets the http client timeout on Elsa server. + /// + public TimeSpan HttpClientTimeout { get; set; } = TimeSpan.FromSeconds(60); /// /// A type that can be used to authenticate with the Elsa server. From 0832fda8ab5217caee6be1c1cf1db6ec257fbf48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Vasile=20Vu=C8=99can?= Date: Thu, 6 Feb 2025 12:19:26 +0200 Subject: [PATCH 2/3] Exposed incidents in the Elsa.Api.Client --- .../Models/ActivityIncident.cs | 51 +++++++++++++++++++ .../WorkflowInstances/Models/WorkflowState.cs | 5 ++ 2 files changed, 56 insertions(+) create mode 100644 src/clients/Elsa.Api.Client/Resources/WorkflowInstances/Models/ActivityIncident.cs diff --git a/src/clients/Elsa.Api.Client/Resources/WorkflowInstances/Models/ActivityIncident.cs b/src/clients/Elsa.Api.Client/Resources/WorkflowInstances/Models/ActivityIncident.cs new file mode 100644 index 000000000..078275008 --- /dev/null +++ b/src/clients/Elsa.Api.Client/Resources/WorkflowInstances/Models/ActivityIncident.cs @@ -0,0 +1,51 @@ +using System.Text.Json.Serialization; + +namespace Elsa.Api.Client.Resources.WorkflowInstances.Models; + +/// +/// Holds information about an activity incident. +/// +public class ActivityIncident +{ + /// + /// Initializes a new instance of the class. + /// + [JsonConstructor] + public ActivityIncident() + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The ID of the activity that caused the incident. + /// The type of the activity that caused the incident. + /// The message of the incident. + /// The exception that caused the incident. + /// The timestamp of the incident. + public ActivityIncident(string activityId, string activityType, string message, ExceptionState? exception, DateTimeOffset timestamp) + { + ActivityId = activityId; + ActivityType = activityType; + Message = message; + Exception = exception; + Timestamp = timestamp; + } + + /// The ID of the activity that caused the incident. + public string ActivityId { get; init; } = default!; + + /// The type of the activity that caused the incident. + public string ActivityType { get; init; } = default!; + + /// The message of the incident. + public string Message { get; init; } = default!; + + /// The exception that caused the incident. + public ExceptionState? Exception { get; init; } + + /// + /// The timestamp of the incident. + /// + public DateTimeOffset Timestamp { get; init; } +} diff --git a/src/clients/Elsa.Api.Client/Resources/WorkflowInstances/Models/WorkflowState.cs b/src/clients/Elsa.Api.Client/Resources/WorkflowInstances/Models/WorkflowState.cs index 1a7c2a7b4..48f1391d8 100644 --- a/src/clients/Elsa.Api.Client/Resources/WorkflowInstances/Models/WorkflowState.cs +++ b/src/clients/Elsa.Api.Client/Resources/WorkflowInstances/Models/WorkflowState.cs @@ -38,6 +38,11 @@ public class WorkflowState : Entity /// public ICollection Bookmarks { get; set; } = new List(); + /// + /// A collection of incidents that may have occurred during execution. + /// + public ICollection Incidents { get; set; } = new List(); + /// /// The serialized workflow state, if any. /// From 23d37c060fede3a8d732e9b53709e4df13813e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Vasile=20Vu=C8=99can?= Date: Thu, 6 Feb 2025 12:49:04 +0200 Subject: [PATCH 3/3] Removed unwanted code --- .../Elsa.Api.Client/Options/ElsaClientBuilderOptions.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/clients/Elsa.Api.Client/Options/ElsaClientBuilderOptions.cs b/src/clients/Elsa.Api.Client/Options/ElsaClientBuilderOptions.cs index debd1c303..52b0b1b77 100644 --- a/src/clients/Elsa.Api.Client/Options/ElsaClientBuilderOptions.cs +++ b/src/clients/Elsa.Api.Client/Options/ElsaClientBuilderOptions.cs @@ -19,11 +19,6 @@ public class ElsaClientBuilderOptions /// Gets or sets the API key function to use when authenticating with the Elsa server. /// public string? ApiKey { get; set; } - - /// - /// Gets or sets the http client timeout on Elsa server. - /// - public TimeSpan HttpClientTimeout { get; set; } = TimeSpan.FromSeconds(60); /// /// A type that can be used to authenticate with the Elsa server.