postAutoFlows method

Future<PopulatedFlow?> postAutoFlows(
  1. CreateFlowReq createFlowReq
)

Creates an automation and its initial DRAFT version in one call.

Creates an automation and its initial DRAFT version in one call. The new flow is DISABLED — creating it does not arm its trigger; POST /v1/auto/flows/{id}/enable does that.

Parameters:

Implementation

Future<PopulatedFlow?> postAutoFlows(CreateFlowReq createFlowReq,) async {
  final response = await postAutoFlowsWithHttpInfo(createFlowReq,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'PopulatedFlow',) as PopulatedFlow;

  }
  return null;
}