createContactList method

Future<void> createContactList({
  1. required String contactListName,
  2. String? description,
  3. List<Tag>? tags,
  4. List<Topic>? topics,
})

Creates a contact list.

May throw BadRequestException. May throw TooManyRequestsException. May throw AlreadyExistsException. May throw LimitExceededException.

Parameter contactListName : The name of the contact list.

Parameter description : A description of what the contact list is about.

Parameter tags : The tags associated with a contact list.

Parameter topics : An interest group, theme, or label within a list. A contact list can have multiple topics.

Implementation

Future<void> createContactList({
  required String contactListName,
  String? description,
  List<Tag>? tags,
  List<Topic>? topics,
}) async {
  ArgumentError.checkNotNull(contactListName, 'contactListName');
  final $payload = <String, dynamic>{
    'ContactListName': contactListName,
    if (description != null) 'Description': description,
    if (tags != null) 'Tags': tags,
    if (topics != null) 'Topics': topics,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v2/email/contact-lists',
    exceptionFnMap: _exceptionFns,
  );
}