listWorkflowRuns method

Future<ListWorkflowRunsResponse> listWorkflowRuns({
  1. required String workflowDefinitionName,
  2. int? maxResults,
  3. String? nextToken,
  4. SortOrder? sortOrder,
})

Lists all workflow runs for a specific workflow definition with optional filtering and pagination.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter workflowDefinitionName : The name of the workflow definition to list workflow runs for.

Parameter maxResults : The maximum number of workflow runs to return in a single response.

Parameter nextToken : The token for retrieving the next page of results.

Parameter sortOrder : The sort order for the returned workflow runs (ascending or descending).

Implementation

Future<ListWorkflowRunsResponse> listWorkflowRuns({
  required String workflowDefinitionName,
  int? maxResults,
  String? nextToken,
  SortOrder? sortOrder,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final $payload = <String, dynamic>{
    if (sortOrder != null) 'sortOrder': sortOrder.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/workflow-definitions/${Uri.encodeComponent(workflowDefinitionName)}/workflow-runs',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListWorkflowRunsResponse.fromJson(response);
}