diff --git a/src/clients/Elsa.Api.Client/Helpers/RefitSettingsHelper.cs b/src/clients/Elsa.Api.Client/Helpers/RefitSettingsHelper.cs index fafd23891..b5e5de3c5 100644 --- a/src/clients/Elsa.Api.Client/Helpers/RefitSettingsHelper.cs +++ b/src/clients/Elsa.Api.Client/Helpers/RefitSettingsHelper.cs @@ -1,9 +1,6 @@ using System.Text.Json; using System.Text.Json.Serialization; -using System.Text.Json.Serialization.Metadata; using Elsa.Api.Client.Converters; -using Elsa.Api.Client.Resources.Alterations.Contracts; -using Elsa.Api.Client.Resources.Alterations.Models; using Refit; namespace Elsa.Api.Client; @@ -36,30 +33,7 @@ public static class RefitSettingsHelper options.Converters.Add(new JsonStringEnumConverter()); options.Converters.Add(new VersionOptionsJsonConverter()); options.Converters.Add(new TypeJsonConverter()); - - var alterationTypes = new[] { typeof(Cancel) }; - - options.TypeInfoResolver = new DefaultJsonTypeInfoResolver() - .WithAddedModifier(typeInfo => - { - if (typeInfo.Type != typeof(IAlteration)) - return; - - if (typeInfo.Kind != JsonTypeInfoKind.Object) - return; - - var polymorphismOptions = new JsonPolymorphismOptions { TypeDiscriminatorPropertyName = "type" }; - - foreach (var alterationType in alterationTypes.ToList()) - { - polymorphismOptions.DerivedTypes.Add(new(alterationType, alterationType.Name)); - } - - typeInfo.PolymorphismOptions = polymorphismOptions; - }); - - configureJsonSerializerOptions?.Invoke(serviceProvider, options); - + return options; } } \ No newline at end of file diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Contracts/IAlteration.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Contracts/IAlteration.cs deleted file mode 100644 index 0ce1f7a50..000000000 --- a/src/clients/Elsa.Api.Client/Resources/Alterations/Contracts/IAlteration.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Elsa.Api.Client.Resources.Alterations.Contracts; - -/// -/// Marker interface for all alteration classes -/// -public interface IAlteration; \ No newline at end of file diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationBase.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationBase.cs deleted file mode 100644 index 18615eca9..000000000 --- a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationBase.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Elsa.Api.Client.Resources.Alterations.Contracts; - -namespace Elsa.Api.Client.Resources.Alterations.Models; - -/// -/// A base class for all IAlterations. -/// -public abstract class AlterationBase : IAlteration; \ No newline at end of file diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationPlan.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationPlan.cs index 993858cf5..dd5843d5f 100644 --- a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationPlan.cs +++ b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationPlan.cs @@ -1,4 +1,4 @@ -using Elsa.Api.Client.Resources.Alterations.Contracts; +using System.Text.Json.Nodes; using Elsa.Api.Client.Resources.Alterations.Enums; using Elsa.Api.Client.Shared.Models; @@ -12,7 +12,7 @@ public class AlterationPlan : Entity /// /// The alterations to be applied. /// - public ICollection Alterations { get; set; } = new List(); + public ICollection Alterations { get; set; } = new List(); /// /// The IDs of the workflow instances that this plan applies to. diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationPlanParams.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationPlanParams.cs index f9fc5a1c1..893aa89e6 100644 --- a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationPlanParams.cs +++ b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/AlterationPlanParams.cs @@ -1,4 +1,4 @@ -using Elsa.Api.Client.Resources.Alterations.Contracts; +using System.Text.Json.Nodes; namespace Elsa.Api.Client.Resources.Alterations.Models; @@ -15,7 +15,7 @@ public class AlterationPlanParams /// /// The alterations to be applied. /// - public ICollection Alterations { get; set; } = new List(); + public ICollection Alterations { get; set; } = new List(); /// /// The IDs of the workflow instances that this plan applies to. diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/Cancel.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/Cancel.cs deleted file mode 100644 index 45b2c836d..000000000 --- a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/Cancel.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Elsa.Api.Client.Resources.Alterations.Models; - -/// -/// Cancels the workflow instances in an alteration plan. -/// -public class Cancel : AlterationBase; \ No newline at end of file diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/CancelActivity.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/CancelActivity.cs deleted file mode 100644 index 2500e7d97..000000000 --- a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/CancelActivity.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Elsa.Api.Client.Resources.Alterations.Models; - -/// -/// Cancels a workflow instance activity during an alteration -/// -public class CancelActivity : AlterationBase -{ - /// - /// The ID of the activity to be cancelled. If not specified, the activity instance ID will be used. - /// - public string? ActivityId { get; set; } - - /// - /// The ID of the activity instance to be cancelled. If specified, overrides . - /// - public string? ActivityInstanceId { get; set; } -} \ No newline at end of file diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/Migrate.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/Migrate.cs deleted file mode 100644 index 1a4dc3b69..000000000 --- a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/Migrate.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Elsa.Api.Client.Resources.Alterations.Models; - -/// -/// Migrates a workflow instance to a newer version in an alteration. -/// -public class Migrate : AlterationBase -{ - /// - /// The target version to upgrade to. - /// - public int TargetVersion { get; set; } -} \ No newline at end of file diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/ModifyVariable.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/ModifyVariable.cs deleted file mode 100644 index 60ab9f6ba..000000000 --- a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/ModifyVariable.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Elsa.Api.Client.Resources.Alterations.Models; - -/// -/// Modifies a variable in a workflow instance alteration -/// -public class ModifyVariable : AlterationBase -{ - /// - /// The ID of the variable to modify. - /// - public string VariableId { get; set; } = default!; - - /// - /// The new value of the variable. - /// - public object? Value { get; set; } - -} \ No newline at end of file diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/ScheduleActivity.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Models/ScheduleActivity.cs deleted file mode 100644 index 2b0f77f6d..000000000 --- a/src/clients/Elsa.Api.Client/Resources/Alterations/Models/ScheduleActivity.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Elsa.Api.Client.Resources.Alterations.Models; - -/// -/// Schedules an activity for execution in an alteration. -/// -public class ScheduleActivity : AlterationBase -{ - /// - /// The ID of the next activity to be scheduled. If not specified, the ActivityInstanceId will be used. - /// - public string? ActivityId { get; set; } - - /// - /// The ID of the activity instance to be scheduled. If not specified, the ActivityId will be used. - /// - public string? ActivityInstanceId { get; set; } -} \ No newline at end of file diff --git a/src/clients/Elsa.Api.Client/Resources/Alterations/Responses/RunRequest.cs b/src/clients/Elsa.Api.Client/Resources/Alterations/Responses/RunRequest.cs index fdaf341e8..0d9995712 100644 --- a/src/clients/Elsa.Api.Client/Resources/Alterations/Responses/RunRequest.cs +++ b/src/clients/Elsa.Api.Client/Resources/Alterations/Responses/RunRequest.cs @@ -1,4 +1,4 @@ -using Elsa.Api.Client.Resources.Alterations.Contracts; +using System.Text.Json.Nodes; namespace Elsa.Api.Client.Resources.Alterations.Responses; @@ -10,7 +10,7 @@ public class RunRequest /// /// The alterations to be applied. /// - public ICollection Alterations { get; set; } = new List(); + public ICollection Alterations { get; set; } = new List(); /// /// The IDs of the workflow instances that this plan applies to.