createGroup method

Future<CreateGroupResponse> createGroup({
  1. required String name,
  2. required String organizationId,
  3. bool? hiddenFromGlobalAddressList,
})

Creates a group that can be used in WorkMail by calling the RegisterToWorkMail operation.

May throw DirectoryServiceAuthenticationFailedException. May throw DirectoryUnavailableException. May throw InvalidParameterException. May throw NameAvailabilityException. May throw OrganizationNotFoundException. May throw OrganizationStateException. May throw ReservedNameException. May throw UnsupportedOperationException.

Parameter name : The name of the group.

Parameter organizationId : The organization under which the group is to be created.

Parameter hiddenFromGlobalAddressList : If this parameter is enabled, the group will be hidden from the address book.

Implementation

Future<CreateGroupResponse> createGroup({
  required String name,
  required String organizationId,
  bool? hiddenFromGlobalAddressList,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'WorkMailService.CreateGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      'OrganizationId': organizationId,
      if (hiddenFromGlobalAddressList != null)
        'HiddenFromGlobalAddressList': hiddenFromGlobalAddressList,
    },
  );

  return CreateGroupResponse.fromJson(jsonResponse.body);
}