insert method

Future<User> insert(
  1. User request, {
  2. bool? resolveConflictAccount,
  3. String? $fields,
})

Creates a user.

Mutate calls immediately following user creation might sometimes fail as the user isn't fully created due to propagation delay in our backends. Check the error details for the "User creation is not complete" message to see if this is the case. Retrying the calls after some time can help in this case.

request - The metadata request object.

Request parameters:

resolveConflictAccount - Optional. If set to true, the option selected for handling unmanaged user accounts will apply. Default: false

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

Completes with a User.

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<User> insert(
  User request, {
  core.bool? resolveConflictAccount,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (resolveConflictAccount != null)
      'resolveConflictAccount': ['${resolveConflictAccount}'],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'admin/directory/v1/users';

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