create method

Future<Domain> create(
  1. CreateDomainRequest request, {
  2. String? $fields,
})

Developer Preview: Adds a domain to the user's account.

Returns INVALID_ARGUMENT if a domain is not provided. Returns ALREADY_EXISTS if the domain is already registered by the user.

request - The metadata request object.

Request parameters:

$fields - Selector specifying which fields to include in a partial response.

Completes with a Domain.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Domain> create(
  CreateDomainRequest request, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'fields': ?$fields == null ? null : [$fields],
  };

  const url_ = 'v2/domains';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return Domain.fromJson(response_ as core.Map<core.String, core.dynamic>);
}