listWorkflowRuns method

Future<ListWorkflowRunsResponse> listWorkflowRuns({
  1. required String projectName,
  2. required String spaceName,
  3. int? maxResults,
  4. String? nextToken,
  5. List<WorkflowRunSortCriteria>? sortBy,
  6. String? workflowId,
})

Retrieves a list of workflow runs of a specified workflow.

Parameter projectName : The name of the project in the space.

Parameter spaceName : The name of the space.

Parameter maxResults : The maximum number of results to show in a single call to this API. If the number of results is larger than the number you specified, the response will include a NextToken element, which you can use to obtain additional results.

Parameter nextToken : A token returned from a call to this API to indicate the next batch of results to return, if any.

Parameter sortBy : Information used to sort the items in the returned list.

Parameter workflowId : The ID of the workflow. To retrieve a list of workflow IDs, use ListWorkflows.

Implementation

Future<ListWorkflowRunsResponse> listWorkflowRuns({
  required String projectName,
  required String spaceName,
  int? maxResults,
  String? nextToken,
  List<WorkflowRunSortCriteria>? sortBy,
  String? workflowId,
}) async {
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (workflowId != null) 'workflowId': [workflowId],
  };
  final $payload = <String, dynamic>{
    if (sortBy != null) 'sortBy': sortBy,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/v1/spaces/${Uri.encodeComponent(spaceName)}/projects/${Uri.encodeComponent(projectName)}/workflowRuns',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListWorkflowRunsResponse.fromJson(response);
}