updateContact method

Future<void> updateContact({
  1. required String contactListName,
  2. required String emailAddress,
  3. String? attributesData,
  4. List<TopicPreference>? topicPreferences,
  5. bool? unsubscribeAll,
})

Updates a contact's preferences for a list.

May throw BadRequestException. May throw ConcurrentModificationException. May throw NotFoundException. May throw TooManyRequestsException.

Parameter contactListName : The name of the contact list.

Parameter emailAddress : The contact's email address.

Parameter attributesData : The attribute data attached to a contact.

Parameter topicPreferences : The contact's preference for being opted-in to or opted-out of a topic.

Parameter unsubscribeAll : A boolean value status noting if the contact is unsubscribed from all contact list topics.

Implementation

Future<void> updateContact({
  required String contactListName,
  required String emailAddress,
  String? attributesData,
  List<TopicPreference>? topicPreferences,
  bool? unsubscribeAll,
}) async {
  final $payload = <String, dynamic>{
    if (attributesData != null) 'AttributesData': attributesData,
    if (topicPreferences != null) 'TopicPreferences': topicPreferences,
    if (unsubscribeAll != null) 'UnsubscribeAll': unsubscribeAll,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/v2/email/contact-lists/${Uri.encodeComponent(contactListName)}/contacts/${Uri.encodeComponent(emailAddress)}',
    exceptionFnMap: _exceptionFns,
  );
}