startWorkflowRun method

Future<StartWorkflowRunResponse> startWorkflowRun({
  1. required String projectName,
  2. required String spaceName,
  3. required String workflowId,
  4. String? clientToken,
})

Begins a run of a specified workflow.

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

Parameter spaceName : The name of the space.

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

Parameter clientToken : A user-specified idempotency token. Idempotency ensures that an API request completes only once. With an idempotent request, if the original request completes successfully, the subsequent retries return the result from the original successful request and have no additional effect.

Implementation

Future<StartWorkflowRunResponse> startWorkflowRun({
  required String projectName,
  required String spaceName,
  required String workflowId,
  String? clientToken,
}) async {
  final $query = <String, List<String>>{
    'workflowId': [workflowId],
  };
  final $payload = <String, dynamic>{
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/v1/spaces/${Uri.encodeComponent(spaceName)}/projects/${Uri.encodeComponent(projectName)}/workflowRuns',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return StartWorkflowRunResponse.fromJson(response);
}