Add (bulk) publish/retract ops to API client
This commit is contained in:
parent
9971f94fb8
commit
4c2ae330f2
|
|
@ -61,6 +61,22 @@ public interface IWorkflowDefinitionsApi
|
|||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
[Delete("/workflow-definitions/{definitionId}")]
|
||||
Task DeleteAsync(string definitionId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Publishes a workflow definition.
|
||||
/// </summary>
|
||||
/// <param name="definitionId">The ID of the workflow definition to publish.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
[Post("/workflow-definitions/{definitionId}/publish")]
|
||||
Task<WorkflowDefinition> PublishAsync(string definitionId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Retracts a workflow definition.
|
||||
/// </summary>
|
||||
/// <param name="definitionId">The ID of the workflow definition to retract.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
[Post("/workflow-definitions/{definitionId}/retract")]
|
||||
Task<WorkflowDefinition> RetractAsync(string definitionId, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes many workflow definitions.
|
||||
|
|
@ -78,6 +94,14 @@ public interface IWorkflowDefinitionsApi
|
|||
[Post("/bulk-actions/publish/workflow-definitions/by-definition-ids")]
|
||||
Task<BulkPublishWorkflowDefinitionsResponse> BulkPublishAsync(BulkPublishWorkflowDefinitionsRequest request, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Retracts many workflow definitions.
|
||||
/// </summary>
|
||||
/// <param name="request">The request containing the IDs of the workflow definitions to retract.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
[Post("/bulk-actions/retract/workflow-definitions/by-definition-ids")]
|
||||
Task<BulkRetractWorkflowDefinitionsResponse> BulkRetractAsync(BulkRetractWorkflowDefinitionsRequest request, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Exports a workflow definition.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ namespace Elsa.Api.Client.Resources.WorkflowDefinitions.Models;
|
|||
public class BulkPublishWorkflowDefinitionsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BulkDeleteWorkflowDefinitionsRequest"/> class.
|
||||
/// Initializes a new instance of the <see cref="BulkPublishWorkflowDefinitionsRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="definitionIds">The IDs of the workflow definitions to delete.</param>
|
||||
/// <param name="definitionIds">The IDs of the workflow definitions to publish.</param>
|
||||
public BulkPublishWorkflowDefinitionsRequest(IEnumerable<string> definitionIds)
|
||||
{
|
||||
DefinitionIds = definitionIds.ToArray();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
namespace Elsa.Api.Client.Resources.WorkflowDefinitions.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A request to retract many workflow definitions.
|
||||
/// </summary>
|
||||
public class BulkRetractWorkflowDefinitionsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BulkRetractWorkflowDefinitionsRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="definitionIds">The IDs of the workflow definitions to retract.</param>
|
||||
public BulkRetractWorkflowDefinitionsRequest(IEnumerable<string> definitionIds)
|
||||
{
|
||||
DefinitionIds = definitionIds.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IDs of the workflow definitions to delete.
|
||||
/// </summary>
|
||||
public string[] DefinitionIds { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
namespace Elsa.Api.Client.Resources.WorkflowDefinitions.Models;
|
||||
|
||||
/// <summary>
|
||||
/// The response from a request to publish workflow definitions.
|
||||
/// </summary>
|
||||
public record BulkRetractWorkflowDefinitionsResponse(
|
||||
ICollection<string> Retracted,
|
||||
ICollection<string> AlreadyRetracted,
|
||||
ICollection<string> NotFound);
|
||||
|
|
@ -1,20 +1,25 @@
|
|||
namespace Elsa.Workflows.Api.Endpoints.WorkflowDefinitions.BulkRetract;
|
||||
|
||||
public class Request
|
||||
internal class Request
|
||||
{
|
||||
public ICollection<string> DefinitionIds { get; set; } = default!;
|
||||
}
|
||||
|
||||
public class Response
|
||||
internal class Response
|
||||
{
|
||||
public Response(ICollection<string> retracted, ICollection<string> notPublished, ICollection<string> notFound)
|
||||
public Response(ICollection<string> retracted, ICollection<string> alreadyRetracted, ICollection<string> notFound)
|
||||
{
|
||||
Retracted = retracted;
|
||||
NotPublished = notPublished;
|
||||
AlreadyRetracted = alreadyRetracted;
|
||||
NotPublished = alreadyRetracted;
|
||||
NotFound = notFound;
|
||||
}
|
||||
|
||||
public ICollection<string> Retracted { get; }
|
||||
public ICollection<string> AlreadyRetracted { get; }
|
||||
|
||||
[Obsolete("Use AlreadyRetracted instead")]
|
||||
public ICollection<string> NotPublished { get; }
|
||||
|
||||
public ICollection<string> NotFound { get; }
|
||||
}
|
||||
Loading…
Reference in a new issue