addDomain method

Future<Domain?> addDomain({
  1. AddDomainRequest? addDomainRequest,
})

Add a domain

Add a new domain for your instance. Useful in the case of multi-domain instances, allows adding satellite domains to an instance. The new domain must have a name. The domain name can contain the port for development instances, like localhost:3000. At the moment, instances can have only one primary domain, so the is_satellite parameter must be set to true. If you're planning to configure the new satellite domain to run behind a proxy, pass the proxy_url parameter accordingly.

Parameters:

Implementation

Future<Domain?> addDomain({
  AddDomainRequest? addDomainRequest,
}) async {
  final response = await addDomainWithHttpInfo(
    addDomainRequest: addDomainRequest,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty &&
      response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(
      await _decodeBodyBytes(response),
      'Domain',
    ) as Domain;
  }
  return null;
}