putRegistrationFieldValue method

Future<PutRegistrationFieldValueResult> putRegistrationFieldValue({
  1. required String fieldPath,
  2. required String registrationId,
  3. String? registrationAttachmentId,
  4. List<String>? selectChoices,
  5. String? textValue,
})

Creates or updates a field value for a registration.

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

Parameter fieldPath : The path to the registration form field. You can use DescribeRegistrationFieldDefinitions for a list of FieldPaths.

Parameter registrationId : The unique identifier for the registration.

Parameter registrationAttachmentId : The unique identifier for the registration attachment.

Parameter selectChoices : An array of values for the form field.

Parameter textValue : The text data for a free form field.

Implementation

Future<PutRegistrationFieldValueResult> putRegistrationFieldValue({
  required String fieldPath,
  required String registrationId,
  String? registrationAttachmentId,
  List<String>? selectChoices,
  String? textValue,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PinpointSMSVoiceV2.PutRegistrationFieldValue'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FieldPath': fieldPath,
      'RegistrationId': registrationId,
      if (registrationAttachmentId != null)
        'RegistrationAttachmentId': registrationAttachmentId,
      if (selectChoices != null) 'SelectChoices': selectChoices,
      if (textValue != null) 'TextValue': textValue,
    },
  );

  return PutRegistrationFieldValueResult.fromJson(jsonResponse.body);
}