Add Activity Executions API client
This commit is contained in:
parent
a2a2b60d05
commit
3538d24147
|
|
@ -0,0 +1,30 @@
|
|||
using Elsa.Api.Client.Resources.ActivityExecutions.Models;
|
||||
using Elsa.Api.Client.Resources.ActivityExecutions.Requests;
|
||||
using Elsa.Api.Client.Shared.Models;
|
||||
using Refit;
|
||||
|
||||
namespace Elsa.Api.Client.Resources.ActivityExecutions.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a client for the activity executions API.
|
||||
/// </summary>
|
||||
public interface IActivityExecutionsApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a report of activity executions for a given workflow instance.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="cancellationToken">An optional cancellation token.</param>
|
||||
/// <returns>The response containing the activity execution report.</returns>
|
||||
[Post("/activity-executions/report")]
|
||||
Task<ActivityExecutionReport> GetReportAsync([Body] GetActivityExecutionReportRequest request, CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Lists activity executions for a given activity in a workflow instance.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="cancellationToken">An optional cancellation token.</param>
|
||||
/// <returns>The response containing a list of activity executions.</returns>
|
||||
[Get("/activity-executions/list")]
|
||||
Task<ListResponse<ActivityExecutionRecord>> ListAsync(ListActivityExecutionsRequest request, CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
using Elsa.Api.Client.Resources.ActivityExecutions.Models;
|
||||
using Elsa.Api.Client.Resources.ActivityExecutions.Requests;
|
||||
using Refit;
|
||||
|
||||
namespace Elsa.Api.Client.Resources.ActivityExecutions.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a client for the activity executions API.
|
||||
/// </summary>
|
||||
public interface IActivityExecutionsApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends the specified request to the API.
|
||||
/// </summary>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The response.</returns>
|
||||
[Post("/activity-executions/report")]
|
||||
Task<ActivityExecutionReport> GetReportAsync([Body] GetActivityExecutionReportRequest request, CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
|
@ -18,9 +18,24 @@ public class ActivityExecutionRecord : Entity
|
|||
public string ActivityId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the activity type version.
|
||||
/// The type of the activity.
|
||||
/// </summary>
|
||||
public int Version { get; set; }
|
||||
public string ActivityType { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The version of the activity type.
|
||||
/// </summary>
|
||||
public int ActivityTypeVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the activity.
|
||||
/// </summary>
|
||||
public string? ActivityName { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The state of the activity at the time this record is created or last updated.
|
||||
/// </summary>
|
||||
public IDictionary<string, object>? ActivityState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time at which the activity execution began.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
namespace Elsa.Api.Client.Resources.ActivityExecutions.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request for a list of activity execution log records for a given activity in a workflow instance.
|
||||
/// Represents a request for a list of activity execution records for a given activity in a workflow instance.
|
||||
/// </summary>
|
||||
public class GetActivityExecutionReportRequest
|
||||
{
|
||||
|
|
@ -11,7 +11,7 @@ public class GetActivityExecutionReportRequest
|
|||
public string WorkflowInstanceId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the activity to get the execution record for.
|
||||
/// The IDs of the activities to get the execution record for.
|
||||
/// </summary>
|
||||
public ICollection<string> ActivityIds { get; set; } = new List<string>();
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using Refit;
|
||||
|
||||
namespace Elsa.Api.Client.Resources.ActivityExecutions.Requests;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a request for a list of activity execution records for a given activity in a workflow instance.
|
||||
/// </summary>
|
||||
public class ListActivityExecutionsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// The ID of the workflow instance to get the execution log for.
|
||||
/// </summary>
|
||||
[Query]
|
||||
public string WorkflowInstanceId { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the activity to get the execution record for.
|
||||
/// </summary>
|
||||
[Query]
|
||||
public string ActivityId { get; set; } = default!;
|
||||
}
|
||||
Loading…
Reference in a new issue