createForm method

Future<CreateFormResponse> createForm({
  1. required String appId,
  2. required String environmentName,
  3. required CreateFormData formToCreate,
  4. String? clientToken,
})

Creates a new form for an Amplify app.

May throw InternalServerException. May throw InvalidParameterException. May throw ResourceConflictException. May throw ServiceQuotaExceededException.

Parameter appId : The unique ID of the Amplify app to associate with the form.

Parameter environmentName : The name of the backend environment that is a part of the Amplify app.

Parameter formToCreate : Represents the configuration of the form to create.

Parameter clientToken : The unique client token.

Implementation

Future<CreateFormResponse> createForm({
  required String appId,
  required String environmentName,
  required CreateFormData formToCreate,
  String? clientToken,
}) async {
  final $query = <String, List<String>>{
    if (clientToken != null) 'clientToken': [clientToken],
  };
  final response = await _protocol.sendRaw(
    payload: formToCreate,
    method: 'POST',
    requestUri:
        '/app/${Uri.encodeComponent(appId)}/environment/${Uri.encodeComponent(environmentName)}/forms',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return CreateFormResponse(
    entity: Form.fromJson($json),
  );
}