Update API client with support for saving workflow definitions
This commit is contained in:
parent
183e2bc0a3
commit
3f979a9f19
|
|
@ -30,6 +30,15 @@ public interface IWorkflowDefinitionsApi
|
|||
[Get("/workflow-definitions/{definitionId}?versionOptions={VersionOptions}&includeCompositeRoot={includeCompositeRoot}")]
|
||||
Task<WorkflowDefinition?> GetAsync(string definitionId, VersionOptions? versionOptions = default, bool includeCompositeRoot = false, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Saves a workflow definition.
|
||||
/// </summary>
|
||||
/// <param name="request">The request containing the workflow definition to save.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The workflow definition.</returns>
|
||||
[Post("/workflow-definitions")]
|
||||
Task<WorkflowDefinition> SaveAsync(SaveWorkflowDefinitionRequest request, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a workflow definition.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
namespace Elsa.Api.Client.Resources.WorkflowDefinitions.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a request to save a workflow definition.
|
||||
/// </summary>
|
||||
public class SaveWorkflowDefinitionRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// The workflow definition to save.
|
||||
/// </summary>
|
||||
public WorkflowDefinitionModel Model { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the workflow definition should be published.
|
||||
/// </summary>
|
||||
public bool? Publish { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
namespace Elsa.Api.Client.Resources.WorkflowDefinitions.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Stores information about a workflow variable.
|
||||
/// </summary>
|
||||
public class VariableDefinition
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string TypeName { get; set; }
|
||||
public bool IsArray { get; set; }
|
||||
public string? Value { get; set; }
|
||||
public string? StorageDriverTypeName { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
using System.Text.Json;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Elsa.Api.Client.Resources.WorkflowDefinitions.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a serializable workflow definition.
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <param name="DefinitionId"></param>
|
||||
/// <param name="Name"></param>
|
||||
/// <param name="Description"></param>
|
||||
/// <param name="CreatedAt"></param>
|
||||
/// <param name="Version"></param>
|
||||
/// <param name="Variables"></param>
|
||||
/// <param name="Inputs"></param>
|
||||
/// <param name="Outputs"></param>
|
||||
/// <param name="Outcomes"></param>
|
||||
/// <param name="CustomProperties"></param>
|
||||
/// <param name="IsReadonly"></param>
|
||||
/// <param name="IsLatest"></param>
|
||||
/// <param name="IsPublished"></param>
|
||||
/// <param name="Options">The type of <c>IWorkflowActivationStrategy</c> to apply when new instances are requested to be created.</param>
|
||||
/// <param name="Root"></param>
|
||||
[PublicAPI]
|
||||
public record WorkflowDefinitionModel(
|
||||
string Id,
|
||||
string DefinitionId,
|
||||
string? Name,
|
||||
string? Description,
|
||||
DateTimeOffset CreatedAt,
|
||||
int Version,
|
||||
ICollection<VariableDefinition>? Variables,
|
||||
ICollection<InputDefinition>? Inputs,
|
||||
ICollection<OutputDefinition>? Outputs,
|
||||
ICollection<string>? Outcomes,
|
||||
IDictionary<string, object>? CustomProperties,
|
||||
bool IsReadonly,
|
||||
bool IsLatest,
|
||||
bool IsPublished,
|
||||
WorkflowOptions? Options,
|
||||
JsonElement? Root
|
||||
)
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public WorkflowDefinitionModel() : this(
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!,
|
||||
default!)
|
||||
{
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue