Skip to content

Commit 8660f59

Browse files
committed
Add Getting list of workflow execution tasks
#49
1 parent c1dc60d commit 8660f59

File tree

4 files changed

+52
-7
lines changed

4 files changed

+52
-7
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace FlowSynx.Client.Messages.Requests.Workflows;
2+
3+
public class WorkflowExecutionTasksRequest
4+
{
5+
public required Guid WorkflowId { get; set; }
6+
public required Guid WorkflowExecutionId { get; set; }
7+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace FlowSynx.Client.Messages.Responses.Workflows;
2+
3+
public class WorkflowExecutionTasksResponse
4+
{
5+
public Guid Id { get; set; }
6+
public string Name { get; set; } = string.Empty;
7+
public Guid WorkflowId { get; set; }
8+
public Guid WorkflowExecutionId { get; set; }
9+
public string? Status { get; set; }
10+
public string? Message { get; set; }
11+
public DateTime? StartTime { get; set; }
12+
public DateTime? EndTime { get; set; }
13+
}

src/FlowSynx.Client/Services/IWorkflowsService.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Task<HttpResult<Result<IEnumerable<WorkflowExecutionListResponse>>>> ExecutionsA
7373
/// <param name="request">The request specifying which workflow to execute and with what parameters.</param>
7474
/// <param name="cancellationToken">Token to cancel the asynchronous operation.</param>
7575
/// <returns>A result indicating the execution status.</returns>
76-
Task<HttpResult<Result<Unit>>> ExecuteAsync(
76+
Task<HttpResult<Result<Guid>>> ExecuteAsync(
7777
ExecuteWorkflowRequest request,
7878
CancellationToken cancellationToken = default);
7979

@@ -137,6 +137,16 @@ Task<HttpResult<Result<WorkflowExecutionLogsResponse>>> ExecutionsLogsAsync(
137137
WorkflowExecutionLogsRequest request,
138138
CancellationToken cancellationToken = default);
139139

140+
/// <summary>
141+
/// Retrieves the list of execution tasks for a given workflow execution.
142+
/// </summary>
143+
/// <param name="request">The request object containing workflow execution identifiers associated tasks.</param>
144+
/// <param name="cancellationToken">A token that can be used to cancel the asynchronous operation.</param>
145+
/// <returns>A result containing list of execution tasks.</returns>
146+
Task<HttpResult<Result<IEnumerable<WorkflowExecutionTasksResponse>>>> ExecutionTasksAsync(
147+
WorkflowExecutionTasksRequest request,
148+
CancellationToken cancellationToken = default);
149+
140150
/// <summary>
141151
/// Retrieves details of a specific task within a workflow execution.
142152
/// </summary>

src/FlowSynx.Client/Services/WorkflowsService.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public async Task<HttpResult<Result<IEnumerable<WorkflowExecutionListResponse>>>
9898
.SendRequestAsync<Result<IEnumerable<WorkflowExecutionListResponse>>>(requestMessage, cancellationToken);
9999
}
100100

101-
public async Task<HttpResult<Result<Unit>>> ExecuteAsync(
101+
public async Task<HttpResult<Result<Guid>>> ExecuteAsync(
102102
ExecuteWorkflowRequest request,
103103
CancellationToken cancellationToken = default)
104104
{
@@ -109,7 +109,7 @@ public async Task<HttpResult<Result<Unit>>> ExecuteAsync(
109109
};
110110

111111
return await _httpRequestHandler
112-
.SendRequestAsync<Result<Unit>>(requestMessage, cancellationToken);
112+
.SendRequestAsync<Result<Guid>>(requestMessage, cancellationToken);
113113
}
114114

115115
public async Task<HttpResult<Result<WorkflowExecutionDetailsResponse>>> ExecutionsDetailsAsync(
@@ -181,8 +181,8 @@ public async Task<HttpResult<Result<Unit>>> RejectExecutionsAsync(
181181
{
182182
HttpMethod = HttpMethod.Post,
183183
Uri = $"workflows/{request.WorkflowId.ToString()}/" +
184-
$"executions/{request.WorkflowExecutionId.ToString()}/" +
185-
$"approvals/{request.WorkflowExecutionApprovalId.ToString()}/reject"
184+
$"executions/{request.WorkflowExecutionId.ToString()}/" +
185+
$"approvals/{request.WorkflowExecutionApprovalId.ToString()}/reject"
186186
};
187187

188188
return await _httpRequestHandler
@@ -203,6 +203,21 @@ public async Task<HttpResult<Result<WorkflowExecutionLogsResponse>>> ExecutionsL
203203
.SendRequestAsync<Result<WorkflowExecutionLogsResponse>>(requestMessage, cancellationToken);
204204
}
205205

206+
public async Task<HttpResult<Result<IEnumerable<WorkflowExecutionTasksResponse>>>> ExecutionTasksAsync(
207+
WorkflowExecutionTasksRequest request,
208+
CancellationToken cancellationToken = default)
209+
{
210+
var requestMessage = new Request
211+
{
212+
HttpMethod = HttpMethod.Get,
213+
Uri = $"workflows/{request.WorkflowId.ToString()}/" +
214+
$"executions/{request.WorkflowExecutionId.ToString()}/tasks"
215+
};
216+
217+
return await _httpRequestHandler
218+
.SendRequestAsync<Result<IEnumerable<WorkflowExecutionTasksResponse>>>(requestMessage, cancellationToken);
219+
}
220+
206221
public async Task<HttpResult<Result<WorkflowTaskExecutionDetailsResponse>>> TaskExecutionDetailsAsync(
207222
WorkflowTaskExecutionDetailsRequest request,
208223
CancellationToken cancellationToken = default)
@@ -212,7 +227,7 @@ public async Task<HttpResult<Result<WorkflowTaskExecutionDetailsResponse>>> Task
212227
HttpMethod = HttpMethod.Get,
213228
Uri = $"workflows/{request.WorkflowId.ToString()}/" +
214229
$"executions/{request.WorkflowExecutionId.ToString()}/" +
215-
$"task/{request.WorkflowTaskExecutionId.ToString()}"
230+
$"tasks/{request.WorkflowTaskExecutionId.ToString()}"
216231
};
217232

218233
return await _httpRequestHandler
@@ -228,7 +243,7 @@ public async Task<HttpResult<Result<IEnumerable<WorkflowTaskExecutionLogsRespons
228243
HttpMethod = HttpMethod.Get,
229244
Uri = $"workflows/{request.WorkflowId.ToString()}/" +
230245
$"executions/{request.WorkflowExecutionId.ToString()}/" +
231-
$"task/{request.WorkflowTaskExecutionId.ToString()}/" +
246+
$"tasks/{request.WorkflowTaskExecutionId.ToString()}/" +
232247
$"logs"
233248
};
234249

0 commit comments

Comments
 (0)