diff --git a/src/clients/Elsa.Api.Client/Extensions/HeaderExtensions.cs b/src/clients/Elsa.Api.Client/Extensions/HeaderExtensions.cs new file mode 100644 index 0000000000..e23bafce7b --- /dev/null +++ b/src/clients/Elsa.Api.Client/Extensions/HeaderExtensions.cs @@ -0,0 +1,14 @@ +using Elsa.Api.Client.Shared; + +namespace Elsa.Api.Client.Extensions; + +/// +/// Contains extension methods for the class. +/// +public static class HttpResponseMessageExtensions +{ + /// + /// Gets the workflow instance ID from the response. + /// + public static string? GetWorkflowInstanceId(this HttpResponseMessage response) => response.Headers.TryGetValues(HeaderNames.WorkflowInstanceId, out var values) ? values.FirstOrDefault() : default; +} \ No newline at end of file diff --git a/src/clients/Elsa.Api.Client/Shared/HeaderNames.cs b/src/clients/Elsa.Api.Client/Shared/HeaderNames.cs new file mode 100644 index 0000000000..a3c26753c4 --- /dev/null +++ b/src/clients/Elsa.Api.Client/Shared/HeaderNames.cs @@ -0,0 +1,12 @@ +namespace Elsa.Api.Client.Shared; + +/// +/// Contains header names used by the Elsa API. +/// +public static class HeaderNames +{ + /// + /// The name of the header that contains the workflow instance ID. + /// + public const string WorkflowInstanceId = "x-elsa-workflow-instance-id"; +} \ No newline at end of file